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