Copy link to clipboard
Copied
Hello,
Is there a script line for "Fit to screen" in ps?
TRY
runMenuItem(app.charIDToTypeID("FtOn")); // FIT TO SCREEN
runMenuItem(app.charIDToTypeID("ZmOt")); // ZOOM -
runMenuItem(app.charIDToTypeID("ZmIn")); // ZOOM +
runMenuItem(app.charIDToTypeID("ActP")); // ACTUAL PIXEL
Copy link to clipboard
Copied
TRY
runMenuItem(app.charIDToTypeID("FtOn")); // FIT TO SCREEN
runMenuItem(app.charIDToTypeID("ZmOt")); // ZOOM -
runMenuItem(app.charIDToTypeID("ZmIn")); // ZOOM +
runMenuItem(app.charIDToTypeID("ActP")); // ACTUAL PIXEL
Copy link to clipboard
Copied
Thank You
Copy link to clipboard
Copied
How do you know those Action Manager codes? I tried to run Script Listener but it doesn´t record that way haha! Where do you found that info or where did you learn it? Thank you in advance!
Copy link to clipboard
Copied
To get the code to call the menu or create a path, use the items in the drop-down menu of the Actions palette "Insert Menu Item ..." and "Insert Path".
Copy link to clipboard
Copied
Loll I missed 'Insert Path'. To be honest I don't know how that happened but I never saw that item 😕
Copy link to clipboard
Copied
You may use one of my old functions. It's named 'fit', but it does different stuff for real. It depends on inserted value:
function fit(ft) {// SCREEN FITTING:
function cTT(v) {return charIDToTypeID(v)}; function sTT(v) {return stringIDToTypeID(v)}
tle = RegExp(tV = 'tileVertically').test(ft) ? (/^\d\.|10/.test(version) ? tV : ((function(){if (documents.length == 2) fit('consolidateAllTabs')})(), 'Tile')) : ft;
(ref = new ActionReference()).putEnumerated(cTT('Mn '), cTT('MnIt'), eval((tle.length <= 4 ? 'c' : 's') + 'TT(tle)'));
(dsc = new ActionDescriptor()).putReference(cTT('null'), ref), executeAction(cTT('slct'), dsc, DialogModes.NO)
}
fit('FtOn')
Copy link to clipboard
Copied
Kukurykus
excuse what is the difference
they are both the same thing.
Copy link to clipboard
Copied
When you put that code to your library (in other file for example) you can use it in your current code as fit('<value>'). Many ScriptListener codes when you use often you can shorten to similar form. So you dont have each time use long lines of code but only short function calling. Its useful when you use it many times in one / more code(s), especially with different values.
In CS2 and CS3 both 'Tile' and 'tileVertically' worked, but in CS4 and CS5 'tileVertically' was removed while 'Tile' behaviour was changed to 'tileVerticaly'. Now you could use 'tileVertically' as old 'Tile', but couldn't anymore use 'Tile' old way. To fix it I found a trick. If I wanted two images were distributed horizonatally I had to use that code which after 'consolidateAllTabs' making, palyed 'Tile' so forced images to be distributed vertically. In CS6 there still wasn't 'tileVertically' but 'Tile' behaviour was changed back to original 'Tile'. So not matter you used 'tileVertically' or 'Tile' with my function with 'consolidateAllTabs' or not, as each time images were distributed vertically. You had no chance to make horizontal distribution by a script. They actually add new distribution options (for even more than two images), that you could chose between other things vertical distribution but unfortunatelly that wasnt scriptable so completetly useless for me, as I dont lose time to do things manually during job if something can be automated. Even with shortcuts it would bew additional manual operation I had to perform many times a day, so really wasteful.
Well I often worked on vertical orientation monitor (so height was longer than width), it's why I I needed my function to use, however as I say that was not possible to do with CS6 as far you didn't choose it manyally. That really strange some people in Adobe do things for worse 😕 First they destroeyd perfect 'tileVertically' and 'Tile' options, to make 2nd working as first (?!), then when I finally found a remedy for this problem (with 'consolidateAllTabs') they restored old 'Tile' but prevend horizontal distribution by scritping. I'm asking why to change something what is perfect, and then changing that once again that you even can't make workaround ?! The more replacing it with something what is commonly unuseful during working.
Ps. you can use fit() to other items from View menu. What is good you can use values interchangeably as strings and chars.
Copy link to clipboard
Copied
Excellent explanation
thank you
Copy link to clipboard
Copied
Btw here'e something really funny when you read all posts to the end (focus on years):
Bridge: ExtendScript UI not drawing correctly | Photoshop Family Customer Community
Copy link to clipboard
Copied
I'm currently trying to get Photoshop to execute a "Fit on Screen" upon opening an image from Adobe Camera Raw. Right now, when I put an Open Document event listener that executes either a "Fit on Screen" menu execution action or if I use your script, it will fit the image on screen if I'm opening an image from within Photoshop. But, if I go to Bridge, open a RAW image from there in ACR, then have it open from there to Photoshop, nothing happens. I'm thinking the script is executing before the image is actually opened, because I got a Continue or Stop error before the image had opened when trying some other actions. Any thoughts?