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

Re: Wierdness


  • Subject: Re: Wierdness
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 24 Nov 2015 15:24:13 +1100

On 24 Nov 2015, at 2:33 PM, John C. Welch <email@hidden> wrote:
>
> 	set theResult to (my loadedKextInfoWithIdentifiers:listOfIdentifiers infoKeys:listOfInfoKeys) as record
>
> 	set theKextList to theResult as list --this is necessary, as otherwise, it's still a record of records, and
> 	-- for our needs, a list of records is better.

I'm always wary of doing that. I can see what you're on about, and maybe it doesn't hurt, but if you leave it as a dictionary, then get allKeys, you can loop through the array of keys returned, getting objectForKey:. Something like (code written in Mail):

set theResult to (my loadedKextInfoWithIdentifiers:listOfIdentifiers infoKeys:listOfInfoKeys)
set theKeys to theResult's allKeys()
repeat with aKey in theKeys
set subDict to theResult's objectForKey:aKey
-- do stuff to subDict

> 		if (OSBundleCPUType of theItem as text) is "16777223" then
> 			set OSBundleCPUType of x to "x86_64"
> 			else if OSBundleCPUType of theItem is 16777234 then
> 			set OSBundleCPUType of x to "PPC-64"
> 			else if OSBundleCPUType of theItem is 18 then
> 			set OSBundleCPUType of x to "PPC-32"
> 			else if OSBundleCPUType of theItem is 7 then
> 			set OSBundleCPUType of x to "i386-32"
> 		end

OSBundleCPUType is defined as a CFNumber, which means it becomes an NSNumber. So if you keep subDict as a dictionary, you can use something like:

set theType to subDict's objectForKey:"OSBundleCPUType"
if theType is missing value then
-- handle error
end if
set theType to theType as integer
if theType = 1677223 then
--
else if theType = 167224 then
--

> 		if (OSKernelResource of theItem as text) is "0" then
> 			log "false"
> 			set OSKernelResource of theItem to "false"
> 		else if OSKernelResource of theItem is 1 then
> 			log "true"
> 			set OSKernelResource of theItem to "true"
> 		end if

OSKernelResource is a boolean, so do something similar:

set theType to subDict's objectForKey:"OSKernelResource"
if theType is missing value then
-- handle error
end if
set theType to theType as boolean
if theType = true then
--


--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Wierdness (From: "John C. Welch" <email@hidden>)

  • Prev by Date: Wierdness
  • Next by Date: [ANN] BridgePlus script library 1.3
  • Previous by thread: Wierdness
  • Next by thread: [ANN] BridgePlus script library 1.3
  • Index(es):
    • Date
    • Thread