sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Save Copy As Previous Version

    Scheduled Pinned Locked Moved Plugins
    60 Posts 22 Posters 65.7k Views 22 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.
    • TIGT Online
      TIG Moderator
      last edited by

      Remove the whole block of code starting from [and up to and including the 'end']
      unless File.exists?(script_file) .... end
      Add in these lines instead
      script = "Set WshShell = WScript.CreateObject(\"WScript.Shell\")\n" script += "WshShell.SendKeys(\"+(%s)\")\n" script += "WScript.Sleep(500)\n" script += "WshShell.SendKeys(\"{LEFT}{LEFT}{LEFT}{LEFT}{BACKSPACE}_v8{TAB}{DOWN}{DOWN}{ENTER}{ENTER}y\")\n" script += "WScript.Sleep(1000)\n" script += "WshShell.SendKeys(\" \")\n" script += "Set WshShell = Nothing\n"

      To match the new key-strokes you must add a new shortcut key-combo Shift+Alt+S to activate the File menu's 'Save A Copy As' - so then it then saves a v8 COPY but leaves the original v2018 SKP still open. You can mess around with that combo in the second line, + = Shift, % = Alt and ^ = Ctrl, and 's' = S key, note how the second modifier key must to be with the 'letter' key inside the () e.g. +(%s) ...

      Now the v2013 'Habitat.skp' gets saved as 'Habitat**_v8**.skp' ...
      Change ' _v8' to ' JACK_V8' or whatever you like...
      The BACKSPACE keystroke is there to remove the auto-added '1' on the end of the SKP name when SketchUp makes a Copy name.

      The ' ' space is to invoke the Select tool after the Copy is made, because the 'y' needed to overwrite an existing Copy [if any] could otherwise invoke whatever tool you have set to shortcut Y ?
      The final 'Nothing' part is to ensure that the process stops.

      TIG

      1 Reply Last reply Reply Quote 0
      • kenK Offline
        ken
        last edited by

        TIG

        Thanks you for your help. I can't seem to get it to work. Here is what I copied into the plugin, with one line above and one line below what I copied into the file. Also changed short cut key to shift + alt + S. The save a copy file menu does show up.

        "jf_save_as_prev_version.vbs") # this line above
        script = "Set WshShell = WScript.CreateObject("WScript.Shell")\n"
        script += "WshShell.SendKeys("+(%s)")\n"
        script += "WScript.Sleep(500)\n"
        script += "WshShell.SendKeys("{LEFT}{LEFT}{LEFT}{LEFT}{BACKSPACE}Jack_v8{TAB}{DOWN}{DOWN}{ENTER}{ENTER}y")\n"
        script += "WScript.Sleep(1000)\n"
        script += "WshShell.SendKeys(" ")\n"
        script += "Set WshShell = Nothing\n"
        UI.openURL("file:///"+script_file)
        end # this line below.

        I added "Jack_v8". Right now it saves a copy, one number above the last copy, but does not add the "Jack_v8" or change the version #.

        Again thank you for your help. I know you are busy. So I will just plug along.

        Ken

        Fight like your the third monkey on Noah's Ark gangway.

        1 Reply Last reply Reply Quote 0
        • TIGT Online
          TIG Moderator
          last edited by

          Here's the FULL code - replaces everything below the top # lines

          module JF
            def self.save_as_previous_version()
              title = Sketchup.active_model.title
              if title == ""
                UI.messagebox("Model must be saved before it can be saved as the previous version.", MB_OK, 1)
                return
              end
              Dir.chdir(File.dirname(Sketchup.active_model.path))
              script_file = File.join(ENV["TEMP"], "jf_save_as_prev_version.vbs")
              script  = "Set WshShell = WScript.CreateObject(\"WScript.Shell\")\n"
              script += "WshShell.SendKeys(\"+(%s)\")\n"
              script += "WScript.Sleep(500)\n"
              script += "WshShell.SendKeys(\"{LEFT}{LEFT}{LEFT}{LEFT}{BACKSPACE}_v8{TAB}{DOWN}{DOWN}{ENTER}{ENTER}y\")\n"
              script += "WScript.Sleep(1000)\n"
              script += "WshShell.SendKeys(\" \")\n"
              script += "Set WshShell = Nothing\n"
              begin;File.delete(script_file);rescue;end
              File.open(script_file, "w"){|f| f.puts(script) }
              UI.openURL("file;///"+script_file)
            end
          end
          UI.menu("File").add_item("Save_As Previous Version") { JF.save_as_previous_version() }
          
          

          PC only, and change '_v8' to '_Jack_v8' as desired...

          TIG

          1 Reply Last reply Reply Quote 0
          • kenK Offline
            ken
            last edited by

            TIG

            Works great. This plugin will save my boss from the "white screen of death" he gets when I send the models forgetting to save in V8.

            Thank you for your time and knowledge.

            Ken

            Fight like your the third monkey on Noah's Ark gangway.

            1 Reply Last reply Reply Quote 0
            • M Offline
              mirale999
              last edited by

              Fantastic plugin! Since I begin using the 2013 version, I,m always annoyed with this same thing.
              But I find that if I have mcafee in my system, the .vbs in the TEMP folder will be blocked, is there a safe folder can be used for the vbs, such as the sketchup folder? That will be better~

              paranoia is a higher form of awareness...

              1 Reply Last reply Reply Quote 0
              • TIGT Online
                TIG Moderator
                last edited by

                You'll have limited permissions to any folders within the Programs Files tree too !
                So Macafee blocking is likely there too...
                [ You should have reset the SketchUp Plugins folder to have FULL read/write, BUT even then Macafee might block ! ]
                The user's TEMP folder should have FULL permissions by default.
                If Macafee blocks it, then isn't it easier to teach it to allow it !
                There are several tools doing things like this [like the SketchUcation Archive Installer for ZIP files or when using custom-plugins folders to AutoINstall...] so you'll have continuing problems unless you put your foot down.
                Don't let your virus-app dictate to you - show it who's boss... 😉

                TIG

                1 Reply Last reply Reply Quote 0
                • S Offline
                  sstuchfield
                  last edited by

                  Hi Jim,

                  I can't seem to find a download link to this plugin anywhere... Is it still available?

                  Sandy

                  1 Reply Last reply Reply Quote 0
                  • U Offline
                    unclex
                    last edited by

                    could it always save as one version, such as 13 or 8 @2014?
                    like a switch, could be fixed

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by

                      @sstuchfield said:

                      Hi Jim,

                      I can't seem to find a download link to this plugin anywhere... Is it still available?

                      Sandy

                      I took it down to work on it, but looks like I never got it re-posted.

                      @unclex said:

                      could it always save as one version, such as 13 or 8 @2014?
                      like a switch, could be fixed

                      My current version uses a sub-menu to list all available back versions - so you could set a shortcut key to your preferred version. I may also add an option to set the default version.

                      I will update in the next few days.


                      2014-04-11_023555.png

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • JQLJ Offline
                        JQL
                        last edited by

                        Really useful!

                        www.casca.pt
                        Visit us on facebook!

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          Jim
                          last edited by

                          I think the name "Save As Previous" does not accurately convey my original purpose of this plugin. Rather than "Save", I think "Export As Version" would be more accurate. Exporting implies the desire to keep the original file unchanged while creating a new file at the selected SU version. Perhaps the new file would have a version hint in in the file name.

                          So the workflow is:

                          1. Editing a model named "Jones_Residence" in the most recent version of SketchUp.
                          2. Ready to send changes to person or application that can only use SU version 8 files.
                          3. Activate shortcut to "Export model as Version 8."
                          4. A new model is exported as "Jones_Residence_su8" in the same folder as original. Original model is unmodified both in SketchUp and on disc.
                          5. Send v8 file.
                          6. Repeat.

                          Sound about right?

                          Hi

                          1 Reply Last reply Reply Quote 0
                          • kenK Offline
                            ken
                            last edited by

                            Jim

                            Is there anyway to add the date, or a version #, such as, ??????_SU8_03_12_14 or ??????SU8_V_01?

                            That would prevent writing over the file.

                            Ken

                            Fight like your the third monkey on Noah's Ark gangway.

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              Jim
                              last edited by

                              @unknownuser said:

                              s there anyway to add the date, or a version #,

                              Yes, I will make the format customizable.

                              Hi

                              1 Reply Last reply Reply Quote 0
                              • S Offline
                                sstuchfield
                                last edited by

                                Hi Jim,

                                Do you have an estimate of when you will be able to repost it?

                                Cheers,
                                Sandy

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  Jim
                                  last edited by

                                  Thanks for the reminder. With SU being a hobby for me and not something i do for a living, I tend to spend time on things that interest me at the moment. I will get this plugin updated this weekend.

                                  Hi

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sstuchfield
                                    last edited by

                                    Awesome, Thanks

                                    1 Reply Last reply Reply Quote 0
                                    • J Offline
                                      Jim
                                      last edited by

                                      Updated, see first post.

                                      Hi

                                      1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        stagelight
                                        last edited by

                                        Great plugin !! Thank you.

                                        1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          dirtypr
                                          last edited by

                                          This is wonderful!! thanks!

                                          1 Reply Last reply Reply Quote 0
                                          • R Offline
                                            rv1974
                                            last edited by

                                            Would it be possible to make the 'silent' version of this script:

                                            1. no confirmation windows
                                            2. no additions to the file name
                                            3. background autosave as prev. version
                                              ?
                                              This script would help to solve the problem of crashing windows explorer (v.2015) and open skp files in other applications (Xnview renders skp thumbnails (up to v.2013) and 3ds Max\Lumion open only older skp versions).

                                            Thanks.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement