Get the Click-Style via the Ruby API?
-
How?
-
Seems like it should be stored in the registry for Win and the equivalent for the "other" OS.
-
Oh no - not another inaccessible property...
-
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.
-
I did not find it - probably because they are model settings and this appear to be application setting.
-
@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.)
-
-
Best I can do then is just mimic the default setting "Auto-Detect". sigh Another item for the wish-list.
-
@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:
- 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
-
@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.
-
@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.
-
@dan rathbun said:
There is an annoyance.. a cmd window flashes on the screen but disappears.
Ah - and that can not be suppressed?
-
-
And BTW shell commands are done with Kernel.` (backquote character)
see http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel._bq -
@dan rathbun said:
And BTW shell commands are done with Kernel.` (backquote character)
see http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel._bqMore Info: The shell execution also sets the $? variable with the command's exit status.
-
@dan rathbun said:
And BTW shell commands are done with Kernel.` (backquote character)
see http://phrogz.net/ProgrammingRuby/ref_m_kernel.html#Kernel._bqstill a cmd window...
ex:ipconfig /all
Advertisement