Script to launch PDF
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Dear Stormy1,
You start your script with "on mouseUp". Put the if-then statement, which I posted, right after the line that defines the myPath variable. Put everything else, except "end mouseUp", on the line saying "-- remainder of script". Finish the script with "end mouseUp". Let me know and post your script if it doesn't work.
Best,
Mark
You start your script with "on mouseUp". Put the if-then statement, which I posted, right after the line that defines the myPath variable. Put everything else, except "end mouseUp", on the line saying "-- remainder of script". Finish the script with "end mouseUp". Let me know and post your script if it doesn't work.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Thanks for that Mark
However, before I do that, I'm still not clear as to why this script (the main one you posted before) stops working after I create the standalone.
When previewing in Revolution on the Mac, the button works fine and opens the document. However, as soon as its a standalone, nothing.
According to the documentation, Revolution defaults to creating the defaultfolder to the one where the .exe is housed. That means, your script should work. But when I try it on the Mac, the button does nothing and on Windows, I get a MS-DOS black window and an error message saying it can't find file "".
I can't believe this is SO difficult to do considering its something so basic.
Thanks
However, before I do that, I'm still not clear as to why this script (the main one you posted before) stops working after I create the standalone.
When previewing in Revolution on the Mac, the button works fine and opens the document. However, as soon as its a standalone, nothing.
According to the documentation, Revolution defaults to creating the defaultfolder to the one where the .exe is housed. That means, your script should work. But when I try it on the Mac, the button does nothing and on Windows, I get a MS-DOS black window and an error message saying it can't find file "".
I can't believe this is SO difficult to do considering its something so basic.
Thanks
Hi Mark
Put the script in a few places although I'm not sure i'm getting it right.
While in Revolution, the document opens plus a system file search window which isn't obviously the right way!
However, in all cases, when spitting out a standalone, the button still does nothing.
I just still don't understand why it works in Revolution and then NOT as a standalone!!! Why have a 'launch document' command and it not do anything????
Put the script in a few places although I'm not sure i'm getting it right.
While in Revolution, the document opens plus a system file search window which isn't obviously the right way!
However, in all cases, when spitting out a standalone, the button still does nothing.
I just still don't understand why it works in Revolution and then NOT as a standalone!!! Why have a 'launch document' command and it not do anything????
OK Mark, now we're getting somewhere!
Thanks for your patience on this.
I got your script in the right place and when running the standalone, I get the 'Can't Find File' window with the location its trying to search for.
For some reason, its adding "/Contents/MacOS" before the info I added in the script for the document location. Thats why it can't find it.
In other words, it gives the string to the .app file of the standalone which is correct but then puts "/Contents/MacOS" between that and the rest of the location of the file.
Why has that been inserted and how can I take it out?
Thanks
Thanks for your patience on this.
I got your script in the right place and when running the standalone, I get the 'Can't Find File' window with the location its trying to search for.
For some reason, its adding "/Contents/MacOS" before the info I added in the script for the document location. Thats why it can't find it.
In other words, it gives the string to the .app file of the standalone which is correct but then puts "/Contents/MacOS" between that and the rest of the location of the file.
Why has that been inserted and how can I take it out?
Thanks
Ok, so officially, this is getting ridiculous.
For some reason, thanks to the GLX framework, I can get the file to link on the Mac using your script. However, the PC (which has never worked either) still isn't working.
I have tried loads of different permutations but have got nothing.
This is the Windows part of the script:
else if the platform is "Win32" then
replace slash with backslash in myPath
put "start '' '" & myPath & "'" into myShell
get shell(myShell)
end if
All this gives me in Windows is an empty black DOS window and a warning message saying is can find "". I have tried putting in the link etc into various places but again, nothing.
All I want to do is open a Word doc. Is that too much to ask?????
For some reason, thanks to the GLX framework, I can get the file to link on the Mac using your script. However, the PC (which has never worked either) still isn't working.
I have tried loads of different permutations but have got nothing.
This is the Windows part of the script:
else if the platform is "Win32" then
replace slash with backslash in myPath
put "start '' '" & myPath & "'" into myShell
get shell(myShell)
end if
All this gives me in Windows is an empty black DOS window and a warning message saying is can find "". I have tried putting in the link etc into various places but again, nothing.
All I want to do is open a Word doc. Is that too much to ask?????
Dear Stormy1,
Please, have a look at the folder structure of a Mac standalone. You will see that it isn't just one document but a bundle with several files and folders in it. The executable file is burried pretty deep in a nested folder. As a result, the effeective filename of a standalone or a stack saved with that standalone differs. On Mac, you get
Macintosh HD/Folder/Application.app/Contents/MacOS/Executable
while on Windows you get
C:/Folder/Executable.exe
You can do two things now. Either change your script to delete item -4 to -1 of myPath (itemDelimiter set to slash) whenever your script runs in a standalone or store the referenced file inside Macintosh HD/Folder/Application.app/Contents/MacOS/
This problem is not a bug, it is the consequence of the difference in file structure between Mac and other operating systems.
Best regards,
Mark
Please, have a look at the folder structure of a Mac standalone. You will see that it isn't just one document but a bundle with several files and folders in it. The executable file is burried pretty deep in a nested folder. As a result, the effeective filename of a standalone or a stack saved with that standalone differs. On Mac, you get
Macintosh HD/Folder/Application.app/Contents/MacOS/Executable
while on Windows you get
C:/Folder/Executable.exe
You can do two things now. Either change your script to delete item -4 to -1 of myPath (itemDelimiter set to slash) whenever your script runs in a standalone or store the referenced file inside Macintosh HD/Folder/Application.app/Contents/MacOS/
This problem is not a bug, it is the consequence of the difference in file structure between Mac and other operating systems.
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode