Copy link to clipboard
Copied
I’m trying to figure out if it’s possible to call the Object Selection Tool in Photoshop using a script — in the same way as pressing the W key on the keyboard.
So far I’ve tried:
Switching tools with Action Manager code (select with objectSelectionTool).
Using app.currentTool.
None of these approaches reliably activate the Object Selection Tool across different Photoshop versions.
Has anyone successfully scripted this so that it behaves exactly like pressing W?
If yes, could you share the code snippet or approach you used?
Thanks in advance!
It's not that obviously named.
selectTool('magicLassoTool');
function selectTool(tool) {
var desc9 = new ActionDescriptor();
var ref7 = new ActionReference();
ref7.putClass(app.stringIDToTypeID(tool));
desc9.putReference(app.charIDToTypeID('null'), ref7);
executeAction(app.charIDToTypeID('slct'), desc9, DialogModes.NO);
}
Copy link to clipboard
Copied
It's not that obviously named.
selectTool('magicLassoTool');
function selectTool(tool) {
var desc9 = new ActionDescriptor();
var ref7 = new ActionReference();
ref7.putClass(app.stringIDToTypeID(tool));
desc9.putReference(app.charIDToTypeID('null'), ref7);
executeAction(app.charIDToTypeID('slct'), desc9, DialogModes.NO);
}
Copy link to clipboard
Copied
Thanks a lot, Stephen! I’ve been stuck on this for 3 hours, and now it finally makes sense 🙏
Find more inspiration, events, and resources on the new Adobe Community
Explore Now