Hi there,
(sorry I know I should do a full search but whenever I search I can only access the first page and every page after that has lost the search parameters!)
I am trying to write a script which can write a file to disk, specifically internet connect configurations, which are a type of XML, so its just a flat file.
Is this possible or am I barking up the wrong tree?
Cheers for any help you can give.
JW
Model: Dual 1Ghz G4 Tower
Browser: Firefox 1.5.0.4
Operating System: Mac OS X (10.4)
set fRef to open for access (path to desktop as text) & "myConfigs.txt" with write permission
-- change the path to whatever you have in mind
-- this creates a file if it doesn't exist, opens it if it does
set eof to 0 -- erases the file. If you want to append, don't do it.
write yourStuff to fRef
close access fRef -- Don't forget this!
-- to get it back:
set myConfigs to read (path to desktop as text) & "myConfigs.txt"
You could also use 'do shell script “defaults read …” to write a pref file. See man defaults.
EDIT: if you have the XMLTools scripting addition, you can prepare and parse XML from a script.