Wednesday, 15 February 2012

Photoshop Javascript: How to get / set current tool? -


How can one get the current device using Javascript in Photoshop?

  #target Photoshop if (app curentTool == BRUSH_TOOL) {app.currentTool = ERASE_TOOL; } And {app.currentTool = BRUSH_TOOL; } I have found a solution, but I want it to be easy. Basically I'm using it to select brush tool and to toggle the eraser tool, using only one button. In this way I only have to use a button on my Wakom tablet.  
  #target photoshop if (getTool () == 'paintbrush') {set-to-handle ('erasaratul'); } Else {setTool ('paintbrushTool'); } // https://forums.adobe.com/thread/579195 function getTool () {var ref = new ActionReference (); Ref.putEnumerated (charIDToTypeID ("capp"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt")); Var cTool = typeIDToStringID (executeActionGet (referee) .getEnumerationType (stringIDToTypeID ('tools'))); Return cTool; } // http://www.ps-scripts.com/bb/viewtopic.php?t=2179 Function Set Tools (Tools) {var desc9 = new ActionDiscriptor (); Var ref7 = new interference (); Ref7.putClass (app.stringIDTopeID (tool)); Desc9.putReference (app chirrupoted ('empty'), riff 7); Execution action (app childtotipid ('SLCT'), Days 9, Dialogmodes.No); } // moveTool // marqueeRectTool // marqueeSlingleRolTool // marqueeSingleColumnTool // lassoTool // polySelTool // magnetic losotil // quickceptol / / magic vantall // croptol // sliceol / slice / selected jokes / spot healing brush tools / / Jadustamptil / patch select / / redEyeTool // paintbrushTool // pencilTool // colorReplacementBrushTool // cloneStampTool // patternStampTool // historyBrushTool // artBrushTool // eraserTool // backgroundEraserTool // magicEraserTool // gradientTool // bucketTool // blurTool // sharpenTool // smudgeTool // dodgeTool // burnInTool // saturationTool // penTool // freeformPenTool // addKnotTool // deleteKnotTool // Knhwartconttail / type / Krenkr Type / writeTraglyTrolTall / /Cert masktool / / typeWriterCreativeMaskTall //SiteCompactSetTransactionTotal // DirectSetLol / /Itolol / GoalFoldAndLatall //EllipTestol // Multilanguage Toll / / LineTool / / CustomShowTool / / TextNet / VoiceAnotot / IDEP PerTool // colorSamplerTool // Rule Toll // Handtool // ZoomTel  

No comments:

Post a Comment