• 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: comparing and updating lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comparing and updating lists


  • Subject: Re: comparing and updating lists
  • From: julifos <email@hidden>
  • Date: Tue, 21 Jan 2003 16:55:11 +0100

> hiya!
>
> a newbie query about lists:
>
> If I have two lists
>
> list1 {"1","2","3"}
> list2 {"1", "2", "3", "4"}
>
> what i want to do is:
> 1) loop through both lists
> 2) get a list of those items which are in list2 but not in list1
> 3) copy the missing items from list2 to list1
>
> What I eventually want to do is to have a script which checks a
> folder (list2) periodically for newly added files (like "4") and
> copies any newly added files to another folder (list1).
>
> any help or advice or example scripts would be greatly appreciated.
>
> thanx loads for your patience!
>
> bis
> --

A quick sample:

set list1 to {"1", "2", "3"}
set list2 to {"1", "2", "3", "4"}

if list1's length is not equal to list2's length then -- only if needed
repeat with i in list2
if i is not in contents of list1 then set list1's end to i's
contents
end repeat
end if

list1 --> {"1", "2", "3", "4"}

JJ
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
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: Illustrator preferences
  • Next by Date: Re: comparing and updating lists
  • Previous by thread: comparing and updating lists
  • Next by thread: Re: comparing and updating lists
  • Index(es):
    • Date
    • Thread