Hi,
I want my program to open a PDF document, using the default program available on the OS.
I'm unsure on how to do that, with cross platform in mind.
Anybody has an idea?
Open document
Re: Open document
Code: Select all
RunProgram("mypdf.pdf")
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: Open document
Thanks, but it doesn't work (at least not on OSX).ts-soft wrote:Code: Select all
RunProgram("mypdf.pdf")
-
- Enthusiast
- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: Open document
Try this
Take advantage of applescript.
Code: Select all
CompilerIf #PB_Compiler_OS=#PB_OS_MacOS
a.s="tell application "+Chr(34)+"Preview"+Chr(34)+#LF$
a.s+"activate"+#LF$
a.s+"open "+Chr(34)+"/absolute/path/To/file/my file.pdf"+Chr(34)+#LF$
a.s+"End tell"+#LF$
COCOA_AppleScript(a.s)
CompilerEndIf
Re: Open document
Thanks, how do I use CocoaScript with PB?
Re: Open document
Found the solution for OSX, if that can help somebody 
RunProgram("open", doc.pdf, "", #PB_Program_Open)

RunProgram("open", doc.pdf, "", #PB_Program_Open)