Cannot launch SU from hta [Now can]
-
I don't know about version 5 or earlier.
Version 6 InstallLocation:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{98736A65-3C79-49EC-B7E9-A3C77774B0E6}\InstallLocation
Version 7+ (so far)
HKLM\SOFTWARE\Google\Google SketchUp [7|8]\InstallLocation
And the license file for 6 is stored in the
/SketchUp/Support
folder, where version 7+ is in/All Users/Application Data\Google\SketchUp [version]\
-
-
This doesn't include version 6 (or prior,) but it should find the installation location for versions 7 and later.
<span class="syntaxdefault">version </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">'8'</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">var loc</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">try </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> loc </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> shell</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">RegRead</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'HKLM\\Software\\Google\\Google SketchUp '</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">version</span><span class="syntaxkeyword">+</span><span class="syntaxstring">'\\InstallLocation\\'</span><span class="syntaxkeyword">);<br />}</span><span class="syntaxdefault"> catch</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">err</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">//alert(err.message);<br /></span><span class="syntaxkeyword">}<br /></span><span class="syntaxcomment">// loc will be the location as a String, or undefined.<br />// need to quote the path because it contains spaces.<br /></span><span class="syntaxdefault">var cmd </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">'"'</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> loc </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxstring">'\\sketchup.exe'</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxstring">'"'</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">try </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> shell</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">run</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">cmd</span><span class="syntaxkeyword">);</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}</span><span class="syntaxdefault"> catch</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> alert</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">message</span><span class="syntaxkeyword">);</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> </span>
Can we get a full-width
code
style, please? -
@jim said:
Hello Chris,
You need to use the full path - the HTA knows not where to find "sketchup.exe"
You need to read the registry to get the actual path. I have a partially finished sketchup launcher I need to add this too also, so I will look at that today.
But it knows where to find iexplore, firefox and notepad.
Anyway I tried that but still no joy with or without double slashes. Also tried (blindly) adding %20 for the gaps. Can I have a copy of your launcher when finished - presumably it can launch anything and open files?
About full width code boxes, it seems to me, with all the code, images etc it would be better for the default to be full width with an option to "blockquote" text.
-
I just found out that this works:
shell = new ActiveXObject("WScript.shell"); shell.run("file;///C;/Program%20Files/Google/Google%20SketchUp%207/SketchUp.exe");
but this doesn't:
shell = new ActiveXObject("WScript.shell"); shell.run("C;/Program%20Files/Google/Google%20SketchUp%207/SketchUp.exe");
I suppose it is because the hta is a kind of browser but that doesn't explain why winzip.exe and the others work ... or does it?
Thanks Jim for the copy of the launcher. I understand it better now. Is it possible to get the file name by browsing. (I can't remember how).
Also - a follow up question - is it possible to open a webdialog on loading SU and position off screen?
Thanks
-
@chrisglasier said:
But it knows where to find iexplore, firefox and notepad.
@thomthom said:
I'm guessing WinZip has added it's path to the environment variables...
-
@chrisglasier said:
Also - a follow up question - is it possible to open a webdialog on loading SU and position off screen?
YES .. I've done it (in an unreleased utility.) Works great.
-
@chrisglasier said:
Does anyone know why and more importantly how to fix it.
You could set an environment var "SUpath" to the install location and try using that in the path.
Ruby:
f = File.new('C:\setSUpath.cmd') f.print "SET SUpath="+Sketchup.find_support_file("") f.close
in your Js it'd be:
%(#8000BF)[shell.Exec("C:\setSUpath.cmd") shell.run( shell.ExpandEnvironmentStrings("%SUpath%")+"\sketchup.exe");]
See: [Methods (Windows Script Host)](http://msdn.microsoft.com/en-us/library/2x3w20xf(v) -
Thanks for both your notes Dan.
Would you tell me how to automatically open a webdialog on launching SU?
I should explain that I am trying to facilitate opening things from a single hta (as a prototype) with the minimum of clicks ... it could be an application, a web page, an html widget and so on. The choice would be up to the owner to set up.
So in terms of applications I'm thinking s/he would need to select the exe file in its directory in order to store the filename and path. I am looking at this example but are having some difficulty implementing it. If you or anyone else knows of a better way, preferably in js, please let me know.
Thanks again
-
@chrisglasier said:
Would you tell me how to automatically open a webdialog on launching SU?
Write the method as you would normally using module as namespace.
Then at the end of the file, instead of creating a menu for the method, just call the method.
module CG def self.my_web_dialog # create and show the dialog end end CG.my_web_dialog
-
@chrisglasier said:
I am looking at this example but are having some difficulty implementing it. If you or anyone else knows of a better way, preferably in js, please let me know.
That example is in VBS. You can use it "as is" by wrapping it within an html <SCRIPT> tag but specifying the language attribute as either "vbs" or "vbscript" See [MSDN](http://msdn.microsoft.com/en-us/library/ms533940(v).
Or you can translate it into JS.
- change DIM to VAR
- change all blocks to { }, ie, replace End If, End Loop etc with a } and insert a { at the begining of the block.
This includes wrapping all function blocks, and replace the function's END with }. - put ; (a semi-colon) at end of all statements.
- There may be some other quirky things that may need to change slightly.
-
Thanks J + D. Very helpful as usual.
-
Also found this written by the same guy specifically for hta's. I just wrote the input into my code so there is no need for any pop up window. Maybe useful for others ...
Advertisement