Hi, first of all, thanks for reading this, I’ve been working in this project for hours long and I’m really confused right now.
I need to build an applescript to open a .pdf file located in the same directory as the app, I found this code, which worked great while testing from my hard drive.
--set the name of the file to open
property fileName : "file.pdf"
--get the path to the containing folder
set myPath to (path to me as string)
set AppleScript's text item delimiters to ":"
set the parentFolder to ¬
((text items 1 thru -2 of myPath) & "") as string
set AppleScript's text item delimiters to ""
-- find the flash file
try
set targetFile to alias (the parentFolder & fileName)
on error
--ie if there's no file here by this name, it will quit.
return quit
end try
-- open the file
tell application "Finder"
open file targetFile
end tell
The problem is, when I copy the application folder to a pendrive (that will be the final destination for my application) the script stops working. The .app will run but won’t open the .pdf. I’m really a newbie to Applescript, I can understand what that script does more or less but I don’t know what could be the problem as this is the first time I make an application for OSX.
Please, could you help me find where the problem is?
BTW, the pendrive is a FAT32 disk as it must run in Windows too. (same thing in windows is done via .bat files with “start” command)
Thank You