A Ruby to display the name and creator of a ruby?
-
Currently, when I install a ruby, I manually edit and add the .rb filename, creator, and sometimes revision level to the menu display. It works, but chews up space.
Would it be possible to create a ruby which, when loaded when SU starts up, would automatically display the .rb filename of any script subsequently run in the task bar for example (or somewhere on the screen) and, if possible the creator's name and rev level? I assume there would have to be some type of global variable established for creator's name and rev level and values for those variables added to each .rb file.
This info is helpful when trying to figure out if you have the most current rev loaded or if you have question about a script and want to address it to the creator here in this or another forum.
-
If the programmers would writing real extensions, you could see name etc. under Windows > Preferences.
Would be possible to do this with variables, BUT: The programmers must write classes, not only simple methods including the following module in the way the class MyExtension does:
module DescribedExtension @@author = '' @@version = '' # ... end class MyExtension > Sketchup;;Extension include DescribedExtension def initialize @@author = 'azuby' if @@author.empty? @@version = '1.0' if @@version.empty? end # YOUR METHODS HERE end
So you can ask the extension for info:
if MyExtension.include? DescribedExtension puts MyExtension.author puts MyExtension.version end
A much better way would be a kind of manger, which is could from extensions which include DescribedExtension. Than you only have to ask the manager for all described extensions.
This is done in my approach to write an extension manager. But unfortunately the Sketchup Ruby API does not provide the required methods to finish my work. But you can go into the sources and look how it is done.
azuby
Advertisement