• 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
Re: XML?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML?


  • Subject: Re: XML?
  • From: Emmanuel <email@hidden>
  • Date: Fri, 12 May 2006 01:22:26 +0200

At 11:06 AM +0100 5/11/06, Ruth Bygrave wrote:
(incidentally, thanks to the people who tried to help with the backup. Nothing is perfect: 'rsync' seems to be difficult unless the user hits the exact magic collection of switches that makes it do what they want; and Smile backup seems to be perfect except for giving Finder a lot of event timeouts,

This is because you're telling Finder to run the "backup" command. Instead, launch the "backup" command from Smile: Smile will be frozen for the time the command runs, but you won't get any timeout problem.


That said, if you prefer to block your Finder rather than Smile, just encapsulate your script with:

with timeout of 86400 seconds -- one day
[your script here]
end

Am also trying to learn about XML, using the Smile osax, and trying to do a simple example list of books. This is difficult as the only tutorial I can find (Smile's example) is a bit difficult to figure out

We do sympathize. If you want us to help, too, you are welcome to describe the problem you are facing.


Every book in the list may or may not have an optional comment element. I've got Applescript to display the items in the list, but I don't know how to get it to 'display comment if there is a comment, otherwise don't'.

You don't tell us enough about what kind of list you are having in the first place, and what you really mean with "display".


If you have to test for the existence of something, sometimes the good way is to use a "try" block. Suppose you are building a string from a list stored as XML. Suppose the <book> element may or may not have a "comment" attribute: <book comment="quite a nice piece of work">. Then the piece of script which would append the comment if there is one to the string you are building could look like:

try
    set theString to theString & XMLGetAttribute theBookNode name "comment"
end try

theString gets augmented if the attribute exists, otherwise the "XMLGetAttribute" command fails silently, and theString remains unchanged.

Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >XML? (From: Ruth Bygrave <email@hidden>)

  • Prev by Date: Re: GUI Scripting Issue
  • Next by Date: Re: Coerce file reference to text
  • Previous by thread: XML?
  • Next by thread: Duplicate item with new name to same folder?
  • Index(es):
    • Date
    • Thread