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

Fit to screen js script

Community Beginner ,
Dec 23, 2017 Dec 23, 2017

Copy link to clipboard

Copied

Hello,

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

TOPICS
Actions and scripting

Views

3.2K

Translate

Translate

Report

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

Votes

Translate

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank You

Votes

Translate

Translate

Report

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

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!

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Kukurykus

excuse what is the difference

they are both the same thing.

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Excellent explanation

thank you

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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