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

Copy link to clipboard

Copied

how can i run script automatically at strat of illustrator? 

TOPICS
Scripting

Views

3.6K
Translate

Report

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

Votes

Translate
Adobe
LEGEND ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

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 

Votes

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Report

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

Copy link to clipboard

Copied

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 ();

Votes

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

add what I suggested and see if it works

Votes

Translate

Report

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

Copy link to clipboard

Copied

hey @CarlosCanto  it works good now

very appreciated guys!

 

 

Votes

Translate

Report

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

Copy link to clipboard

Copied

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/

Votes

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

This is the error message I'm getting

 

aviel222_0-1624902091127.pngexpand image

 

 

Votes

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

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.

 

Votes

Translate

Report

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

Copy link to clipboard

Copied

Votes

Translate

Report

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

Copy link to clipboard

Copied

Salut!

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

Votes

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Report

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

Copy link to clipboard

Copied

@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

Votes

Translate

Report

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