• 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
AppleScript and XPath query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript and XPath query


  • Subject: AppleScript and XPath query
  • From: Thierry Willemsens <email@hidden>
  • Date: Thu, 19 May 2011 15:03:15 +0200

Hello everybody,

I try to find a solution to run a XPath Query into an AppleScript.

To make my life easier, I've done the beginning with Automator.
1) Get Specified URLs
2) Get Link URLs from WebPages
3) Filter URLs ( because I didn't need some of the links )
4) Display Webpages
5) Run AppleScript

What I need from each page is :
id('textcontent')/x:h4 ==> title
id('textcontent')/x:table[1]/x:tbody/x:tr[2]/x:td ==> address
id('textcontent')/x:table[1]/x:tbody/x:tr[3]/x:td ==> infos 1
id('textcontent')/x:table[3]/x:tbody/x:tr[2]/x:td ==> infos 2

I've done a global query to make things easier.
id('textcontent')/x:h4 | id('textcontent')/x:table[1]/x:tbody/x:tr[2]/x:td | id('textcontent')/x:table[1]/x:tbody/x:tr[3]/x:td | id('textcontent')/x:table[3]/x:tbody/x:tr[2]/x:td

How can I put it into an AppleScript and get the result into TeachText or OpenOffice?

Here is my starting script, for the moment it's not really far but it closes all tabs due to the numbers of pages open in Safari.

tell application "Safari"
	tell front window
		repeat while (count of tabs) is greater than 1
			close tab (count of tabs)
		end repeat
	end tell
end tell

For sure I need a loop before closing each tab but as long as I can't get the Query working I don't know where to start...

I thank you in advance for your answer.

Thierry


 _______________________________________________
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: AppleScript and XPath query
      • From: Emmanuel LEVY <email@hidden>
  • Prev by Date: Re: Import txt file in Excel and set cell options
  • Next by Date: Re: AppleScript and XPath query
  • Previous by thread: another why
  • Next by thread: Re: AppleScript and XPath query
  • Index(es):
    • Date
    • Thread