#!hs2 ####################################################################### # This Script checks if new mails have arrived for any given # # useraccount. # # This also works if mails are not deleted or even picked up # # i.e. they stay in . # # # # Autor : Daniel Kopp Email: daniel.kopp@bigfoot.de 28.05.2000 # # # # Translated : Markus G. Klötzer 09.05.2001 # # : hamster.resourcez@gmx.co.uk www.hamster.resourcez.com # # # Location : http://home.clara.net/mgk/hsc/newmail.hsc # # # # Usage : runscript( "newmail.hsc" ,false) # # ####################################################################### # # # First called the script creates a file username.mail in the # # Hamster-directory. # # This file containes the numbers of the arriving emails . # # Starting with the second call it checks if there have been any # # additions. If applicable there will be a message box containing # # the Sender and Subject. # # # ####################################################################### # # # Note: any prior version of "username.mail" will be overwritten # # without any scruples! # # # ####################################################################### if (!HamWaitIdle) var ( $namen ) var ( $name ) varset ( $i, 0 ) var ( $k ) var ( $mails ) var ( $read ) var ( $header ) var ( $mail ) var ( $mailcount ) $namen = ListAlloc $mails = ListAlloc $read = ListAlloc ListDirs( $namen, HamPath + "Mails\*." ) while( $i < ListCount( $namen ) ) $name = ListGet( $namen, $i ) $mailcount=0 if ($name!="Mail.Out") ListClear ( $mails ) ListClear ( $read ) $header=chr (13) + chr (10) ListFiles ( $mails, HamPath + "\Mails\" + $name + "\*.msg" ) if (FileExists(HamPath + "\" + $name + ".mail")) ListLoad ($read, HamPath + "\" + $name + ".mail") $k=0 while ($k < ListCount( $mails )) $mail=ListIndexOf ( $read , ListGet ($mails, $k)) if ($mail="-1") if (($mailcount%15=0) && ($mailcount)) MsgBox( "More than " + $mailcount + " new fails for "_ + $name+$header,"New mails for "+$name) $header=chr (13) + chr (10) endif mailfrom(ListGet($mails, $k)) inc ($mailcount) endif inc ( $k ) endwhile if ($mailcount) if ($mailcount=1) MsgBox("one new mail for " + $name+$header,"1 mail for "_ +$name) else if ($mailcount>15) MsgBox( "Additional mail(s) from : "+ $mailcount_ + " new mails for " + $name+$header,_ "New mails for "+$name) else MsgBox( $mailcount + " new mails for " + $name_ + $header,"New mails for "+$name) endif endif endif else MsgBox ("mail-file for " + $name + " created") endif ListSave ( $mails, HamPath + "\" + $name + ".mail") endif inc( $i ) endwhile ListFree ($namen) ListFree ($mails) ListFree ($read) quit sub mailfrom($toread) var ( $text ) var ( $abs ) var ( $subj ) varset ( $index, 0 ) varset ( $fertig, 0 ) $text = ListAlloc if (FileExists(HamPath + "Mails\" + $name + "\" + $toread)) ListLoad($text , HamPath + "Mails\" + $name + "\" + $toread) while (($index