• 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: Execute Javascript on an HTML file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Execute Javascript on an HTML file


  • Subject: Re: Execute Javascript on an HTML file
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 26 Apr 2013 11:05:44 -0700
  • Thread-topic: Execute Javascript on an HTML file

Title: Re: Execute _javascript_ on an HTML file
As far as I recall, I don't believe that Outlook is any different from Entourage: 'content' of a message is just the plain text version of the message body, never the HTML version of multipart messages (which is what HTML messages are). It certainly can't be a file - it's just text. Are you saying that the message body consists of actual HTML code (copied from an HTML file), rather than an HTML message as such? In that case I guess you could proceed the way you're doing and, like Emmanuel, I wonder what the problem is. But if you're talking about an actual HTML message, you'd have to get the 'source', not the 'content', of the message and first parse it to get only the HTML part of the multipart source, and then proceed to your next steps. You'd have to look for " Content-type: text/html;" and trim what comes before <html>, then continue until </html>.

--
Paul Berkowitz



From: Jim Skibbie <email@hidden>
Date: Fri, 26 Apr 2013 14:12:10 +0000
To: AppleScript-Users <email@hidden>
Subject: Execute _javascript_ on an HTML file

I have a workflow where I'm pulling out the HTML source out of an email with:

tell application "Microsoft Outlook"

set theList to current messages

set theMsgContent to content of item 1 of theList

end tell


The variable
theMsgContent is an HTML file which has some formatted HTML tables in it with data. I would like to execute a chunk of _javascript_ on that HTML to parse out certain data out of it using something like:

document.getElementsByTagName('td');

Short of writing out the HTML file to disk and then opening it in Safari to perform a:

tell application "Safari"

set theResult to do _javascript_ xyz in tab a

end tell


Is there a way to execute _javascript_ code on a file without involving the browser? Ideally, I'd like to do this with some resource that comes with a standard installation of OS software since this script will be distributed across multiple workstations and I don't want to have to maintain a certain environment for the script to be able to run.

Thanks.


_______________________________________________
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
 _______________________________________________
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: Execute Javascript on an HTML file
      • From: Emmanuel LEVY <email@hidden>
References: 
 >Execute Javascript on an HTML file (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Re: Execute Javascript on an HTML file
  • Next by Date: Making a List of Lists
  • Previous by thread: Re: Execute Javascript on an HTML file
  • Next by thread: Re: Execute Javascript on an HTML file
  • Index(es):
    • Date
    • Thread