Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Has anyone managed to trigger the Object Selection Tool via script?

Community Beginner ,
Sep 12, 2025 Sep 12, 2025

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!

TOPICS
Actions and scripting , Windows
116
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 12, 2025 Sep 12, 2025

@marcin_1620 

 

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);
}

 

Translate
Adobe
Community Expert ,
Sep 12, 2025 Sep 12, 2025

@marcin_1620 

 

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);
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 12, 2025 Sep 12, 2025
LATEST

Thanks a lot, Stephen! I’ve been stuck on this for 3 hours, and now it finally makes sense 🙏

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines