Re: Finder inconsistency (Was: What makes AppleScript difficult)
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