Trying to Display a Help File (Help.jpg)
-
I have tried this method to display a help file for the user. I get no error message and the screen flashes like something is happening but the picture is not open in the browser as I expected.
Any Suggestions?def dowelHelp self.k2_Tools_help_Path @helpfile = "K2_ToolsDowelHelp.jpg" fullpath = File.join(@base_path,@rel_path,@helpfile) UI.openURL(fullpath) end #def dowelHelpKeith
-
I believe it needs to be a URL to work at all, and on a mac, it also needs to be a .html to open in the browser...
i.e. this opens in 'Preview' not 'Safari' [ mac image viewer ]UI.openURL("file;///Users/johns_iMac/Desktop/400px-Lion_Rampant.png")but this opens in 'Safari'
UI.openURL("file;///Users/johns_iMac/Desktop/!a_test/testhtml.html")'
john -
Assuming the path to the actual file is correctly formed...
TryUI.openURL("file:///#{fullpath}")
which should then open the file in its default application.
An image-file will NOT open in a web-browser unless that web-browser is set as the default application for that image-file type.
Of course you could write a short .html file instead, and then that can simply load the specific image-file, and then the .html file will open in the user's default web-browser...
-
Well I wrote a htlm file and placed it in the same dir as the Dowel help file and when I click on the htlm file the Help picture opens. However I have not yet accomplished this from inside my ruby script.
def dowelHelp UI.openURL("file;///K2WS_Tools/k2ws_DowelHelp.html") UI.messagebox("Dowel Help Complete") end #def dowelHelpThis does not produce an error message and the UI.messagebox following the open file displays so the code completes running but no help file picture.
Suggestions
Thanks
Keith -
B_U_T...
That is NOT the full path to the file !
UI.openURL("file:///K2WS_Tools/k2ws_DowelHelp.html")
It needs to be something more like:
UI.openURL("file:///**C:/Users/UserName/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/**K2WS_Tools/k2ws_DowelHelp.html")
[depending on the SketchUp version]
The find the path to the folder use__FILE__
dir=File.dirname(__FILE__)will return the folder the 'calling plugin file' is in...
Either the tool's subfolder or the Plugins folder itself, depending on the location of it...
-
This is what finally worked:
def dowelHelp dowel_help_File = File.join(File.dirname(__FILE__),"K2_ToolsSupportFiles","k2ws_DowelHelp.html") UI.openURL("file;///#{dowel_help_File}") UI.messagebox("Dowel Help Complete " + dowel_help_File.to_s) end #def dowelHelpThe html file was:
<!DOCTYPE html> <html> <body> <p> <img src="K2_ToolsDowelHelp.png" > </p> </body> </html>Thanks
Keith
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement