How to check registry for pro version?
-
I think the topic says it all: I need to check in the registry whether the pro or free version is installed. Can anyone help me?
-
The method
Sketchup.is_pro?
tells you if the current version of Sketchup running is Pro.This code tells you which ' Pro' versions are installed [PC only]
def pro_installed?() if [PLATFORM].grep(/mswin/)!=[PLATFORM] UI.beep puts 'Windows method only!' return nil end#if cmd='pro_installed.cmd' txt='pro_installed.txt' file=File.new(cmd,'w') file.puts('reg query "HKCU\Software\Google" | find "SketchUp" | find " Pro" > pro_installed.txt') file.close UI.openURL(cmd) sleep(0.1) result=IO.read(txt) File.delete(cmd) File.delete(txt) return result end
usage: copy+paste all of this code into a file '
pro_installed.rb
' in the Plugins folderand restart, then type:
pro_installed?
or add as a 'method' in other code...
returns:
HKEY_CURRENT_USER\Software\Google\SketchUp7 Pro
HKEY_CURRENT_USER\Software\Google\SketchUp8 Pro
etc
-
TIG, what if the user installed Pro, then let it expire? Does the Pro reg key still exist? I think it might.
-
Yes... it just tells you if 'Pro' has been installed... but the question was, 'Is Pro installed?' and this code might effectively return, 'Yes it is!'... or 'No it's not!'... even if it's now expired!! So the code does 'what it says on the tin', and what was asked for
I can't see how we might tell if the Pro version is 'valid' or 'licensed' ??
So, the
Sketchup.is_pro?
is likely to be the only route, and can only be used when Sketchup is open... -
@tig said:
I can't see how we might tell if the Pro version is 'valid' or 'licensed' ??
The API has a method, but it's defined in the wrong place (which is why you overlook it. I reported this, but basically, Scott said that it was to late to change, or move it, which of course I disagree with. The method might be cloned into the Sketchup module.)
see: Model.get_product_family()
Perhaps something like this may make it easier to use ??
module Sketchup def self.get_product_family() self.active_model.get_product_family() end #def end #module
I seem to recall during beta, that there may be issues with this method.
-
@jim said:
TIG, what if the user installed Pro, then let it expire? Does the Pro reg key still exist? I think it might.
I just tested that. It seems the registry keys get deleted if you uninstall SU Pro. I will use this to check for my program. It's not ideal, since you could probably have a pro version running as a free version, but better than nothing
Thanks!
Advertisement