• 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: Getting at some Hidden Clipboard Contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting at some Hidden Clipboard Contents


  • Subject: Re: Getting at some Hidden Clipboard Contents
  • From: Bruce Robertson <email@hidden>
  • Date: Sat, 17 Mar 2007 13:18:02 -0700

> Hi Bruce. I guess what we need to do here is break up the text into
> chunks that aren't way too long, dude.
>
> Using the 'run script' method, we could then convert each chunk into
> XMSC data and write the results to a temporary file. Finally, we
> should be able to read the accumulated data from the file as «class
> XMSC».
>
> Watch out for line wraps (particularly those containing lengthy data):
>
> --------------------------
>
> on text_chunks from t by n
> set c to count t
> if c ¾ n then return {t}
> set l to {}
> tell n - 1 to repeat with i from n to c by n
> set l's end to t's text (i - it) thru i
> end repeat
> if i < c then set l's end to t's text (i + 1) thru c
> l
> end text_chunks
>
> set text_data to
> "3C64756D6D793E0A093C5363726970742069643D223122206E616D653D2253637269707
> 42220696E636C756465496E4D656E753D2254727565222072756E46756C6C41636365737
> 33D2246616C7365223E0A09093C537465702069643D223622206E616D653D22476F20746
> F204C61796F75742220656E61626C653D2254727565223E0A0909093C4C61796F7574446
> 57374696E6174696F6E2076616C75653D224F726967696E616C4C61796F7574222F3E0A0
> 9093C2F537465703E0A093C2F5363726970743E0A3C2F64756D6D793E0A"
>
> set XMSC_file to (path to temporary items as Unicode text) & "XMSC.dat"
> set XMSC_ref to open for access XMSC_file with write permission
> set eof XMSC_ref to 0
> repeat with data_chunk in (text_chunks from text_data by 254)
> write (run script "«data XMSC" & data_chunk & "»") to XMSC_ref
> end repeat
> close access XMSC_ref
> set the clipboard to (read file XMSC_file as «class XMSC»)
>
> -- check the result:
> the clipboard data as record
>
> --> {«class XMSC»:«data
> XMSC3C64756D6D793E0A093C5363726970742069643D223122206E616D653D2253637269
> 70742220696E636C756465496E4D656E753D2254727565222072756E46756C6C41636365
> 73733D2246616C7365223E0A09093C537465702069643D223622206E616D653D22476F20
> 746F204C61796F75742220656E61626C653D2254727565223E0A0909093C4C61796F7574
> 44657374696E6174696F6E2076616C75653D224F726967696E616C4C61796F7574222F3E
> 0A09093C2F537465703E0A093C2F5363726970743E0A3C2F64756D6D793E0A»}
>
> --------------------------
>
> ---
> kai

OK. And thanks! But why write to a temp file? Can't this just be done in
memory?

 _______________________________________________
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

References: 
 >Re: Getting at some Hidden Clipboard Contents (From: kai <email@hidden>)

  • Prev by Date: How to set user interaction to non in Indesign CS2?
  • Next by Date: Can you run Ruby Scripts via get shell?
  • Previous by thread: Re: Getting at some Hidden Clipboard Contents
  • Next by thread: Re: Getting at some Hidden Clipboard Contents
  • Index(es):
    • Date
    • Thread