thanks for system attribute has info
thanks for system attribute has info
- Subject: thanks for system attribute has info
- From: trinko <email@hidden>
- Date: Sun, 11 Apr 2004 12:09:25 -0700
Thanks guys. I knew about the Gestalt stuff-- I actually used to
occasionly use the Mac Toolbox before java came out. You're right you
can find lots of stuff with a Google search. In fact i've got an
example of how to use "sysv" to get the system version in a human
readable format. what confused me was the desription in the
dictionary of the has clause "test specific bits of response'. I
assumed it meant that all of the bits in the integer had to match the
bits in the returned value not that if any bit in the integer matched
with the attribute value.
>
>
>
Message: 2
>
Date: Sat, 10 Apr 2004 13:32:54 -0700
>
Subject: Re: has option in system attributes
>
From: "John W. Baxter" <email@hidden>
>
To: <email@hidden>
>
snip
>
>
If I remember correctly, has causes the returned value from system attribute
>
to be treated as a bitmap. The parameter to has is also treated as a bit
>
map, and ANDed with the system attribute value. The result is true if the
>
result of the AND has any 1 bits.
>
>
Thus:
>
(one line)
>
{system attribute "sysv", system attribute "sysv" has 1, system attribute
>
"sysv" has 8, system attribute "sysv" has 9}
>
>
yields the list {4147, true, false, true}
>
since 4147, 1, and 9 all have the low order bit set, but 8 does not.
>
>
Now to look at the dictionary...which seems to agree with my memory.
>
>
4147 decimal is 1033 hex. Half of all integers have the low order bit
>
set...half of the integers which don't have the low order bit set have the
>
next bit leftward set, so even ignoring the other three bits in 1033 hex,
>
3/4 of all integers (in the range of interest) will return true when tested
>
that way against 4147.
>
>
--John
>
>
Date: Sat, 10 Apr 2004 20:01:36 -0400
>
Subject: Re: has option in system attributes
>
From: Bill Cheeseman <email@hidden>
>
To: AppleScript-Users Mail <email@hidden>
>
>
on 2004-04-10 3:37 PM, trinko at email@hidden wrote:
>
>
> I was looking at system attributes and i'm wondering if anyone has a
>
> quick explination for how the has clause works.
>
>
The 'system attribute' command corresponds to what programmers know as the
>
Gestalt command. Here and there on the Web you can find lists of the Gestalt
>
command selectors and bit masks. The selectors are 4-char values. There are
>
hundreds of selectors, some of which recognize bit masks. They're all really
>
very useful.
>
>
As far as I know, 'system attribute' assumes that you know what you're
>
doing. If you send correct values in the parameters, you'll get correct
>
results. Otherwise, all bets are off.
>
>
Go to Google and search for "Mac Gestalt". You'll find lots of interesting
>
stuff.
>
>
In older versions of the Mac OS, this was known as the 'computer' command. I
>
wrote up the change from 'computer' to 'system attribute' in AppleScript 1.6
>
at <http://www.applescriptsourcebook.com/applescript/applescript160.html>.
>
>
--
>
>
Bill Cheeseman - email@hidden
>
Quechee Software, Quechee, Vermont, USA
>
http://www.quecheesoftware.com
>
>
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
>
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
>
--
tom trinko
http://members.aol.com/trinkos/basepage.html
email@hidden
_______________________________________________
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.