• 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: Updating Mail 1.2 database
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating Mail 1.2 database


  • Subject: Re: Updating Mail 1.2 database
  • From: "Arthur J. Knapp" <email@hidden>
  • Date: Wed, 02 Oct 2002 16:42:34 -0400

> Date: Wed, 2 Oct 2002 14:00:25 -0400
> Subject: Re: Updating Mail 1.2 database
> From: Jeff Porten <email@hidden>

> Alternately, you could keep a master list within AppleScript of the
> messages that have been moved, and check against that. I'm thinking of
> a list of booleans, where item i of the boolean list is set to true
> when item i of the mail list is moved. Then write it so your script
> moves on when a message has already been handled.


Wow, I must really be bored ;-)


on newBooleanLookup(booleanLabels, initialBooleanState)

script BooleanLookup

property userList : booleanLabels
property boolList : {}

on IsTrueOf(v)
set i to my __index(v)
if (i = 0) then
return false
else
return true = my boolList's item i
end if
end IsTrueOf

on IsTrueAt(i)
try
return true = my boolList's item i
on error
return false
end try
end IsTrueAt

on SetTruthOf(v, b)
set i to my __index(v)
if (i = 0) then
set my userList's end to v
set my boolList's end to b
else
return true = my boolList's item i
end if
end SetTruthOf

on SetTruthAt(i, b)
try
set my boolList's item i to b
on error m number n
"BooleanLookup : SetTruthAt(i,b) : i"
result & return & return & m
error (result) number n
end try
end SetTruthAt

on __index(v)
tell (my userList) to if (it contains {v}) then
set i to 1
repeat until (item i = v)
set i to i + 1
end repeat
return i
else
return 0
end if
end __index

end script

tell BooleanLookup to repeat (it's userList's length) times
set it's boolList's end to initialBooleanState
end repeat

return BooleanLookup

end newBooleanLookup

set yesNoQuestions to {"Raining?", "Sunny?", "Hot?"}

set eternalTruths to newBooleanLookup(yesNoQuestions, false)

tell (eternalTruths)

IsTrueOf("Raining?") --> false
IsTrueOf("Sunny?") --> false
IsTrueOf("Hot?") --> false

IsTrueAt(1) --> false
IsTrueAt(2) --> false
IsTrueAt(3) --> false

IsTrueAt(4) --> also false, non-existence

SetTruthOf("Sunny?", true)
IsTrueOf("Sunny?") --> true

SetTruthOf("Snowy", true) --> creates new entry
IsTrueOf("Snowy") --> true

end tell

{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
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: Horrible bugs in Address Book
  • Next by Date: Re: What means this?
  • Previous by thread: Re: Updating Mail 1.2 database
  • Next by thread: how run CGI perl script offline with OS X?
  • Index(es):
    • Date
    • Thread