Re: Getting at some Hidden Clipboard Contents
Re: Getting at some Hidden Clipboard Contents
- Subject: Re: Getting at some Hidden Clipboard Contents
- From: kai <email@hidden>
- Date: Fri, 16 Mar 2007 21:51:39 +0000
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
_______________________________________________
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