G’day again
I really apologize for hogging this list, but I’m very frustrated.
I thought I’d take an approach to just list the matching .plist’s, and then try and either delete them, or whatever (that parts a bit vague, I really don’t know what the heck I’m doing).
However, I found out that my code seems unable to get the correct .plist value. The error is below, but the path to the “tile-data” .plist seems fine. Perhaps Sierrra is locking me out???
I could really do with some detailed advice if humanly possible, please.
Regards
Santa
Can’t get property list item "tile-data" of {GUID:3.049249951E+9, |tile-type|:"file-tile", |tile-data|:{|dock-extra|:false, |file-type|:41, |parent-mod-date|:3.552333813E+9, book:«data 626F6F6BF002000000000410300000000000000000000000000000000000000000000000000000000000000000000000040200000C000000010100004170706C69636174696F6E73130000000101000044722E2053657573732773204142432E61707000080000000106000004000000180000000800000004030000A6000000000000000800000004030000F63C29000000000008000000010600004400000054000000080000000004000041AC02E9EC000000180000000102000002000000000000000F0000000000000000000000000000000000000001050000080000000109000066696C653A2F2F2F0C00000001010000427269616E2773204469736B08000000040300000000863CD5020000080000000004000041BD7176CA000000240000000101000035333739423437462D373236302D333545312D413537432D33463932454445363242424418000000010200008100000001000000EF13000001000000000000000000000001000000010100002F000000B200000001020000393831623966316132656137653930323037623166653535663436666230656265393062356162303B30303030303030303B30303030303030303B303030303030303030303030303032303B636F6D2E6170706C652E6170702D73616E64626F782E726561642D77726974653B30303030303030313B30313030303030383B303030303030303030303239336366363B2F6170706C69636174696F6E732F64722E2073657573732773206162632E617070000000B4000000FEFFFFFF01000000000000000E000000041000003400000000000000051000006400000000000000101000008400000000000000401000007400000000000000022000003C0100000000000005200000AC0000000000000010200000BC0000000000000011200000F00000000000000012200000D00000000000000013200000E000000000000000202000001C0100000000000030200000A40000000000000001D00000A40000000000000080F000004801000000000000», |file-data|:{_CFURLStringType:15, _CFURLString:" file:///Applications/Dr. Seuss's ABC.app/"}, |file-label|:"Dr. Seuss's ABC", |file-mod-date|:3.409599612E+9, |bundle-identifier|:"com.mackiev.abc"}}. property NSUserDefaults : class "NSUserDefaults" of current application
tell NSUserDefaults tell application "System Events" set dockPlistFile to property list file "~/Library/Preferences/com.apple.dock.plist" tell dockPlistFile tell property list item "persistent-apps" set appTileItems to value of every property list item # whose value of property list item "tile-data"'s property list item "file-label" is "Mail Manager" say (count of appTileItems) -- < '67'as string repeat with x from 64 to 67 set eachPlist to item x of appTileItems say x display dialog value of property list item "tile-data"'s property list item "file-label" of eachPlist try if (eachPlist)'s (value of property list item "tile-data"'s property list item "file-label") is "Mail Manager" then say 1 try display dialog value of eachPlist as text end try #set eachPlist's value to "" end if end try end repeat end tell end tell end tell end tell do shell script ("killall Dock”) On 14 Sep. 2016, at 9:57 am, Shane Stanley < email@hidden> wrote: On 14 Sep 2016, at 7:16 AM, Brian Christmas <email@hidden> wrote:
Obviously Sierra does not like the code.
Any thoughts on how I can do this, or what’s wrong with this code, please? I’ve tried everything I can think of.
The problem is that your code is based on a misunderstanding of how the defaults process works. The property list files are read by a daemon the first time an app runs, and the app talks to that daemon. The daemon periodically writes updated values to the file, but it doesn't need to read from it again until either a restart, or it decides to clear out old values after an app has quit. So fiddling with the files is unreliable at best, and useless at worst.
Use defaults via do shell script or NSUserDefaults. They are the only way to talk to the defaults daemon.
-- Shane Stanley <email@hidden> <www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
And what, you ask, was the beginning of it all? And it is this...... Existence that multiplied itself For sheer delight of being And plunged with numberless trillions of forms So that it might find itself innumerably
Sri Aurobindo
|