Link in Zwischenablage kopieren
Kopiert
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
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
...Link in Zwischenablage kopieren
Kopiert
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 )
Link in Zwischenablage kopieren
Kopiert
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
Link in Zwischenablage kopieren
Kopiert
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
Link in Zwischenablage kopieren
Kopiert
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
Link in Zwischenablage kopieren
Kopiert
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
Link in Zwischenablage kopieren
Kopiert
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.
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen