Copy link to clipboard
Copied
This script works if I call it via menu file/scripts/scriptname, but when I assign an action to run it, the action ignores the selection[0] calls. I'm trying to get this script to run with a function key.
if ( app.documents.length > 0) {
doc = app.activeDocument;
selection[0].embed()
app.executeMenuCommand ("releaseMask")
app.executeMenuCommand ("ungroup")
selection[0].remove();
}
You are using the wrong way to add the script to the action. Add scripts via "Insert menu item".
Copy link to clipboard
Copied
Hi,
If I understand you mean, you can not embed() using the actions?
I tried, and I see that embed can not be recorded.
Copy link to clipboard
Copied
Yeah it seems making an action to run a script, limits what the script can do.
Copy link to clipboard
Copied
Tell us more about it. What happens on the screen, does an error show up? What version of Adobe Illustrator, Mac OS, Windows? Could you show us an example file? I added your script to a new Action and ran it on the linked EPS. The script executed. Illustrator CC 2019/2022, Mac OS.
Copy link to clipboard
Copied
That's the whole script 🙂 . I run on windows 11 with cc, so should be latest. When I add the script to action, I can see the two executeMenu commands show up as individual action items, but the embed, and remove do not. So when I run it, I get the error clippin mask unavailable, but if I embed it manually first, does not error, but also does not remove the clipping area. It seems when action added it, it stripped out the embed and remove. One thing I'm trying is to loop through the selected items ( I have 3 linked image items selected), then running the script on those, but haven't had luck with that yet. I can try running on mac also. I'll upload some files tomorrow. Thanks for taking a look.
Copy link to clipboard
Copied
Show a screenshot of your Action panel. Or you can record a video of you adding an action and calling it. I don't quite understand how you can see the individual script commands in the Action panel? Only the script file is added there.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
As I wrote in the screenshot, this is a JS file added to the action. gstewartjr wrote that the script inside the action doesn't work. I didn't see any reason why it wouldn't work in the test.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You are using the wrong way to add the script to the action. Add scripts via "Insert menu item".
Copy link to clipboard
Copied
OMG thanks! It works.