CEP How do i open Preferences -> Guides, Grid & Slices window

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

timobee
Posts: 4
Joined: Tue Nov 17, 2020 11:10 pm

CEP How do i open Preferences -> Guides, Grid & Slices window

Post by timobee »

I'm trying to open the Preferences -> Guides, Grid & Slices settings window when a user clicks on my CEP extension button. I can't figure it out and I can't find any references on how this could be achieved.


I managed to find a post taht opens the Print settings

Code: Select all

executeAction(charIDToTypeID("Prnt"), undefined, DialogModes.ALL);

I also found this link and got all the action manager stringID but I can't figure how to use this.
https://feedback.photoshop.com/conversa ... 3d4268b648
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: CEP How do i open Preferences -> Guides, Grid & Slices window

Post by Kukurykus »

Code: Select all

sTT = stringIDToTypeID, dsc = new ActionDescriptor(); (ref = new ActionReference())
.putProperty(sTT('property'), sTT('guidesPrefs')), ref.putClass(sTT('application'))
dsc.putReference(sTT('null'), ref), executeAction(sTT('set'), dsc, DialogModes.ALL)
timobee
Posts: 4
Joined: Tue Nov 17, 2020 11:10 pm

Re: CEP How do i open Preferences -> Guides, Grid & Slices window

Post by timobee »

Kukurykus wrote: Wed Nov 18, 2020 5:52 am

Code: Select all

sTT = stringIDToTypeID, dsc = new ActionDescriptor(); (ref = new ActionReference())
.putProperty(sTT('property'), sTT('guidesPrefs')), ref.putClass(sTT('application'))
dsc.putReference(sTT('null'), ref), executeAction(sTT('set'), dsc, DialogModes.ALL)

Photoshop gives an error: Could not complete the command because of a program error.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: CEP How do i open Preferences -> Guides, Grid & Slices window

Post by Kukurykus »

That was for CS6, for CC you need one code line more:

Code: Select all

sTT = stringIDToTypeID;

(ref = new ActionReference()).putProperty(sTT('property'), gP = sTT('guidesPrefs'))
ref.putClass(sTT('application')), (dsc = new ActionDescriptor()).putReference(sTT('null'), ref);
dsc.putObject(sTT('to'), gP, new ActionDescriptor()), executeAction(sTT('set'), dsc, DialogModes.ALL)
timobee
Posts: 4
Joined: Tue Nov 17, 2020 11:10 pm

Re: CEP How do i open Preferences -> Guides, Grid & Slices window

Post by timobee »

Kukurykus wrote: Wed Nov 18, 2020 8:56 am That was for CS6, for CC you need one code line more:

Code: Select all

sTT = stringIDToTypeID;

(ref = new ActionReference()).putProperty(sTT('property'), gP = sTT('guidesPrefs'))
ref.putClass(sTT('application')), (dsc = new ActionDescriptor()).putReference(sTT('null'), ref);
dsc.putObject(sTT('to'), gP, new ActionDescriptor()), executeAction(sTT('set'), dsc, DialogModes.ALL)

Ooh, thanks this worked like a charm : ). Is there a logical way of finding out this kind of stuff? I would really like to learn more about CEP Extension development.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: CEP How do i open Preferences -> Guides, Grid & Slices window

Post by Kukurykus »