Page 1 of 1

Custom keyboard shortcut to launch a script?

Posted: Fri Mar 04, 2016 6:59 pm
by lehtiniemi
Is it possible to set a custom keyboard shortcut to a script? Custom tool scripts show up in the keyboard shortcut setup, but not scripts.

Any ideas how to accomplish this?

Re: Custom keyboard shortcut to launch a script?

Posted: Fri Mar 04, 2016 7:12 pm
by synthsin75
Menu scripts are the same as button scripts, so if you add them to the toolbar, you can give them a shortcut.

Re: Custom keyboard shortcut to launch a script?

Posted: Fri Mar 04, 2016 7:31 pm
by lehtiniemi
Ah, button scripts. I started scripting today... makes sense! Thanks again!!! :) I'll give my script a button.

Re: Custom keyboard shortcut to launch a script?

Posted: Fri Mar 04, 2016 10:42 pm
by synthsin75
You're welcome, and welcome to AS scripting.

Re: Custom keyboard shortcut to launch a script?

Posted: Fri Mar 04, 2016 11:27 pm
by lehtiniemi
Thank you :)

I quickly wanted to clarify two things, I'm not quite sure about these concepts yet?

-by making it a button, do you mean creating a tool that has a button bar at the top? It's not possible to create a tool-looking button that would activate a script directly but it has to be via "Select tool -> press button at the appearing toolbar"?

-which function separates a script menu script and a tool? I could find a mention which function AS looks for in the script to determine whether it's a tool or a script menu script? What is the very basic code that tells AS to make a script a tool?

Re: Custom keyboard shortcut to launch a script?

Posted: Sat Mar 05, 2016 12:17 am
by synthsin75
No, not a tool option button. In the toolbar are two types of scripts, tools and buttons. Buttons do not remain active when pressed, like the Insert Text button. Buttons use the exact same syntax as menu scripts, e.g. function someScript:Run(moho). To get the button behavior, you'll need to edit the _tool_list.txt in the tools folder (preferably in your custom content folder). You'll see that the tool_list already has some buttons setup, so just follow that example with your own.

Re: Custom keyboard shortcut to launch a script?

Posted: Sat Mar 05, 2016 11:14 am
by lehtiniemi
synthsin75 wrote:No, not a tool option button. In the toolbar are two types of scripts, tools and buttons. Buttons do not remain active when pressed, like the Insert Text button. Buttons use the exact same syntax as menu scripts, e.g. function someScript:Run(moho). To get the button behavior, you'll need to edit the _tool_list.txt in the tools folder (preferably in your custom content folder). You'll see that the tool_list already has some buttons setup, so just follow that example with your own.
Ah, thank you so much!!! :)