Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

run script on startup

Explorer ,
Jun 25, 2021 Jun 25, 2021

how can i run script automatically at strat of illustrator? 

TOPICS
Scripting
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 30, 2021 Jun 30, 2021

@aviel222 

Try to replace your existsing code with

if (app.documents.length) {
	app.executeMenuCommand('Print')// JavaScript Document
	//Here, add your more code if exists
}
// JavaScript Document
Translate
Adobe
LEGEND ,
Jun 25, 2021 Jun 25, 2021

On Mac I use Keyboard Maestro to trigger a script on startup or whenever Illustrator launches.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2021 Jun 25, 2021

Locate your version of Adobe Illustrator in your Applications Folder. inside the app folder, create a new folder called "Startup Scripts". Then you can place one or more .jsx files into that folder and they will run automatically whenever illustrator is launched. 

 

Screen Shot 2021-06-25 at 9.58.35 AM.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 25, 2021 Jun 25, 2021

hey @Disposition_Dev ! it works good But,

every time I run another script, Startup Script also appears 

How Can I stop this, Only needs run it, when ilustrator Starts 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2021 Jun 25, 2021

Hmm. I'm not sure. Any scripts in that folder should only get executed when illustrator is launched.. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2021 Jun 25, 2021

the guide reads "the scripts run automatically when you launch Illustrator and each time you run a script."

 

In theory, if you have your script run only when there are no open documents, that should do the trick.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 25, 2021 Jun 25, 2021

hey @CarlosCanto  

please check out my code maybe Im doing something wrong

 

//Welcome script
var w = new Window ("dialog", "", undefined, {closeButton: true});
w.alignChildren = "right";
var texto= w.add("statictext", undefined, "BIENVENIDO GERSSON");
w.show ();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2021 Jun 25, 2021

Hi Gersson, your script works great, what do I suppose to check?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 25, 2021 Jun 25, 2021

indicate to script only works when Ilustrator is launched , maybe we can fix this Issue !!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2021 Jun 25, 2021

add what I suggested and see if it works

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 30, 2021 Jun 30, 2021

hey @CarlosCanto  it works good now

very appreciated guys!

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 11, 2023 Feb 11, 2023
LATEST


Hello @CarlosCanto could you help me clarify here ? 
"the scripts run automatically when you launch Illustrator and each time you run a script." 
so yes of course the startup script will pop up when I run another script 

Can we prevent this from happening? Or in other words, is it possible to have a scrip run run ONLY on startup ? 
 
If I take this script for example 

 

//Welcome script
var w = new Window ("dialog", "", undefined, {closeButton: true});
w.alignChildren = "right";
var texto= w.add("statictext", undefined, "BIENVENIDO GERSSON");
w.show ();

 

do I need to specify or target something more in the script itself to make it run only when launching the app ? 

Thanks for your wisdom!


-
www.instagram.com/mugen_labz/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2021 Jun 26, 2021

This is the error message I'm gettingScreen Shot 2021-06-26 at 21.52.25.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2021 Jun 28, 2021

This is the error message I'm getting

 

aviel222_0-1624902091127.pngexpand image

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2021 Jun 28, 2021

Is this error with a particular script or every script that you put in the startup folder? From the error, it looks like an error specific to the operation this script does. Did you make sure all the requirements for the script to run are met at the application start? For ex. if the script expects an open document the script will crash and cause errors at the startup if the condition is not handled in the code.

-Manan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2021 Jun 30, 2021

We can't really help any further until you share your script so we can figure out what might be causing the issue.

 

If you've put your script into the appropriate location and it's still not working, then we can't even suggest anything else until we know more. Otherwise we'd just be taking random guesses in the dark and that's not productive for any of us or for you.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 30, 2021 Jun 30, 2021
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 30, 2021 Jun 30, 2021

Salut!

Normal, au démarrage de AI, il n'y a aucun document ouvert?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 01, 2021 Jul 01, 2021

charu
It was an attempt to solve the printing problem we were talking about at the time.
But now, every time I open a new document and run the script they wrote to me - a print window opens. The goal - to run my script and print without opening a print window.
So I need to somehow find a solution for me (even for a nominal fee).
If it seems to you - we will continue via email in private.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2021 Jun 30, 2021

@aviel222 

Try to replace your existsing code with

if (app.documents.length) {
	app.executeMenuCommand('Print')// JavaScript Document
	//Here, add your more code if exists
}
// JavaScript Document
Best regards
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines