• 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
Re: Finder inconsistency (Was: What makes AppleScript difficult)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder inconsistency (Was: What makes AppleScript difficult)


  • Subject: Re: Finder inconsistency (Was: What makes AppleScript difficult)
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 7 Dec 2007 07:40:01 -0600

On Dec 6, 2007, at 11:13 PM, Skeeve wrote:
Michelle Steiner wrote:

On Dec 6, 2007, at 3:16 PM, Skeeve wrote:

work around, that I haven't tried, would be to: 'duplicate' to the "TemporaryItems" folder;
Which requires that there isn't already a file by that name!

Just add "with replacing" to the "duplicate" command

So you will replace a file that was placed there by another application?
Bad idea! Very Bad!

The nature of the temporary folder is that it's ... well ... uhhh ... temporary!
The easiest way to open it is with ...


tell application "Finder" to open window of ((path to temporary items) as alias)

just in case you want to see what's there. You will find that it's empty. Any application that uses the Temporary Items folder is responsible for cleaning up after itself. If there is a rare situation where there is a collision of file names, simply overwrite the old file and don't worry about it.

And of course, after using Temporary Items, your application/script will need to remove its droppings.
I recommend this handler ...


on remove(itemAlias)
	try
		tell application "Finder"
			set itemName to (name of itemAlias)
			set itemCont to (container of itemAlias) as alias
		end tell
		do shell script "rm -fr " & (quoted form of POSIX path of itemAlias)
		tell application "Finder" to update item itemName of itemCont
	end try
end remove

It has the advantage of not using the Trash, which is slow.

When I commented that ...
A work around, that I haven't tried, would be to: 'duplicate' to the "TemporaryItems" folder; change the name or other properties of this temporary item; 'duplicate' this temporary item to the final destination; then remove the temporary item.

I was referring to the current situation in the original post. I have used this technique before ... and it does work!


_______________________________________________
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 inconsistency (Was: What makes AppleScript difficult)
      • From: Emmanuel <email@hidden>
    • Re: Finder inconsistency (Was: What makes AppleScript difficult)
      • From: Skeeve <email@hidden>
References: 
 >What makes AppleScript difficult (From: Richard Doust <email@hidden>)
 >Finder inconsistency (Was: What makes AppleScript difficult) (From: Skeeve <email@hidden>)
 >Re: Finder inconsistency (Was: What makes AppleScript difficult) (From: Luther Fuller <email@hidden>)
 >Re: Finder inconsistency (Was: What makes AppleScript difficult) (From: Skeeve <email@hidden>)
 >Re: Finder inconsistency (Was: What makes AppleScript difficult) (From: Michelle Steiner <email@hidden>)
 >Re: Finder inconsistency (Was: What makes AppleScript difficult) (From: Skeeve <email@hidden>)

  • Prev by Date: Re: What makes appleScript so easy
  • Next by Date: Re: Changing the name of a file in the temporary items folder
  • Previous by thread: Re: Finder inconsistency (Was: What makes AppleScript difficult)
  • Next by thread: Re: Finder inconsistency (Was: What makes AppleScript difficult)
  • Index(es):
    • Date
    • Thread