Clear the ruby window
-
Anyone know how to clear the text? I just hit enter a bunch of times but then those enters are put into my typing history that I have to skip over to get back to previous things I typed. Just want CLS or something like that.
-
You can't do it from SketchUp/Ruby. You can do it on Windows using Win32API.so, let me recover cls.rb I have here...
-
-
Thanks! Works pretty well. Leaves a "1" in the corner but I can live with that. Appreciate it.
-
Uh, looks a little strange for me what you've done there, Jim.
If I don't ask to much, would you explain in detail, for dummies like myself ? -
Win32API allows you to call Windows API functions. I can't explain the syntax of the calls because I ripped them from SketchyPhysics. I think the "N" and "P" are defining the type (Integer, Pointer, etc) of argument the API function uses.
Microsoft provides documentation for FindWindow and the the rest.
-
@jim said:
Win32API allows you to call Windows API functions.
Win API functions are some of the fundemental behind the scenes functions used by Windows itself to manage the Windows GUI.
MS doesn't advertise them because many can be used to affect other peoples compiled programs. (In this case they are being used to manipulate the Ruby console.
They can be difficult to learn to use properly as how they interact with each other is not published in depth. One fairly good source is:
http://allapi.mentalis.org/apilist/f.shtml (Note the alphabetical list at the top of the web page.)FindWindow is used to locate a top level window by ClassName and WindowTitle. It returns a pointer to the found window.
Windows pointers are created and destroyed constantly so you cannot save and reuse the value once you glom onto it.
FindWindowEx is used to find Child or Sibling Window handles.
Just about every Graphical object in Windows is a window. Textboxes, Listboxes Etc...SendMessage is an all purpose tool used to manipulate a Window.
The kind of manipulation is defined by a list of MessageCode Constants.
0x000C is the SET TEXT message. There are many more.The Win32API module that you are referencing in Ruby must remap some of the parameters as there appear to more than the functions normally take.
In this case I believe that 'N' stands for number which would be the window pointers and P stands for a String Pointer. (Course that is just a guess.) -
Gruf, I hope you stay around here for a long time....
Chris
-
This looks like a great group to hang around with. Looking forward to spending some time here.
RE: the Ruby console
I cannot believe that the good folks at Sketchup didn't provide a CLS command. Seems like a no brainer to me.
WinAPI's can get flakey.
-
@gruff said:
This looks like a great group to hang around with. Looking forward to spending some time here.
RE: the Ruby console
I cannot believe that the good folks at Sketchup didn't provide a CLS command. Seems like a no brainer to me.
WinAPI's can get flakey.
Gruff,
If you are on Windows, why don't you install Jim's magnificent plugin Ruby Toolbar(obviously the plugin that I have been using the most, thanks Jim). It includes a Clear (on top of load, reload scripts).
Fredo
-
Anyone want to configure Jim's plugin for 64bit?
Chris
Advertisement