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

    If Toolbar is true make it false

    Scheduled Pinned Locked Moved Developers' Forum
    54 Posts 4 Posters 2.6k Views 4 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.
    • S Offline
      simonstaton
      last edited by

      some of the features I am using on my toolbar dont want to work in sketchup 7 😠 such as my checkout system,

      is it ok if I try detecting the toolbar being open? any chance you know any code that I could use to see if it is visible then using an if statement have it send the action.

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

        @simonstaton said:

        some of the features I am using on my toolbar dont want to work in sketchup 7 😠 such as my checkout system,

        What doesn't work and why?

        @simonstaton said:

        is it ok if I try detecting the toolbar being open? any chance you know any code that I could use to see if it is visible then using an if statement have it send the action.

        I mentioned that here: http://forums.sketchucation.com/viewtopic.php?f=180&t=29216&start=0#p254562
        UI.toolbar_visible?('GettingStarted')

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

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

          hmm that method didnt work either it must be somthing to do with my .rb code. any chance either of you could quick put the following in a .rb file in your plugins and see if closes the toolbar when sketchup loads:

          status = if UI.toolbar_visible?('GettingStarted')
          Sketchup.send_action(21992)
          end

          if it does then it must be somthing to do with my sketchup

          Thanks,
          Simon

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

            ok through the ruby code I recieve the following method after ive just installed sketchup 7 and tryed it in there:

            (eval):894: syntax error
            status = if UI.toolbar_visible?('GettingStarted') Sketchup.send_action(21992) end
            ^>
            (eval):894
            status = if UI.toolbar_visible?('GettingStarted') Sketchup.send_action(21992) end
            Error: #<SyntaxError: (eval):894: compile error
            (eval):894: syntax error
            status = if UI.toolbar_visible?('GettingStarted') Sketchup.send_action(21992) end
            ^
            (eval):894: syntax error
            status = if UI.toolbar_visible?('GettingStarted') Sketchup.send_action(21992) end
            ^>
            (eval):894

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

              Simon use the code ... /code blocks, so it looks like this:

              
              status = if UI.toolbar_visible?('GettingStarted')
                Sketchup.send_action(21992)
              end
              
              

              The Code button on the post edit toolbar will insert them for you.

              I'm not here much anymore.

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

                ok will do thanks dan, sorry just new to forums, well not new joined 2 years ago but not used to it.

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

                  need to be 3 lines, not all on 1 line, or else you must finish statements with a semi-colon ( ; ).

                  I'm not here much anymore.

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

                    in the console (ver 7 😞
                    if UI.toolbar_visible?('GettingStarted'); Sketchup.send_action(21992); end

                    with the toolbar off, does nothing and returns nil.

                    with the toolbar visible, it hides the toolbar and returns true.

                    I'm not here much anymore.

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

                      great that worked in sketchup 7, however when I put it inside of my .rb file it dosnt work. to test it out could I simply just add a new .rb file inside of the plugins folder and inside there put:

                      status = if UI.toolbar_visible?('GettingStarted')
                      Sketchup.send_action(21992)
                      end
                      
                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        simonstaton
                        last edited by

                        ok I have got:

                        if UI.toolbar_visible?('GettingStarted'); Sketchup.send_action(21992); end
                        

                        working in my v6 through the ruby console however how come when I put it inside of my .rb file it does not work?

                        could there be errors?

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

                          @simonstaton said:

                          to test it out could I simply just add a new .rb file inside of the plugins folder and inside there put:

                          status = if UI.toolbar_visible?('GettingStarted')
                          > Sketchup.send_action(21992)
                          > end
                          

                          Yes I put things like this in a rb called "!Defaults.rb"
                          The exclamation makes it load before alpha characters because of the position of ! in the ASCII set.

                          Also you don't need "status =" if you will not use the status reference.

                          I'm not here much anymore.

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

                            @simonstaton said:

                            could there be errors?

                            🀣
                            of course there could be!
                            πŸ˜†

                            I'm not here much anymore.

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

                              I see so how would I load up a new .rb file to have this in, is it as simple as making a file called hidetool.rb then inside there putting

                              !Defaults.rb
                              if UI.toolbar_visible?('GettingStarted')
                              Sketchup.send_action(21992)
                              end
                              
                              1 Reply Last reply Reply Quote 0
                              • Dan RathbunD Offline
                                Dan Rathbun
                                last edited by

                                @simonstaton said:

                                ..., is it as simple as making a file called hidetool.rb then inside there putting

                                No.. name the FILE --> !Defaults.rb

                                
                                # defaults for Sketchup Startup
                                begin
                                  # hide the GettingStarted toolbar
                                  Sketchup.send_action(21992) if UI.toolbar_visible?('GettingStarted')
                                end
                                

                                P.S. the send action line is all 1 line in the above example.

                                I'm not here much anymore.

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

                                  @dan rathbun said:

                                  @simonstaton said:

                                  ..., is it as simple as making a file called hidetool.rb then inside there putting

                                  No.. name the FILE --> !Defaults.rb

                                  
                                  > # defaults for Sketchup Startup
                                  > begin
                                  >   # hide the GettingStarted toolbar
                                  >   Sketchup.send_action(21992) if UI.toolbar_visible?('GettingStarted')
                                  > end
                                  

                                  P.S. the send action line is all 1 line in the above example.

                                  legend that seems to be working however each time I load sketchup it seems to toggle it on and off, so the first time I load it it turns it off then I close and reopen then its turned on.

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

                                    Close sketchup.
                                    Rename Plugins folder -> xPlugins
                                    make a new Plugins folder
                                    copy the !Defaults.rb file into the new folder
                                    Restart Sketchup

                                    if it works, some other file is causing problems
                                    if it doesn't work, then it's a ver 6 bug

                                    (when done restore your folders to before.)

                                    Your only alternate then would be a Windows System call using Win32API.so
                                    That requires a knowledge of C language and the MS Windows API.

                                    I'm not here much anymore.

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

                                      Ok, neither of the methods worked I also tried it using v7 and its still not working.

                                      it is defiantly doing something as when all the plugins are disabled it will disable the toolbar then on the next reopen the toolbar will open so it just seems to be toggling it :s

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

                                        Why are you trying to turn on/off the user's toolbar in the first place?

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

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

                                          it is so that the user can see only my toolbar which is explained when they download, what is so bloody confusing is that when I put the event:

                                          UI.set_toolbar_visible("GettingStarted", false)
                                          

                                          inside of a toolbars tool event it works fine and hides it however when I put it lose inside the .rb file nothing happens!

                                          this is driving me crazy I might just leave it as they have to click a button on my toolbar to hide it.

                                          Simon

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

                                            Maybe the toolbars aren't accessible when the .rb loads... ?
                                            Timed delay?

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

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

                                            Advertisement