XML in AppleScript

Hi All,
I am currently attempting to put together an AppleScript that can manipulate the data within an XML file.
I have been reading various web-sites and forums, this looking like the place to be!
My intention is to take the output from FCS “Write XML” function and change the File Name value.

I have got so far as:
on adding folder items to this_folder after receiving added_items
tell application “System Events”
repeat with this_item in added_items
tell contents of XML file this_item
???
end tell
end repeat
end tell
end adding folder items to

My issue is what to put between the “tell contents” action. I would like to replace the File Name with a predefined value “fname”…
Here is a sample of the XML:
<?xml version="1.0"?>





592x333_Test.png




Is this possible? Can somebody help?

KR,
Ben

Welcome to the site.

I have done some XML scripting. Basically, system events is pretty good for reading in XML info but not really for writing out new XML. I have used Late Night software’s XML and XSL scripting additions and they are great. And they are free.

If you want to check them out:
http://www.latenightsw.com/freeware/

Without the scripting additions, you will most likely end up formatting your new XML in the script and writing out a text file. It works but is a bit clunky.

Model: PowerPC G5 Tower OS 10.4.9
AppleScript: XCode 2.5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi,
Thanks, I’ll give it a go… Looks like a long read of the online documentation is in order!
I’ll update my post with my progress as and when, if anybody wants to post a few example scripts in the interim it would be much appreciated.

KR,

Ben