Open URL on local disk
-
@tig said:
Try
UI.openURL("C:/Windows/System32/notepad.exe")
UI.openURL("notepad.exe")
or even justUI.openURL("notepad")
will also work. -
@cjthompson said:
even just
UI.openURL("notepad")
will also work.You never know when one little factoid will solve a problem.
I tried
notepad
(it works), thennotepad++
(also works) and then an HTML file. It opened the HTML, but it opened it in Notepad++.Now if only I can figure out how to specify both program and file ...
-
What is your default html opening program ? Notepad++.exe ?
-
@martinrinehart said:
It opened the HTML, but it opened it in Notepad++.
This a problem specific to your machine Martin, because you have overridden the HTML &Open file association to open in Notepad++ instead of leaving it pointing to your default browser (IExpore).
You should have instead had the &Edit association pointing to Notepad++, and left the &Open as it was.
So it is not a problem for your users... it's personal problem.
To 'fix' it, open Windows Explorer, any folder (doesn't matter.)
- On Menu: Tools > Folder Options...* In "Folder Options" dialog, choose "File Types" tab.* [Windows will take a few mins to build the list]* In list, (with 1st item selected,) click the "H" key to scroll down to the H extensions.* scroll a bit more to show HTM and HTML extensions* highlight each in turn, click the "Advanced" button* In "Edit File Type" dialog, highlight "Open"* If it's NOT set to default, the "Set Default" button will be enabled, so click it to restore normal htm/html broswer open.* If it's set to default, the "Set Default" button will be greyed (disabled,) and it's properly set.I'm not sure if you will need to log off, and back on to see changes reflected.
-
@dan rathbun said:
You should have instead had the &Edit association pointing to Notepad++
Folder Options has disabled what I need:
I gave the user admin privileges, but that didn't help. I right-clicked in Explorer, Properties, and was able to change the default Open to a browser, getting
openURL()
working but that doesn't allow setting the Edit default.Can I go back to KDE now?
-
Just to make sure we aren't all going insane: what happens when you double click a .htm file?
-
I've set single click to open. An HTM opens in Chrome.
-
@martinrinehart said:
Folder Options has disabled what I need:
I gave the user admin privileges, but that didn't help.You can try going to Control Panel and right-click "Folder Options" and choose "Run As...", then pick an Administrative account to run this one applet as. (This is called running with "Elevated Privileges" in 'MS MicroSpeak'; and is more secure than having a user account always running with Administrative rights. Those slimeballs who write Trojans love people who always run with Administrative rights, especially when when connected to the Internet.)
Also there is a wizard for controlling browser setings called "Set Program Access and Defaults", if you can find it on the Start Menu, you can also right-click it's icon and "Run As..."
(It's actually a sub-routine of "Add/Remove Programs" and appears as the bottom button in it's left toolcolumn.) The program to run, if you have to actually right-click the file, in order to "Run As...", is:
%SystemRoot%\system32\appwiz.cpl
The shortcut command (in case you can't find it in your menus, and want to make a shourtcut,) is:
%SystemRoot%\system32\control.exe appwiz.cpl,,3 -
@martinrinehart said:
Now if only I can figure out how to specify both program and file ...
Something like this (needs work for Mac, and can be wrapped in a method.)
filename='somefile.html' path='C;/dir/dir' filepath=File.join(path,filename) if RUBY_PLATFORM.include?('mswin') # if Kernel.test(?d,"#{ENV['SystemRoot']}/ie9") browser="#{ENV['SystemRoot']}/ie9/iexplore.exe") elsif Kernel.test(?d,"#{ENV['SystemRoot']}/ie8") browser="#{ENV['SystemRoot']}/ie8/iexplore.exe") elsif Kernel.test(?d,"#{ENV['SystemRoot']}/ie7") browser="#{ENV['SystemRoot']}/ie7/iexplore.exe") elsif Kernel.test(?d,"#{ENV['SystemRoot']}/ie6") browser="#{ENV['SystemRoot']}/ie6/iexplore.exe") elsif Kernel.test(?d,"#{ENV['SystemRoot']}/ie5") browser="#{ENV['SystemRoot']}/ie5/iexplore.exe") else raise(Errno;;ENOENT,filepath) end # else # Mac # browser = ??? end # open specific file in broswer f = IO.popen("#{browser} #{filepath}")
EDIT: It looks like the PC browser location (for all versions) can be simplified to:
browser = "#{ENV['ProgramFiles']}"<<'/Internet Explorer/iexplore.exe'
It may be that the hidden system folder "Windows/ieX" is a install folder. -
@martinrinehart said:
I've set single click to open. An HTM opens in Chrome.
Hey Martin, what's the fullpath to the Chrome executable on your PC ??
Advertisement