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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Get the Click-Style via the Ruby API?

    Scheduled Pinned Locked Moved Developers' Forum
    15 Posts 5 Posters 747 Views 5 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      Seems like it should be stored in the registry for Win and the equivalent for the "other" OS.

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

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

        Oh no - not another inaccessible property... 😞

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

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

          Have a look through the various options collections via the options manager. I don't really know, but it could be there.

          It has Units options, and 3 others I can't recall.

          Hi

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

            I did not find it - probably because they are model settings and this appear to be application setting.

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

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

              @thomthom said:

              Get the Click-Style via the Ruby API? How?

              Registry

              key: HKCU\Software\Google\Sketchup7\Preferences

              Preferences dialog > Drawing tab (page)

              att: ClickStyle

              • Click-drag-release = 0* Auto Detect = 2* Click-move-click = 1
                att: ContinueLineMode

              • (boolean) 0 | 1
                att: DisplayCrosshairs

              • (boolean) 0 | 1

              @thomthom said:

              Oh no - not another inaccessible property...

              Sorry.. yes they are all DWORD values.
              As you know by now... read_default and write_default cannot read**|**write DWORD values.

              p Sketchup.read_default('Preferences','ClickStyle','Read Error!')
              >> "Read Error!"
              

              The only GOOD thing is the values appear to be dynamic (ie, they are updated in the registry when the dialog is closed and NOT when Sketchup shuts down. However.. changing pages in the Preferences dialog does not update the registry value, only when the whole dialog is closed.)

              I'm not here much anymore.

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

                Best I can do then is just mimic the default setting "Auto-Detect". sigh Another item for the wish-list.

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

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

                  @thomthom said:

                  Best I can do then is just mimic the default setting "Auto-Detect".

                  Does the above code snippet work on the Mac ??

                  If YES, then for Windows you have 3 options:

                  1. A shell command (or IO.popen,) calling reg.exe, with the key/attribute as args1. use the standard Ruby library Registry1. use a Win32 System call via Win32API.so

                  I'm not here much anymore.

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

                    @dan rathbun said:

                    Does the above code snippet work on the Mac ??

                    hm.. dunno. will have to test.

                    @dan rathbun said:

                    A shell command (or IO.popen,) calling reg.exe, with the key/attribute as args

                    This can be done via the SketchUp Ruby? I don't want to bundle another library just to read this setting.

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

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

                      @thomthom said:

                      @dan rathbun said:

                      A shell command (or IO.popen,) calling reg.exe, with the key/attribute as args

                      This can be done via the SketchUp Ruby?

                      
                      unless defined? Platform require 'Platform' # Platform.rb
                      if Platform.is_win?
                        clickstylecmd ='REG QUERY HKCU\Software\Google\Sketchup7\Preferences /v ClickStyle'
                        num=nil
                        IO.popen(clickstylecmd) { |f| num=("%x" % f.readlines[4].split(' ').last).to_i }
                      elsif Platform.is_mac?
                        num = Sketchup.read_default('Preferences','ClickStyle','Read Error!')
                      else
                        # error unsupported platform
                      end
                      # detect ClickStyle setting
                      unless num=='Read Error!'
                        if num==0
                          # Click-drag-release
                        elsif num==1
                          # Click-move-click 
                        elsif num==2
                          # Auto Detect 
                        else
                          # error
                        end
                      else
                        # raise an exception
                      end
                      #
                      
                      

                      There is an annoyance.. a cmd window flashes on the screen but disappears.

                      I'm not here much anymore.

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

                        @dan rathbun said:

                        There is an annoyance.. a cmd window flashes on the screen but disappears.

                        Ah - and that can not be suppressed?

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

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

                          @thomthom said:

                          @dan rathbun said:

                          There is an annoyance.. a cmd window flashes on the screen but disappears.

                          Ah - and that can not be suppressed?

                          I haven't yet found a way.
                          maybe with a PIF file we can make it run minimized ?

                          I'm not here much anymore.

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

                            And BTW shell commands are done with Kernel.` (backquote character)
                            see http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel._bq

                            I'm not here much anymore.

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

                              @dan rathbun said:

                              And BTW shell commands are done with Kernel.` (backquote character)
                              see http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel._bq

                              More Info: The shell execution also sets the $? variable with the command's exit status.

                              I'm not here much anymore.

                              1 Reply Last reply Reply Quote 0
                              • L Offline
                                lionk
                                last edited by

                                @dan rathbun said:

                                And BTW shell commands are done with Kernel.` (backquote character)
                                see http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel._bq

                                still a cmd window...
                                ex:ipconfig /all

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

                                Advertisement