Jump to content


Photo

Open "user guide" HTML of tool for any OS?

invoke html default internet browser windows linux osx

  • Please log in to reply
5 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1355 posts
  • Gender:Male
  • Location:Spain

Posted 06 May 2018 - 11:52

I am trying to create a simple function to invoke an html file saved in the root folder of the tool (..tool\user_guide\phrasetouch_user_guide_en.html), so that it opens automatically with the default Internet browser of the operating system.

 
I can only try this function with Windows 10. I do not have OSX or Linux. Could someone be ready to work correctly with OSX and Linux? Unfortunately I can not test it for both operating systems.
 
The function and the button to invoke:
------------------------------------------------------------------------------------------------
--user guide
local function pht_user_guide_path()
  local dir = os.currentdir() --dir for tool
  local html = "user_guide/phrasetouch_user_guide_en.html"
  local guide = "file:///"..dir..html
  return guide
end
---
local PHT_USER_GUIDE = vb:column { spacing = 3,
  vb:text {
    font = "big",
    text = "PhraseTouch User Guide"
  },
  vb:row { style = "plain", margin = 5,
    vb:text {
      height = 25,
      width = 300,
      text = "Use a browser to read the HTML PhraseTouch User Guide:"
    },
    vb:button {
      height = 25,
      width = 250,
      text = "Show PhraseTouch User Guide",
      notifier = function() renoise.app():open_url( pht_user_guide_path() ) end,
      tooltip = ""..pht_user_guide_path()
    }
  }
}
  • The function pht_user_guide_path() work correctly on all 3 operating systems? It is invoked from "notifier = function() renoise.app():open_url( pht_user_guide_path() ) end"
  • file:/// is also necessary for the 3 operating systems?

 

With Windows 10, the local guide return:

file:///C:\Users\NAME_USER\AppData\Roaming\Renoise\V3.1.1\Scripts\Tools\ulneiz.PhraseTouch_v1.0.xrnx\user_guide/phrasetouch_user_guide_en.html
Can anybody help me?

Edited by Raul (ulneiz), 08 May 2018 - 10:44.

:excl: Development of my tools PhraseTouch  |  GT16-Colors (old)

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#2 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6795 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 07 May 2018 - 18:11

That would work on my system (win8.1) as well, and probably across most other platforms:
https://stackoverflo...he-file-scheme 

 

Re HTML: as long as you don't rely on any javascript, it should work - but for security reasons, things are quite restricted in browsers when using the file:// protocol. 


Tracking with Stuff. API wishlist | Soundcloud


#3 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1355 posts
  • Gender:Male
  • Location:Spain

Posted 08 May 2018 - 10:37

That would work on my system (win8.1) as well, and probably across most other platforms:
https://stackoverflo...he-file-scheme 

 

Re HTML: as long as you don't rely on any javascript, it should work - but for security reasons, things are quite restricted in browsers when using the file:// protocol. 

 

Thanks!

 

Ok! The code I use is simple. It's just HTML, a common CSS3 file linked and links to PNG and animated GIF images. If in Windows 10 the function "pht_user_guide_path()" works correctly, as it does, I suppose that in the rest of the operating systems it will work fine as well.

 

If we analyze the structure of the function to define the complete address of the file to be executed:

  1. local dir = os.currentdir()   This defines the complete address to the tool folder.
  2. local html = "user_guide/phrasetouch_user_guide_en.html"   This defines the folder that is inside the root folder of the tool, and the name and extension of the file to invoke. But with a curious exception. The separation slash should look like this: /    If you use \ it will not work because it disappears. It must be because of the LUA code, which seems to be reserving this bar for special uses. Then, when you read the full address in the address bar of the internet browser, this bar will appear like this /, but os.currentdir() return the bars like this ...\...\...\... Should not I return them like that .../.../.../... ???   It seems that the browser itself makes several corrections with the bars.
  3. local guide = "file:///"..dir..html   This defines the complete address, including file: //. Apparently, whether you use file:// or file:/// the browser will interpret it equally correctly, and it will read like this file:/// ...As I understood, file:// is to be able to access the file of the computer. It is necessary to include it.

The complete result is this (Windows 10):

- with print():

file:///C:\Users\NAME_USER\AppData\Roaming\Renoise\V3.1.1\Scripts\Tools\ulneiz.PhraseTouch_v1.0.xrnx\user_guide/phrasetouch_user_guide_en.html

- with browser:

file:///C:/Users/NAME_USER/AppData/Roaming/Renoise/V3.1.1/Scripts/Tools/ulneiz.PhraseTouch_v1.0.xrnx/user_guide/phrasetouch_user_guide_en.html

 

If all the pieces that define the address are correct, it should work in any operating system, since in the background it seems that the Internet browser does the work...


Edited by Raul (ulneiz), 08 May 2018 - 10:38.

:excl: Development of my tools PhraseTouch  |  GT16-Colors (old)

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#4 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1355 posts
  • Gender:Male
  • Location:Spain

Posted 08 May 2018 - 10:44

I put this matter as resolved. If later there is a problem detected, I will return to this thread to detail it.

 

I find it interesting to be able to click on a button of the tool and that I can directly invoke the documentation of the user guide. This is very easy.


  • pat likes this

:excl: Development of my tools PhraseTouch  |  GT16-Colors (old)

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#5 pat

pat

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 505 posts
  • Gender:Male

Posted 09 May 2018 - 21:28

I'm really looking forward to seeing whatever this is you've been working on Raul!



#6 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1355 posts
  • Gender:Male
  • Location:Spain

Posted 13 May 2018 - 21:31

I'm really looking forward to seeing whatever this is you've been working on Raul!

 

Very soon it will be available for everyone in the tools section of www.renoise.com


:excl: Development of my tools PhraseTouch  |  GT16-Colors (old)

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler





Also tagged with one or more of these keywords: invoke html, default internet browser, windows, linux, osx