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

Open JPG/PNG image from html5 extension

Community Beginner ,
Sep 26, 2017 Sep 26, 2017

Hello Everyone,

Is there any way to open the JPG/PNG image from cc build.

I found a solution and implemented it in extension

app.open(File(filePath));

but it opens the file in photoshop and I want to get it open in OS image viewer app like: "Preview" for mac and "Image viewer" for Windows

TOPICS
Actions and scripting
784
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 , Sep 27, 2017 Sep 27, 2017

You can try (in the JSX) to create a file instance and then execute it, like:

var f = new File('~/Desktop/flower.jpg')

if (f.exists) { f.execute() }

This should trigger the default app that is set for each OS (Preview on Mac, and Image viewer on Windows), provided that the user hasn't changed his OS preferences.

Hope this helps!

Davide

Translate
Adobe
Community Expert ,
Sep 26, 2017 Sep 26, 2017

You would need to execute a system command not use a photoshop command.

app.system('the correct Mac or the correct windows command and pass the filePath');

for example this would stop the scriptlistener writting the javascript log file on windows

app.system('Attrib +R "%USERPROFILE%\\Desktop\\ScriptingListenerJS.log" ');

JJMack
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 ,
Sep 27, 2017 Sep 27, 2017

You can try (in the JSX) to create a file instance and then execute it, like:

var f = new File('~/Desktop/flower.jpg')

if (f.exists) { f.execute() }

This should trigger the default app that is set for each OS (Preview on Mac, and Image viewer on Windows), provided that the user hasn't changed his OS preferences.

Hope this helps!

Davide

Davide Barranca - PS developer and author
www.ps-scripting.com
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 Beginner ,
Sep 27, 2017 Sep 27, 2017

Thanks, this was the solution I was looking for.

Thanks a log.

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 ,
Sep 27, 2017 Sep 27, 2017
LATEST

That can be unpredictable it could be Photoshop be the same as app.open(File(filePath));

JJMack
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