开发者

Modify sub key in *plist files

I'm would like to modify a subkey in a plist file (i.e. "TB Item Identifiers"):

NSNavPanelExpandedStateForSaveMode = 1;
NSPreferencesContentSize = "{508, 413}";
NSPreferencesSelectedIndex = 6;
"NSToolbar Con开发者_Go百科figuration BrowserWindowToolbarIdentifier" =     {
    "TB Display Mode" = 2;
    "TB Icon Size Mode" = 1;
    "TB Is Shown" = 1;
    "TB Item Identifiers" =         (
        BackForwardToolbarIdentifier,
        HomeToolbarIdentifier,
        InputFieldsToolbarIdentifier
    );
    "TB Size Mode" = 1;
    "TB Visibility Priority Values" =         {
        BackForwardToolbarIdentifier =             (
            999
        );
        InputFieldsToolbarIdentifier =             (
            1000
        );
    };
};

I'm using the following command in a shell script :

defaults write com.apple.file key keyvalue

So each time I want to change "TB Item Identifiers", I'm modifying the entire "NSToolbar Configuration BrowserWindowToolbarIdentifier". How to directly modify a plist sub key or a sub sub key ?


Use the PlistBuddy

/usr/libexec/PlistBuddy -c "set Key:SubKey1:SubKey2:Subkey3 value" ./Path/To/Your.plist


defaults write com.yourcompany.app key -dict-add subkey plistValue
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜