Page 1 of 1

Complete Tool TypeID list for Photoshop CS5

Posted: Thu Nov 24, 2011 10:53 pm
by dbosst
As I just learned, the string ID's are generated at runtime, so they change from session to session. But since some of the tools have string ID's and some are char ID's, its difficult to get all the type ID's in one place. This code will place all the tool type ID's in a dictionary and generate them at run time.

The benefit of this over having a separate handler just doing the lookups individually, is that this way you can see all the tool names in one file for easy reference.

For instance, if you want the bucket tool type ID, you just do
Code: Select allphsClass["bucketTool"]


The code, there are two pieces.

Code: Select all// in the start of the main script:
include 'toolStrings.as';

// in your creation complete
protected function creationCompleteHandler(event:FlexEvent):void {
  for (var i:Number = 0; i < phsClassToolStrings.length; i++) {
    phsClass[phsClassToolStrings] = Photoshop.app.stringIDToTypeID(phsClassToolStrings);
  }
}


And for the separate toolStrings.as file:
Code: Select allprotected var phsClassToolStrings:Array = new Array (
   "3DFOVTool",
   "3DObjectPanTool",
   "3DObjectRollTool",
   "3DObjectRotateTool",
   "3DObjectScaleTool",
   "3DObjectSlideTool",
   "3DOrbitCameraTool",
   "3DPanCameraTool",
   "3DRollCameraTool",
   "3DWalkCameraTool",
   "addKnotTool",
   "artBrushTool",
   "backgroundEraserTool",
   "blurTool",
   "bucketTool",
   "burnInTool",
   "cloneStampTool",
   "colorReplacementBrushTool",
   "colorSamplerTool",
   "convertKnotTool",
   "countTool",
   "cropTool",
   "customShapeTool",
   "deleteKnotTool",
   "directSelectTool",
   "dodgeTool",
   "ellipseTool",
   "eraserTool",
   "eyedropperTool",
   "freeformPenTool",
   "gradientTool",
   "handTool",
   "historyBrushTool",
   "lassoTool",
   "lineTool",
   "magicEraserTool",
   "magicStampTool",
   "magicWandTool",
   "magneticLassoTool",
   "marqueeEllipTool",
   "marqueeRectTool",
   "marqueeSingleColumnTool",
   "marqueeSingleRowTool",
   "moveTool",
   "paintbrushTool",
   "patchSelection",
   "pathComponentSelectTool",
   "patternStampTool",
   "penTool",
   "pencilTool",
   "polySelTool",
   "polygonTool",
   "quickSelectTool",
   "rectangleTool",
   "redEyeTool",
   "rotateTool",
   "roundedRectangleTool",
   "rulerTool",
   "saturationTool",
   "sharpenTool",
   "sliceSelectTool",
   "sliceTool",
   "smudgeTool",
   "spotHealingBrushTool",
   "textAnnotTool",
   "typeCreateMaskTool",
   "typeCreateOrEditTool",
   "typeVerticalCreateMaskTool",
   "typeVerticalCreateOrEditTool",
   "wetBrushTool",
   "zoomTool"
);


Complete Tool TypeID list for Photoshop CS5

Posted: Thu Nov 24, 2011 11:59 pm
by Mike Hale
The stringIDs are generated at runtime and can vary from Photoshop session to session. You can not depend on a stringID always having the same typeID as you can with charIDs.

Complete Tool TypeID list for Photoshop CS5

Posted: Fri Nov 25, 2011 2:10 am
by dbosst
Ah I just learned that! Doh! I'll edit the top post with a fix in a bit..