Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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

409

Likes

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

Adobe Community Professional , Apr 12, 2018 Apr 12, 2018
Hi rarur97798982,you can open a file in the wished application eg photoshop#target Illustratorvar psfile = new File('~/Desktop/YourFilename.jpg');if (psfile.exists) { photoshop.open(psfile); }else { alert('file does not exist');}Have fun

Likes

Translate

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

Copy link to clipboard

Copied

moving to Illustrator Scripting

Likes

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
Adobe Community Professional ,
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

Likes

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?

Likes

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 🙂

Likes

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
Adobe Community Professional ,
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.

Likes

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