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

Doubling issue


  • Subject: Doubling issue
  • From: "John C. Welch" <email@hidden>
  • Date: Wed, 03 Aug 2011 19:06:39 -0400
  • Thread-topic: Doubling issue

So, running on 10.7, I'm building a table. The main subroutine is here:

on loadLocalUsers()

          set my localUsersAndGroupsData to {}

          log (length of localUsersAndGroupsData as text)

         try

               set theRawLocalUsers to do shell script "/usr/bin/dscl  . -list /Users UniqueID"

               set theRawLocalUsers to every paragraph of theRawLocalUsers

               repeat with x in theRawLocalUsers

                    --log (contents of x as text)

                    set theTextItems to every word of x

                    if (item 2 of theTextItems as integer) ≥ 500 then

                         log (theTextItems as text)

                         set the end of my localUsersAndGroupsData to {userName:(item 1 of theTextItems), userID:(item 2 of theTextItems), isUser:"User"}

                    end if

               end repeat

               log (length of localUsersAndGroupsData as text)

               set theRawLocalGroups to do shell script "/usr/bin/dscl  . -list  /Groups PrimaryGroupID" --get local groups

               set theRawLocalGroups to every paragraph of theRawLocalGroups

               repeat with x in theRawLocalGroups

                    set theTextItems to every word of x

                    if (item 2 of theTextItems as integer) ≥ 500 then

                         log (theTextItems as text)

                         set the end of my localUsersAndGroupsData to {userName:(item 1 of theTextItems), userID:(item 2 of theTextItems), isUser:"Group"}

                    end if

               end repeat

              log (length of localUsersAndGroupsData as text)

              

               tell theArrayController --load data into the table

                    removeObjects_(arrangedObjects())

                    addObjects_(localUsersAndGroupsData)

               end tell

              

               --log (length of localUsersAndGroupsData as text)

               on error errorMessage number errorNumber

               display dialog errorMessage & " " & (errorNumber as text)

          end try

     end loadLocalUsers



The table view is bound to an array controller, and each column is bound to the appropriate record fields. When I look at the log statement results, I see what I expect to see. 

The problem is when it hits the table view, there's twice the amount of entries, like It's writing localUsersAndGroupsData twice. There are no errors generated, so I'm not exactly sure as to what's going wrong.



-- 
Head wounds do tend to bleed a lot. Don’t panic.

 _______________________________________________
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

  • Follow-Ups:
    • Re: Doubling issue
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Grabbing the current URL of a webview
  • Next by Date: Re: Doubling issue
  • Previous by thread: Re: Grabbing the current URL of a webview
  • Next by thread: Re: Doubling issue
  • Index(es):
    • Date
    • Thread