• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
XML Editing - set Value with System Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML Editing - set Value with System Events


  • Subject: XML Editing - set Value with System Events
  • From: "email@hidden" <email@hidden>
  • Date: Sun, 08 Apr 2012 10:01:49 +1000


Hi I am trying to modify  an element value in an XML.
I am using the base script below but the value is not being written to the file.

Any help would be most appreciated.

Regards,
Adrian

Sample.xml

<?xml version="1.0" encoding="UTF-8" ?>
<ImageTransformList>
<MediaRef>/media/dbone/Left/18_01/1920x1080/12345.tiff</MediaRef>
<RefId>12345.tiff</RefId>
</ImageTransformList>


Applescript:

set currentFile to "Users:doglight:Desktop:Sample.xml"

set theXMLa to POSIX path of (currentFile)

tell application "System Events"
set theXMLb to XML file theXMLa
tell contents of theXMLb
set hello to "3"

set (value of XML element "MediaRef" of XML element "ImageTransformList" of XML file theXMLb) to hello

end tell

end tell
 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: XML Editing - set Value with System Events
      • From: Luther Fuller <email@hidden>
    • Re: XML Editing - set Value with System Events
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: AppleScript-Users Digest, Vol 9, Issue 147
  • Next by Date: Re: XML Editing - set Value with System Events
  • Previous by thread: Re: AppleScript-Users Digest, Vol 9, Issue 147
  • Next by thread: Re: XML Editing - set Value with System Events
  • Index(es):
    • Date
    • Thread