Either you will need to determine the ID at the beginning of each session (or just before using it) …
… or you could use WIN32OLE
and the SendKeys()
method.
WIN ||= Sketchup::platform == :platform_win rescue RUBY_PLATFORM !~ /darwin/i
require 'win32ole' if WIN
def group_from_slice
if WIN
WIN32OLE::new('WScript.Shell').SendKeys('{ESC}^%s')
else
puts "Feature is PC Only"
end
end
I send the ESC key to close the Ruby console window, so that the
main application window will receive the CTRL+ALT+S keystroke.