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

    [REQ] Plugin "open file"

    Scheduled Pinned Locked Moved Plugins
    23 Posts 8 Posters 1.9k Views 8 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.
    • fredo6F Offline
      fredo6
      last edited by

      Bep,

      Actually, the main difficulty is to decide on the icons displayed in the toolbar.

      It could be just:

      • colors
      • Letters, like A, B, C, .... or numbers
      • thumbnail of files (more difficult, and not differentiating since rather based on file type)
      • a set of predefined icons

      In any case, someone has to design these icons.

      Fredo

      1 Reply Last reply Reply Quote 0
      • BepB Offline
        Bep
        last edited by

        @fredo6 said:

        Bep,

        Actually, the main difficulty is to decide on the icons displayed in the toolbar.

        It could be just:

        • colors
        • Letters, like A, B, C, .... or numbers
        • thumbnail of files (more difficult, and not differentiating since rather based on file type)
        • a set of predefined icons

        In any case, someone has to design these icons.

        Fredo

        Fredo, i understand and foresaw the difficulty about the icons your explaining.
        That is why i asked for a not to fancy script in the first place.
        Sam's script almost worked for me, if only it was not limited to Sketchup files.
        "I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
        If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
        I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.

        Bep

        "History is written by the winners"

        1 Reply Last reply Reply Quote 0
        • G Offline
          glro
          last edited by

          @bep said:

          @fredo6 said:

          Bep,

          Actually, the main difficulty is to decide on the icons displayed in the toolbar.

          It could be just:

          • colors
          • Letters, like A, B, C, .... or numbers
          • thumbnail of files (more difficult, and not differentiating since rather based on file type)
          • a set of predefined icons

          In any case, someone has to design these icons.

          Fredo

          Fredo, i understand and foresaw the difficulty about the icons your explaining.
          That is why i asked for a not to fancy script in the first place.
          Sam's script almost worked for me, if only it was not limited to Sketchup files.
          "I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
          If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
          I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.

          Bep

          UI.openURL ("") is the code to open any file

          this is an example that shows an image on my screen at ""C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\logo.jpg""

          just change to the file you need to open

          the icon file is in the plugins folder; in that case MCT_LRO.jpg
          you can change that too

          tb = UI::Toolbar.new("Toolbar Name")
          cmd = UI::Command.new("Plugin Name") { Sketchup.open_file UI.openURL("C:\\Users\\glro\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Plugins\\MTX\\logo.jpg") }
          cmd.tooltip = "Plugin Name"
          cmd.status_bar_text = "Plugin Name"
          cmd.large_icon = File.join(File.dirname(__FILE__), "MCT_LRO.png")
          

          cmd.small_icon = File.join(File.dirname(FILE), "MCT_LRO.png")

          tb.add_item(cmd)
          tb.show unless tb.get_last_state == 0
          
          1 Reply Last reply Reply Quote 0
          • G Offline
            glro
            last edited by

            this is a better version, based on TIG's code in the plugin MIRROR to add a button:

            replace

            C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\notice_metrix_2016_bd.pdf

            by the path to your file

            replace the name of module and definition also, and the name of the png file

            ` require "sketchup"

            module MTX
            def MTX.notice
            UI.openURL("C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\notice_metrix_2016_bd.pdf")
            end
            end

            unless file_loaded?(File.basename(FILE))###
            UI.menu("Plugins").add_item("MTX_Notice Metrix"){MTX.notice}

            Context menu

            #=begin
            UI.add_context_menu_handler do |menu|### v3.5 TIG

            if Sketchup.active_model.selection[0]

                #menu.add_separator
                menu.add_item("Notice Metrix"){Sketchup.active_model.select_tool(MTX.notice)}
            

            end#if

            end#do menu###
            #=end

            Toolbar - only adds the toolbar IF there's an icon png with it ###v3.2

            png=File.join(File.dirname(FILE),"MTX_notice_Metrix.png")
            if FileTest.exist?(png)
            tb=UI::Toolbar.new("Notice Metrix")
            cmd=UI::Command.new("MI"){Sketchup.active_model.select_tool(MTX.notice)}
            cmd.large_icon=png
            cmd.small_icon=png
            cmd.tooltip="Notice Metrix"
            cmd.status_bar_text="Notice Metrix: afficher..."
            tb.add_item(cmd)
            if tb.get_last_state==TB_NEVER_SHOWN
            tb.show
            elsif tb.get_last_state==TB_VISIBLE
            tb.restore
            end#if state
            end#if toolbar

            end#if loaded
            file_loaded(File.basename(FILE))`

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

              Rather bizarre request..
              Why one won't just put any desired desktop shortcut instead?

              1 Reply Last reply Reply Quote 0
              • G Offline
                glro
                last edited by

                @rv1974 said:

                Rather bizarre request..
                Why one won't just put any desired desktop shortcut instead?

                maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut

                if the shortcup is inside the sketchup window, you can access it directly

                each clic matters...

                1 Reply Last reply Reply Quote 0
                • BepB Offline
                  Bep
                  last edited by

                  @glro said:

                  @bep said:

                  @fredo6 said:

                  Bep,

                  Actually, the main difficulty is to decide on the icons displayed in the toolbar.

                  It could be just:

                  • colors
                  • Letters, like A, B, C, .... or numbers
                  • thumbnail of files (more difficult, and not differentiating since rather based on file type)
                  • a set of predefined icons

                  In any case, someone has to design these icons.

                  Fredo

                  Fredo, i understand and foresaw the difficulty about the icons your explaining.
                  That is why i asked for a not to fancy script in the first place.
                  Sam's script almost worked for me, if only it was not limited to Sketchup files.
                  "I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
                  If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
                  I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.

                  Bep

                  UI.openURL ("") is the code to open any file

                  this is an example that shows an image on my screen at ""C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\logo.jpg""

                  just change to the file you need to open

                  the icon file is in the plugins folder; in that case MCT_LRO.jpg
                  you can change that too

                  tb = UI::Toolbar.new("Toolbar Name")
                  cmd = UI::Command.new("Plugin Name") { Sketchup.open_file UI.openURL("C:\\Users\\glro\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Plugins\\MTX\\logo.jpg") }
                  cmd.tooltip = "Plugin Name"
                  cmd.status_bar_text = "Plugin Name"
                  cmd.large_icon = File.join(File.dirname(__FILE__), "MCT_LRO.png")
                  

                  cmd.small_icon = File.join(File.dirname(FILE), "MCT_LRO.png")

                  tb.add_item(cmd)
                  tb.show unless tb.get_last_state == 0
                  

                  Thank you very much Glro,

                  I got the script opening a file just as i requested.

                  However the file will pup up in front of the Sketchup-window, and than in a split second hides behind it.
                  I have to click the file icon on the taskbar or reach for the file-window behind the Sketchup-window, to click it, and to get it in front of the Sketchup-window again.

                  I hope i can figure out how the fix this last bit.

                  Bep

                  "History is written by the winners"

                  1 Reply Last reply Reply Quote 0
                  • BepB Offline
                    Bep
                    last edited by

                    @rv1974 said:

                    Rather bizarre request..
                    Why one won't just put any desired desktop shortcut instead?

                    Hello rv1974,
                    do not judge too quickly.
                    In my case its not that bizarre.
                    The tool-button will be part of a toolbar that is used in a repetitive process.
                    One part of the process is opening office file's to copy and paste from and to.
                    All parts of the process are in one toolbar, in the correct sequence from left to right.
                    Setting up these machines with all the right files and ruby's in one .rbz is the goal for meantime.
                    The ultimate goal however is to try to automate the whole process.(taking small steps)

                    Bep

                    "History is written by the winners"

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

                      Some years ago I modified a little script file so it would open the calculator program in windows. It could be modified to open any program I expect. And looking at the thread, I suppose you could add a toolbar although I would prefer a keyboard shortcut.

                      Etaoin Shrdlu

                      %

                      (THERE'S NO PLACE LIKE)

                      G28 X0.0 Y0.0 Z0.0

                      M30

                      %

                      1 Reply Last reply Reply Quote 0
                      • BepB Offline
                        Bep
                        last edited by

                        @dave r said:

                        Some years ago I modified a little script file so it would open the calculator program in windows. It could be modified to open any program I expect. And looking at the thread, I suppose you could add a toolbar although I would prefer a keyboard shortcut.

                        Dave, i remember your calc.rb
                        imho keyboard shortcuts would be less efficient, be course i would have to install them on every machine next to Sketchup and all the necessary ruby's.
                        Than i would have put sticky notes on every PC-machine with the keybord -shortcuts and instruct all persons working with these machine's.
                        The way i see it, Sketchup with this toolbar could work as a sort off switchboard to all the necessary files and programs.
                        Bep

                        "History is written by the winners"

                        1 Reply Last reply Reply Quote 0
                        • Rich O BrienR Offline
                          Rich O Brien Moderator
                          last edited by

                          Didn't Sahi have a plugin to open a folder/file location?

                          Download the free D'oh Book for SketchUp 📖

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            glro
                            last edited by

                            @bep said:

                            ...
                            I got the script opening a file just as i requested.

                            However the file will pup up in front of the Sketchup-window, and than in a split second hides behind it.
                            I have to click the file icon on the taskbar or reach for the file-window behind the Sketchup-window, to click it, and to get it in front of the Sketchup-window again.

                            I hope i can figure out how the fix this last bit.

                            Bep

                            on my computer, the opened file stays on top on the sketchup window

                            1 Reply Last reply Reply Quote 0
                            • G Offline
                              glro
                              last edited by

                              @rv1974 said:

                              @glro said:

                              @rv1974 said:

                              Rather bizarre request..
                              Why one won't just put any desired desktop shortcut instead?

                              maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut

                              if the shortcup is inside the sketchup window, you can access it directly

                              each clic matters...

                              Just ONE Win+D (Alt+Tab if it's open) hit! And thisrequires a dedicated plugin??
                              And to pin a File or Folder to the Windows 7 Taskbar won't ease solve your problem either?
                              😲

                              the "dedicated plugin" is such an easy one..no big deal
                              and from what i understand, it is the beginning of something else

                              i just tried to help

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

                                @glro said:

                                @rv1974 said:

                                Rather bizarre request..
                                Why one won't just put any desired desktop shortcut instead?

                                maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut

                                if the shortcup is inside the sketchup window, you can access it directly

                                each clic matters...

                                Just ONE Win+D (Alt+Tab if it's open) hit! And thisrequires a dedicated plugin??
                                And to pin a File or Folder to the Windows 7 Taskbar won't solve your problem either?
                                😲

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

                                Advertisement