Plist modification script

Joined
Nov 26, 2007
Messages
5
Reaction score
0
Points
1
Hey all,

I was wondering if anyone knew a way to write a script to change a value of a entry in a plist file.

the file I am trying to modify is

user/library/presences/com.extensis.suitcase.plist

the entry i want to change is

last server

i need to change whatever is there to "usat-vocmac01"

I am pretty new to apple script ( i'm not even sure if apple script is the best way to do this)

any help would be greatly appreciated
 
Joined
Mar 30, 2004
Messages
4,744
Reaction score
381
Points
83
Location
USA
Your Mac's Specs
12" Apple PowerBook G4 (1.5GHz)
Or any text editor (TextEdit, BBEdit, TextWrangler, Smultron...)
 
M

MacHeadCase

Guest
Right you are tech! I had forgotten about that! I can't remember when I had to modify a plist but I did it once: took the idea from a How To of some kind... I think I used TextEdit.
 
OP
C
Joined
Nov 26, 2007
Messages
5
Reaction score
0
Points
1
I think I may have worded my question wrong

I can edit the plist fine on a single machine I have 50 to do so I was wondering if there was a way to automate it

a click here to switch servers.applescript type of deal.
 
Joined
Oct 27, 2005
Messages
4,702
Reaction score
404
Points
83
Are you looking for a script that will run on all 50 machines simultaneously?

Are you trying to change some text here?

I just wondered that if you are using something like TextEdit, then couldn't you just use the "Find/Replace With" in the Edit menu?
 
OP
C
Joined
Nov 26, 2007
Messages
5
Reaction score
0
Points
1
im looking to email the users a script to run.

I didnt think that the plist were texteditable?
 
Joined
Jan 8, 2005
Messages
6,188
Reaction score
254
Points
83
Location
New Jersey
Your Mac's Specs
Mac Pro 8x3.0ghz 12gb ram 8800GT , MBP 2.16 2GB Ram 17 inch.
hmm i am not sure about this but this is what i had to do if I wasn't sure If I could trust people on the network to put the file in the right place:

I would write a plist file yourself, send that in a disk image.. inside the disk image put the file and a alias to the folder where the plist belongs and have make the instructions to drag the file to the folder in the same window, similar to how applications you download install to the applications folder.
 
Joined
Mar 11, 2004
Messages
1,964
Reaction score
175
Points
63
I didnt think that the plist were texteditable?
I would write a plist file yourself. . .
Right-click the plist and choose Open With TextEdit, or whatever.

You could make all plists open with TextEdit or whatever by right-clicking a plist, choosing Get Info, choosing the app you want to open it with, then clicking on Change All (or whatever the wording is) under that. So you could open a plist, change it and Save As.
 
OP
C
Joined
Nov 26, 2007
Messages
5
Reaction score
0
Points
1
im looking to email the users a script to run.

I didnt think that the plist were texteditable?


Right-click the plist and choose Open With TextEdit, or whatever.

You could make all plists open with TextEdit or whatever by right-clicking a plist, choosing Get Info, choosing the app you want to open it with, then clicking on Change All (or whatever the wording is) under that. So you could open a plist, change it and Save As.


again I would really not like to walk to each machine some of which are in different states and do this for each user.

thats why im looking for a way to script it.
 
Joined
Feb 13, 2005
Messages
1,186
Reaction score
73
Points
48
Location
New Orleans, LA, USA
Your Mac's Specs
13" Macbook Pro 2.26Ghz Unibody 4G RAM 160G HDD Superdrive
Terminal:

cat user/library/presences/com.extensis.suitcase.plist | sed 's/last server/usat-vocmac01/' > /tmp/newplist.plist; mv /tmp/newlist.plist user/library/presences/com.extensis.suitcase.plist

Or whatever the text is you want to change. Stupid UNIX tricks and all.

You may need some extra slashes somewhere in there, but that's the basic idea. Stuff that into a bash shell script, and either have cron or something else execute it when you want to.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top