script get file error?

Hey guys,
I’m calling an applescript from a flash file to open an adobe reader file. the code i use is the following:

--set the name of the file to open 
property fileName : "thedocument.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
tell application "Finder"
	open file targetFile
end tell

As you can see, the code gets the path to the applescript file inside the fscommand folder and opens the pdf in the same folder as the applescript.
The code works perfectly on my machine. However to distribute the whole 70MB package (2 flash projectors and 100+ pdf’s) I compile it into a disk image. Again once mounted it still works fine on my machine. However, once i post it to one of my collegues, and they mount the image and run the flash file, the applecript returns an error saying it cant get the file…?

I’m afraid i’ve only been able to teach myself the absolute basics of applescript, but am a keen learner and any help eould be fantastic regarding why it is happening and how i can get around it?

Cheers :slight_smile:

Try this one:

property fileName : "a.txt"

try
	tell application "Finder" to open file fileName of parent of (path to me)
end try

Hey, thanks for the reply :slight_smile:

i used the script and again it worked on my machine but not on the other machines…

I’ve suddenly realised that the icons for all the PDF’s are semi-transparent… as if hidden… and low and behold, on the other machines, they dont appear in the filesystem! :o it turns out that they were hidden using Windows before being transfered to my mac… meaning they dont have the period (.) preceding the file name… any ideas how to un-hide them??

:frowning:

all sorted… used File Buddy 8 to unhide them all.
:smiley:

Cheers for the help aswell :slight_smile: