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

Is there any possible way to open an application from illustrator using javascript?

Explorer ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

Hi all,

I am new in this scripting inside illustrator. I am not even sure, if my question is blunder or not.
I have a requirement, that I need to open another application by running the javascript from illustrator. Is this possible?

Thanks in advance.

TOPICS
Scripting

Views

644

Translate

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 , Apr 12, 2018 Apr 12, 2018

Hi ,

you can open a file in the wished application eg photoshop

#target Illustrator

var psfile = new File('~/Desktop/YourFilename.jpg');

if (psfile.exists) { photoshop.open(psfile); }

else { alert('file does not exist');}

Have fun

Votes

Translate

Translate
Adobe
Adobe Employee ,
Apr 12, 2018 Apr 12, 2018

Copy link to clipboard

Copied

moving to Illustrator Scripting​

Votes

Translate

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 ,
Apr 12, 2018 Apr 12, 2018

Copy link to clipboard

Copied

Hi ,

you can open a file in the wished application eg photoshop

#target Illustrator

var psfile = new File('~/Desktop/YourFilename.jpg');

if (psfile.exists) { photoshop.open(psfile); }

else { alert('file does not exist');}

Have fun

Votes

Translate

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 ,
Apr 12, 2018 Apr 12, 2018

Copy link to clipboard

Copied

HI, That worked. In indesign there is an option by which we can select any image and be opened with photoshop. Is there any chance of opening the image in photoshop from illustrator by using the script?

Votes

Translate

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
Engaged ,
Apr 17, 2018 Apr 17, 2018

Copy link to clipboard

Copied

function unique(ain) {
	var seen = {}
	var aout = []
	for(var i = 0; i < ain.length; i++) {
		var elt = ain[i]
		if (!seen[elt]) {
			aout.push(elt)
			seen[elt] = true 
		}
	}
	return aout
}

var doc = app.activeDocument;
var listImageFiles = [];
var i, in_file;
for(i = 0; i < doc.placedItems.length; i++) {
	in_file = doc.placedItems[i].file;
	listImageFiles.push(in_file);
	listImageFiles = unique(listImageFiles);
}
   
var ii;
for(ii = 0; ii < listImageFiles.length; ii++) {
	photoshop.open(listImageFiles[ii]);
}

 

First we put all placed images with full path into an array.

Then we use the unique function to remove any images placed more than once from the array.

In the end we open all files stored in the array in Photoshop.

 

To prevent errors make sure Photoshop is already running because the script is faster than app startup 🙂

Votes

Translate

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
LEGEND ,
Oct 24, 2021 Oct 24, 2021

Copy link to clipboard

Copied

LATEST

I edited a script, crippled due to forums transition. Check if it works with readded [i] chunks.

Votes

Translate

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