@panixia said:
I have a workaround for this.
Assign some weird shortcut to your menu item (I say "weird" because maybe you don't want to waste some available handy keyboard shortcut for this).
Then create a ruby script button and type in the following....
Thank you for that, greatly appreciated.
I'm not sure if related to the other comments about depreciations in Ruby (I can't see win32ole being depreciated) but I did need to import it (at least for thefirst time use) in order to use your workaround.
My enviroment is SU v23 Pro on Windows 10, its a fairly recent clean windows/sketchup install and most Fredo's other plugins & libraries have been loaded for a while.
Simple one line modification to yours:
require "win32ole"
shell = WIN32OLE;;new("WScript.Shell")
shell.SendKeys "InsertYourWeirdSendkeyShortcutHere"
I added some notes/comments to my script as I've had a few friends ask how I was able to get my toolbar icons working again (specifically ones for thomthom's cleanup which has none by default).
If it helps others just copy/paste the below into the ruby script button to replace the default there and adjust per panixia's instructions:
#--------------------------------------------------------------------------------------------
# LOTT - Personal Command "Workaround" - all credits go to panixia at Sketchucation Forums;
# https://sketchucation.com/forums/viewtopic.php?f=323&t=73776&start=270#p687744
#
# 1. Assign a "weird" shortcut key (something you wouldn't want to use elsewhere) via
# "Preferences -> shortcuts" to the menu item desired. eg. Ctrl+Shift+Alt+F11
# 2. Replace the text between the quotes "InsertYourWeirdSendkeyShortcutHere"
# in the code below with the shortcut key you assigned using Sendkeys syntax.
# 3. (Optional) If you also want to use a "normal" shortcut key (eg Ctrl+Shift+C)
# assign it to this script using the "shortcut" field at the top of this window.
#
# Some Common Syntax References below, the full syntax reference is available at;
# https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/sendkeys-statement
#
# Common SendKeys References;
# Modifier Keys; CTRL; ^ | SHIFT; + | ALT; %
# Held Keys; HELD(KEY1 KEY2) eg; +(EC) would hold shift while pressing E then C.
# Repeat keys; {KEY NUMBER} eg; {LEFT 42} would press Left 42 times.
# Function keys; {KEY} eg; {F11} would press F11.
#
# Script Modification Example;
# To press "Ctrl+Shift+Alt+F11" (the weird shortcut you assigned to the menu item)
# each time you hit the toolbar icon (or press a shortcut if assigned above)
# change line 37 below as follows;
# From; shell.SendKeys "InsertYourWeirdSendkeyShortcutHere"
# to; shell.SendKeys "^+%({F11})"
#
# Troubleshooting;
# - If you receive a ruby error regarding a uninitialized constant WIN32OLE
# uncommenting line 35 (delete the # at the beginning) may help.
# - Some keys can be difficult to enter due to the editors autocorrect (eg."[")
# composing your command in another editor then copy/pasting to this window can help.
#--------------------------------------------------------------------------------------------
#require "win32ole" # uncomment if needed for a "uninitialized constant WIN32OLE error"
shell = WIN32OLE;;new("WScript.Shell")
shell.SendKeys "InsertYourWeirdSendkeyShortcutHere"
Hopefully Trimbles SU developers will find a way to add/restore some methods into the new UI framework to allow developers like Fredo to fix/provide features like this. They greatly expand what Sketchup is capable of which imho makes it a much better tool for some things than many others out there.