Copy link to clipboard
Copied
Hello,
I'm trying to get working an old jsx script + applescript that split my main screen with the two frontmost Photoshop documents - it was very useful for comparing two documents.
This script worked with an old Photoshop CS6 but it gives an error on Photoshop 2025 when I try to retrieve my screen sizes.
I was using :
app.getCustomOptions('screensSize').getString(0)
Do you know any Photoshop 2025 compatible equivalent?
1 Correct answer
Sorry, I forgot to answer your question. This is a part of my script and the results.
var myProp = 'screensSize';
var myString = 'Hello';
var desc = new ActionDescriptor();
app.putCustomOptions(myProp, desc, false);
alert(app.getCustomOptions('screensSize')); // --> [ActionDescriptor] : [count]'0' [typename]'ActionDescriptor'
alert(app.getCustomOptions('screensSize').getString(0)); // --> ERROR 8500 : property doesn't exist
I'll try with your links.
By @frmorel
First, you use getString(),
...Explore related tutorials & articles
Copy link to clipboard
Copied
If I understand correctly, do you need this?
Copy link to clipboard
Copied
Thank you for your answer.
Yes, this kind of display.
But better:
- I would like only the windows of the two frontmost documents to be modified
- I would also like the windows of any other documents not to be placed in tabs
Copy link to clipboard
Copied
you could put a screenshot of what you would like.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Did you »app.putCustomOptions(…« before trying to get them?
Otherwise there being nothing to retrieve seems logical.
Please post screenshots illustrating what you mean exactly.
If you (understandably for a Mac-user) don’t want tabs please disable them via the Preferences (»Open Documents as Tabs« and QEnable Floating Document Window Docking«).
Copy link to clipboard
Copied
app.getCustomOptions('screensSize')
returns "error 1302" -> Nonexistent element
These are some screen captures:
1 - initial demo state (please note the order of the windows : car and cat are the two frontmost documents)
2 - what I want (what I had in CC6!) - dog document has not been affected, it is below the others
3 - what I have with Arrange > 2-up Vertical - note the tab (though open docs in tabs is not checked in the settings)
Copy link to clipboard
Copied
3 - what I have with Arrange > 2-up Vertical - note the tab (though open docs in tabs is not checked in the settings)
But is »Enable Floating Document Window Docking« checked?
Edit: Never mind, apparently the Preferences settings are disregarded when invoking those arrangements.
Again: Did you putCustomOptions?
If not what would be there to retrieve?
I suspect you set this up when installing the Script/s originally on CS6 and you would have to do the same for 2025.
Copy link to clipboard
Copied
I generally use txt-files to store data across runs of a Script but in this thread
I posted an example @Paul Riggott had originally posted (though I may have changed the code somewhat, I cannot locate the original thread) that shows how to use getCustomOptions and putCustomOptions to store and retrieve information.
Copy link to clipboard
Copied
Sorry, I forgot to answer your question. This is a part of my script and the results.
var myProp = 'screensSize';
var myString = 'Hello';
var desc = new ActionDescriptor();
app.putCustomOptions(myProp, desc, false);
alert(app.getCustomOptions('screensSize')); // --> [ActionDescriptor] : [count]'0' [typename]'ActionDescriptor'
alert(app.getCustomOptions('screensSize').getString(0)); // --> ERROR 8500 : property doesn't exist
I'll try with your links.
Copy link to clipboard
Copied
Forgive the bluntness, but that code seems contradictory to me.
You define »desc« as a new ActionDescriptor, put it in custom options with the name »myProp«, then
• try to retrieve it by the name »screensize« and
• expect it to carry some specific information.
But … I seem to vaguely recall that custom options cannot be defined by simple names anymore but need to be identified by a UUID – a change that was implemented some time after CS6, I expect.
Copy link to clipboard
Copied
You're right, there is a small mistake in my demo code.
But if I write :
app.putCustomOptions('screensSize', desc, false);
I have the same error. Maybe it's due to the UUID identifier... but what is an UUID? Where could I find some detailed informations about app.putCustomOptions()?
Anyhow, if it's too complicated, I think I can make a workaround for my problem with an Applescript.
Copy link to clipboard
Copied
but what is an UUID?
By frmorel
You can Goolge or ask AI about UUID or GUID.
For Photoshop, they are most “commonly” used in scripts to provide a unique I.D. for a custom menu item, such as the <eventid></eventid> used in the <javascriptresource></javascriptresource> block in scripts such as Export Layers to Files. I have also used them when adding a layer that should have a "unique" name.
Here are a couple of script examples:
alert(generateGuid());
function generateGuid() {
// GUID generator
/* http://blog.shkedy.com/2007/01/createing-guids-with-client-side.html */
/* https://en.wikipedia.org/wiki/Universally_unique_identifier */
var result, i, j;
result = '';
for (j = 0; j < 32; j++) {
if (j == 8 || j == 12 || j == 16 || j == 20)
result = result + '-';
i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
result = result + i;
}
return result;
}
Or:
alert(uuid());
function uuid() {
/* https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid */
var chars = '0123456789abcdef'.split('');
var uuid = [],
rnd = Math.random,
r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4'; // version 4
for (var i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | rnd() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r & 0xf];
}
}
return uuid.join('');
}
Copy link to clipboard
Copied
Thank you Stephen for your explanations.
Copy link to clipboard
Copied
Sorry, I forgot to answer your question. This is a part of my script and the results.
var myProp = 'screensSize';
var myString = 'Hello';
var desc = new ActionDescriptor();
app.putCustomOptions(myProp, desc, false);
alert(app.getCustomOptions('screensSize')); // --> [ActionDescriptor] : [count]'0' [typename]'ActionDescriptor'
alert(app.getCustomOptions('screensSize').getString(0)); // --> ERROR 8500 : property doesn't exist
I'll try with your links.
By @frmorel
First, you use getString(), but I don't see putString().
Second, don't use 0 for the key(id) argument. more
Copy link to clipboard
Copied
It works! Thank you very much for your help.
var myProp = 'screensSize';
var myString = 'Hello';
var desc = new ActionDescriptor();
desc.putString(1, myString);
app.putCustomOptions(myProp, desc, false);
alert(app.getCustomOptions(myProp).getString(1)); // --> "Hello"
Copy link to clipboard
Copied
I apologize, I was mistaken, the UUID-identification is apparently not necessary.

