Skip to main content
Participant
August 4, 2008
Question

AS: how to switch between screen modes?

  • August 4, 2008
  • 5 replies
  • 682 views
hi @ all,

does anybody know how to switch between the 4 screen modes in ps cs3?

- standard
- maximized
- full screen with menubar
- full screen

I looked around but could not find anything discribing a way doing this by applescript.
the only thread I found

http://www.adobeforums.com/webx/.3bc85cba/0

refers to javascript but I was not able to adopt it.

thanks for any help
Claus
This topic has been closed for replies.

5 replies

Participant
August 4, 2008
maaaaan - I was dreaming:

when I first tried your integrated js, I forgot to define screenModeOptions as nr. 2.
so the screen mode still remained in standard mode so I couldn´t see any effect. :-)

by the way: your help showed me how to use js inside of as.
so far I always had the js-part "sourced out" (do you say so?) in another seperate file.

thanks again & have a good time!
Participating Frequently
August 4, 2008
...by result I mean like a string of text.
Participating Frequently
August 4, 2008
No, there's no direct way.

"undefined" is the result of the JS because the JS doesn't return any result back to the Applescript. It just sets the screen mode as expected.
Participant
August 4, 2008
Carl: thanks a lot!

so far I helped myself out with letting "system events" click the specific menu item:

tell application "System Events"
tell process "Photoshop"
click menu item "Vollbildmodus mit Menüleiste" of menu 1 of menu item "Bildschirmmodus" of menu 1 of menu bar item "Ansicht" of menu bar 1
end tell

(=> menu items in german)

-------------------
I also tried the integration of js into an applescript as you showed it above.
this results in "undefined" (shown in the scripteditor).

there is no way direct command in applescript?
Participating Frequently
August 4, 2008
To do it with AS only, you need to simulate the "f" key with System Events:

tell application "System Events"

tell process "Adobe Photoshop CS3" to keystroke "f"
end tell

That will loop thought the screen modes as if you did it manually.

To run the JS from the other thread, you need to use the "do javascript" command. Remember to escape all the quotes in the JS:

tell application "Adobe Photoshop CS3"

do javascript "var screenModeOptions = new Array(4);
screenModeOptions[0] = \"screenModeStandard\";
screenModeOptions[1] = \"screenModeMaximized\";
screenModeOptions[2] = \"screenModeFullScreenWithMenubar\";
screenModeOptions[3] = \"screenModeFullScreen\";

applyScreenMode(screenModeOptions[0]);

function applyScreenMode(mode){
var desc = new ActionDescriptor();
var ref = new ActionReference();
var menuID = stringIDToTypeID( mode );
ref.putEnumerated( charIDToTypeID( \"Mn \" ), charIDToTypeID( \"MnIt\" ), menuID );
desc.putReference( charIDToTypeID( \"null\" ), ref) ;
executeAction( charIDToTypeID( \"slct\" ), desc, DialogModes.NO );
}"
end tell


The JS is the better solution if you wanted to skip directly to the desired screen mode without looping through the others.

Carl.