How can I assign a keyboard key as a SketchUp shortcut
-
Hi,
May I know that how can I assign a keyboard key as a SketchUp shortcut via ruby, please?
Thanks
Oscar -
go to Window>Preferences>Shortcuts>
now make your shortcut and save it.
-
oscarlok: it is not possible to make a keyboard shortcut via Ruby as this is a feature that user should decide (imagine if every script started to change your shortcuts )
-
It IS possible to modify and add shorcuts to the PC registry using SketchUp Ruby methods [search other recent threads on this] BUT I would not recommend it unless it's for 'in-house' use only. As TBD says imagine the chaos it'd cause if your script messed up everyones pre-set shortcuts...
IF you want to do this then at least offer the choice - make your script with an installer [part] which checks to see if the shortcut has already been used, and with a dialog that asks something like, "Would you like to assign 'Q' as the shortcut key for this tool ?" and if it's already pre-set, "\nNote that 'Q' is currently used for xxxxxxxxxx."; Yes/No. If Yes then you make / change the shortcut. The installer only auto-runs once - on exiting the dialog it also writes something into the registry that is checked by it when it's about to run again, and if that's found then doesn't even ask.
This way the user has the option - and at least then knows that a key has been assigned...
Advertisement