sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Exit/Shutdown SU 7 ??

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 7 Posters 3.7k Views 7 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      HPW
      last edited by

      I tried the API-call from that link.
      But unfourtunatly it does not work from a ruby loaded on startup.
      When I type it from the Console after startup it closes SU.

      1 Reply Last reply
      Reply Quote 0
      • H
        HPW
        last edited by

        After the problem with the Win32Api-code I searched further and found:

        Error 404 (Not Found)!!1

        favicon

        (rubyonwindows.blogspot.com)

        
        require 'win32ole'
        wsh = WIN32OLE.new('Wscript.Shell')
        if wsh.AppActivate(skpbasename+".skp - SketchUp")
          wsh.SendKeys('%{F4}')
        end
        
        

        This works for me now.

        1 Reply Last reply
        Reply Quote 0
        • BurkhardB
          Burkhard
          last edited by

          We have a lot of Bugsplat possiblities to close SU7. ie. it could be easier to create a ruby which select all same materials, set Podium reflection at once. Sketchup closes immediately. πŸ˜‰

          http://www.ia-plus.de

          1 Reply Last reply
          Reply Quote 0
          • A
            AlexMozg
            last edited by

            @hpw said:

            Can I shutdown/exit SU 7 with ruby?
            How?

            
            def Sketchup;;exit
                model = Sketchup.active_model
                model.save "temp_model.tmp" if model.modified?
                Sketchup.send_action 57602
            end#def
            
            

            Model doezn't realy save.
            πŸ˜„

            1 Reply Last reply
            Reply Quote 0
            • W
              wikii
              last edited by

              Following ruby code works PC.

              
              system("taskkill /im sketchup.exe /f")
              
              
              1 Reply Last reply
              Reply Quote 0
              • H
                HPW
                last edited by

                @unknownuser said:

                Sketchup.send_action 57602

                Undocumented feature but it works.

                The doc shows:
                21560 and up: causes a runtime Error

                So is it official and where do you find such things?

                @unknownuser said:

                system("taskkill /im sketchup.exe /f")

                Works but shows a cmd-window and is slower.

                1 Reply Last reply
                Reply Quote 0
                • thomthomT
                  thomthom
                  last edited by

                  @hpw said:

                  @unknownuser said:

                  system("taskkill /im sketchup.exe /f")

                  Works but shows a cmd-window and is slower.

                  hmm.... what if you have other SU windows open at that time.. kills them too?

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply
                  Reply Quote 0
                  • H
                    HPW
                    last edited by

                    Another point to use one of the other methods.
                    For now I will go for the Sketchup.send_action which seems to be the best/smallest option.

                    1 Reply Last reply
                    Reply Quote 0
                    • H
                      HPW
                      last edited by

                      I revert back to the:

                      wsh.SendKeys('%{F4}')

                      because:

                      Sketchup.send_action 57602

                      immidiatly shut down SU even when the save-process is not finished.
                      So its get not saved.

                      1 Reply Last reply
                      Reply Quote 0
                      • Dan RathbunD
                        Dan Rathbun
                        last edited by

                        [code] Sketchup Safe Shutdown method
                        http://forums.sketchucation.com/viewtopic.php?f=180&t=29162&p=254022#p254022

                        cross-platform and safe.

                        I'm not here much anymore.

                        1 Reply Last reply
                        Reply Quote 0
                        • Dan RathbunD
                          Dan Rathbun
                          last edited by

                          @alexmozg said:

                          
                          > def Sketchup;;exit
                          >     model = Sketchup.active_model
                          >     model.save "temp_model.tmp" if model.modified?
                          >     Sketchup.send_action 57602
                          > end#def
                          > 
                          

                          Model doezn't realy save.

                          Do NOT use exit as a method name !!!

                          It is already defined as a global method by the Kernel module (and so is inherited by ALL classes and modules.)

                          exit() Initiates the termination of the Ruby script by raising the SystemExit exception. Also runs any at_exit block methods before termination.

                          I'm not here much anymore.

                          1 Reply Last reply
                          Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better πŸ’—

                          Register Login
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement