Use Ruby to make a temporary file called say
C:\Temp\taskkillSUP.bat
Use puts to add a string into it
taskkill /fi "Windowtitle eq ModelNsme - SketchUp*"
Then run it using
UI.openURL("C:\Temp\taskkillSUP.bat")
The current SketchUp window with that title will be closed without
saving
- although of course you could have checked if the model has been
saved and if not save it before doing this ?
You need to assemble the string thus
"taskkill /fi \"Windowtitle eq " + Sketchup.active_model.title + " -
SketchUp*\"\n"
The wildcard * is to cover free and pro window-title differences ?
The 2 escaped " [\"] are needed too...
You can also delete the temp bat file to tidy up by adding a second
line to itself to self-delete...
del "C:\Temp\taskkillSUP.bat"
The puts string is formed thus
"del \"C:\Temp\taskkillSUP.bat\"\n"
Hope this helps ???
Can anyone suggest a way to close SketchUp from Ruby on Windows OS?
--
You received this message because you are subscribed to the Google Groups "SketchUp Ruby API" group.
To post to this group, send email to sketch...@googlegroups.com.
To unsubscribe from this group, send email to sketchupruby...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sketchupruby?hl=en.
- Invoking active_model.save writes the .skp file but doen't set
active_model.title.
- Save file by manulaly using the SU menu bar works in a way; It sets
the active_model.tittle and writes the .skp file, BUT when retrieved,
active_model.title does not contain the file extension.
Thanks - May fortune find you healthy - JJ
> > sketchupruby...@googlegroups.com<sketchupruby%2Bunsu...@googlegroups.com>
It's not supposed to. It's a Title not a filename.
The API says, "The title method retrieves the name of the model. If
the model is saved on disk, returns the file name **without
extension.** Otherwise returns an empty string."
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#title
Thw safest way would be to make a system call, and send the SU window
a WM_CLOSE message (basically simulating a ALT+F4 keystroke.)
Hafta look into that. (User would need Win32API.so in the search
paths.)
--
You received this message because you are subscribed to the Google Groups "SketchUp Ruby API" group.
To post to this group, send email to sketch...@googlegroups.com.
To unsubscribe from this group, send email to sketchupruby...@googlegroups.com.
> On Wed, Feb 3, 2010 at 8:42 AM, ChrisJT <cjthomp...@aagard.com> wrote:
> > I don't know if this is what you are talking about, but you can use:
> > Process.kill("KILL",Process.pid) to kill Sketchup.
That's not all that safe... no chance to save work, etc.
But for an emergency... sure.