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
var GPU = systemInformation.match(/(GPUName:\s+)(.+)/),
openCL = systemInformation.match(/(IsOpenCLGPUCapable:\s+)(.+)/);
alert ('GPU Model: ' + GPU[2] + '\nOpen CL Capable: ' + openCL[2])
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
...
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])
Copy link to clipboard
Copied
Thank you. Thank you for your help
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
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)
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);
Не? : )
Copy link to clipboard
Copied
That's amazing. Thank you
Copy link to clipboard
Copied
@r-bin, я так понял, что нужно узнать не состояние включено/выключено, а может ли видеокарта (с точки зрения Фотошопа) его использовать. В systemInformation мнение Фотошопа на этот счет светится вне зависимости от того, что пользователь натыркал галочками в разделе performance.
Copy link to clipboard
Copied
@r-bin, я так понял, что нужно узнать не состояние включено/выключено, а может ли видеокарта (с точки зрения Фотошопа) его использовать. В systemInformation мнение Фотошопа на этот счет светится вне зависимости от того, что пользователь натыркал галочками в разделе performance.
By @jazz-y
Возможно. Только вот это всё версия-зависимое очень. В CS6 и СС2020, например, совершенно разные буковки. При этом ни одна не совпадает с твоим вариантом, как я понял для 2023.
Copy link to clipboard
Copied
I got the solution thanks @jazz-y