Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mahaboob

macrumors member
Original poster
Jul 10, 2008
31
0
I need to launch a pdf file when clicking the help button.
So I used the code :
Code:
  Dim f as FolderItem
  f = GetFolderItem("MyHelp.pdf")
  f.Launch
and I imported the MyHelp.pdf file into the project.
When I'm running the application the file is launched.
But After building the application and I ran the application, it is not opening.
So I checked it with f.LastErrorCode and it shows error code 101(file not found). How can I use the pdf file in my application?
I need to distribute the application with this help file.

I'm using Realbasic 2007 R5 on Mac OS X 10.5

Thanks in advance
mahaboob
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Note: I don't know RealBasic

A quick google came up with a few threads that suggest using:
Code:
app.ExecutableFile.AbsolutePath

To get the path to your executable inside your bundle. You can then move to the resources directory (or wherever the PDF is ending up in your bundle) and open it up.

-Lee
 

blaster_boy

macrumors 6502
Jan 31, 2004
282
4
Belgium
I don't know Realbasic either, but it seems to me that you need to specify the path where your helpfile is located. Inside the project the executable probably sees it, once compiled it will need to be specified.

For easy testing, I would put the pdf in the same folder as where your executable is created and create a variable to the pdf using for the filepath the result of app.ExecutableFile.AbsolutePath + the name of the pdf.

In pseudocodish:
Code:
var x=app.ExecutableFile.AbsolutePath + "MyHelp.pdf"
f=GetFolderItem(x)
f.launch

You might want to print f or x to verify that the filepath is created correctly.
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
It's been a while since I did any RB, but it sounds like you're including the pdf in your project as a resource and so you would access it using the getresource() (I think) methods. Perhaps it would be easier to just distribute the pdf file with the executable, especially if your app is cross platform. Best to ask on the RealBasic forum over at RealSoftware if you haven't already.

b e n
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.