How do I run send_action for a custom menu item
-
Ive read most of the posts describing the built in items available with send_action but how do I do this for a new custom menu item.
Say I installed a custom plugin called NewExtension and one of the menu items is Doit.
What I want is something like
Sketchup.send_action "Plugins/NewExtension/Doit:"Is that possible? Or is there some other way to execute this custom menu item within a ruby script?
-
You cannot access such menu items that way...
However, since you know what command the menu item itself 'runs' you can access that directly in any other script...Just repeat the same code that is in the menu item...
It depends how your code is constructed...
For example...cmd = UI::Command.new('NewExtension-Doit'){ NewExtension.new() } UI.menu('Plugins').add_item(cmd)OR if you are not making a command for a toolbar, perhaps
UI.menu('Plugins').add_item('NewExtension-Doit'){ NewExtension.new() }If it's a 'Tool' you need to use a different syntax for the last part, like:
Sketchup.active_model.select_tool(NewExtension.new()) -
Thanks for the reply Tig.
I don't know what code the menu item runs. I would like to simulate, with a ruby command, that I had clicked on a menu item in this pre-installed custom extension.
Am I missing something in your suggestion? -
You can't use the script's code if it's inside an encrypted RBS, but if the Extension menu/toolbar-maker is in a RB, then you can read it to see what it's doing...
You have to do some detective work...
If we knew this 'secret' extension then we could comment more constructively
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement