Erratic Script Behavior with 'whose name contains' clause
Erratic Script Behavior with 'whose name contains' clause
- Subject: Erratic Script Behavior with 'whose name contains' clause
- From: Max Matson <email@hidden>
- Date: Mon, 29 Apr 2002 12:21:53 -0700 (PDT)
Hi fellow AS users,
I've recently been experiencing a fairly frustrating error with some scripts I've set up. I'm hoping that anyone has a clue as to what I might check / do. Here is a fairly high level (lengthy though-sorry ;] ) explanation of what is occurring.
I set up a series of scripts that work with the Finder (10.1.3) to do a bunch of file manipulations. The basic operation that is failing is locating a specific file in a folder. The name of the file is date stamped. Two of the three scripts that are broken are searching for the file on a remote (AppleShare IP) server. The third is searching for the script in a local directory. I use the follow code snippet to locate the files:
--Code snippet
tell me
set myCurrentServerFiles to (every file of disk "Server" whose name contains (myCurrentTextFile)) as alias
set myFoundTextFile to (name of file myCurrentServerFiles) as string
end tell
--End Code snippet
'myCurrentTextFile' is the name of the file that is expected to be on the server and is set just after the server is mounted. I use some custom script libraries (loaded at start) to determine what the file name should be. While there is a lot of code before and after this snippet, this is where it appears to be failing ever time. The crazy part is that the code ran on it's daily schedule without any errors for 2 weeks+ prior to failing. This script is called by another script which is launched via the Cron utility. The three scripts run at various times in the day, and all three broke on the same day. No changes to the system were made just prior to the code breaking. And no significant changes have been made since. All of the scripts fail the first time they are run, but then run perfectly after that. And as of yesterday, one of the three scripts started running as it should again. (With no changes made to it)!!!
Also, I have some logging functions built into the script which show the status of the variables when the script errors out. They show that the variable 'myCurrentTextFile' does indeed contain the right file name. The variable 'myCurrentServerFiles' is empty (as though the file is not on the server at all - not true). The variable 'myFoundTextFile' is empty of coarse, because the variable 'myCurrentServerFiles' is also empty.
Interestingly- The variable myCurrentServerFiles was retaining the previous days value even though the script is quit every day. That was fixed by initializing the variable to " " on start up.
Like I said, any help, suggestions, or crazy ideas are welcome at this point. Thanks in advance!!!!
Max
email@hidden
_______________________________________________
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.