Copy link to clipboard
Copied
I'm looking for a way to automate an Illustrator action. I can do batch out of ILL. But was wondering if the Action can be run on a selection of images out of Bridge?
Thanks
Max
Copy link to clipboard
Copied
It is possible to hard code an Illustrator action into a script. You then need to get the script into Bridge’s Tools/Illustrator menu and to then get it work correctly from Bridge (easier said than done, you may need to add specific Bridge code).
Copy link to clipboard
Copied
I'm sending the code that works using photoshop (in this case to open DNGs from bridge in cameraraw)
All you have to do is to put illustrator code in the var 'psdMessage' and put target 'illustrator' on BridgeTalk
Here an example how it works on photoshop getting files from bridge thumbnails selection:
var dd=app.document;
// getting dng (if there isn't any thumbnail selected, it uses the selectAll dngs)
if (dd.selections.length == 0) {
var f =dd.getSelection("DNG,dng");
for (var all in f) {
dd.select(f[all]);
}
}
// build message to send to photoshop (in a string) via BridgeTalk >> if using illustrator, change the code to illustrators code (I can't help you in here, sorry)
var psdMessage = "var RawOptions = new CameraRAWOpenOptions; RawOptions.settings = CameraRAWSettingsType.SELECTEDIMAGE; ";
psdMessage += "RawOptions.bitsPerChannel = BitsPerChannelType.EIGHT; RawOptions.size = CameraRAWSize.MEDIUM; ";
psdMessage += "RawOptions.resolution = 300; RawOptions.colorSpace = ColorSpaceType.SRGB; ";
for (var psds in dd.selections) {
psdMessage += ' app.open(File("' + decodeURI(File(dd.selections[psds].path)) + '"), RawOptions);';
}
//
dd.chooseMenuItem('OpenInCameraRaw');
// send to photoshop using BridgeTalk:
var openMessage = new BridgeTalk();
openMessage.target = "photoshop"; // here you need to use 'illustrator'
openMessage.body = psdMessage;
openMessage.send();
The second thing you need to do is choose where you want to have access to this in Bridge:
A) on a button using you own built pallet in Bridge (app.document.palettes)
B) on the content panel using top or bottom (app.document.navbars.filesystem.top)
C) by clicking a group of thumbnails using the right-click and selecting your action
D) by clicking a folder in the Folders subpanel using the right-click and selecting your action
You must choose.
Copy link to clipboard
Copied
Thank you Pedro,
I have tried to follow your suggestions, however I am still getting an error with the script when I run Bridge: “The test-actionAction is not available in the test-set Set.”
The action is installed in: Macintosh HD/Library/Application Support/Adobe/Startup Scripts CS6/Adobe Bridge
The script is visible and ticked/active in Bridge/Preferences/Startup Scripts
The script works fine when it is run from say Illustrator/File/Scripts/Browse
The action set is loaded in Illustrator and the action is in the set.
The working code for referencing an action via JS follows:
// https://forums.adobe.com/message/8101549#8101549
// Set your action name and the set name that it belongs to here
var myAction = "test-action";
var mySet = "test-set";
//---------------------------------------------------------------------------------
try {
app.doScript(myAction, mySet);
} catch(e) {
alert("The " + myAction + "Action is not available in the " + mySet +" Set.");
}
Copy link to clipboard
Copied
I thought you needed to run an illustrator action using [illustrator files??] pre-selected in Bridge
The code you sent is illustrator code and must be nested in a string var on bridge code and passed to illustrator using BridgeTalk.
Like this. I have tried using Illustrator CC2014 and Illustrator did got the message and runed its action. But the code must be stared from bridge.
// runned from Bridge and sent to Illustrator:
var myAction = "test-action";
var mySet = "test-set";
// build message to send to photoshop (in a string) via BridgeTalk >> if using illustrator, change the code to illustrators code (I can't help you in here, sorry)
var messageToIllustr = 'try { app.doScript("'+myAction+'", "'+mySet+'"); } catch(e) { alert("The " + "'+myAction+'" + "Action is not available in the " + "'+mySet+'" +" Set."); }';
$.writeln(messageToIllustr);
// send to photoshop using BridgeTalk:
var openMessage = new BridgeTalk();
openMessage.target = "illustrator"; // here you need to use 'illustrator'
openMessage.body = messageToIllustr;
openMessage.send();
I used ESTK to test the code.
Have you asked this on illustrator scripting forum?
Copy link to clipboard
Copied
Hi Pedro, sorry for the confusion, I’d love to be able to script – however that is beyond me for now. That being said, I am vicariously attempting to follow along.
The OP asked if it was possible to apply a script referencing an action to selected files in Bridge.
I came across a different post, where a method to run an action via scripting was offered.
I am oblivious to the issues that you mention. :]
Copy link to clipboard
Copied
Hello
You need 4 things:
1. Bridge: How to collect a bunch of files ( On my first answer I did geve an example collecting a group of images on bridge)
On Bridge, you collect Objects (folders/files) but you can filter only what you want.
2. After collecting them you need to write have also the illlustrator code you need to process within illustrator. If it depends on having files from bridge, you need to separate what is inside and what is a var outside (see var psdMessage - attention to single/double quotes). In the code I tested (2nd answer) I didn't use vars collected from bridge (it may have caused some confusion), but I did passed other vars myAction/mySet that can anything from bridge...
3. Then you need to pass the illustrator message from bridge: using BridgeTalk;
4. The last thing you need is to decide where you want your final code to be triggered in Bridge. There are many possibilities. A button, a mouse right-click, an iconbutton in a customized panel, etc. I did not mention post this code because I think there are too many solutions all valid. It is better to ask them individually as new single question posts.
As you, I am also a non-native coder. And many many times I felt lost within the many Bridge code bugs...
Many I solved myself and may others with this forum. I studied/tested the manuals:
Bridge Developer Center | Adobe Developer Connection
For ScriptUI:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now