GeOpenHTML()



  • On 11/02/2017 at 08:25, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   18 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hi,

    I assemble a string that looke like this:

    file:///Applications/MAXON/CINEMA 4D R18/plugins/CanStack/docs/index.html#OSTACK-STACK_GROUP_STACK-STACK_RENDERINSTANCES

    That string I pass to GeOpenHTML(), hoping it would load the HTML page and make the browser jump to the anchor OSTACK-STACK_GROUP_STACK-STACK_RENDERINSTANCES. But nothing happens. The browser (in my case Safari) does not open. I also tried it without the "file://" but that doesn't do anything either. The URL ist correct, though, manually copying it to the browser opens the correct file and anchor.

    Is GeOpenHTML() broken?

    Thanks in advance!

    Cheers,
    Frank



  • On 11/02/2017 at 09:58, xxxxxxxx wrote:

    In R13 this opens Firefox to the specified URL as expected.
    But I'm not using a callback function or anything fancy. So you might need to post more of your code.
    The command itself does seem to work as expected for me.

        String url = "http://google.com";  
      GeOpenHTML(url);
    

    -ScottA



  • On 11/02/2017 at 10:22, xxxxxxxx wrote:

    EDIT: I removed the part about the HelpDelegate from my initial post, as it is nothing to do with the problem.

    So, maybe GeOpenHTML() does not work with local files?



  • On 11/02/2017 at 10:41, xxxxxxxx wrote:

    It's working fine for me with a local .html file on my desktop.

        Filename file = GeGetC4DPath(C4D_PATH_DESKTOP) + Filename("mypage.html");  
      String url = file.GetString();  
      GeOpenHTML(url);
    

    The code in mypage

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
      
    <html>  
      
    <head>  
      <title>My First HTML Page</title>  
    </head>  
      
    <body>  
      
      text stuff here  
      
    </body>  
      
    </html>
    

    -ScottA



  • On 11/02/2017 at 14:31, xxxxxxxx wrote:

    Strange, it doesn't work for me. Nothing happens.

    Funny enough, I can open the html file using

      
    GeExecuteFile(thePathToTheFile);   
    

    But it doesn't work with anchors.

    Did anyone so far implement a HelpDelegate solution that's a bit more sophisticated than simply opening an HTML file?

    Cheers,
    Frank



  • On 11/02/2017 at 16:29, xxxxxxxx wrote:

    What exactly do you mean by "HelpDelegate"?

    I typically use an HtmlViewerCustomGui inside of a GeDialog to display help in my plugins.
    I've never needed anything fancier than that.
    But you could use a tree gui if you really want to get super fancy.

    -ScottA



  • On 12/02/2017 at 09:43, xxxxxxxx wrote:

    The HelpDelegate is Maxon's solution to enable plugin developers to react if the user clicks "Show help" in the context menu in the description of a plugin. It's demonstrated in the Atom Object example plugin.

    Good idea with the CustomGUI, I'll setup up a good solution for that, thanks ;-)



  • On 13/02/2017 at 06:26, xxxxxxxx wrote:

    Having looked at this myself some time ago, my conclusion was that GeOpenHTML() does not work correctly with anchors on a page if the URL is a file:/// URL. It does work if the URL is an http:// one. A bit silly but if you try it with a web page with an anchor, you should see that it works correctly.

    Steve



  • On 15/02/2017 at 00:05, xxxxxxxx wrote:

    Hi guys,

    I'm terribly sorry, it took so long until you get an official answer here. My bad, if you need I can provide you with my GPS coords so you can kick my ... as I deserve.

    The solution is actually quite simple here. On OSX there are no spaces allowed in the URL string passed to GeOpenHTML(). This is not in our code, but on Apple's end. Simply replace the spaces by %20 and you should be good to go.

    Or maybe I should put the explanation the other way round. To my knowledge (let me know, if I'm wrong here) there are no spaces allowed by the standard in URLs. That it works on Windows is just a convenience function delivered by Microsoft.



  • On 20/03/2017 at 03:29, xxxxxxxx wrote:

    Ah, just saw you replied. Sorry for my late reply, too ;-)

    I'll do the replacing whitespaces with "%20", thanks!



  • On 20/03/2017 at 03:44, xxxxxxxx wrote:

    Before any open of an url you should encode this one. (for avoid error liek that).
    Anchor probably don't work cause they are not encoded.

    http://stackoverflow.com/questions/154536/encode-decode-urls-in-c
    http://meyerweb.com/eric/tools/dencoder/ and if you put a simpel space you have the magic %20 ;)


Log in to reply