How does one get / set the current tool using Javascript in Photoshop?
#target photoshop
if (app.currentTool == BRUSH_TOOL) {
app.currentTool = ERASE_TOOL;
} else {
app.currentTool = BRUSH_TOOL;
}
How does one get / set the current tool using Javascript in Photoshop?
#target photoshop
if (app.currentTool == BRUSH_TOOL) {
app.currentTool = ERASE_TOOL;
} else {
app.currentTool = BRUSH_TOOL;
}
4
Answers
I found a solution, but I wish it was simpler. Basically I'm using this to select the brush tool and toggle the eraser tool, using only one button. That way I only have to use one button on my Wacom Tablet.
It’s simpler in AppleScript. This is my little library script that I use with my Wacom:
you can try to use
photoshop-python-api
https://github.com/loonghao/photoshop-python-api
Old question, but still relevant so I wanted to simplify it further. The OP was on the right track with the code, it needed only the necessary string values for various tools, which were provided by @skibulk above.
According to the Photoshop Javascript Reference PDF, currentTool is a read-write string property of the Application object. This means we can get the value of the current tool, but also set the value of the current tool.