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

How to use scripts to determine whether opencl can be used

Explorer ,
Apr 15, 2023 Apr 15, 2023

Copy link to clipboard

Copied

How to use scripts to determine whether photoshop opencl can be used. 

Or determine if there is a discrete graphics card 

TOPICS
Actions and scripting

Views

1.5K

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 2 Correct answers

Guide , Apr 15, 2023 Apr 15, 2023
var GPU = systemInformation.match(/(GPUName:\s+)(.+)/),
openCL = systemInformation.match(/(IsOpenCLGPUCapable:\s+)(.+)/);

alert ('GPU Model: ' + GPU[2] + '\nOpen CL Capable: ' + openCL[2])

Votes

Translate

Translate
People's Champ , Apr 17, 2023 Apr 17, 2023
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("cachePrefs"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var openglEnabled = executeActionGet(r).getObjectValue(stringIDToTypeID("cachePrefs")).getBoolean(stringIDToTypeID("openglEnabled"));  

var useOpenCL = executeActionGet(r).getObjectValue(stringIDToTypeID("cachePrefs")).getObjectValue(stringIDToTypeID("openglAdvanced")).getBoolea
...

Votes

Translate

Translate
Adobe
Guide ,
Apr 15, 2023 Apr 15, 2023

Copy link to clipboard

Copied

var GPU = systemInformation.match(/(GPUName:\s+)(.+)/),
openCL = systemInformation.match(/(IsOpenCLGPUCapable:\s+)(.+)/);

alert ('GPU Model: ' + GPU[2] + '\nOpen CL Capable: ' + openCL[2])

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

Copy link to clipboard

Copied

Thank you. Thank you for your help 

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 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

Unfortunately, Photoshop 2020 prompts the error, only Photoshop 2022 and 2023 can run normally, how can 2020 be judged, or use the cmd command of. bat to judge? Thanks 

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
Guide ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

systemInformation contains a string with system information in text form (similar to what you see in Photoshop's menu help -> system info). You can explore its contents yourself in previous versions of Photoshop and write a regular expression that will get the information you need.

I don’t see any reason to complicate the script and access the operating system command line, if this information is already in Photoshop, it’s enough just to extract it correctly (you can write a function that will work according to one or another algorithm depending on the app.version)

 
 

 

 

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
People's Champ ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("cachePrefs"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var openglEnabled = executeActionGet(r).getObjectValue(stringIDToTypeID("cachePrefs")).getBoolean(stringIDToTypeID("openglEnabled"));  

var useOpenCL = executeActionGet(r).getObjectValue(stringIDToTypeID("cachePrefs")).getObjectValue(stringIDToTypeID("openglAdvanced")).getBoolean(stringIDToTypeID("CLCompute"));  


alert(openglEnabled && useOpenCL);

 

Не? : )

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 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

That's amazing. Thank you 

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
Guide ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

@r-bin, я так понял, что нужно узнать не состояние включено/выключено, а может ли видеокарта (с точки зрения Фотошопа) его использовать. В systemInformation мнение Фотошопа на этот счет светится вне зависимости от того, что пользователь натыркал галочками в разделе performance.

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
People's Champ ,
Apr 18, 2023 Apr 18, 2023

Copy link to clipboard

Copied

LATEST
quote

@r-bin, я так понял, что нужно узнать не состояние включено/выключено, а может ли видеокарта (с точки зрения Фотошопа) его использовать. В systemInformation мнение Фотошопа на этот счет светится вне зависимости от того, что пользователь натыркал галочками в разделе performance.


By @jazz-y

 

Возможно. Только вот это всё версия-зависимое очень. В CS6 и СС2020, например, совершенно разные буковки. При этом ни одна не совпадает с твоим вариантом, как я понял для 2023.

 

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
New Here ,
Apr 16, 2023 Apr 16, 2023

Copy link to clipboard

Copied

I got the solution thanks @jazz-y 

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