Skip to main content
Inspiring
August 16, 2023
Answered

How to change the selected plugin tool, using SDK API functions?

  • August 16, 2023
  • 1 reply
  • 434 views

Hi all,

another question has come up. I already apologize if the answer is very simple, and I just missed it so far.

The following setup is used:

  • Windows 10
  • Adobe Illustrator 27.8.1 (64-bit)
  • The latest SDK 2023

I have created one plugin with several different custom tools.

I have enabled selection-changed and tool-selected notifier, connected to callback-functions. Therefore, I know which tool is currently selected.

 

My goal now is to figure out how to change, which tool is selected or activated in Illustrator.

For example: One of my tools was selected by the user and then a specific button is clicked. Now I want the current tool to be disabled, and another tool to be enabled. Just as if the user would have clicked on the other tool icon in Illustrator.

 

So, my question is, which SDK suite or API functions can I use to tell Illustrator to disable the current tool and enabled one of my other tools instead.

Thank you very much in advance.

Fabian T.

Correct answer EmBert

I've not tried it myself so pardon if I end up accidentally taking a big bite out of my own foot, but at least going by the (albeit sparse) documentation, AIToolSuite::SetSelectedTool() sounds like it should do what you're asking:

Selects a plug-in tool programmatically.

This is the same as the user selecting the tool in the Tool palette. To select built-in tools, see SetSelectedToolByName()

Parameters:
 tool The tool reference.

 

The same suite also has SetSelectedToolByName() and SetSelectedToolByNumber()

1 reply

EmBertCorrect answer
Participant
August 17, 2023

I've not tried it myself so pardon if I end up accidentally taking a big bite out of my own foot, but at least going by the (albeit sparse) documentation, AIToolSuite::SetSelectedTool() sounds like it should do what you're asking:

Selects a plug-in tool programmatically.

This is the same as the user selecting the tool in the Tool palette. To select built-in tools, see SetSelectedToolByName()

Parameters:
 tool The tool reference.

 

The same suite also has SetSelectedToolByName() and SetSelectedToolByNumber()

owitaAuthor
Inspiring
August 28, 2023

Dear EmBert,

thank you very much! 🙂

It works fine and I am a little embarrassed that I didnt't find it myself. 😉

Best Regards

Participant
May 24, 2025

It seem can not use SetSelectedToolByName/SetSelectedToolByNumber/SetSelectedTool in the plugin-in SelectTool method directly, must submit a thread to run these methods