Re: Questions questions...
Re: Questions questions...
- Subject: Re: Questions questions...
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 11 Mar 2002 16:34:37 -0700
- Organization: [very little]
>
Date: Mon, 11 Mar 2002 15:19:50 -0600
>
Subject: Questions questions...
>
From: mjn <email@hidden>
>
To: <email@hidden>
>
>
I am attempting to write a script which will look at all of the files in
>
Startup items and delete any file whose creator matches "NDS".
>
>
I wrote something like this:
>
>
on run
>
tell application "Finder"
>
activate
>
set theFolder to startup items folder
>
set fileNames to (every item whose file creator contains "NDS") of
>
theFolder as list
>
repeat with myFile in fileNames
>
set delFile to (theFolder as string) & contents of myFile
>
delete delFile
>
end repeat
>
end tell
>
end run
>
>
But I keep getting errors about not being able to turn some things into
>
items or other things into strings.
>
>
Suggestions? Is there something blatantly stupid I have done here? Seems
>
to me this should be a bunch easier than it actually is...
It could be a bunch easier than the way you were trying to do it. Try
it this way:
tell application "Finder"
set theFldr to (startup items folder)
set delList to files of theFldr whose creator type starts with "NDS "
if delList is not {} then
delete delList
empty trash
end if
end tell
You were trying to get "file creator", which is not a file property,
from a list, which doesn't have properties at all. This way you're
looking for "creator type" only in files (items include folders), and
you're looking in a folder, which is a Finder object, not in a list.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[3/11/02 4:30:06 PM]
_______________________________________________
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.