0

I'm trying to add a printer to CustomPapers' .plist using this terminal command:

defaults write com.apple.print.custompapers.plist 165x165 -dict-add <bottom>0</bottom><custom>1</custom><height>467.71653555</height><id>'165x165'</id><left>0</left><name>'165x165'</name><printer> </printer><right>0</right><top>0</top><width>467.71653555</width>

Please can someone suggest where I've gone wrong with this and if a dictionary item exists with the key "165x165" that it should not add the item.

1 Answer 1

0

You have to quote the value, remove -dict-add, and use for example <key>name</key><string>165x165</string> instead of <name>165x165</name>:

defaults write com.apple.print.custompapers 165x165 '<dict><key>bottom</key><real>0</real><key>custom</key><true/><key>height</key><real>467.71653555</real><key>id</key><string>165x165</string><key>left</key><real>0</real><key>name</key><string>165x165</string><key>printer</key><string> </string><key>right</key><real>0</real><key>top</key><real>0</real><key>width</key><real>467.71653555</real></dict>'

This checks if the key exists:

if defaults read com.apple.print.custompapers 165x165 &> /dev/null; then echo 'the key exists'; fi

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .