• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Finder Renaming Unpleasant Surprise
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finder Renaming Unpleasant Surprise


  • Subject: Finder Renaming Unpleasant Surprise
  • From: "S. J. Cunningham" <email@hidden>
  • Date: Fri, 13 Jan 2017 09:57:45 -0500

(*


So I have been counting on the Finder to throw an error if I try
to rename a file to a name which already exists in the same folder.
But it appears that is not what happens.  It simply silently ignores
the rename command.  I am I missing something?  This doesn't seem right.


*)

try
tell application "Finder"
set firstFile to make new file at desktop with properties {name:"firstfile"}
set secondFile to make new file at desktop with properties {name:"secondfile"}
set duplicateName to name of firstFile
set the name of secondFile to duplicateName
set newName to name of secondFile
if newName = duplicateName then
display dialog "WTF?"
end if
end tell
on error errMsg number errNum
display dialog "Error " & errNum & ": " & errMsg
end try
--> name of secondFile is not changed and no error is thrown


Steve
------------------
OS X 10.6.8, AppleScript 2.1.2

 _______________________________________________
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

  • Follow-Ups:
    • Re: Finder Renaming Unpleasant Surprise
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: set theAttachments to theMessage's mail attachments fails when called by a rule
  • Next by Date: Re: AppleScript-Users Digest, Vol 14, Issue 42
  • Previous by thread: Re: set theAttachments to theMessage's mail attachments fails when called by a rule
  • Next by thread: Re: Finder Renaming Unpleasant Surprise
  • Index(es):
    • Date
    • Thread