Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Fit to screen js script

Community Beginner ,
Dec 23, 2017 Dec 23, 2017

Hello,

Is there a script line for "Fit to screen" in ps?

TOPICS
Actions and scripting
4.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Dec 23, 2017 Dec 23, 2017

TRY

runMenuItem(app.charIDToTypeID("FtOn")); // FIT TO SCREEN

runMenuItem(app.charIDToTypeID("ZmOt")); // ZOOM -

runMenuItem(app.charIDToTypeID("ZmIn")); // ZOOM +

runMenuItem(app.charIDToTypeID("ActP")); // ACTUAL PIXEL

Translate
Adobe
Advocate ,
Dec 23, 2017 Dec 23, 2017

TRY

runMenuItem(app.charIDToTypeID("FtOn")); // FIT TO SCREEN

runMenuItem(app.charIDToTypeID("ZmOt")); // ZOOM -

runMenuItem(app.charIDToTypeID("ZmIn")); // ZOOM +

runMenuItem(app.charIDToTypeID("ActP")); // ACTUAL PIXEL

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2017 Dec 23, 2017

Thank You

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 14, 2018 Sep 14, 2018

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Sep 15, 2018 Sep 15, 2018

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".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 15, 2018 Sep 15, 2018

Loll I missed 'Insert Path'. To be honest I don't know how that happened but I never saw that item 😕

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 23, 2017 Dec 23, 2017

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')

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 24, 2017 Dec 24, 2017

Kukurykus

excuse what is the difference

they are both the same thing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 24, 2017 Dec 24, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 24, 2017 Dec 24, 2017

Excellent explanation

thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 24, 2017 Dec 24, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 16, 2024 May 16, 2024
LATEST

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines