Open documents using iPad Quick Look?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Open documents using iPad Quick Look?
Has anyone figured out how to open, say a pdf, using iPads Quick Look? I mean via LC.
This would be great because Quick Look handles many types of files.
Thanks,
Simon
This would be great because Quick Look handles many types of files.
Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 20
- Joined: Sun Dec 28, 2008 3:26 pm
Re: Open documents using iPad Quick Look?
Same question, anyone done this via, say, UIWebView ?
Re: Open documents using iPad Quick Look?
Hi Maarten,
That is what I ended up using. Just put the docs in a browser.
Simon
That is what I ended up using. Just put the docs in a browser.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 20
- Joined: Sun Dec 28, 2008 3:26 pm
Re: Open documents using iPad Quick Look?
I tried that, but doesn;t work. Can you send me (or PM me) a sample? I would be most grateful.
As url I am trying file:docs\test.pdf, where test.pdf is in the engine\docs directory
As url I am trying file:docs\test.pdf, where test.pdf is in the engine\docs directory
Re: Open documents using iPad Quick Look?
I'd use the documents folder:
specialFolderPath("documents")
I think the entire URL looks something like this:
iphoneControlSet sBrowserID, "url", "File://" & (specialFolderPath("documents") & "test.pdf")
Simon
specialFolderPath("documents")
I think the entire URL looks something like this:
iphoneControlSet sBrowserID, "url", "File://" & (specialFolderPath("documents") & "test.pdf")
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Open documents using iPad Quick Look?
I use this:
put (specialFolderPath("Documents") & "/lunch.pdf") into theUrl
replace " " with "%20" in theUrl -- don't ask, just do it
iphoneControlSet browserID, "url", theUrl
Gerry
put (specialFolderPath("Documents") & "/lunch.pdf") into theUrl
replace " " with "%20" in theUrl -- don't ask, just do it

iphoneControlSet browserID, "url", theUrl
Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
Re: Open documents using iPad Quick Look?
"\" ? Is that your problem? It should be "/".maarten.koopmans wrote:As url I am trying file:docs\test.pdf, where test.pdf is in the engine\docs directory
Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
Re: Open documents using iPad Quick Look?
Dag maarten,
you should really take a look at the "iOS Release Notes" (menu: Help)!
That is the only documentation we have for iOS.
And LiveCode ALWAYS uses a SLASH as a path delimiter, since it has its roots in Unix.
Best
Klaus
you should really take a look at the "iOS Release Notes" (menu: Help)!
That is the only documentation we have for iOS.
This is definitively NOT a valid path in iOS!maarten.koopmans wrote:file:docs\test.pdf
And LiveCode ALWAYS uses a SLASH as a path delimiter, since it has its roots in Unix.
So you need to do this like in Jellicle's example::maarten.koopmans wrote:... is in the engine\docs directory
Code: Select all
...
put specialfolderpath("engine") & "/" & docs/test.pdf" into tUrl
replace " " with "%20" in theUrl
## NO spaces allowed in internet URLs!!!
## Internet browser do this behind the scenes when we enter URLs with SPACES!
iphoneControlSet browserID, "url", theUrl
...
Klaus
Re: Open documents using iPad Quick Look?
Hi Klaus,
Is this where we use URLEncode?
But with, replace "+"with "%20", to get all characters?
Simon
Is this where we use URLEncode?
But with, replace "+"with "%20", to get all characters?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Open documents using iPad Quick Look?
Hi Simon,
no urlencoding!
URLs are a special case where we "only" need to replace SPACE with "%20".
Don't ask me why, I didn't invent it
Best
Klaus
no urlencoding!
URLs are a special case where we "only" need to replace SPACE with "%20".
Don't ask me why, I didn't invent it

Best
Klaus
Re: Open documents using iPad Quick Look?
The first handler below works to create the browser and load a pdf with the file name "APT600_30.PDF" in a folder titled "ALSFD" in the documents folder. The statementbelow : iphoneControlSet sBrowserId, "autoFit", "true" is important. The second handler loads a PDF once the browser has been created. What you don't want is a bunch of browser instances opened with iphoneControlCreate "browser" command and the sBrowserId global variable overwritten each time. Then when you go to another card the browser window follows you to that card. I'd post my stack but the 256k limit won't allow me to load even two pdf's. lame.
here is the code.
global sBrowserId ## the number of the browser instance kept I'm memory
on openMyBrowserForBusiness ## this one creates the browser with the iphoneControlCreate "browser" command
if the environment is not "mobile" then exit openMyBrowserForBusiness ## only works in the tester or on an IOS Ipad
put "APT600_S30" into tMyPdfChoice ## one of the PDF file names in the "ALSFD" folder
put "file:///" & specialfolderpath("documents") & "/ALSFD/" & tMyPdfChoice & ".pdf" into tLocalPDF
replace " " with "%20" in tLocalPDF ## replaces blank spaces in the url
iphoneControlCreate "browser" ## creates a browser instance
put the result into sBrowserId ## the number of the instance kept in memory
set the rect of group "Browser" to 0,120, the width of this card, the height of this card ## set the rect of the browser
iphoneControlSet sBrowserId, "rect" , the rect of group "Browser"
iphoneControlSet sBrowserId, "visible" , "true"
iphoneControlSet sBrowserId, "autoFit", "true"
iphoneControlSet sBrowserId, "url", tLocalPDF
end openMyBrowserForBusiness
on ReloadWhenBrowserIsOpen ## sent from tthe left, right, up, down buttons to navigate
if the environment is not "mobile" then exit ReloadWhenBrowserIsOpen
put "APT600_Q30" into tMyPdfChoice
put specialfolderpath("documents") & "/ALSFD/" & tMyPdfChoice & ".pdf" into tLocalPDF
if there is not a file tLocalPDF then
answer "page" && tMyPdfChoice && "is either not a valid file address or there was a problem loading it."
exit ReloadWhenBrowserIsOpen
end if
put "file:///" & specialfolderpath("documents") & "/ALSFD/" & tMyPdfChoice & ".pdf" into tLocalPDF
replace " " with "%20" in tLocalPDF
iphoneControlSet sBrowserId, "rect" , the rect of group "Browser"
iphoneControlSet sBrowserId, "visible" , "true"
iphoneControlSet sBrowserId, "autoFit", "true"
iphoneControlSet sBrowserId, "url", tLocalPDF
end ReloadWhenBrowserIsOpen
on closeCard
if the environment is not "mobile" then
exit closeCard
end if
# destroy the browser we created
iphoneControlDelete sBrowserId
end closeCard
here is the code.
global sBrowserId ## the number of the browser instance kept I'm memory
on openMyBrowserForBusiness ## this one creates the browser with the iphoneControlCreate "browser" command
if the environment is not "mobile" then exit openMyBrowserForBusiness ## only works in the tester or on an IOS Ipad
put "APT600_S30" into tMyPdfChoice ## one of the PDF file names in the "ALSFD" folder
put "file:///" & specialfolderpath("documents") & "/ALSFD/" & tMyPdfChoice & ".pdf" into tLocalPDF
replace " " with "%20" in tLocalPDF ## replaces blank spaces in the url
iphoneControlCreate "browser" ## creates a browser instance
put the result into sBrowserId ## the number of the instance kept in memory
set the rect of group "Browser" to 0,120, the width of this card, the height of this card ## set the rect of the browser
iphoneControlSet sBrowserId, "rect" , the rect of group "Browser"
iphoneControlSet sBrowserId, "visible" , "true"
iphoneControlSet sBrowserId, "autoFit", "true"
iphoneControlSet sBrowserId, "url", tLocalPDF
end openMyBrowserForBusiness
on ReloadWhenBrowserIsOpen ## sent from tthe left, right, up, down buttons to navigate
if the environment is not "mobile" then exit ReloadWhenBrowserIsOpen
put "APT600_Q30" into tMyPdfChoice
put specialfolderpath("documents") & "/ALSFD/" & tMyPdfChoice & ".pdf" into tLocalPDF
if there is not a file tLocalPDF then
answer "page" && tMyPdfChoice && "is either not a valid file address or there was a problem loading it."
exit ReloadWhenBrowserIsOpen
end if
put "file:///" & specialfolderpath("documents") & "/ALSFD/" & tMyPdfChoice & ".pdf" into tLocalPDF
replace " " with "%20" in tLocalPDF
iphoneControlSet sBrowserId, "rect" , the rect of group "Browser"
iphoneControlSet sBrowserId, "visible" , "true"
iphoneControlSet sBrowserId, "autoFit", "true"
iphoneControlSet sBrowserId, "url", tLocalPDF
end ReloadWhenBrowserIsOpen
on closeCard
if the environment is not "mobile" then
exit closeCard
end if
# destroy the browser we created
iphoneControlDelete sBrowserId
end closeCard