Page 1 of 1
Folder path variables
Posted: Sun May 21, 2017 6:54 pm
by PeterG
Hi All
I am busy with something in in the Windows Operating system that should merge number of pdf files and create a resulting PDF.
The first bit works fine but I am opening a new card after this.
In the "on open card" event I want to set a Browser widget url to a variable value:
Code: Select all
set the url of widget "wgtBrowser" to gFilename
After tracing the following, found that the value has a space:
tCombined = "/users/Documents/pdf /combined.pdf"
Any suggestion would be appreciated.
Thanks
Peter G
Re: Folder path variables
Posted: Sun May 21, 2017 8:26 pm
by PeterG
Hi All
My apologies.
Had 2 ampersands instead of one in the code.
Code: Select all
put defaultfolder & "combined.pdf" into tCombined
set the url of widget "wgtBrowser" to tCombined
Thanks
Peter G
Re: Folder path variables
Posted: Sun May 21, 2017 8:56 pm
by richmond62
At the risk of seeming very stupid indeed I cannot understand what you are trying to get across
as you mention this:
set the url of widget "wgtBrowser" to gFilename
and
tCombined = "/users/Documents/pdf /combined.pdf"
which are, presumably sections of some script we cannot see, so we
can see no obvious connexion between them at all.
Please can you post ALL the script so . . . . .
Re: Folder path variables
Posted: Mon May 22, 2017 1:21 am
by FourthWorld
A URL requires a service specifier. Try adding "file://" before the path.
Re: Folder path variables
Posted: Tue May 23, 2017 8:40 am
by MaxV
I tried also with urlencode, but it seems a bug to me.
This doesn't work: file:///home/max/Scrivania/test+with+spaces.xml
Re: Folder path variables
Posted: Tue May 23, 2017 3:14 pm
by FourthWorld
Is it an HTML file or an XML file?
When the file is opened in a separate browser application, does it display? If so, what is the URL shown there? Does it differ from the path used in the LC app?
Re: Folder path variables
Posted: Wed May 24, 2017 3:21 pm
by MaxV
This doesn't work: file:///home/max/Scrivania/test+with+spaces.html
this work: file:///home/max/Scrivania/test%20with%20spaces.html
So in the end this is the solution:
########CODE to copy and paste#######
on mouseUp
answer file "Select file:"
if the result is not "cancel" then
put it into temp
replace space with "%20" in temp
set the URL of widget 1 to ( "file://" & temp )
end if
end mouseUp
#####END OF CODE generated by http://tinyurl.com/j8xf3xq with livecode 9.0.0-dp-6#####
Re: Folder path variables
Posted: Thu Jun 01, 2017 4:54 pm
by PeterG
Hi MaxV
Many thanks for your input
Much appreciated
Peter G