Re: Ghost Comments
Re: Ghost Comments
- Subject: Re: Ghost Comments
- From: Iurista GmbH <email@hidden>
- Date: Sat, 18 Feb 2012 06:34:18 +0100
Am 18.02.2012 um 00.46 schrieb Luther Fuller:
> While working on a script this afternoon, I noticed something that shouldn't happen.
> So, I wrote this quick test script (in 10.6.8) to discover what was happening ...
>
> set deskAlias to (path to desktop)
> tell application "Finder"
> if exists folder "TEST" of deskAlias then
> (folder "TEST" of deskAlias) as alias as text
> tell application "System Events" to delete disk item the result
> end if
> delay 1
> set newFolder to (make new folder at deskAlias with properties {name:"TEST"}) as alias
> delay 1
> get comment of newFolder
> display dialog the result buttons {"OK"} default button 1
> end tell
>
> After the first run, you will have a folder "TEST" on your desktop.
> Get Info for this folder and enter some text in the comment field. Close Get Info.
>
> Now run this script again, and again, and ...
>
> Every time it runs, it displays the text you entered in the comment field.
> Yet the folder and presumably its comment have been deleted on each run.
>
> The fix is to use this:
> set newFolder to (make new folder at deskAlias with properties {name:"TEST", comment:""}) as alias
>
> Anyone have an explanation?
The comment is stored in the invisible file .DS_Store. The Finder does not update this file so quickly.
Therefore, when you delete an item with comment (file or folder, btw) and establish (more or less immediately) a new item of the same class and with same name, the comment stay as it is. I use this for example with applications, to which I add comment. Replacing or updating manually the app file quickly allows me to preserve the comment.
Rudolf
_______________________________________________
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