Re: Repeats with list of just 1 file not working
Re: Repeats with list of just 1 file not working
- Subject: Re: Repeats with list of just 1 file not working
- From: KOENIG Yvan <email@hidden>
- Date: Tue, 24 Apr 2007 09:36:29 +0200
Le 24 avr. 07 à 09:15:59, Brett Conlon a écrit :
Hi all,
Can a repeat process a list of just 1 file? It should, right???!!!
I'm struggling with a change I have just made to one of my scripts
and I
think it is coming down to a repeat which processes files from a
specified
folder. Things seem to work fine if there are 2 or more files in the
folder but the repeat seems to be skipped if there is only 1 file.
Before I send any code (it's getting to be a long handler and
weeding out
the important bits will take a bit of time) I'd first like to have
confirmed if I need to do anything special to make a repeat work when
dealing with files. In my previous version of this script all I was
interested in was the words in the file names so I had them all set
to a
list and the repeat was working through every word of the names of the
files - it worked great. With the new versions I need to pinpoint
files
which fail specific criteria so I need the repeat to scroll through
the
files and extract the details from each file. Since making the
change I
can't get it to work properly.
As I said, put 2 or more files in the folder and they seem to be
processed
as expected. Where there's only 1 file it seems like the repeat
just gets
ignored.
Your pointers are most appreciated!
Cheers,
Brett
Aren't you using this kind of code:
tell application "Finder"
set myList to ……… as alias list
end tell
If the responce is YES, this may be the source of your problem.
When the listed source contains only one item, the result is an error.
I use this kind of workaround:
set doss to "Macintosh HD:Users:yvankoenig:Desktop:dossier sans titre
2:"
tell application "Finder"
try
set myList to entire contents of folder doss as alias list
on error
set myList to (entire contents of folder doss as alias) as list
end try
end tell
With this code the repeat …end repeat scheme will work.
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden