• 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: Sun, 18 Mar 2007 15:55:57 -0700

>
> On 16 Mar 2007, at 18:46, Bruce Robertson wrote:
>
>> At 4:38 PM -0700 10/2/05, Bruce Robertson wrote:
>>>
>>>>  At 2:33 PM -0700 10/2/05, Todd Geist wrote:
>>>>>
>>>>>  Follow up...
>>>>>
>>>>>  If I try to get the data of the clipboard it looks like this
>>>>>
>>>>>  get the clipboard data as record
>>>>>  -->
>>
>> {«class XMSC»:«data
>> XMSC3C64756D6D793E0A093C5363726970742069643D223122206E616D653D22536372
>> 697074
>> 2220696E636C756465496E4D656E753D2254727565222072756E46756C6C4163636573
>> 733D22
>> 46616C7365223E0A09093C537465702069643D223622206E616D653D22476F20746F20
>> 4C6179
>> 6F75742220656E61626C653D2254727565223E0A0909093C4C61796F75744465737469
>> 6E6174
>> 696F6E2076616C75653D224F726967696E616C4C61796F7574222F3E0A09093C2F5374
>> 65703E
>> 0A093C2F5363726970743E0A3C2F64756D6D793E0A»}
>>
>>>>>  I wish I had a clue what all this means  :<(
>>>>
>>>>  {«class XMSC»:«data
>>>>  XMSC<dummy>    <Script id="1" name="Script" includeInMenu="True"
>>>>  runFullAccess="False">        <Step id="6" name="Go to Layout"
>>>>  enable="True">            <LayoutDestination
>>>>  value="OriginalLayout"/>        </Step>    </Script> </dummy> »}
>>>
>>> Cool, how did you do that?
>>
>> How about back conversion to put it back onto the clipboard? I can
>> get the
>> body of the text converted but how to get it back as {«class
>> XMSC»:«data
>>
>> Kai showed a "run script" technique that worked with shorter
>> segments but it
>> fails with longer strings.
>>
>> Still looking for an answer to this question...
>
> 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

Turns out that it is even easier than I thought but I still wonder about
eliminating the need to read a file. Is there any way to do something like
this:

  Get myVariable as «class XMSC»

Here is the write/read version. System events is used because this is called
from inside Filemaker so otherwise there is a terminology conflict.


-- start script
-- get data from field and put onto cliboard
set xmlsource to get data cell "XML" of current record
set mypath to ((path to temporary items) as text) & "script.txt"
set pxpath to (posix path  of (path to temporary items) ) & "script.txt"

tell application "System Events"
do shell script "echo " & quoted form of xmlsource & " > " & pxpath

set x to (read alias mypath as «class XMSC»)
set the clipboard to x
end tell
-- end script

 _______________________________________________
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: Getting at some Hidden Clipboard Contents
      • From: kai <email@hidden>
References: 
 >Re: Getting at some Hidden Clipboard Contents (From: kai <email@hidden>)

  • Prev by Date: Re: Choose File Crashing Finder
  • Next by Date: Re: System Events scripting of Finder window
  • Previous by thread: Re: Getting at some Hidden Clipboard Contents
  • Next by thread: Re: Getting at some Hidden Clipboard Contents
  • Index(es):
    • Date
    • Thread