Forum Replies Created
-
AuthorPosts
-
Kasyan Servetsky
MemberHere is an example:
#targetengine “dentistw”
var myScript1 = new File(app.filePath + “/Scripts/Scripts Panel/uniquePDFexport.scpt”);
var myScriptAction1 = app.scriptMenuActions.add(“PDF export”);
var myEventListener1 = myScriptAction1.eventListeners.add(“onInvoke”, myScript1, false);try{
var myScriptMenu = app.menus.item(“$ID/Main”).submenus.item(“Scripts”);
myScriptMenu.title;
}
catch (myError){
var myScriptMenu = app.menus.item(“$ID/Main”).submenus.add(“Scripts”);
}var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);
Save it to the “Scripts > Startup Scripts” folder and restart InDesign. A new “Scripts” menu will appear with a single “PDF export” item which will trigger the uniquePDFexport.scpt script (change the name to whatever your script's name is, of course).
You can easily add more menu items by coping and pasting lines 2-4 and the last one and incrementing the number at the end of the variabels' names and making necessary changes to these lines.
For example:
var myScript2 = new File(app.filePath + “/Scripts/Scripts Panel/YourAnotherScriptName.scpt”);
var myScriptAction2 = app.scriptMenuActions.add(“Do Something Else”);
var myEventListener2 = myScriptAction2.eventListeners.add(“onInvoke”, myScript2, false);…..
var myScriptMenuItem2 = myScriptMenu.menuItems.add(myScriptAction2);You can also insert separators like so:
var myScriptMenuItem8 = myScriptMenu.menuItems.add(myScriptAction8);
var myMenuSeparator3 = myScriptMenu.menuSeparators.add(LocationOptions.AFTER, myScriptMenuItem8);Hope this helps.
Kas
Kasyan Servetsky
MemberHere is the link to the tutorial scripts and here you can find some useful links for beginners.
Kas
Kasyan Servetsky
Membervar doc = app.activeDocument;
var links = doc.links;for (var i = links.length-1; i >= 0; i–) {
links[i].unlink();
}Kasyan Servetsky
Member//DESCRIPTION:Label Images with their Eff ppi
try {
app.activeDocument.layers.add({name:”ImageEffPpi”, layerColor: [255,192,0], printable: false});
} catch (_) { }try {
app.activeDocument.paragraphStyles.add({name:”ImageEffPpi”, justification: Justification.CENTER_ALIGN});
} catch (_) { }reportLayer = app.activeDocument.layers.item(“ImageEffPpi”);
reportStyle = app.activeDocument.paragraphStyles.item(“ImageEffPpi”);
imageList = app.activeDocument.allGraphics;for (im=0; im < imageList.length; im++)
{
try {
showScaleFor (imageList[im]);
} catch (_) {}
}function showScaleFor (anImage)
{
var gb,fr,pg;
gb = anImage.parent.geometricBounds;
pg = anImage.parent;while (1)
{
if (pg instanceof Character)
pg = pg.parentTextFrames[0];
if (pg instanceof Document || pg instanceof Spread || pg instanceof Page)
break;
pg = pg.parent;
}fr = pg.textFrames.add(reportLayer, {geometricBounds: gb, textFramePreferences: {verticalJustification: VerticalJustification.CENTER_ALIGN, ignoreWrap:true}});
fr.insertionPoints[0].appliedParagraphStyle = reportStyle;
if (anImage.effectivePpi[0] == anImage.effectivePpi[1])
fr.contents = twoDec(anImage.effectivePpi[0])+” ppi”;
else
fr.contents = twoDec(anImage.effectivePpi[0]) + “/” + twoDec(anImage.effectivePpi[1]) + ” ppi”;
}function twoDec(x)
{
return Math.round(x*100)/100;
}Kasyan Servetsky
Member//DESCRIPTION:Label Images with their Eff ppi
try {
app.activeDocument.layers.add({name:”ImageEffPpi”, layerColor: [255,192,0], printable: false});
} catch (_) { }try {
app.activeDocument.paragraphStyles.add({name:”ImageEffPpi”, justification: Justification.CENTER_ALIGN});
} catch (_) { }reportLayer = app.activeDocument.layers.item(“ImageEffPpi”);
reportStyle = app.activeDocument.paragraphStyles.item(“ImageEffPpi”);
imageList = app.activeDocument.allGraphics;for (im=0; im < imageList.length; im++)
{
try {
showScaleFor (imageList[im]);
} catch (_) {}
}function showScaleFor (anImage)
{
var gb,fr,pg;
gb = anImage.parent.geometricBounds;
pg = anImage.parent;while (1)
{
if (pg instanceof Character)
pg = pg.parentTextFrames[0];
if (pg instanceof Document || pg instanceof Spread || pg instanceof Page)
break;
pg = pg.parent;
}fr = pg.textFrames.add(reportLayer, {geometricBounds: gb, textFramePreferences: {verticalJustification: VerticalJustification.CENTER_ALIGN, ignoreWrap:true}});
fr.insertionPoints[0].appliedParagraphStyle = reportStyle;
if (anImage.effectivePpi[0] == anImage.effectivePpi[1])
fr.contents = twoDec(anImage.effectivePpi[0])+” ppi”;
else
fr.contents = twoDec(anImage.effectivePpi[0]) + “/” + twoDec(anImage.effectivePpi[1]) + ” ppi”;
}function twoDec(x)
{
return Math.round(x*100)/100;
}Kasyan Servetsky
MemberGo to the 2nd page:
app.activeWindow.activePage = app.activeDocument.pages[1];
Kasyan Servetsky
MemberHi Joseph,
I am engaged in development of scripts and scripted plug-ins for InDesign, scripts for Photoshop, Bridge, Illustrator and Enfocus Power Switch (scripts attached to configurators that run from Power Switch as part of a flow). I live on the opposite side of the globe from you: Kiev, Ukraine
If you are interested, you can get in touch with me via e-mail: askoldich [at] yahoo [dot] com.
Regards,
KasyanKasyan Servetsky
MemberIt's strange — I just retested the script on CS4 (ID 6.0.4, Mac OC X 10.4.11) and it works on my side. The error says that the script is unhappy with versionComments parameter — but it's optional and I haven't included it into the script.
Could you get in touch with me by e-mail: askoldich [at] yahoo [dot] com and send me a file that causes the error?
BTW, recently I found a problem: script didn't work with files inside Documents folder on Mac — I corrected it in version 3.3
Kasyan
Kasyan Servetsky
MemberIt's strange — I just retested the script on CS4 (ID 6.0.4, Mac OC X 10.4.11) and it works on my side. The error says that the script is unhappy with versionComments parameter — but it's optional and I haven't included it into the script.
Could you get in touch with me by e-mail: askoldich [at] yahoo [dot] com and send me a file that causes the error?
BTW, recently I found a problem: script didn't work with files inside Documents folder on Mac — I corrected it in version 3.3
Kasyan
Kasyan Servetsky
MemberI've found out that some versions of Bridge — for example CS3 and CS4 for Mac — interpret incorrectly new line characters in script.
In CS3 for Windows it works as expected, but if I run the same script in CS3/4 for Mac, it displays only the first line. However the information is still there — if I move cursor over the panel, right click and choose copy, then paste it into a text editor, all lines are present there.MHebert, do you have the same problem on CS4 for Windows?
Kasyan
Kasyan Servetsky
MemberI've found out that some versions of Bridge — for example CS3 and CS4 for Mac — interpret incorrectly new line characters in script.
In CS3 for Windows it works as expected, but if I run the same script in CS3/4 for Mac, it displays only the first line. However the information is still there — if I move cursor over the panel, right click and choose copy, then paste it into a text editor, all lines are present there.MHebert, do you have the same problem on CS4 for Windows?
Kasyan
Kasyan Servetsky
MemberI tested it on CS3 for Windows on my home computer and it worked for me.
Today is the first day I am at work after New Year & Cristmas holidays. I tried to run it in Bridge CS3 for Mac, but it turned out that it doesn't work with this version, in spite of the fact that the code is supposed to work identically on both platforms.
I am going to investigate this problem and will try to solve it as soon as possible. If people are interested in this script I'll be working on it.
By the way, I am open to any suggestions and ideas, so if you have a proposal to add some interesting feature to the script, feel free to post it here or write me at askoldich@yahoo.com.
Kasyan
Kasyan Servetsky
MemberI tested it on CS3 for Windows on my home computer and it worked for me.
Today is the first day I am at work after New Year & Cristmas holidays. I tried to run it in Bridge CS3 for Mac, but it turned out that it doesn't work with this version, in spite of the fact that the code is supposed to work identically on both platforms.
I am going to investigate this problem and will try to solve it as soon as possible. If people are interested in this script I'll be working on it.
By the way, I am open to any suggestions and ideas, so if you have a proposal to add some interesting feature to the script, feel free to post it here or write me at askoldich@yahoo.com.
Kasyan
Kasyan Servetsky
MemberI’ve remade the script for Bridge: now you can select multiple InDesign documents in Bridge and see the list of links in Inspector Palette for every selected file.
With Bridge scripting it is possible to create a really cool stuff. There are loads of scripts written for InDesign, but too few for Bridge.
Kasyan Servetsky
MemberI remade the script to save over old files: https://kasyan.ho.com.ua/downlo…..Files2.zip
Thanks Jongware for the tip!
Kasyan
-
AuthorPosts
