folder of alias "any:thing" = /Applications
folder of alias "any:thing" = /Applications
- Subject: folder of alias "any:thing" = /Applications
- From: Sander Tekelenburg <email@hidden>
- Date: Fri, 30 Jul 2004 07:25:19 +0200
Suppose you want to do a simple rename of a bunch of JPGs in a folder
somewhere, and you make a silly coercion typo like in line 3:
set theFolder to choose folder
tell application "System Events"
set theFiles to every file of folder theFolder
set fileCount to 1
repeat with aFile in theFiles
--danger commented out::
--set name of aFile to "new filename" & fileCount & ".jpg"
set fileCount to fileCount + 1
end repeat
end tell
Would you expect it to rename every file in /Applications?
I sure did not ;) (Luckily I ran this in Script Editor - its Event Log told
me what file had been called what, and I could repair. All seems well, thus
far.)
Yes, of course, I shouldn't give myself Admin permissions if I don't know
what I'm doing :) What I'm curious about is why this happens. I'd have
expected a coercion error being thrown at me. Why does "folder of alias
[anything]" point to /Applications?
Note that Script Editor's Event Log says:
tell application "System Events"
get every file of folder (alias "[path to the folder you chose]")
followed by a listing of every file in /Applications
--
Sander Tekelenburg, <
http://www.euronet.nl/~tekelenb/>
_______________________________________________
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.