Copy link to clipboard
Copied
Thanks to the community I already have a script to set the setting setting "resize image during place" using the following script...
sTT = stringIDToTypeID; (ref = new ActionReference()).putProperty(sTT('property'), gP = sTT('generalPreferences')) ref.putClass(sTT('application')); (dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref); (dsc2 = new ActionDescriptor()).putBoolean(sTT('resizePastePlace'), false) dsc1.putObject(sTT('to'), gP, dsc2), executeAction(sTT('set'), dsc1);
I would like to "upgrade" the function to set it back to what it previously was. Is it posible to also read this setting?
Does this help?
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var placeScale = applicationDesc.getObjectValue(stringIDToTypeID("generalPreferences")).getBoolean(stringIDToTypeID("resizePastePlace"));
alert (placeScale);
Copy link to clipboard
Copied
Does this help?
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var placeScale = applicationDesc.getObjectValue(stringIDToTypeID("generalPreferences")).getBoolean(stringIDToTypeID("resizePastePlace"));
alert (placeScale);
Copy link to clipboard
Copied
Thanks! That works great!
I run a script that requires this setting to be off, but some users didn't like having this setting turned off in every day use, so now I can adjust the script to read it first and reset it to it's previous setting after the script is done.
Copy link to clipboard
Copied
I would have thought that it would be as simple as changing false to true, but it is not that easy!
Script listener works, it is just a little more verbose.
Copy link to clipboard
Copied
If you'd have asked it in original thread I would say to change false to true:
How change Photoshop Preferences by script (Resize Image During Place)
Copy link to clipboard
Copied
@Kukurykus wrote:
If you'd have asked it in original thread I would say to change false to true:
How change Photoshop Preferences by script (Resize Image During Place)
I didn't think of it at the time and had forgotten that I had even taken part in that original topic! :]
Ah, now I see, your original (correct) code below is not the same as posted above!
sTT = stringIDToTypeID;
(ref = new ActionReference()).putProperty(
sTT("property"),
(gP = sTT("generalPreferences"))
);
ref.putClass(sTT("application"));
(dsc1 = new ActionDescriptor()).putReference(sTT("null"), ref);
(dsc2 = new ActionDescriptor()).putBoolean(sTT("resizePastePlace"), false);
dsc1.putObject(sTT("to"), gP, dsc2), executeAction(sTT("set"), dsc1);
And yes, both true and false work as expected... Mystery solved, thank you!
Copy link to clipboard
Copied
Mine code from other thread and provided by user are same, aren't they?
Copy link to clipboard
Copied
@Kukurykus wrote:
Mine code from other thread and provided by user are same, aren't they?
No, they are not exactly the same, which explains why I couldn't simply change false to true and get a workable result in the code posted in this topic. I can change your original code from the other topic and get a workable result, which is the clue.
Forgetting minor differences such as single vs. double quotes, one example is a missing parentheses and semi-colon:
Copy link to clipboard
Copied
It's same but with spaces instead of returns.
Copy link to clipboard
Copied
There is a missing ); as indicated in the text search screenshot, this is not a word wrap issue.
Forgetting white space, there are 368 charcters in the original code, 357 characters in the copied code.
Copy link to clipboard
Copied
No, there is no ';' in original code, but return character, while in pasted code a space character.
Copy link to clipboard
Copied
@Kukurykus wrote:
No, there is no ';' in original code, but return character, while in pasted code a space character.
There is, there are at least two of them, you can see it in the screenshot and in the code that I copied from the original topic above and in the image below:
Copy link to clipboard
Copied
You look at wrong spots. Compare culprits in both codes: ') r' & ') d'.
Copy link to clipboard
Copied
I don't think that there is any point in discussing this further, I have stated the case multiple times... But again:
Your original code from the original topic works when swapping the false/true.
The code in this topic by the OP does not.
Copy link to clipboard
Copied
Yes, it does work. You must do something wrong if it doesn't for you. That's the same code.
Change space characters to return characters in 2 spots I indicated and it'll work flawlessly.