Copy link to clipboard
Copied
Let me start by introducing the reason behind this.
I want to automate a task to have a computer converting files to ai and getting the size of the content. It then save it to a csv which is read by a software that use it to run its task and send the job to production. So one person click a button and it goes through all the steps automatically.
The software before Adobe illustrator is all automated from windows command. We only have a person going to the pc to launch an action script in batch. I made a script (based on other scripts I have found here on the forum - thanks!) to open the files in the output folder one by one and run the action script before closing it and move to the next one. But it crashes when it reaches the part where the action script reach the call for a javascript (file,script, "here.jsx").
Question 1 : How can I open an empty file + run the javascript in from windows command? I tried "path of the file" -r path of the script and it opens the file but won't run the script.
Question 2 : How can I run a javascript within an action when launched from a script (if it makes sense). If I can't run it from within the action script can I call it from somewhere else? I tried to call it from app.executeMenuCommand("script name"); without success, same for . I need to run the action and it ends by calling the javascript. I can remove the javascript call and script it in the javascript code if it works.
Goal : to save the human a boring task of being there just to run an action script between two jobs.
Thanks.
for some reasons it wasn't launching the script. I decided to remove the illustrator software path and only run the script. It opens illustrator since I target the software on the first line. I also had to take the jsx script out of the action as it wasn't able to execute it from there... So I scripted it to run after the action is performed.
Thank you for your help!
So the solution I found with the help of the community is :
- Make a script to check folder and list all files
- Run through the fil
...Copy link to clipboard
Copied
I don't know about running a Javascript within an action, but to run an action within a JSX use this command:
app.doScript ("[actionName]", "[actionGroup]" );
It would look like this:
app.doScript ("Unite", "AI Actions_KM" );
Copy link to clipboard
Copied
Thanks for the reply.
I do have this line working but that is the line where it breaks as soon as it hits the jsx. My action run a couple of actions before running a script. It does well until it hits the script.
I took the script out and it works well... but now I have to find a way to run that script from the script and to run the latest from windows command. But I don't think Illustrator can run script from a windows command...
Copy link to clipboard
Copied
Your question: "Question 2 : How can I run a javascript within an action …"
If your action already exists: Go to the step in the action (in the Action Panel) before the script should start. Choose from the options (in the Action Panel) --> Insert Menucommand
If the little Dialog pops up go the way to the script (through the menus) Menu: File --> Scripts --> "Your desired script"
Then the script name will shown in the little dialog. Confirm the dialog.
Ready
(But be sure, you will have an actual version of Illustrator. Older/earlier Illustrator versions "will lost" the script in an action after closing Illustrator.)
Copy link to clipboard
Copied
Unfortunately this is exactly what I did and whenever I launch the action from a script it crashes when it gets to the script saying it cannot be run at the time.
Copy link to clipboard
Copied
Did you test it for troubleshooting with a simplified script that calls simple action that calls a simple script?
Does that work for you – or not too?
Copy link to clipboard
Copied
I haven't managed to launch a script from an action when running the action from a script. But I scripted the script to run right after the action in the same loop so it works now 🙂
Thanks!
Copy link to clipboard
Copied
to run a script from command line type this
"c:\program files\full path to your illustrator version\illustrator.exe" "c:\full path to your script\script.jsx"
plus, add this line at the beginning of your script
#target Illustrator
Copy link to clipboard
Copied
for some reasons it wasn't launching the script. I decided to remove the illustrator software path and only run the script. It opens illustrator since I target the software on the first line. I also had to take the jsx script out of the action as it wasn't able to execute it from there... So I scripted it to run after the action is performed.
Thank you for your help!
So the solution I found with the help of the community is :
- Make a script to check folder and list all files
- Run through the files with a for loop.
- Within this loop run action, script and save.
- Target illustrator on your first line of the document.
- Run the script from windows command. it will open illustrator and execute.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more