sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Trying to Display a Help File (Help.jpg)

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 282 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      ktkoh
      last edited by

      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 dowelHelp
      

      Keith

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        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

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          Assuming the path to the actual file is correctly formed...
          Try UI.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... πŸ€“

          TIG

          1 Reply Last reply Reply Quote 0
          • K Offline
            ktkoh
            last edited by

            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 dowelHelp
            

            This 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

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              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... πŸ˜’

              TIG

              1 Reply Last reply Reply Quote 0
              • K Offline
                ktkoh
                last edited by

                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 dowelHelp
                

                The html file was:

                <!DOCTYPE html>
                <html>
                <body>
                <p>
                <img src="K2_ToolsDowelHelp.png" > 
                </p>
                </body>
                </html>
                

                Thanks
                Keith

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement