read a file in same directory
read a file in same directory
- Subject: read a file in same directory
- From: email@hidden
- Date: Tue, 29 Jan 2002 01:22:14 EST
I'm having problems getting my AppleScript application to read a text file that is in the same directory. For whatever reason, I get a "Finder got an error. Duplicate file name." error when I run this. I'm not sure I understand what it means by "duplicate file name".
tell application "Finder"
activate
-- set file_in_string to (home as string) & "finisherparms.txt"
set file_in_string to "finisherparms.txt"
try
set originalfile to open for access file file_in_string
on error error_message number errNum
display dialog "2: " & errNum & " " & error_message
end try
try
read originalfile
copy the result to readstring
display dialog "readstring = " & readstring
on error error_message number errNum
display dialog "3: " & errNum & " " & error_message
close access originalfile
end try
end tell