• 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: accessing raw data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing raw data


  • Subject: Re: accessing raw data
  • From: julifos <email@hidden>
  • Date: Tue, 08 Jul 2003 10:16:40 +0200

> SUBJECT CHANGE BY O.P.
>
> original subject: 24U 'post notification'
> new subject: Accessing Raw Data
>
>
> On or about 7/7/03 7:59 AM, julifos wrote:
>
>> (somebody with a more complete explaining of *data*?)
> <clip>
>> ________________
>> * brief info, ASLG, page 120
>
> Okay, I didn't definitively answer my own question, but I think the answer
> is: No, one can not access any of the literal returned result of class data.
>
> Granted that I may not be seeing the forest for the trees, can I not, taking
> JJ's example of:
>
> "k" as C string
> --> <<data cstr6B00>>
>
> ...and, being given only <<data cstr6B00>>, go backward, to determine that
> this data is a 'cstr' with a value of '6B00' ?

If you are really interested in the contents of a data value, you can
allways ask for its class:

class of <<data NMrc6B000000>>
--> notification
class of <<data cstr6B00>>
--> C string

But if we're talking about a unknown data type...

class of <<data unkn5478>>
--> <<class unkn>>

To explore the contents of a data value, you must know *how* does it work.
In the given example "C string", you must know that it is
some-text-followed-by-a-null, which is the key for the "way to go":

######################################
try
<<data cstr6B00>> * 5
on error msg
set dataStringIzed to text (offset of "<<" in msg) thru (offset of ">>"
in msg) of msg
end try

set hexData to text 11 thru -4 of dataStringIzed
set nullValue to text -3 thru -2 of dataStringIzed
set asciiIzeHexData to my hextoString(hexData)
{hexData, nullValue, asciiIzeHexData}

to hextoString(hexData) --> routine quick to type, not to run
set z to ""
repeat with i from 1 to hexData's length by 252
try
set z to z & (run script "<<data cstr" & [BREAK]
text i thru (i + 251) of hexData & "00>> as string")
on error
set z to z & (run script "<<data cstr" & [BREAK]
text i thru -1 of hexData & "00>> as string")
end try
end repeat
z
end hextoString
######################################

But this code won't be valid for Unicode data or "notification" data. Eg:

<<data utxt20AC>> --> unicode euro symbol

You see that there are no longer null values, since Unicode data has its own
"way-to-go" (1 character = 2 bytes); as well as the "notification" data,
which probably will end in a number, rather than text.

So, you can only access a data value coercing it to string (there are
several ways), but it is not useful, unless you know the how-to of the data.

Cheers,

<<data utxt006A006A>>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Creator type of packaged app bug?
  • Next by Date: Re: Get a list of applications
  • Previous by thread: Re: iChat AV Scripting
  • Next by thread: Thanks a lot for your help
  • Index(es):
    • Date
    • Thread