Applescript code in Javascript in Photoshop

Explorer ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi,

I have develop the appleScript code in Javascript for Photoshop (see below coding) to open particular "html" in safari browser. 

 

var htmlPth = "/Users/asuvathdhamank/Desktop/Asuvath/Image Export Tool/HTML/index.html"; openHTML_Safari(htmlPth);

function openHTML_Safari(url){

var body = 'tell application "Safari"\ropen POSIX file "'+url+'"\rend tell';

app.doJavaScript(body, ScriptLanguage.applescriptLanguage);

}


But this script is not working, can anyone check and help me from out from this?


thanks

Asuvath

TOPICS
Actions and scripting

Views

360

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi Stephen,
Thanks for checking on this.
My original script is JavaScript, i have included "AppleScript" on that, but the above link have reversely Applescript run the javaScript.

 

Can you please advise how do i run the appleScript code in Javascript with Photoshop.

Thanks
Asuvath

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

system()

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi Kukurykus,

Sorry, i can not get your answer.

 

Thanks

Asuvath

 

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi Kukurykus,

 

Thanks, but in this link there are several sub links, so can you please give me the exact links to refer for this issue?

 

Thanks

Asuvath

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hmm, my bad. I was sure there's explanation of Photoshop app.reflect.methods[33]. For some reason there's nothing about also in JavaScript Tools Guide, but I found it in Bridge JavaScript Reference (on one page) that you can download from https://console.adobe.io/downloads/br  

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 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

Hi Kukurykus,

 

Thanks. Sorry i am unable to download that guide, can you please email (asuvathdhamank@gmail.com) me if possible?

Thanks

Asuvath

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 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

LATEST

Log in and download documentation to read this part:

 

quote
app.system (commandLine)

Issues the argument to the operating system, as if it were entered on
the command line in a shell. Control does not return to Bridge until this
function returns. Returns undefined.

commandLine The command to pass to the operating system.

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

You may need to compile the AS code into an app, then call the app from the JS.

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 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

Hi Stephen,

 

Thanks for the information, i tried this idea too. The html doc will be dynamic, so if created as App, i am struggling to get the input (HTML doc) for user.


Can you please guide me, how do i pass the parameter (HTML Doc) from javascript to appliscript created App.

Thanks

Asuvath

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
LEGEND ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Try throwing the HTML file to your OS to open with the application  the user has associated with HTML files.  I have nor recieved a bur report froe a mabt user the my Help button doe not work.  I run Windows know nothinf avout Apple Script. My scripts are javascript only.

function help() {
	try{
		var URL = new File(Folder.temp + "/PhotoCollageToolkit.html");
		URL.open("w");
		URL.writeln('<html><HEAD><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html"></HEAD></HTML>');
		URL.close();
		URL.execute();
	}catch(e){
		alert("Error, Can Not Open.");
	};
}
JJMack

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 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi JJMack,

 

Thanks for the checking. Actually i would like to open the html document in specific browser "Safari".

But in this code there is no any specification for the browser. Can you please check and help me to out from this.

 

Thanks

Asuvath

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