Hyperlink file:// error

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
trmpluym
Posts: 166
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 3 times
Been thanked: 6 times

Hyperlink file:// error

Post by trmpluym » Sun Mar 19, 2017 5:52 pm

I like to open a PDF on a local path. In Windows this is possible using a hyperlink with the file:// syntax.

For example:

file://c:\folder\20170444.pdf

This works everywhere Windows. For example in 'Eplorer' or 'Internet Explorer'

But when i try to use it in HMG i got an error:

wndArtikelen.hplBrochure.Address := 'file://c:\folder\20170444.pdf'

See:
2017-03-19 18_40_54-Program Error.png
2017-03-19 18_40_54-Program Error.png (17.68 KiB) Viewed 179 times
This error is not correct, the URL is valid but it is not a http:// or https:// but a file:// URL.

Is it possible to make these kind of file URL's possible ?

Theo

User avatar
serge_girard
Posts: 1524
Joined: Sun Nov 25, 2012 2:44 pm
Location: Belgium
Has thanked: 146 times
Been thanked: 21 times
Contact:

Re: Hyperlink file:// error

Post by serge_girard » Sun Mar 19, 2017 6:24 pm

Theo,

Please try with : 'file://c:\folder/20170444.pdf' (slashes in stead of backslashes!).
This works for me!

Serge

trmpluym
Posts: 166
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 3 times
Been thanked: 6 times

Re: Hyperlink file:// error

Post by trmpluym » Sun Mar 19, 2017 6:46 pm

Thank you Serge, i tried both:

file://c:\folder/20170444.pdf

And

file://c:/folder/20170444.pdf

Same error :(

User avatar
serge_girard
Posts: 1524
Joined: Sun Nov 25, 2012 2:44 pm
Location: Belgium
Has thanked: 146 times
Been thanked: 21 times
Contact:

Re: Hyperlink file:// error

Post by serge_girard » Sun Mar 19, 2017 7:20 pm

Theo,

And this: file:///C:/.... (3 slashes)

Serge

User avatar
Pablo César
Posts: 3793
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 78 times
Been thanked: 125 times

Hyperlink file:// error

Post by Pablo César » Mon Mar 20, 2017 12:53 pm

I think that I am understanding what is happening with you Theo.

IMHO there is a logical mess in URI for accepting address in HMG control...

I have reported one of relative problems at: viewtopic.php?p=47915#p47915

And also I made some tricky equivalent to overcome certain shortcomings:

viewtopic.php?p=47955#p47955

Please ready carefully and see if helps you...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

trmpluym
Posts: 166
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 3 times
Been thanked: 6 times

Re: Hyperlink file:// error

Post by trmpluym » Mon Mar 20, 2017 9:30 pm

Pablo César wrote:
Mon Mar 20, 2017 12:53 pm
And also I made some tricky equivalent to overcome certain shortcomings:
Your solution works like a charm Pablo :D (as always!)

User avatar
Pablo César
Posts: 3793
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 78 times
Been thanked: 125 times

Hyperlink file:// error

Post by Pablo César » Mon Mar 20, 2017 9:38 pm

I am happy to know it serves for you Theo. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

trmpluym
Posts: 166
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 3 times
Been thanked: 6 times

Re: Hyperlink file:// error

Post by trmpluym » Mon Mar 20, 2017 10:10 pm

Pablo,

I was a little to early. When the property is set in the source it works well, like:

Code: Select all

@ 220,360 LABEL H14 VALUE "Word file"                             ACTION 'TEST.docx'   
But when i try to set the property programmaticly the same error occurs like:

Code: Select all

ACTION (SetProperty("Main_form","H07","ADDRESS",'TEST.docx'))
The error is: Control: H07 must have valid email or url defined. Program Terminated

I modified your demo with a SET ADDRESS button

Can you have a look ?

Thanks in advance,

Theo
Attachments
hyperlink.zip
(1.52 MiB) Downloaded 6 times

User avatar
Pablo César
Posts: 3793
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 78 times
Been thanked: 125 times

Hyperlink file:// error

Post by Pablo César » Mon Mar 20, 2017 10:53 pm

The main problem is that.

SetProperty in HMG for HYPERLINKs that wrongly forces to FileProtocolHandler mailto:, as said wrongly IMO because it should differentiate when is email address or a file or folder as URL.

You will see at i_UsrInit.ch in the pack that it makes the differance by when it contains "@".

IMHO, this is a little missunderstanding from HMG. I suppose that Roberto deals to make easier for emails but now have to connsidered there are other way to inform URL: HTTP, HTTPS, FTP, local files, email address.

Alias, when have to make mention not as URL we have to say as URIs instead, I guess.
( https://en.wikipedia.org/wiki/Uniform_R ... C_and_URNs )

For that reason I am using MySetAddressControlProcedure in user component.

Another bug I found is getting the procedure for address in HYPERLINKs and is wrongly comes as Nil... This I have adviced to Claudio here but he has not confirmed yet... :|

So, to solve your new assigning ADDRESS as file I guess you will need to replace:
Screen137.png
Screen137.png (14.78 KiB) Viewed 70 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply

Who is online

Users browsing this forum: mol and 1 guest