file rename occasionally fails last time through loop
file rename occasionally fails last time through loop
- Subject: file rename occasionally fails last time through loop
- From: Seth Tager <email@hidden>
- Date: Tue, 6 May 2003 13:59:18 -0700 (PDT)
I've written a script that generates and then renames
multiple files in a loop (generate via FileMaker,
rename via Finder). Sometimes, on the last time
through the loop, the rename command will fail telling
me only that the finder can't rename that file. (The
file definitely doesn't exist before running the
script) Any suggestion about fixing this, or help
figuring out why it's failing? Is there some sort of
timing issue that might affect what files the Finder
thinks exist at the time of the applescript requests?
Here's the outline of the script's primary method:
on generatePages(category)
tell application "FileMaker Pro"
set recordCount to count (records)
go to record 1
end tell
repeat with i from 1 to recordCount
tell application "FileMaker Pro"
...do some stuff to generate file...
if (i < recordCount) then
go to record after record i
end if
end tell
tell application "Finder"
set oldfilename to
"path:to:generated:Untitled.html"
if (oldfilename exists) then
set the name of file oldfilename to
"newname.html"
end if
end tell
end repeat
end generatePages
Seth
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
_______________________________________________
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.