realbasic-nug
[Top] [All Lists]

Re: MacAlias

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: MacAlias
From: Thomas Reed <thomasareed at earthlink dot net>
Date: Wed, 27 Feb 2002 15:37:30 -0600
>If I have an alias record read from somewhere in this form:
>
>MacAlias =
>"[...data...]";
>
>can I pass it as a parameter and obtain a folderitem reference, for 
>example using MacAliasRecord plugin by T. Tempelmann?

Sure.  The SetRecord method of the MacAliasRecord class lets you do this.
 Given a string containing the raw alias data, you just pass it to
SetRecord.  However, what you've shown will need a little nudging to get
it in the right form.  You'll need to strip out the "MacAlias = " stuff,
and then translate the numbers.  For example, if your string contains
"00000000", you'll need to translate this into a long integer (4 bytes)
containing the value 0.  If it's "00000741", you'll need to translate
that into a long integer with the value 1857.  Essentially, you translate
every 2 characters into the corresponding byte value, or every 4
characters into a short (2-byte) value, etc.

Probably the way I'd do this is to grab every 2 characters from the alias
data string and translate it to a byte in a MemoryBlock with something
like this:

  mb.byte(i) = val("&h" + twoCharChunk)

where twoCharChunk would go through a sequence of "00", "00", "00", "00",
"01", "46", etc for the sample data you showed.  You can use the mid
function to grab these sequential two-character bits of the string.

Dunno the answer to your other question, though.

-Thomas

Personal web page:                 http://home.earthlink.net/~thomasareed/
My shareware:            http://home.earthlink.net/~thomasareed/shareware/
Pixel Pen web pub. guide: http://home.earthlink.net/~thomasareed/pixelpen/

If it is on fire, it is not a software problem.



<Prev in Thread] Current Thread [Next in Thread>
  • MacAlias, Artur Moniuszko
    • Re: MacAlias, Thomas Reed <=