Shortcuts.rb: how does it work?
-
i posted a question on the pro user forum: how can i print a list of my shortcuts?
kris suggested i downloaded shortcuts.rb. i did it but as i click on it nothing happens.
unless i downloaded the wrong thing it seems to be a very simple script, as it consists of a single line: (UI.menu("Plugins").add_item("List Shortcuts") { Sketchup.send_action 21477}.
could i be missing something like a previous step? could any of you ruby guys help me out?
thanks.
p.s.: i am on mac.
-
Sketchup.get_shortcuts.sort!.each{|s|puts s}
will put a list of your shortcuts in the Ruby Console both on a PC AND a Mac - you could then copy/paste that into a text file and print it...
To be a bit cleverer - if you want it to go directly into a file then use:
filepath="C:/Temp/Shortcuts.txt"; file=File.new(filepath,"w"); Sketchup.get_shortcuts.sort!.each{|s| file.puts s}; file.close
your make filepath to suit yourself.
Copy everything from "filepath=" to ".close" and paste it into the Ruby Console, OR you could make a proper ruby script with a menu item - copy some other's methods for this...
-
@tig said:
Sketchup.get_shortcuts.sort!.each{|s|puts s}
thanks, TIG. i just dropped the line above into the ruby console and, voilá, i got my shortcuts list.
regards.
-
glad you found what you're looking for Edson...
-
Here's a 'universal solution'...
Paste this into a file:(c) TIG 2007, ANY without warranty...
BUT you can use it freely...
however, it'd be nice NOT to claim it as your own
OR at least just to mention me when you do reuse it...
To use it: Put it in the Plugins folder...
as 'GetShortcuts.txt', and the you can manually load it,
when required [load"GetShortcuts.txt"] in the Ruby Console...
require 'sketchup'
Choose where you want the list to go PICK ONE # ...
#filepath=ENV["TEMP"]+"/Shortcuts.txt" ### list's in, =YOUR Temp...
#filepath=ENV["TMP"]+"/Shortcuts.txt" ### =YOUR Tmp...
filepath="C:/Temp/Shortcuts.txt" ### =SystemTemp (PC)file=File.new(filepath,"w")
Sketchup.get_shortcuts.sort!.each{|s|file.puts s}
file.close
Advertisement