Displaying PDF - Help! Urgent!!

Gordon Tillman got at mindspring.com
Tue Sep 13 13:17:55 EDT 2005


Chris it's best to let the particular operating system decide the  
best way to open a PDF doc (as well as other types of docs as well).

> Hello folks -
>
> I'm doing a quick 'n' dirty menu front-end for a CD and need to be  
> able to display a multi-page PDF document.  On Mac I'll just open  
> it with "Preview" - but I need to know what is equivalent on PC.   
> (I am a Windows dunce...)
>
> I have to do this tonight!!  Gulp!
>
> Chris

Here is a snippet of code for Mac OS X and Windows (95 through XP).   
You may need to tweak it a bit but it will give you the idea - I  
don't have any versions of Windows older than XP handy to check it on:

Bonjour IM with Gordon Tillman <gordy at gordy15>.
12:17
lll
on mouseUp
local tPdfFile
answer file "Select a PDF document"
put it into tPdfFile
if tPdfFile is empty then exit mouseUp

if the platform is "MacOS" and char 1 to 2 of the systemVersion is  
"10" then
openMac tPdfFile
else if the platform is "Win32" then
get the shortFilePath of tPdfFile
replace "/" with "\" in it
if the systemVersion contains "Windows 4" then
openWin4 it
else if the systemVersion contains "NT" then
openWin5 it
end if
end if

end mouseUp

on openMac pPdfDoc
-- /usr/bin/open
get shell("/usr/bin/open '" & pPdfDoc & "'" )
end openMac


on openWin4 pPdfDoc
-- cmd /c
get shell("cmd /c" && pPdfDoc )
end openWin4

on openWin5 pPdfDoc
-- start
put shell("start" && pPdfDoc )

end openWin5


--gordy





More information about the use-livecode mailing list