Loading...

applescript-users@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Ghost Comments Iurista GmbH Sat Feb 18 03:00:51 2012

Ups, that was too quick, I should do that better

Again:
Enable invisibles to be shown
Create a new folder XXX, manually or by your script
Create any item in that folder (folder or file)
Add Comment to that new item
Open the .DS_Store in the  folder XXX with TextEdit.app, et voilà, you will see 
your comment, among some unreadable scratch
Rudolf


Am 18.02.2012 um 11.50 schrieb Iurista GmbH:

> Well, it's really easy to check that it is stored in .DS_STORE:
> Enable invisibles to be shown
> Create a new folder, manually or by your script
> Add Comment
> Open the .DS_Store with TextEdit.app, et voilà, you will see your comment, 
> among some unreadable scratch
> Rudolf
> 
> 
> 
> Am 18.02.2012 um 11.14 schrieb Axel Luttgens:
> 
>> Le 18 févr. 2012 à 00:46, Luther Fuller a écrit :
>> 
>>> 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 ...
>>> 
>>> [...]
>>> 
>>> 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?
>> 
>> IIRC, starting with 10.4, those comments are stored as metadata.
>> But it seems that the Finder is somehow (and possibly somewhat erroneously) 
>> caching the info:
>> 
>>      tell application "Finder"
>>              if (exists folder "TEST" of desktop) then tell application 
>> "System Events" to delete folder "TEST" of desktop folder
>>              tell (make new folder at desktop with properties {name:"TEST"})
>>                      comment of it
>>                      --> "previously entered comment"
>>                      it as alias
>>              end tell
>>      end tell
>>      do shell script "mdls -name kMDItemFinderComment " & quoted form of 
>> POSIX path of result
>>      --> "kMDItemFinderComment = (null)"
>> 
>> By setting the comment while creating the new folder, you are updating that 
>> cached info.
>> Alternatively, you may let the finder know what's happening instead of doing 
>> various things behind the scene:
>> 
>>      tell application "Finder"
>>              if (exists folder "TEST" of desktop) then delete folder "TEST" 
>> of desktop
>>              tell (make new folder at desktop with properties {name:"TEST"})
>>                      comment of it
>>                      --> ""
>>                      it as alias
>>              end tell
>>      end tell
>>      do shell script "mdls -name kMDItemFinderComment " & quoted form of 
>> POSIX path of result
>>      --> "kMDItemFinderComment = (null)"
>> 
>> But I really don't know how the Finder caches such data; just restarting it 
>> isn't sufficient.
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      ([EMAIL PROTECTED])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/applescript-users/iurista%40ch.inter.net
> Archives: http://lists.apple.com/archives/applescript-users
> 
> This email sent to [EMAIL PROTECTED]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/alexiscircle%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users

This email sent to [EMAIL PROTECTED]