Write to file??
Write to file??
- Subject: Write to file??
- From: "Steve Suranie" <email@hidden>
- Date: Tue, 30 Jul 2002 15:32:24 -0400
- Thread-topic: Write to file??
Hi all:
I have a script which at the end writes data to a log file. When I run the script on my G4 it works fine. When I move it to a G3 which I am using as a workstation I get an execution error. "Finder got an error. Can't make ....[path and filename]... into a file specification. Any clues as to why? Here's my code: [I'm hard coding some info in here for testing purposes]
tell application "Finder"
--==========================================
--WRITING LOG AND SENDING OUT EMAIL MESSAGE
--==========================================
set thisDate to current date
set logPath to the folder "_logs" of the folder "Merion Image Archive" of the disk "Cumulus" as string
set thisMonth to the month of thisDate as string
if thisMonth = "January" then
set thisMonth to "01"
else if thisMonth = "February" then
set thisMonth to "02"
else if thisMonth = "March" then
set thisMonth to "03"
else if thisMonth = "April" then
set thisMonth to "04"
else if thisMonth = "May" then
set thisMonth to "05"
else if thisMonth = "June" then
set thisMonth to "06"
else if thisMonth = "July" then
set thisMonth to "07"
else if thisMonth = "August" then
set thisMonth to "08"
else if thisMonth = "September" then
set thisMonth to "09"
else if thisMonth = "October" then
set thisMonth to "10"
else if thisMonth = "November" then
set thisMonth to "11"
else if thisMonth = "December" then
set thisMonth to "12"
end if
set totalRecords to "This is a variable"
set thisDay to day of thisDate as string
set thisYear to year of thisDate as string
set thisYear to text 3 thru 4 of thisYear
set theTime to time string of thisDate
set theDate to (thisMonth as string) & thisDay & thisYear
set logFile to theDate & "_log.txt" as string
set recordID to "Merion Image Archive Update Log" & return & ,
"Records added: " & "This is the file count" & return & "The total number of records is now: The file count + totalRecords"
set theFile to logPath & logFile as string
--the error occurs here, at either part of the if statement...
if not (the file theFile exists) then
set writeFile to (open for access theFile with write permission)
write recordID to writeFile
else
set writeFile to (open for access theFile with write permission)
write return & recordID to writeFile starting at eof
end if
close access writeFile
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.