Launch an Application in RUBY
-
Can you clarify ?
If you know where this file is can't you use the full path ?
mdir=File.dirname(model.path)
gives you a folder thenFile.join(mdir, myfilename)
gives the file's path ??
If it's not the model's folder you are referring to then you might have it coded somewhere so you can use that ? -
@simonstaton said:
Tig I tryed your way however the location of the file needing to be run wont always be in the same place however it will be in the same folder of the program everytime so I cannot use the full path will this still working using "../../program.exe"?
But you should try with the full path to ensure that the method work. Because if it does, then you know it is your relative path is incorrect. It might be that the working directory is not the one you assume it is.
You could try File.expand_path() on your relative path and see what absolute path it translates to.
-
Hi Tig,
sorry im a bit of a newb when it comes to this stuff
I will try and explain from the sketchup folder where you have components etc the file I want to launch is "client/googleearth.exe" however the plugin that is calling it is client "Plugins/Utilities/Toolbar.rb" from the sketchup folder. So what command would I use to call the googleearth.exe from toolbar.rb
-
@thomthom said:
@simonstaton said:
Tig I tryed your way however the location of the file needing to be run wont always be in the same place however it will be in the same folder of the program everytime so I cannot use the full path will this still working using "../../program.exe"?
But you should try with the full path to ensure that the method work. Because if it does, then you know it is your relative path is incorrect. It might be that the working directory is not the one you assume it is.
You could try File.expand_path() on your relative path and see what absolute path it translates to.
ohh I see now ok I will give that a go.
-
ok using the full path didnt work
-
ge=UI.openURL("C:\\Program Files\\Google\\Google Earth\\client\\googleearth.exe")
or
ge=UI.openURL("C:/Program Files/Google/Google Earth/client/googleearth.exe")
works and opens googleearth
ge=UI.openURL('googleearth.exe')
doesn't work as it's not been registered to open without a full path [on PC]
Note how 'ge
' will returntrue
if it succeeds, andfalse
if fails - soif not ge
popup a warning message and then run UI.openpanel() for the user to point your tool to googleearth ? -
ok that works with the full path however, google earth is not installed on the clients machine it will be inside sketchup in a way so when they install sketchup it will be inside the sketchup folder and where the sketchup folder is depends on where they have installed it on there machine. our clients are not pc friendly at all so keeping it to the basics is probably best
-
@simonstaton said:
ok that works with the full path however, google earth is not installed on the clients machine it will be inside sketchup in a way so when they install sketchup it will be inside the sketchup folder and where the sketchup folder is depends on where they have installed it on there machine. our clients are not pc friendly at all so keeping it to the basics is probably best
You can find where Sketchup is installed using
Sketchup.find_support_file('')
which returns something like
C:/Program Files/Google/Google SketchUp 7
-
ah there we go solved, now how would I merge the two? this dosnt seem to be working:
ge=UI.openURL(Sketchup.find_support_file('')"/client/googleearth.exe")
-
dont worry i needed to put a "+" between to two solved! thanks tig
Advertisement