Re: Execute Javascript on an HTML file
Re: Execute Javascript on an HTML file
- Subject: Re: Execute Javascript on an HTML file
- From: Emmanuel LEVY <email@hidden>
- Date: Fri, 26 Apr 2013 23:06:51 +0200
Just for the pleasure of chat, won't you have, in addition to trim as you say, to un-QP the stuff?
Best,
Emmanuel
On Apr 26, 2013, at 8:05 PM, Paul Berkowitz wrote:
> 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
_______________________________________________
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