[Plugin] Ruby Toolbar

[Plugin] Ruby Toolbar

Postby Jim » Mon Nov 19, 2007 6:04 am

Ruby Toolbar

About

Ruby Toolbar provides some controls over SketchUp's Ruby Panel (or Console.) It is most useful to people who are writing Ruby plugins.

This is a Windows-only plugin.

The 5 toolbar buttons are shown below.



They are:

[ Show/Hide Ruby Console | Clear Console | Load a .rb | Reload last .rb | Browse Plugins Folder ]

If someone wanted to contribute some good, meaningful icons I'd be grateful.

The position and size of the console is saved to the Windows Registry when the console is hidden using the toolbar, and restored between sessions.

Requirements

  • Sketchup
  • Windows
  • Win32API.so (if not already installed.)

Installation

Download the .zip file, extact the files, and move them into your Plugins directory.

Didier, this is actually an update of the RubyPanelToolbar you have archived on your site.

Download and info here
1
Last edited by Jim on Wed Jan 05, 2011 5:20 pm, edited 4 times in total.
Hi

Jim 
Global Moderator
 

Re: Ruby Toolbar

Postby Didier Bur » Mon Nov 19, 2007 6:05 am

Cool :lol:
very VERY VERY useful tool,
Thanks a lot from all the developers !

hem hem :o :oops: where's the gem ? (didn't find it at Sketchy Endeavors :x )
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: Ruby Toolbar

Postby modelhead » Mon Nov 19, 2007 6:06 am

Yikes!! is that ever a cool thing to have around...thanks...very useful.
0

modelhead 
 

Re: Ruby Toolbar

Postby tomasz » Mon Nov 19, 2007 6:07 am

Jim,

Am I blind already? Description of your tool is so interesting ... but where is the link :lol:
Thanks a lot!

Tomasz
0

tomasz 
SU2TH & SU2KT Developer
 

Re: Ruby Toolbar

Postby Jim » Mon Nov 19, 2007 6:08 am

Oops, that was a major omission. I've added the attachment to the original post.
0
Hi

Jim 
Global Moderator
 

Re: Ruby Toolbar

Postby not registered yet » Mon Nov 19, 2007 6:10 am

When I extracted your .zip file, KI restarted SketchUp and I`can't find it!!! Will you please Bugfix it?

[Invader ZIM]
0

not registered yet 
 

Re: Ruby Toolbar

Postby juju » Mon Nov 19, 2007 6:10 am

ZIM - some toolbars need to be activated under the "view" menu. Have a look to see if this is the case.
0
Save the Earth, it's the only planet with chocolate.
User avatar
juju 
Premium Member
Premium Member
 

Re: Ruby Toolbar

Postby Didier Bur » Mon Nov 19, 2007 6:11 am

Jim,
I'm having the "blank icons syndrom" (all png's are in Plugins folder)
The line that seems to cause the problem is:

imgdir = File.join(File.dirname(__FILE__), File.basename(__FILE__, ".rb"))

It returns: ./(eval)
then the icon file location File.join(imgdir, "rubypanel.png") returns: ./(eval)/rubypanel.png

Please help !


The 'toggle' method doesn't work also. :x At least in V5.
Question: Is findWindow.call(0,"Ruby Console") rely on language settings of SU ? I mean is "Ruby Console" available just for english versions of SU ? In this case the win32api call will not work with other platforms.

P.S.:
Code: Select all
UI.openURL("c:\\program files\\google\\google sketchup 6\\plugins")

A non hard-coded command would be handy. Why not get this path from the registry ? Or something like:

su_ver = Sketchup.version.split(".")[0].to_i
if su_ver < 6
devdir = File.dirname(Sketchup.find_support_file("sketchup.exe")) + "\\Plugins"
else
devdir = ...
end

This makes the command compatible for SU5 and 6 (I guess), no matter where the user has installed SU.


Regards,
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: Ruby Toolbar

Postby Jim » Mon Nov 19, 2007 6:12 am

Didier Bur wrote:Jim,
I'm having the "blank icons syndrom" (all png's are in Plugins folder)
The line that seems to cause the problem is:

imgdir = File.join(File.dirname(__FILE__), File.basename(__FILE__, ".rb"))

It returns: ./(eval)
then the icon file location File.join(imgdir, "rubypanel.png") returns: ./(eval)/rubypanel.png

Please help !


Didier, I'm, not sure why it works on my computer but not yours. I have updated the script to use a method that will hopefully be more robust. There should be a rubytoolbar folder in which the images are located.

Didier Bur wrote:The 'toggle' method doesn't work also. :x At least in V5.
Question: Is findWindow.call(0,"Ruby Console") rely on language settings of SU ? I mean is "Ruby Console" available just for english versions of SU ? In this case the win32api call will not work with other platforms.

This could very well be the case. If you have Ruby installed, you could try your local verion of Win32API.so located in C:\ruby\lib\ruby\1.8\i386-mswin32\Win32API.so.

What is the title text of your Ruby Console window? Is it English "Ruby Console", or maybe French? I think findWindow is using the name of the window.

Didier Bur wrote:P.S.:
Code: Select all
UI.openURL("c:\\program files\\google\\google sketchup 6\\plugins")

A non hard-coded command would be handy. Why not get this path from the registry ? Or something like:

su_ver = Sketchup.version.split(".")[0].to_i
if su_ver < 6
devdir = File.dirname(Sketchup.find_support_file("sketchup.exe")) + "\\Plugins"
else
devdir = ...
end
This makes the command compatible for SU5 and 6 (I guess), no matter where the user has installed SU.

I use the find_support_file method; good idea.

Thank you for the report, and your patience. Please download and try the updates.
0
Hi

Jim 
Global Moderator
 

Re: Ruby Toolbar

Postby Didier Bur » Mon Nov 19, 2007 6:13 am

Hi Jim,
Thanks for the update: icons are there now :D

Show/Hide console doesn't work :? (not very important)
Clear console only moves the text in the console 1 line up 8O

The title of the Ruby console window in french is "Console Ruby". This could cause the problem...
But the most important command "Reload script" works OK since the first version :P

Thanks again for this very useful tool,
Regards,
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: Ruby Toolbar

Postby Gaieus » Mon Nov 19, 2007 6:13 am

Didier Bur wrote:...The title of the Ruby console window in french is "Console Ruby". This could cause the problem...

Thank God I don't need to deal with a "native" version of SU! :)
0
User avatar
Gaieus 
 

Re: Ruby Toolbar

Postby Didier Bur » Mon Nov 19, 2007 6:14 am

Everything's OK with the french version now, including toggle
Only minor tweaks were necessary :lol:
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: Ruby Toolbar

Postby Jim » Mon Nov 19, 2007 6:15 am

Didier Bur wrote:Everything's OK with the french version now, including toggle
Only minor tweaks were necessary :lol:


Great! But would you mind sharing the minor tweaks so maybe I can make the toolbar more international?
0
Hi

Jim 
Global Moderator
 

Re: Ruby Toolbar

Postby Didier Bur » Mon Nov 19, 2007 6:15 am

Hi Jim,

would you mind sharing the minor tweaks


I'm afraid it would be useless because I simply replaced all the calls to "Ruby Console" by "Console Ruby", but that's only for french. Each version of SU does have a particular name for the Ruby Console, so... Even a call to langhandler.rb (with 'getstring') will not work since this deals with a window name, not a message string or such. :(

Regards,
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: Ruby Toolbar

Postby Jim » Mon Nov 19, 2007 6:16 am

Didier Bur wrote:Hi Jim,

would you mind sharing the minor tweaks


I'm afraid it would be useless because I simply replaced all the calls to "Ruby Console" by "Console Ruby", but that's only for french. Each version of SU does have a particular name for the Ruby Console, so... Even a call to langhandler.rb (with 'getstring') will not work since this deals with a window name, not a message string or such. :(

Regards,


Didier, GetString would work, but since it's only one string, I won't use LangHandler. I've updated the plugin to support FR.
0
Hi

Jim 
Global Moderator
 

Re: Ruby Toolbar

Postby CPhillips » Mon Nov 19, 2007 6:17 am

Hi Jim,

I love this toolbar. I use it constantly.

Feature request: How about saving the state and position of the console in the registry? So if I close and reopen Sketchup it remembers if the console was open and where it was.

Also If you want I could give you the code to read the console log window. Saving is the only use I can think of. But maybe it could be parsed to some effect.

Chris
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: Ruby Toolbar

Postby Jim » Mon Nov 19, 2007 6:18 am

Thanks Chris,

The version I posted on SketchyUtils isn't up-to-date, I'll remove it. Download the version available in this thread.

The position and size are saved in the registry, but only if the console is closed using the toolbar. Is it possible to save these settings if the console is closed using the X widget?
0
Hi

Jim 
Global Moderator
 

Re: Ruby Toolbar

Postby CPhillips » Mon Nov 19, 2007 6:18 am

Ah, much better. Yeah I was still using the old one.

I didn't even know this subsection of the forums was here until yesterday.

As far as detecting the window close message. It wouldn't be easy. One thing you could do is just check the position of the window ever 10 sec or so and see if it has moved/closed.

Regards
Chris
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Ruby Toolbar

Postby pilou » Sat Jul 04, 2009 3:31 pm

Why put the "ruby console" and not the "Web Console" of Jim Foltz?
Seems it is more easy using? :)
(but I am totally new beginner in Ruby script :mrgreen:

PS With the Webconsole seems you can't save (bug ?) :o
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Ruby Toolbar

Postby •BTM » Sat Jul 04, 2009 3:57 pm

Pilou wrote:Why put the "ruby console" and not the "Web Console" of Jim Foltz?
Seems it is more easy using? :)
(but I am totally new beginner in Ruby script :mrgreen:

PS With the Webconsole seems you can't save (bug ?) :o

You can save, it just doesn't say that you have the same file open after that. it's weird.
0

•BTM 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Ruby Toolbar

Postby Jim » Sat Jul 04, 2009 5:37 pm

Maybe I should combine the 2 plugins into 1?
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Ruby Toolbar

Postby tomasz » Sat Jul 04, 2009 7:58 pm

Jim wrote:Maybe I should combine the 2 plugins into 1?

Jim,
I use your plugin always when I deal with SU Ruby. Ability to run snippets would be the good addition.

I have also noticed that your plugin doesn't work in Polish version of SU. In PL the console is called "Konsola Ruby". Is there a way to recognise the language of SU instead of the OS? I have SU6PL installed in Vista EN. :)

Thanks
Tomasz
0

tomasz 
SU2TH & SU2KT Developer
 

Re: [Plugin] Ruby Toolbar

Postby tomasz » Sun Jul 05, 2009 12:15 pm

I have checked and
Code: Select all
Sketchup.get_locale

returns 'pl' string which is correct language for SU Version (SU6 PL).

Tomasz
EDIT
Substituted os_language with get_locale
0

tomasz 
SU2TH & SU2KT Developer
 

Re: [Plugin] Ruby Toolbar

Postby pilou » Sun Jul 05, 2009 1:21 pm

@btm
Thx Indeed that's save and load but not in .rb in the Snippets apparently :)
That was my error :)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Ruby Toolbar

Postby thomthom » Wed Aug 18, 2010 8:26 am

I'm getting this error for the Clear Console button:
Error: #<TypeError: no implicit conversion from nil to integer>
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/rubytoolbar.rb:94:in `call'
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/rubytoolbar.rb:94:in `moveConsole'
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/rubytoolbar.rb:66:in `clearConsole'
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/rubytoolbar.rb:167
C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/rubytoolbar.rb:167:in `call'
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Ruby Toolbar

Postby Jim » Wed Aug 18, 2010 12:46 pm

What is the name of your Ruby Console in the title bar?
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Ruby Toolbar

Postby thomthom » Wed Aug 18, 2010 12:51 pm

"Ruby Console"
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Ruby Toolbar

Postby Jim » Wed Aug 18, 2010 1:13 pm

I don't understand the error, then. Does WIn32API work on 64 bit machines? Can you try this version?
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Ruby Toolbar

Postby thomthom » Wed Aug 18, 2010 1:32 pm

Jim wrote:Does WIn32API work on 64 bit machines?

Yes.
I have a working version of a snippet that clears the console. I can compare it against the one in your plugin.

Jim wrote:Can you try this version?

I'll try.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Ruby Toolbar

Postby everywinter » Wed Aug 18, 2010 4:02 pm

Hi! Im a new user to ruby and i have just downloaded the file from your post but i cant seem to activate anything. I have the 'ruby console' under sketchup 'windows' but nothing's in there... Can you teach me what should i do? How should i start?
0

everywinter 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: or35bo and 4 guests

Visit our sponsors: