• 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: How Do I Create class HTML to put on Clipboard?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How Do I Create class HTML to put on Clipboard?


  • Subject: Re: How Do I Create class HTML to put on Clipboard?
  • From: Christopher Stone <email@hidden>
  • Date: Thu, 16 Jun 2016 11:15:11 -0500

On Jun 15, 2016, at 08:11, Shane Stanley <email@hidden> wrote:
Live and learn. My guess:
-- write as html
pb's clearContents()
pb's setString:theHTML forType:"public.html"
-- read as html
set theText to (pb's stringForType:"public.html") as text


Hey Shane,

That works nicely for «class html».  :)

But getting similar text for Safari's «class weba» doesn't:

-------------------------------------------------------------------------------------------
# Prerequisite → Safari content copied to the clipboard.
-------------------------------------------------------------------------------------------
use framework "Foundation"
use framework "AppKit" -- for pasteboard

-- Get the Clipboard
set pb to current application's NSPasteboard's generalPasteboard()

-- Try to read Safari Clipboard as html.

# Fails (of course)
set theHtmlText to (pb's stringForType:"public.html") as text

--> "missing value"

-- Try to read Safari Clipboard as as webarchive.

# Fails
set theWebaText to (pb's stringForType:"com.apple.webarchive") as text

--> "missing value"
-------------------------------------------------------------------------------------------

Is there a slick way around this?

--
Take Care,
Chris

 _______________________________________________
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: How Do I Create class HTML to put on Clipboard?
      • From: Shane Stanley <email@hidden>
References: 
 >How Do I Create class HTML to put on Clipboard? (From: Jim Underwood <email@hidden>)
 >Re: How Do I Create class HTML to put on Clipboard? (From: Christopher Stone <email@hidden>)
 >Re: How Do I Create class HTML to put on Clipboard? (From: Shane Stanley <email@hidden>)
 >Re: How Do I Create class HTML to put on Clipboard? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: How Do I Create class HTML to put on Clipboard?
  • Next by Date: Script Debugger 6 Officially Released
  • Previous by thread: Re: How Do I Create class HTML to put on Clipboard?
  • Next by thread: Re: How Do I Create class HTML to put on Clipboard?
  • Index(es):
    • Date
    • Thread