Launch document problem
Posted: Tue Mar 20, 2007 6:05 am
I'm writing a cross platform stack. It has to run on at least Mac OSX and Windows XP. Other platforms are a bonus. When I get it working, I need to burn it on a hybrid CD format, so that I can ship a single CD for both platforms.
The stack needs to open the user guide (a PDF file) from the same folder/directory as the stack then the user clicks a certain button. I need this to work from the hard drive (on both platforms) as well as from the CD once it's burned. And I need it to work in development mode as well as on the player. Obviously, I cannot use an absolute path to the file; it must be relative to the stack.
In order to solve the development mode problem I use the following script in preOpenStack:
The goal of this is to force revolution to always look for files in the same folder as the stack. This appears to work fine on both PC and Mac.
I also use the following script to find the user guide (for opening later), which can have several name variations as well as the revision:
This also appears to work correctly on both platforms.
When the button is clicked here is how I open the file:
On the PC this works great. Acrobat reader is launched and the User Guide is opened. However, on the Mac I always get an error: "can't open file" along with the correct file name that was found earlier and the correct path. For some reason Mac Revolution can't open the file but the PC version can. BTW, I can double-click the PDF on both platforms and it opens just fine. Also, I am only testing with the Player on the Mac. On the PC I have both Rev Studio and the Player, and both work fine.
Why can I correctly find the file but not launch it on the Mac? Is there a way to get more error/debug information out of Revolution than just "can't open file"? Any help or suggestions would be greatly appreciated.
TIA,
Troy
The stack needs to open the user guide (a PDF file) from the same folder/directory as the stack then the user clicks a certain button. I need this to work from the hard drive (on both platforms) as well as from the CD once it's burned. And I need it to work in development mode as well as on the player. Obviously, I cannot use an absolute path to the file; it must be relative to the stack.
In order to solve the development mode problem I use the following script in preOpenStack:
Code: Select all
get the filename of this stack
split it using "/"
delete variable it[number of lines of the keys of it]
combine it using "/"
set the defaultFolder to it
I also use the following script to find the user guide (for opening later), which can have several name variations as well as the revision:
Code: Select all
global guide
repeat with x = 1 to the number of lines of the files
get line x of the files
if it contains "User's Guide" then
put it into guide
exit findGuide
end if
end repeat
When the button is clicked here is how I open the file:
Code: Select all
global guide
if guide is empty then
answer "I can't find the User Guide. Please check the disk."
else
launch document guide
if the result is not empty then
answer the result && guide && "in" the defaultFolder
end if
end if
Why can I correctly find the file but not launch it on the Mac? Is there a way to get more error/debug information out of Revolution than just "can't open file"? Any help or suggestions would be greatly appreciated.
TIA,
Troy