Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Zooming / Ctrl + 0 (zero)

Gast
Aug 03, 2009 Aug 03, 2009

Is there a way to script the equivalent of hitting Control + zero? I found a zoom routine in this forum but it actually resizes the document, which I can't do.

Control + 0 makes the images as large as it can be without having to scroll in the document window. This would be a very helpful thing to have to add to the end of some of my scripts so the operator can double check the results.

Thanks!

Ken

THEMEN
Aktionen und Skripte
2.4K
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines

correct answers 1 richtige Antwort

Guru , Aug 03, 2009 Aug 03, 2009

In version before cs4

function runMenuItem(item){ // from xbytor
   cTID = function(s) { return app.charIDToTypeID(s); };
   var desc = new ActionDescriptor();
   var ref = new ActionReference();
   ref.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), cTID( item ) );
   desc.putReference( cTID( "null" ), ref );
   executeAction( cTID( "slct" ), desc, DialogModes.NO );
}
runMenuItem("FtOn");// fit on screen ( same as ctrl-0 )

in cs4

runMenuItem(app.charIDToTypeID("FtOn"));// fit on screen ( same as ctr

...
Übersetzen
Adobe
Guru ,
Aug 03, 2009 Aug 03, 2009

In version before cs4

function runMenuItem(item){ // from xbytor
   cTID = function(s) { return app.charIDToTypeID(s); };
   var desc = new ActionDescriptor();
   var ref = new ActionReference();
   ref.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), cTID( item ) );
   desc.putReference( cTID( "null" ), ref );
   executeAction( cTID( "slct" ), desc, DialogModes.NO );
}
runMenuItem("FtOn");// fit on screen ( same as ctrl-0 )

in cs4

runMenuItem(app.charIDToTypeID("FtOn"));// fit on screen ( same as ctrl-0 )

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Neu hier ,
Aug 12, 2009 Aug 12, 2009

in cs4

runMenuItem(app.charIDToTypeID("FtOn"));// fit on screen ( same as ctrl-0 )

Michael,

New to CS scripting so appreciate all the help you give. Where do I find the runMenuItem codes. Have looked at the event codes in the CS2 and CS4 Javascipt Manuals but they do not seem to include "FtOn" for example.

Sorry if this is covered somewhere else but I just need to know where to look.

Cheers

John

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Guru ,
Aug 12, 2009 Aug 12, 2009

As far as I know Adobe doesn't list those IDs in their scripting docs. They may be in the Photoshop SDK but I recommend that if you are new to scripting you have a look at Xbytor's Xtools. http://sourceforge.net/projects/ps-scripts/files/xtools/

In his stdlib.js he has functions for most of the useful menuItems.

If you want just the menuItem ID, there are several ways to find them. Most start with creating a new action and inserting the menuItem of intrest into the action( using the popup menu of the action panel ) then saving the action set. Now either look at that atn file with an hexeditor or use one of Xbytor's actionsTo scripts found in Xtools. But again your best bet is stdlib

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Gast
Sep 06, 2009 Sep 06, 2009

Michael, I just realized I never properly thanked you for your post. All apologies! It works perfectly.

I'll use this info to try and work out a couple of other menu item things I'd like to do.

All best,

Ken

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Engagiert ,
Sep 06, 2009 Sep 06, 2009

Michael L Hale wrote:

As far as I know Adobe doesn't list those IDs in their scripting docs. They may be in the Photoshop SDK but I recommend that if you are new to scripting you have a look at Xbytor's Xtools. http://sourceforge.net/projects/ps-scripts/files/xtools/

In his stdlib.js he has functions for most of the useful menuItems.

If you want just the menuItem ID, there are several ways to find them. Most start with creating a new action and inserting the menuItem of intrest into the action( using the popup menu of the action panel ) then saving the action set. Now either look at that atn file with an hexeditor or use one of Xbytor's actionsTo scripts found in Xtools. But again your best bet is stdlib

http://www.pcpix.com/Photoshop/char.htm

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Guru ,
Sep 06, 2009 Sep 06, 2009
AKTUELL

The info on the page at that link is out of date ( CS ). I stop using it as a reference long ago. I still think Xtools is a better reference. At least Xbytor updates when a version of Photoshop adds to the ID list.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines