Page 1 of 1

Problem in loading pdf

Posted: Wed Jul 01, 2015 7:03 am
by shalu
Hi,

I am beginner in live code, I am using Linux os and I want to open a pdf from home. for that I am using the code

Code: Select all

   put shell("echo $HOME/") into home1
   put the fld "Field" into ss
   put home1&ss into ass
   answer ass
   launch document ass
The above code is not working because while combing the home path and name of pdf into a variable it's shows that home path and pdf name are appearing in separate lines, how i merge these two line, or is it any alternative method for this problem. :oops:

Re: Problem in loading pdf

Posted: Wed Jul 01, 2015 8:03 am
by SparkOut
The shell command returning the home path by echo is bringing a trailing return.
You can add a check after retrieval

Code: Select all

if the last char of home1 is cr then
  delete the last char of home1
end if 
Don't refer to "the" field "Field" - "the" is required for properties but not containers.
I can't check right now but look up specialFolderPath. It might be that there is a "home" option for Linux, if the "documents" folder is not the same.

Re: Problem in loading pdf

Posted: Thu Jul 09, 2015 3:07 pm
by MaxV
SparkOut is right, you can use specialfolderPath this way:

Code: Select all

launch document ( specialFolderPath("home") & "/mydocument.pdf" )
It works on Linux Mint.

Re: Problem in loading pdf

Posted: Thu Jul 09, 2015 3:51 pm
by Klaus
You can even use $HOME if you prefer this more *NIX like syntax :D
...
launch document ($HOME & "/mydocument.pdf")
...