Aide pour un script !!!

cs_topdollar Messages postés 4 Date d'inscription jeudi 29 juillet 2004 Statut Membre Dernière intervention 2 janvier 2005 - 1 janv. 2005 à 13:18
J4Gu4R Messages postés 385 Date d'inscription samedi 7 août 2004 Statut Membre Dernière intervention 3 juillet 2007 - 3 janv. 2005 à 17:22
voici un script tres interressant pour fserve , il fonctionne comme autoget de omenserve mais avec les file server , il est tres bien concu , sauf que j'ai un petit probleme ;lorseque j'utilise la fonction autoget , le download ne coommence pas , normalement quand la fenetre de status s'ouvre , le script envoie le trigger et commence le telechargement , mais rien de ca ne se produit , alors si qqn sy' connaissant en scipting pouvais m'aider parceque je suis novice dans le domaine !!merci d'avance !!!!!!!!! kml p.s: avant d'ouvrir le script il faut creer un dossier nommé "leech" dans le repertoir mirc !!!!!on *:LOAD: { echo 4 -s Entered on Start unset all set %leechin.no.no $addtok(%leechin.no.no,Chanserv,32) ; chanserv is the bot that monitors irc channels s set %leechstatus on set %autoget off set %eggie on ; eggie is whether the exclude list is on or not set %mqflag 0 set %maxqueflag 0 set %crashflag 0 set %totsqcnt 0}alias leech.light { echo 4 -s Entered alias leech.light if ($1 == on) { return [ON] } else { return [off] }}; alias delay { old delay system worked but took up all the cpu time. Uses the system clock to try to; set %counter 0 make a delay timer in seconds. /timer allows the cpu to multitask but doesn't halt the program. ; set %time $time(s); :point; set %time2 $time(s); If (%time != %time2) {; inc %counter; echo -s %counter; set %time %time2; }; If (%counter = %input) { goto end }; goto point; :end; echo -s exiting!; unset %counter %time %time2 %input; }menu Menubar { autoget $leech.light(%leechstatus) .:{ if (%leechstatus == OFF) { set %leechstatus ON } else { set %leechstatus OFF } } . $leech.light(%eggie) ..: { if (%eggie == off) { /set %eggie on } else { /set %eggie off } } ..- ..add $leech.menu.nick :{ if ($snick(#,1) != $null) { set %leechin.no.no $addtok(%leechin.no.no,$snick(#,1),32) } elseif ($active !ischan) { set %leechin.no.no $addtok(%leechin.no.no,$active,32) } else { set %leech.add $?="Nick to exclude" | set %leechin.no.no $addtok(%leechin.no.no,%leech.add,32) | unset %leech.add } } ..remove $leech.menu.nick :{ if ($snick(#,1) != $null) { set %leechin.no.no $remtok(%leechin.no.no,$snick(#,1),32) } elseif ($active !ischan) { set %leechin.no.no $remtok(%leechin.no.no,$active,32) } else { set %leech.add $?="Nick to exclude" | set %leechin.no.no $remtok(%leechin.no.no,%leech.add,32) | unset %leech.add } } ..- ..list :{ /leechnolist } .Load Leech File:{ set %leefile $dir="Choose Leech File (Cancel = None)" leech\*.lee if (%leefile != $null) { echo -s Loading Leech file %leefile ;Extract the Nick from the file set %WrkNick $readini -n %leefile Settings Nick set %WrkChan $readini -n %leefile Settings Channel if (%WrkNick !ison %WrkChan) { echo -s User %WrkNick is not on Channel %WrkChan , aborting load } else { unset % [ $+ [ %WrkNick ] $+ ] * set %autoget ON set % [ $+ [ %WrkNick ] $+ ] -LeechFile %leefile set % [ $+ [ %WrkNick ] $+ ] -bNextCase $true set % [ $+ [ %WrkNick ] $+ ] -bDirOnly $true set % [ $+ [ %WrkNick ] $+ ] -bLoggedIn $false set % [ $+ [ %WrkNick ] $+ ] -CurEvent 1 ; was -1 echo -s Leech file loaded for %WrkNick enable-al-timer %WrkNick run-al-timer %WrkNick 30 echo -s autoget for %WrkNick is now ON } unset %WrkChan unset %WrkNick } unset %leefile }}alias leechnolist { echo 4 -s Entered alias leechnolist window -c @Leech-no-no /window -aolpk +bt @Leech-no-no 248 4 200 240 @Leech-no-no set %leechin.no.total $numtok(%leechin.no.no,32) if (%leechin.no.total == 0) { window -c @Leech-no-no } set %leechin.no.cur 0 :leechcycle inc %leechin.no.cur if (%leechin.no.cur > %leechin.no.total) { goto itstheendoftheroadmyfriend } if ($gettok(%leechin.no.no,%leechin.no.cur,32)) { aline @Leech-no-no -> $gettok(%leechin.no.no,%leechin.no.cur,32) goto leechcycle } :itstheendoftheroadmyfriend aline @Leech-no-no Double Click to remove from list unset %leechin.no.total %leechin.no.cur}menu @Leech-no-no { dclick: { set %remove.leech $sline($active,1).ln set %leechin.no.no $remtok(%leechin.no.no,%remove.leech,32) /leechnolist unset %remove.leech } Add:{ set %leech.add $?="Nick to exclude" | set %leechin.no.no $addtok(%leechin.no.no,%leech.add,32) /leechnolist unset %leech.add }}alias leech.menu.nick { echo 4 -s Entered alias leech.menu.nick if ($snick(#,1) != $null) { return $remove($snick(#,1),nu.nick) } elseif ($active !ischan) { return $remove($active,nu.nick) } else { return nick }}on *:CHAT:*:{ echo 4 -s entered On Chat :forcechat ; ---------------------------------- Got a Closing window response ---------------------------------------- ; set %lname $len($gettok($1-,1,32)) ; get the length of the nick's name out of the line ; set %lname %lname + 1 ; add the space to the length ; if ($pos($1-,closing) > %lname || $pos($1-,idle) > %lname) { ; msg = [ $+ [ $Nick ] ] c ; send the window a c to keep the window open ; } ; ----------------------------------------------------------------------------------------------------------- if (%leechstatus == ON || %autoget == ON) { ; were coming in from the autoleech startup. If the script is active either way do it. ; or we are coming in from the get command in the autoget-file procedure if ($findtok(%leechin.nicks, $nick, 32) != $null) { if ($findtok(%leechin.no.no, $nick, 32) == $null || %eggie == off) { if (['C' for more, 'S' to stop] isin $1-) { ; were stopped so do a dir .msg =$nick Dir | halt } else { inc % [ $+ [ $nick ] $+ ] -leechin ; if $window( [ @Autoget [ $+ [ $nick ] ] leechin [ $+ [ $nick ] ] ] != $null ) { aline [ @Autoget [ $+ [ $nick ] ] leechin [ $+ [ $nick ] ] ] $1- sline [ @Autoget [ $+ [ $nick ] ] ] [ % [ $+ [ $nick ] $+ ] -leechin ] ; add the new line from the fserv into our autoget window and select it. ; ------------------------- CD\ Code -------------------------------------------------- set %getline 0 if (%cdflag == 1) { ; yes, we did a cd\ so trigger this code set %jack $line($active,0) ; get the number of lines in the window sline $active %jack ; make sure the last line is selected set %getline $strip($sline($active,1)) set %placehold $pos(%getline,$chr(32)) inc %placehold ; get over one to get rid of the space char. set %fdir $mid(%getline,%placehold,2) ; get the first 2 characters after the first space, is it a [\ ? Yes, so this line has a directory in it. set %fdiryes $mid(%getline,%placehold,3) ; get the first three characters, are they [\] ? Yes, we are at the root. if (%fdir == [\) { set %dirline 1 } ; set the directory flag if (%dirline == 1 && %fdiryes != [\]) { msg = $+ $remove($active,@Autoget) CD.. set %dirline 0 } ; if its a directory line but not the root, we issue a cd.. again because were not to the root yet. ; reset the directory flag for the next line coming in. We want to check every line for directory. if (%dirline == 1 && %fdiryes = [\]) { msg = $+ $remove($active,@Autoget) DIR ; send the directory command to the window set %cdflag 0 ; close the door on our way out! } ; Were there! now shut it down till next time cd\ ; if not, then we sail out of the on chat dialogue and wait for the next chat line to trigger it again. ; so the incoming lines themselves are the loop. Multitasking :) the program is free to go on and no cpu time is wasted. ; first cd.. will trigger the on chat dialogue and the cdflag 1 will enable it. } ; ---------------------------- End CD\ Code -------------------------------------------------------- if (%autoget == ON && % [ $+ [ $nick ] $+ ] -bNextCase == $true) { ; bnextcase is true when we are coming in from the autoget get which will send us back throught autoget-case and autoget-file for the response check if (% [ $+ [ $nick ] $+ ] -bDirOnly == $true && ($pos($1-, [\) > 0) && ($pos($1-, ]) > 0)) { /autoget-case $nick } elseif (% [ $+ [ $nick ] $+ ] -bDirOnly == $false) { /autoget-case $nick } } ;} } } } } }on *:open:=:{ echo 4 -s Entered On Open Fserv ; on opening of the fserv window if (%leechstatus == ON || %autoget == ON) { ; if we have set the script active in commands or we have clicked autoget in the menu if ($findtok(%leechin.no.no, $nick, 32) == $null || %eggie == off) { ; if the nick is not in the exclude list or we have the exclude list turned off set %leechin.nicks $addtok(%leechin.nicks,$nick,32) ; add the nick to the list of people who we are currently leeching from window -lk @Autoget [ $+ [ $Nick ] ] @Leechin ; ---------------- open the autoleech window -------------------------- /titlebar @Autoget [ $+ [ $Nick ] ] (Autoget 1.0) by Blade / Logan6 ; set the title in the titlebar set % [ $+ [ $nick ] $+ ] -leechin 0 if (% [ $+ [ $nick ] $+ ] -bSentTrigger != $true) { .msg =$nick Dir } halt } }}on *:CLOSE:@Autoget*: { echo 4 -s Entered On Close @Autoget set %leechin.nicks $remtok(%leechin.nicks , $remove($active,@Autoget) , 32) unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -leechin* unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bLoggedIn unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bSentTrigger msg = [ $+ [ $remove($active,@Autoget) ] ] exit}on *:CLOSE:=:{ echo 4 -s Entered On Close Fserv if ($findtok(%leechin.nicks, $nick, 32) != $null ) { ;if ($pos($active, @Autoget) > 0) { if (%leechstatus == ON || %autoget == ON) { unset % [ $+ [ $nick ] $+ ] -leechin* unset % [ $+ [ $nick ] $+ ] -bLoggedIn unset % [ $+ [ $nick ] $+ ] -bSentTrigger window -c @Autoget [ $+ [ $Nick ] ] /close -c $Nick } ;} set %leechin.nicks $remtok(%leechin.nicks,$nick,32) }}Menu @Leechin { dclick { set %fserve.line $strip($sline($active,1)) if ($pos(%fserve.line,$chr(32)) > 0) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %leecher.name $remove($active,@Autoget) if (%fserve.line === $upper(%fserve.line)) { msg = $+ %leecher.name cd %fserve.line | msg = $+ %leecher.name dir } else { if (%fserve.line == ..) { msg = $+ %leecher.name CD.. | /msg = $+ %leecher.name DIR } set %fserve.tmpa $wildtok(%fserve.line,*.??,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) } if (%fserve.tmpa == $null) { msg = $+ %leecher.name cd %fserve.line | msg = $+ %leecher.name dir } else { set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file get set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end msg = $+ %leecher.name %fserve.file unset %fserve.tmp %fserve.tmp2 %fserve.file %fserve.tmpa } } unset %leecher.name } unset %fserve.line } - ; Autoget Menu item Autoget: { echo 4 -s Entered Menu Autoget ; ----------------- Heres where we start the autoget ---------------------------------------- echo 5 -s ***************** STARTED NEW AUTOGET ************************************************ set %filenum 0 unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bNextCase ; lets create a leech file called leech var %searchleech = 0 :searchleechloop inc %searchleech var %leechfile = leech\ $+ [ leech [ $+ [ %searchleech ] ] ] $+ .lee ; above line is where the leech directory\leechfile name is created and stored in %leechfile ; check if the file already exists and if so delete it if ($exists(%leechfile) == $true) { goto searchleechloop } ; Lets test if we can write the leech file or not ; You should have created a /leech directory under mirc. So mirc/leech. writeini %leechfile Settings LeechInfo This Leech file was created with Logan6's autoget if ($exists(%leechfile) == $false) { echo -s Unable to create Leech Configuration File : %leechfile goto select-end } set % [ $+ [ $remove($active,@Autoget) ] $+ ] -LeechFile %leechfile ; --------------------- start the sort loop ---------------------------------------------------- :selloop set %worknum %filenum + 1 ; here we start stripping the filenames out of the lines and putting them into the leech file. set %fserve.line $strip($sline($active,%worknum)) if (%fserve.line == $null) { goto selend } if ($pos(%fserve.line,$chr(32)) > 0) { set %xx $numtok(%fserve.line,32) dec %xx ; get the total number of tokens in the line ; and then get the next to last one which will be the number (last is kb or mb) set %numvar [ $+ [ %worknum ] ] $gettok(%fserve.line,%xx,32) ; get the byte number into numvar[worknum] inc %xx ; reset xx to the last token if ($gettok(%fserve.line,%xx,32) == mb) { set %numvar [ $+ [ %worknum ] ] [ %numvar [ $+ [ %worknum ] ] * 1000 ] } ; if the number is in megabytes, multiply it by a 1000 to get kilobytes set %fserve.line $mid(%fserve.line, $pos(%fserve.line ,$chr(32))+1, $len(%fserve.line)) ; get rid of the nick set %fserve.tmpa $wildtok(%fserve.line,*.??,1,32) ; get the extension out of the line if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) } ; if its just two characters still get it, like for .rm files (real player) set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) ; get the position of the extension out of the line set %fserve.tmp2 0 set %fserve.tmp5 $gettok(%fserve.line,0,32) ; return how many spaces there are in the line if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } ; if none set it to a ridiculous number unset %fserve.file :sortloop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } ; if the position of the extension is less than one or the number of spaces in the line is less than one get out of the loop set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) ; goto sortloop :end inc %filenum set %fserve.file [ $+ [ %worknum ] ] %fserve.file echo 2 -s %fserve.file [ $+ [ %worknum ] ] ; write the filename into the fserv.file array } goto selloop :selend ; ------------------ got the array filled, now begin the sort ( straight selection sort ) ---------- set %current 1 dec %worknum while (%current < %worknum ) { set %smallest $mindex(%current, %worknum) set %swaptemp %numvar [ $+ [ %current ] ] set %swapfile %fserve.file [ $+ [ %current ] ] set %numvar [ $+ [ %current ] ] %numvar [ $+ [ %smallest ] ] set %fserve.file [ $+ [ %current ] ] %fserve.file [ $+ [ %smallest ] ] set %numvar [ $+ [ %smallest ] ] %swaptemp set %fserve.file [ $+ [ %smallest ] ] %swapfile set %current %current + 1 } ; --------------------- sort done, put the names in the leech file ------------------------------------------ set %number 1 :select-loop if (%fserve.file [ $+ [ %number ] ] == $null) { goto select-end } writeini %leechfile Files File $+ %number %fserve.file [ $+ [ %number ] ] inc %number ; write the filename into the appropriate place in the leech file goto select-loop :select-end ; if we have added some files then save the rest of the details if (%filenum > 0) { ; save the settings that we have writeini %leechfile Settings Nick $remove($active,@Autoget) writeini %leechfile Settings TotalFiles %filenum ; now ----------- get the current directory through the autoget-case system ------------------ set %autoget ON set % [ $+ [ $remove($active,@Autoget) ] $+ ] -bNextCase $true set % [ $+ [ $remove($active,@Autoget) ] $+ ] -bDirOnly $true ; unset the variables just in case something bad happened last time unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -CurEvent unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -status unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bLoggedIn unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bSentTrigger unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -CurFileNum msg = $+ $remove($active,@Autoget) dir ; so here we are going to trigger the on CHAT function by cd ( which will show the directory) ; had to change to dir because cd does not always bring up the dir on the servers, then you have to use string functions ; to get rid of the *.* out of the directory line } unset %leechfile %filenum %fserve.line %worknum %fserve.tmp %fserve.tmp2 %fserve.file %fserve.tmpa %number set %number 1 :unloop if (%fserve.file [ $+ [ %number ] ] == $null) { goto unend } unset %fserve.file [ $+ [ %number ] ] inc %number goto unloop :unend } - Queue selected: { echo 4 -s Entered Menu Queue Selected set %fserve.line $strip($sline($active,1)) if ($pos(%fserve.line,$chr(32)) > 0) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.????,1,32) } set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file queue set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end msg = $+ $remove($active,@Autoget) %fserve.file unset %fserve.tmpa %fserve.tmp %fserve.tmp2 %fserve.file } unset %fserve.line } Get selected: { echo 4 -s Entered Menu Get Selected set %linenum 1 set %x 1 set %num 0 :getloop set %fserve.line $strip($sline($active,%linenum)) if (%fserve.line != $null) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %fserve.tmpa $wildtok(%fserve.line,*.??,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) } set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file get set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end timer $+ %x 1 %num msg = $+ $remove($active,@Autoget) %fserve.file inc %linenum if (%x == 1) { set %num %num + 1 } ; want instant at first, but then make up for it so we can still get 2 seconds at least next inc %x set %num %num + 2 ; was set %num %num + $rand(2,12) to make it random between 2 and 12 but was getting to long ; set %input 1 old delay system worked but took up all the cpu time, no multitask ; /delay old delay system as above, timer on line 335 works much better and lets cpu multitask. unset %fserve.tmpa %fserve.tmp %fserve.tmp2 %fserve.file %fserve.line goto getloop } unset %linenum %input %x %num } Read: { echo 4 -s Entered Menu Read set %fserve.line $strip($sline($active,1)) if ($pos(%fserve.line,$chr(32)) > 0) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.????,1,32) } set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file read set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end msg = $+ $remove($active,@Autoget) %fserve.file unset %fserve.tmpa %fserve.tmp %fserve.tmp2 %fserve.file } unset %fserve.line } - Stats: { msg = $+ $remove($active,@Autoget) STATS } Dir: { msg = $+ $remove($active,@Autoget) DIr } Sends { msg = $+ $remove($active,@Autoget) sends } Queues: { msg = $+ $remove($active,@Autoget) queues } Who: { msg = $+ $remove($active,@Autoget) who } CD..: { msg = $+ $remove($active,@Autoget) CD.. msg = $+ $remove($active,@Autoget) DIR } CD\: { set %cdflag 1 set %dirline 0 msg = $+ $remove($active,@Autoget) CD.. } Exit: { msg = $+ $remove($active,@Autoget) exit } - Continue_Msg: { msg = $+ $remove($active,@Autoget) C } Stop_Msg: { msg = $+ $remove($active,@Autoget) S } Command: { msg = $+ $remove($active,@Autoget) $?="message" }}Menu @autogetin { - Exit: { msg = $+ $remove($active,@autogetin) exit }}; ****************************************************************; This alias is the main autoget script and is triggered from ; the autoget menu; ****************************************************************; Parameters passed :; $1 = Leech Nick; Variables Used :; %-CurEvent = Current Event to be processed ; ****************************************************************alias autoget-case { echo 4 -s Entered alias Autoget-case If (% [ $+ [ %WrkNick ] $+ ] -CurEvent == $null) { echo 14 -s Current Event is Null } else { echo 14 -s Current Event is % [ $+ [ %WrkNick ] $+ ] -CurEvent } ; coming in from the on CHAT function ; This is basically like a big case statement to get triggered events ; for the autoget process if ($1 != $null) { set %WrkNick $1 echo -s Entered autoget-case for Nick : %WrkNick if (% [ $+ [ %WrkNick ] $+ ] -CurEvent == $null) { ; if we are just starting go ahead, otherwise go to the appropriate Event Level (its a big if statement) ; we need to get the directory and save it in the config file var %leechfile = % [ $+ [ %WrkNick ] $+ ] -LeechFile var %wrkline = $sline(@Autoget [ $+ [ %WrkNick ] ] ,1) %wrkline = $mid(%wrkline, $pos(%wrkline,$chr(32))+1, $len(%wrkline)) if ($pos(%wrkline,$chr(91)) > 0 && $pos(%wrkline,$chr(93)) > 0) { ; ------------- lets get the directory line ------------------------------ ; we need to go through all this bullshit to cut a line, what a crock! var %pos1 = $pos(%wrkline,$chr(91)) ;var %pos2 = $pos(%wrkline,$chr(93)) var %pos2 = $len(%wrkline)-%pos1 inc %pos1 dec %pos2 var %pos3 = %pos2 %pos3 = %pos3 - %pos1 inc %pos3 set % [ $+ [ %WrkNick ] $+ ] -Directory $mid(%wrkline, %pos1, %pos3) ; check if the directory has a \ at the start if ($mid(% [ $+ [ %WrkNick ] $+ ] -Directory , 1, 1) == \ || $mid(% [ $+ [ %WrkNick ] $+ ] -Directory , 1, 1) == / && % [ $+ [ %WrkNick ] $+ ] -Directory != / && % [ $+ [ %WrkNick ] $+ ] -Directory != \) { set %pos1 $len(% [ $+ [ %WrkNick ] $+ ] -Directory) dec %pos1 var %workdir = % [ $+ [ %WrkNick ] $+ ] -Directory % [ $+ [ %WrkNick ] $+ ] -Directory = $mid(%workdir , 2, %pos1) var %tempdir = $mid(%workdir , 2, %pos1) if (*.* isin %tempdir) { var %tdir = $len(%tempdir) - 4 set % [ $+ [ %WrkNick ] $+ ] -Directory $mid(%tempdir,1,%tdir) } } ; ------- we just got the directory so now lets prompt for the rest of the details --------------- ; create the dialog to get the settings dialog -mrv al_setup- [ $+ [ %WrkNick ] ] alsetup ; Setup the dialog window where we ask for the trigger and display it ; also do a check to see what channel %wrknick is on did -o al_setup- [ $+ [ %WrkNick ] ] 5 1 $comchan(%WrkNick,1) ; overwrite the al_setup id 5 (id from the table) with the first channel name that wrknick and I am on. ; **TODO** we need to check if the Nick on this channel has a +V ; (just in case he is on multiple channels and only advertising on one) ; When we exit out of this routine on the first time, we are going to put our trigger in the dialog and hit ok. This is ; going to trigger two on dialog events and pass us on to the next routine if (% [ $+ [ %WrkNick ] $+ ] -Directory != $null) { writeini %leechfile Settings Directory % [ $+ [ %WrkNick ] $+ ] -Directory } else { writeini %leechfile Settings Directory ERROR - UNABLE TO GET DIRECTORY } ; set a few variables up unset % [ $+ [ %WrkNick ] $+ ] -Directory set % [ $+ [ %WrkNick ] $+ ] -bLoggedIn $false ; -bloggedIn is the flag to whether we have a dcc session up or not. set % [ $+ [ %WrkNick ] $+ ] -CurEvent -1 } else { echo -s Unable to get current directory from line : %wrkline echo -s Aborting autoget ;window -c @AutoLeech- [ $+ [ %WrkNick ] ] unset % [ $+ [ %WrkNick ] $+ ] -CurEvent unset % [ $+ [ %WrkNick ] $+ ] -Directory unset % [ $+ [ %WrkNick ] $+ ] -bDirOnly } } elseif (% [ $+ [ %WrkNick ] $+ ] -CurEvent == 1) { ; we just sent the trigger so now we need to change directory echo -s Changing Directory after Trigger ; need to store the directory so we can change into it if (% [ $+ [ %WrkNick ] $+ ] -WrkDir == $null) { var %store1 = $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) set % [ $+ [ %WrkNick ] $+ ] -WrkDir %store1 } echo -s Work Directory is : % [ $+ [ %WrkNick ] $+ ] -WrkDir ; alstatus 20 = Directory if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) == \ || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) == / ) { set % [ $+ [ %WrkNick ] $+ ] -CurEvent 2 msg = $+ $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,14) cd } elseif ($pos(% [ $+ [ %WrkNick ] $+ ] -WrkDir, \) > 0) { var %pos1 = $pos(% [ $+ [ %WrkNick ] $+ ] -WrkDir, \) dec %pos1 var %wrkline = % [ $+ [ %WrkNick ] $+ ] -WrkDir set %chngdir $mid(%wrkline , 1, %pos1) echo -s Change to Directory is : %chngdir inc %pos1 inc %pos1 var %pos3 = $len(%wrkline) %pos3 = %pos3 - %pos1 inc %pos3 set % [ $+ [ %WrkNick ] $+ ] -WrkDir $mid(%wrkline , %pos1, %pos3) msg = $+ $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,14) cd %chngdir unset %chngdir } else { set % [ $+ [ %WrkNick ] $+ ] -CurEvent 2 msg = $+ $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,14) cd % [ $+ [ %WrkNick ] $+ ] -WrkDir unset % [ $+ [ %WrkNick ] $+ ] -WrkDir } } elseif (% [ $+ [ %WrkNick ] $+ ] -CurEvent == 2) { ; we just cd'd after the change directory echo -s Verify Directory ; verify that we changed into the directory, alstatus 20 = Directory if ($pos($sline(@Autoget [ $+ [ %WrkNick ] ],1), $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20)) %lenname || $pos(%response,queueing) > %lenname || $pos(%response,queued) > %lenname || $pos(%response,qúeued) > %lenname || $pos(%response,adding) > %lenname || $pos(%response,added) > %lenname) { ; do not use the word queue as it is used in other situations as well (i.e. sorry, all queue slots are full (which happens to be a max queue situation, not a queued file one)). ; Update the status screen did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 27 1 Queued file %leech_file ; tell the user we queued the file did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 26 1 %totsqcnt ; increment the queue number in the number of files queued dialog writeini %leechfile Files File [ $+ [ %filenum ] ] [ #Q# [ $+ [ %leech_file ] ] ] ; we are queued so modify the line in the ini file to be #Q# (queued) unset % [ $+ [ %WrkNick ] $+ ] -NumQ unset % [ $+ [ %WrkNick ] $+ ] -CurFileNum unset % [ $+ [ %WrkNick ] $+ ] -ErrorCnt } ; --------------------- The file is being sent -------------------------------------------- elseif ($pos(%response,[) > %lenname || $pos(%response,sent) > %lenname || $pos(%response,sending) > %lenname || %response == $null) { ; see if its the directory line. Sometimes the server says nothing. Otherwise looks for sending or sent. If no response OK, were at check and through, no get. (happens with instasends) if (%response == $null) { echo 15 -s Response was NULL } goto ok } ; ========================= Invalid File Name - Fatal Error ===================================================== elseif ($pos(%response,invalid file name) > %lenname || $pos(%response,doesn't exist) > %lenname || $pos(%response,does not exist) > %lenname) { set %crashflag 1 ech0 13 -s F A T A L C R A S H - H A L T I N G P R O G R A M !!! halt } ; ######################### Error - Something went wrong #################################### else { ; --------- we don't know what the message is so notify the user of the message -------------- ; ******************** WE NEED TO WORK ON THIS!!! ********************************************** dec %totsqcnt ; decrement the total number sending and queued because we aren't really getting a file echo -s Unknown Status message encountered : %response splay -w c:\windows\media\ding.wav ; -------- it couldn't understand the command I sent, try again -------------------- ; unset Our Work Variables and loop again unset % [ $+ [ %WrkNick ] $+ ] -CurFileNum ; ------------ we need to make sure we don't get this more than 3 times otherwise quit --------- if (% [ $+ [ %WrkNick ] $+ ] -ErrorCnt > 0) { inc % [ $+ [ %WrkNick ] $+ ] -ErrorCnt if (% [ $+ [ %WrkNick ] $+ ] -ErrorCnt > 3) { echo -s FATAL ERRORS encountered with autoget system, Aborting disable-al-timer %WrkNick msg = $+ %WrkNick exit unset % [ $+ [ %WrkNick ] $+ ] -ErrorCnt goto exitauto } } else { set % [ $+ [ %WrkNick ] $+ ] -ErrorCnt 1 } disable-al-timer %WrkNick goto end-files } :ok unset %response goto file-loop :end-files ; unset the error count to reset it unset % [ $+ [ %WrkNick ] $+ ] -ErrorCnt unset %response ; ----------- if we are logged in then exit out ------------------------ if (% [ $+ [ %WrkNick ] $+ ] -bLoggedIn == $true) { msg = $+ %WrkNick exit } set % [ $+ [ %WrkNick ] $+ ] -bNextCase $false ; --------- so heres where it catches any files left over after the queues are full ---------------- ; ---------- re-start the timer if we have some files left to get ------------------------ if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] , 24) != $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] , 22)) { enable-al-timer %WrkNick } else { echo -s ***** autoget COMPLETE for %WrkNick ***** did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 27 1 ***** autoget COMPLETE ***** } :exitauto ; unset all the variables unset %leechfile %filenum %leech_file } else { echo -s Could not find Leech file : %leech_file echo -s Aborting autoget disable-al-timer %WrkNick } } } else { echo -s Please pass the Users Nick as the 1st Parameter }}; ****************************************************************; This Alias is used to update the Status Screen; This is called from the Timer which is started from the autoget case; ****************************************************************; Parameters passed :; $1 = Leech Nick; $2 = true or nothing (to force the run); ****************************************************************alias autoget-timer { echo 4 -s Entered alias Autoget-timer if ($1 != $null) { ; Store the Nick for later use var %WrkNick = $1 ; check if we are forcing the run of the file get if ($2 == 1) { echo 3 -s Timer forced for %WrkNick } if (% [ $+ [ %WrkNick ] $+ ] -CurEvent == $null) { ; we shouldn't be running if CurEvent is not set ; unset all the variables and disable the timer echo 7 -s CurEvent IS NULL E R R O R goto unsetmyvars } else { ; Turn the timer off so we don't get hit again while we a busy disable-al-timer %WrkNick set % [ $+ [ %WrkNick ] $+ ] -bNextCase $true ; Verify we have all the variables available if (% [ $+ [ %WrkNick ] $+ ] -status == $null) { var %leechfile = % [ $+ [ %WrkNick ] $+ ] -LeechFile ; Load the status dialog as it is going to hold everything (close it first just in case it already exists) dialog -mrv al_status- [ $+ [ %WrkNick ] ] alstatus ; so dialog is the command, -mrv options, al_status- [ $+ [ %WrkNick ] ] is what we will call it, and alstatus is the table. set % [ $+ [ %WrkNick ] $+ ] -status $true set % [ $+ [ %WrkNick ] $+ ] -dlgname %WrkNick ; we need to load these variables in did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 10 1 %leechfile did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 12 1 $readini -n %leechfile Settings Channel did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 16 1 $readini -n %leechfile Settings Trigger did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 20 1 $readini -n %leechfile Settings Directory did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 14 1 $readini -n %leechfile Settings Nick did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 30 1 60 ; originally 120 did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 31 1 60 ; originally 240 did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 41 1 5 ; set the maximum number of files sent or queued at any one time did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 51 1 0 ; set the starting value of the total sent/queued if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,12) == $null || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,16) == $null || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) == $null) { ; Abort Connection, could't get all values from Config File echo -s Aborting autoget, couldn't get all values from Config File. ; unset all the variables goto unsetmyvars } ; Check the counter variables ; alstatus 22 = Total Files if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,22) == $null || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,22) 0 ; so if total files - the number completed and queued is more than zero, than there are still files waiting to be gotten. Go get them. ; if all the files left over are queued we just need to wait for them to come down from the server. /autoget-file %WrkNick %bRunFile = $true } } } if (%bRunFile == $false) { enable-al-timer %WrkNick set % [ $+ [ %WrkNick ] $+ ] -bNextCase $false } } } unset %leechfile goto conttimer :unsetmyvars ; tell the system we have no status screen unset % [ $+ [ %WrkNick ] $+ ] -status unset % [ $+ [ %WrkNick ] $+ ] -dlgname unset % [ $+ [ %WrkNick ] $+ ] -bSentTrigger unset % [ $+ [ %WrkNick ] $+ ] -bDirOnly disable-al-timer %WrkNick ; update the status screen (if available) echo -s autoget for %WrkNick is now OFF if (% [ $+ [ %WrkNick ] $+ ] -CurEvent != $null) { did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 27 1 Error occured, everything cleared. } :conttimer}; ****************************************************************; This is the Dialog setup for the Channel and Trigger info; This is called from the autoget-case on initial autoget setup; ****************************************************************dialog alsetup { title "autoget Settings" size -1 -1 334 125 Text "Enter Channel" , 4 , 20 20 80 20 Edit "" , 5 , 100 20 220 20 Text "Enter Trigger" , 6 , 20 60 80 20 Edit "" , 7 , 100 60 220 20 Button "OK" , 8 , 110 100 80 20 , ok}; ****************************************************************; set the Channel Variable; ****************************************************************on *:dialog:al_setup*:edit:5: { echo 4 -s Entered dialog alsetup 5 ; set some local variables var %setupnick = $remove($dname,al_setup-) var %setupfile = % [ $+ [ %setupnick ] $+ ] -LeechFile ; we need to extract the trigger from the dialog and write the ini file if ($did(al_setup- [ $+ [ %setupnick ] ] ,5) != $null) { writeini %setupfile Settings Channel $did(al_setup- [ $+ [ %setupnick ] ] ,5) }}; ****************************************************************; set the Trigger Variable; ****************************************************************on *:dialog:al_setup*:edit:7: { echo 4 -s Entered dialog alsetup 7 ; set some local variables var %setupnick = $remove($dname,al_setup-) var %setupfile = % [ $+ [ %setupnick ] $+ ] -LeechFile ; we need to extract the trigger from the dialog and write the ini file if ($did(al_setup- [ $+ [ %setupnick ] ] ,7) != $null) { writeini %setupfile Settings Trigger $did(al_setup- [ $+ [ %setupnick ] ] ,7) }}; ****************************************************************; Check the close of the dialog box; ****************************************************************on *:dialog:al_setup*:sclick:8: { echo 4 -s Entered dialog alsetup 8 ; set some local variables var %setupnick = $remove($dname,al_setup-) var %setupfile = % [ $+ [ %setupnick ] $+ ] -LeechFile ; Make sure we are up to date if ($did(al_setup- [ $+ [ %setupnick ] ] ,5) != $null) { writeini %setupfile Settings Channel $did(al_setup- [ $+ [ %setupnick ] ] ,5) } if ($did(al_setup- [ $+ [ %setupnick ] ] ,7) != $null) { writeini %setupfile Settings Trigger $did(al_setup- [ $+ [ %setupnick ] ] ,7) } ; write the leech file with channel and trigger ; start the timer enable-al-timer %setupnick run-al-timer %setupnick 5 echo -s autoget for %setupnick is now ON ; Send an exit to the current window to close it ; Close the chat window .msg = $+ %setupnick exit}; ****************************************************************; This is the Dialog for the autoget status screen; This also stores all of the Settings for each autoget process; ****************************************************************dialog alstatus { title "autoget-Status" size -1 -1 408 369 Text "LeechFile" , 9 , 20 25 70 20 Edit "" , 10 , 90 20 300 20 , autohs Text "Channel" , 11 , 20 65 70 20 Edit "" , 12 , 90 60 300 20 , autohs Text "Nick" , 13 , 20 95 70 20 Edit "" , 14 , 90 90 300 20 , autohs Text "Trigger" , 15 , 20 125 70 20 Edit "" , 16 , 90 120 300 20 , autohs Text "Directory" , 19 , 20 155 70 20 Edit "" , 20 , 90 150 300 20 , autohs Text "MaxQueue" , 17 , 20 185 70 20 Edit "" , 18 , 100 180 40 20 , autohs Text "Delay (sec)" , 29 , 165 185 65 20 Edit "" , 30 , 230 180 40 20 , autohs Edit "" , 31 , 290 180 40 20 , autohs Text "Max Files at Once" , 40 , 165 220 100 25 Edit "" , 41 , 262 215 40 20 autohs Text "Total Send/Queue Count" , 50 , 165 255 120 25 Edit "" , 51 , 300 250 40 20 Text "Total Files" , 21 , 20 215 70 20 Edit "" , 22 , 100 210 40 20 , autohs Text "Num Completed" , 23 , 20 245 80 20 Edit "" , 24 , 100 240 40 20 , autohs Text "Num Queued" , 25 , 20 275 70 20 Edit "" , 26 , 100 270 40 20 , autohs Text "Status" , 27 , 5 300 320 20 Button "Close" , 28 , 300 320 80 20 , ok}; ****************************************************************; set the Channel Variable; ****************************************************************on *:dialog:al_status*:edit:12: { echo 4 -s Entered dialog alstatus 12 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,12) != $null) { writeini %setupfile Settings Channel $did(al_status- [ $+ [ %setupnick ] ] ,12) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Channel }}; ****************************************************************; set the Nick Variable; ****************************************************************on *:dialog:al_status*:edit:14: { echo 4 -s Entered dialog alstatus 14 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { writeini %setupfile Settings Nick $did(al_status- [ $+ [ %setupnick ] ] ,14) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Nick }}; ****************************************************************; set the Trigger Variable; ****************************************************************on *:dialog:al_status*:edit:16: { echo 4 -s Entered dialog alstatus 16 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ %setupnick ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,16) != $null) { writeini %setupfile Settings Trigger $did(al_status- [ $+ [ %setupnick ] ] ,16) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Trigger }}; ****************************************************************; set the MaxQueue Variable; ****************************************************************on *:dialog:al_status*:edit:18: { echo 4 -s Entered dialog alstatus 18 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,18) != $null) { writeini %setupfile Settings MaxQueue $did(al_status- [ $+ [ %setupnick ] ] ,18) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for MaxQueue }}; ****************************************************************; set the Directory Variable; ****************************************************************on *:dialog:al_status*:edit:20: { echo 4 -s Entered dialog alstatus 20 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,20) != $null) { writeini %setupfile Settings Directory $did(al_status- [ $+ [ %setupnick ] ] ,20) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Directory }}; ****************************************************************; Check the close of the dialog box; ****************************************************************on *:dialog:al_status*:sclick:28: { echo 4 -s Entered dialog alstatus 28 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; stop the timer disable-al-timer %setupnick echo -s autoget for %setupnick is now OFF ; unset everything unset % [ $+ [ %setupnick ] $+ ] -bNextCase unset % [ $+ [ %setupnick ] $+ ] -bLoggedIn unset % [ $+ [ %setupnick ] $+ ] -CurEvent unset % [ $+ [ %setupnick ] $+ ] -status unset % [ $+ [ %setupnick ] $+ ] -bSentTrigger unset % [ $+ [ %setupnick ] $+ ] -TrigCnt unset % [ $+ [ %setupnick ] $+ ] -bDirOnly unset % [ $+ [ %setupnick ] $+ ] -CurFileNum ; just in case unset % [ $+ [ %setupnick ] $+ ] * ; prompt to delete autoget file $$?!="Delete autoget file? if ($1 == $true) { /remove %setupfile }}; ****************************************************************; Change the Delay for the Timer; ****************************************************************on *:dialog:al_status*:edit:30: { echo 4 -s Entered dialog alstatus 30 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } if (% [ $+ [ %setupnick ] $+ ] -status == $true) { var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) var %newtime = 120 if ($did(al_status- [ $+ [ %setupnick ] ] ,30) != $null && $did(al_status- [ $+ [ %setupnick ] ] ,30) > 9 ) { %newtime = $did(al_status- [ $+ [ %setupnick ] ] ,30) ; stop the timer disable-al-timer %setupnick ; restart the timer with the new time in Seconds enable-al-timer %setupnick %newtime ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Timer Updated } }}; ****************************************************************; Change the Max Send/Queues; ****************************************************************on *:dialog:al_status*:edit:41 { }; ****************************************************************; Enable the autoget Timer; ****************************************************************alias enable-al-timer { echo 4 -s Entered alias Enable-al-timer if ($1 != $null) { if ($2 != $null) { var %wrktime = $2 } else { var %wrktime = 60 ; was 120 if (% [ $+ [ $1 ] $+ ] -status == $true) { %wrktime = $rand( $did(al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] ,30), $did(al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] ,31) ) ; get the timer range from the dialog echo -s Restarting timer with Randmized time of %wrktime } } /timer- [ $+ [ $1 ] ] 0 %wrktime autoget-timer $1 }}; ****************************************************************; Disable the autoget Timer; ****************************************************************alias disable-al-timer { echo 4 -s Entered alias Disable-al-timer if ($1 != $null) { /timer- [ $+ [ $1 ] ] off }}; ****************************************************************; Run the autoget-timer command NOW; ****************************************************************alias run-al-timer { echo 4 -s Entered alias Run-al-timer if ($1 != $null) { if ($2 != $null) { var %wrktime = $2 } else { var %wrktime = 5 } /timer- [ $+ [ $1 ] $+ ] -2 1 %wrktime autoget-timer $1 1 }}; ****************************************************************; This procedure marks the file as downloaded if we are autogeting; ****************************************************************on *:filercvd:*.*:{ echo 4 -s Entered On Filercvd set %rq 0 if (%crashflag == 1) { echo 8 -s CRASHED On File Received HALTING halt } ; Find the file name and Mark it as #D# for Downloaded if ($nick != $null) { if (% [ $+ [ $nick ] $+ ] -status == $true) { var %rcvdfile = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] ,10) ; %rcvdfile = the name of the current leech file. echo -s File Received, checking Autoget for file $nopath($filename) in %rcvdfile ; checking Autoget for the name of the file received in the leechfile being used. if ($exists(%rcvdfile) == $true) { var %filenum = 0 :file-loop inc %filenum var %leech_file = $readini -n %rcvdfile Files File [ $+ [ %filenum ] ] ; leech file is going to have the #D# or #Q# in it if it is done or queued. ; read the name of file number filenum from the leech file if (%leech_file == $null) { goto exit-file-loop } ; if were at the end of the list exit the loop var %wrk_leech_file = %leech_file ; leech_file is the filename got from the leech file echo -s Checking file %leech_file ; create a variable with the name of the file without the spaces in it var %wrk_leech_file = $replace(%wrk_leech_file, $chr(32), _) ; so wrk_leech_file is leech_file without any spaces. Sometimes the file sent has _ instead of spaces like the name in the original directory. if (%leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ] || %wrk_leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ] || %leech_file == $nopath($filename) || %wrk_leech_file == $nopath($filename) ) { ; so if the file downloaded is equal to the name of the file in the leech file with spaces or _ and with or without #Q# ; if not then its already done on that file, goto the end, loop, and look at the next filename ; if so, then its one of the not done or queued filenames we wanted to download, continue if (%leech_file != $nopath($filename) && %wrk_leech_file != $nopath($filename)) { ; it has a #Q# in front of it so remove it and set the flag that we have received a queued file var %origfile = $mid(%leech_file, 4, $len(%leech_file)) set %rq 1 echo 2 -s Recvdqueued flag = %rq echo 2 -s Queued File has been received. echo 2 -s leech_file was %leech_file } else { var %origfile = %leech_file ; else it doesn't, its an unqueued file, so leave it alone echo 2 -s Recvdqueued flag = %rq echo 2 -s Non-queued File has been received. echo 2 -s leech_file was %leech_file } writeini %rcvdfile Files File [ $+ [ %filenum ] ] [ #D# [ $+ [ %origfile ] ] ] ; write it down in the leech file as Done. echo 2 -s [ [ $nick ] $+ ] -status = % [ $+ [ $nick ] $+ ] -status echo 2 -s Recvdqueued flag before loop = %rq ; we also need to reduce the Queued File Counter and increase the Completed Counter set %nickstat % [ $+ [ $nick ] $+ ] -status ; have to use nickstat because the if statement doesn't like the -status var for some reason. if (%nickstat == $true && %rq == 1) { ; if were not just beginning (I think thats what that flag is for) and the file was queued (important!) ; if the file wasn't queued then don't decrement the total queued dialog! var %tempQ = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] , 26) ; set tempQ to total number queued set % [ $+ [ $nick ] $+ ] -NumQ %tempQ dec % [ $+ [ $nick ] $+ ] -NumQ ; reduce the total number queued by 1 if (% [ $+ [ $nick ] $+ ] -NumQ < 0) { set % [ $+ [ $nick ] $+ ] -NumQ 0 } ; but don't let it go below zero did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 26 1 % [ $+ [ $nick ] $+ ] -NumQ echo 2 -s Decremented the queue number ; set the new total queued number in the total queued dialog } if (% [ $+ [ $nick ] $+ ] -status == $true) { var %tempQ = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] , 24) set % [ $+ [ $nick ] $+ ] -NumQ %tempQ inc % [ $+ [ $nick ] $+ ] -NumQ did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 24 1 % [ $+ [ $nick ] $+ ] -NumQ ; inc the total number completed and set it in the dialog echo 2 -s incremented the total number completed dec %totsqcnt did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 51 1 %totsqcnt ; update the status screen and the dialog 51 ; decrement the total files sending or queued } goto exit-file-loop } goto file-loop :exit-file-loop ; clean ourselves up unset % [ $+ [ $nick ] $+ ] -NumQ unset %recvdqueued if (%mqflag == 1) { /run-al-timer $nick set %mqflag 0 } } } } ; if (% [ $+ [ $nick ] $+ ] -status == $true) { ; run the auto=leech-file to see if we can get the next file ; /run-al-timer $nick ; }}; ****************************************************************; This procedure Find the file name and Remove the #Q# from the ; so it can be queued again ; ****************************************************************on *:getfail:*.*:{ echo 4 -s Entered On Getfail if (%crashflag == 1) { echo 8 -s CRASHED On Getfail HALTING halt } if ($nick != $null) { if (% [ $+ [ $nick ] $+ ] -status == $true) { var %failfile = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] ,10) echo 7 -s File Received FAILED, checking Autoleech for file $nopath($filename) if ($exists(%failfile) == $true) { var %filenum = 0 :file-loop inc %filenum var %leech_file = $readini -n %failfile Files File [ $+ [ %filenum ] ] ; are we at the end of our files if (%leech_file == $null) { goto exit-file-loop } var %wrk_leech_file = %leech_file ; create a variable with the name of the file without the spaces in it var %wrk_leech_file = $replace(%wrk_leech_file, $chr(32), _) if (%leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ] || %wrk_leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ]) { ; re-write the config file without the #Q# var %origfile = $mid(%leech_file, 4, $len(%leech_file)) writeini %failfile Files File [ $+ [ %filenum ] ] %origfile goto exit-file-loop } goto file-loop :exit-file-loop ; we also need reduce the Queued File Counter if (% [ $+ [ $nick ] $+ ] -status == $true) { var %tempQ = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] , 26) set % [ $+ [ $nick ] $+ ] -NumQ %tempQ dec % [ $+ [ $nick ] $+ ] -NumQ if (% [ $+ [ $nick ] $+ ] -NumQ < 0) { set % [ $+ [ $nick ] $+ ] -NumQ 0 } did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 26 1 % [ $+ [ $nick ] $+ ] -NumQ } ; clean ourselves up unset % [ $+ [ $nick ] $+ ] -NumQ ; launch the autoget-file to see if we can get the next file ;/autoget-file $nick /run-al-timer $nick } } }}; ****************************************************************; This procedure Check who its from and launches the get file system ; to get the next file if it is in the autoget system; ****************************************************************ctcp *:*:*:{ echo 4 -s Entered CTCP if (%crashflag == 1) { echo 8 -s CRASHED CTCP HALTING halt } if ($1 == DCC) && ($2 == Send) { echo -s File Send Detected, checking autoget system for $nick if (% [ $+ [ $nick ] $+ ] -status == $true) { ; run the auto=leech-file to see if we can get the next file ; /autoget-file $nick if (%maxqueflag != 1) { ; are we at maxque? If no then get the next file, otherwise wait for the file to be received and trip the on received trigger. If you don't, your going to just get ; the server saying we are at maxque already. /run-al-timer $nick } else { set %maxqueflag 0 set %mqflag 1 ; we are at maxque, so set the maxque flag and trigger the /run-al-timer $nick after we receive this file so a que slot will be open. ; maybe give it a timer for a few seconds too so the server has time to clear the new que slot. } } }}on *:JOIN:#:{ echo 4 -s Entered On Join if (%crashflag == 1) { echo 8 -s CRASHED On Join HALTING halt } ; check if this user is an autoget user and if so start going again. if ($nick != $null) { if (% [ $+ [ $nick ] $+ ] -status == $true) { ; update the status screen for Num Queued var %tmp = 0 did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 26 1 %tmp ; re-start the autoget system enable-al-timer $nick echo -s autoget for $nick is now ON ; update the status screen did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 27 1 User has logged back onto IRC, autoget re-started } }}alias part-or-quit { echo 4 -s Entered alias Part-or-quit if (%crashflag == 1) { echo 8 -s CRASHED Part-or-quit HALTING halt } ; check it the user is an autoget user and if so stop the timer until they come back if ($1 != $null) { if (% [ $+ [ $1 ] $+ ] -status == $true) { var %partfile = $did(al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] ,10) if ($exists(%partfile) == $true) { ; stop the autoget system disable-al-timer $1 echo -s autoget for $nick is now OFF ; update the status screen did -o al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] 27 1 User has logged off IRC, autoget stopped var %filenum = 0 ; turn off the #Q# for all the files in the config file echo -s Removing all #Q#'s from autoget file :file-loop inc %filenum var %leech_file = $readini -n %partfile Files File [ $+ [ %filenum ] ] ; are we at the end of our files if (%leech_file == $null) { goto exit-file-loop } if ($mid(%leech_file, 1, 3) == #Q#) { ; re-write the config file without the #Q# writeini %partfile Files File [ $+ [ %filenum ] ] $mid(%leech_file, 4, $len(%leech_file)) } goto file-loop :exit-file-loop ; update the status screen for Num Queued var %tmp = 0 did -o al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] 26 1 %tmp } } }}on *:QUIT:{ echo 4 -s Entered On Quit if (%crashflag == 1) { echo 8 -s CRASHED On Quit HALTING halt } part-or-quit $nick}on *:PART:#:{ echo 4 -s Entered On Part if (%crashflag == 1) { echo 8 -s CRASHED On Part HALTING halt } part-or-quit $nick}on *:NICK:{ echo 4 -s Entered On Nick if (%crashflag == 1) { echo 8 -s CRASHED On Nick HALTING halt } ; check it the user is an autoget user and if so stop and rename the timer ; .i.e. did the guy were downloading from just change his nick? if ($nick != $null) { if (% [ $+ [ $nick ] $+ ] -status == $true) { var %nickfile = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] ,10) if ($exists(%nickfile) == $true) { ; stop the timer disable-al-timer $nick ; update the nick did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 14 1 $newnick writeini %nickfile Settings Nick $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] ,14) ; now create the -status and dlgname variables for the new nick set % [ $+ [ $newnick ] $+ ] -status $true set % [ $+ [ $newnick ] $+ ] -dlgname % [ $+ [ $nick ] $+ ] -dlgname unset % [ $+ [ $nick ] $+ ] -status unset % [ $+ [ $nick ] $+ ] -dlgname ; restart the timer enable-al-timer $newnick run-al-timer $newnick ; update the status screen did -o al_status- [ $+ [ % [ $+ [ $newnick ] $+ ] -dlgname ] ] 27 1 User has changed their Nick, autoget updated } } }}alias mindex { ; function mindex ( takes in startindex and endindex and returns mindex to the calling function $mindex(a,b) ) ; function calculates which index in the array holds the smallest number after the starting index and ending index are passed to it. set %startindex $1 set %endindex $2 set %min %startindex set %index [ %startindex + 1 ] :minloop if (%numvar [ $+ [ %index ] ] < %numvar [ $+ [ %min ] ]) { set %min %index } set %mindex %min inc %index if (%index

8 réponses

cs_PaDa Messages postés 1804 Date d'inscription mardi 15 juillet 2003 Statut Membre Dernière intervention 22 septembre 2009 5
1 janv. 2005 à 14:55
frite ou potatoes ?
dsl j'ai pas le coeur a relire des dizaines de lignes de code comme ca...

PaDa
0
J4Gu4R Messages postés 385 Date d'inscription samedi 7 août 2004 Statut Membre Dernière intervention 3 juillet 2007
1 janv. 2005 à 15:54
mdrrrr t dingue twa :p

j'suis perdu au bout de 10 ligne ô_0

-J4Gu4R-
0
Utilisateur anonyme
1 janv. 2005 à 15:56
WAOU !
Le site va exploser !
Désolé je ne peux pas non plus t'aider
0
cs_topdollar Messages postés 4 Date d'inscription jeudi 29 juillet 2004 Statut Membre Dernière intervention 2 janvier 2005
1 janv. 2005 à 16:17
merci quand meme les gars, je vais voir ailleur si qqn ne peux pas m'aider !!
mais vous savez c 1 vrai challenge , un script comme ca y en a jamais eu avant ;enfin a ma connaissance , alors si qqn connais un script pour file server qui manage les download automatikement ; faites moi signe !!!! :big)
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_PaDa Messages postés 1804 Date d'inscription mardi 15 juillet 2003 Statut Membre Dernière intervention 22 septembre 2009 5
1 janv. 2005 à 16:21
lol...
tu as un problème mineur sur un script qui fait plus de 100 lignes, si toi tu te donnais la peine toi même de réduire le remote a son minimum, de chercher d'ou vient l'erreur ... non ? et quand tu bloqueras vraiment mais que tu auras cherché, reposte ici je serai le premier a t'aider ...
PaDa
0
cs_tofu Messages postés 1726 Date d'inscription vendredi 12 septembre 2003 Statut Membre Dernière intervention 13 juin 2009 1
1 janv. 2005 à 19:20
tu mets un //echo -a $true entre chaque ligne de code et tu vois ou ça bloque..

----
0
cs_topdollar Messages postés 4 Date d'inscription jeudi 29 juillet 2004 Statut Membre Dernière intervention 2 janvier 2005
2 janv. 2005 à 20:12
ca y es ,je l'ai resolu en fin de compte , c t presque rien !!un super script pour telecharger des fserve automatikement!!un seul bug , ne pas l'utiliser trop a la fois , sinon c le crash , dans ce cas il suffit de unloader pour de uploader a nouveau , c tt !!le voici : enjoy !!;; A U T O G E T 1.0;; Mouse driven menu by sOs of #sirc; Majority of Autoget 1.0 by _Blade_ formerly named Autoleech 1.6; Debugged, code and functions added, by Logan6;; Well _Blade_ , I couldn't get your program to work either, so I started digging through the script. At first couldn't make heads or tails; of the tight mirc code, so I started trying to learn it thinking it must just be a few bugs. Well, four months and many bugs later; (not to mention screaming at the walls, lol) I think I've got it working with an option to set how many files download at once (those; insta-sends can be a real pain when 30 try to download at once!) Really like the dynamic variables! They allowed me to use an array for; the sort routine.;; Things added:; All files are sorted in the beginning with a straight selection sort so that all instasends will send first, thus avoiding queues.; Unfortuneatly, after something is queued, instasends are no longer possible due to not wanting to hammer a server trying to find a maxque.; So, I just get rid of the instasends at the beginning, which works good. Files are sorted smallest to largest. This program has been; a god send for downloading numerous small files.;; Also added a CD\ (cd to root) which is nice when your buried in a long subdirectory list and just want to get out to the top.;; Ability to set the number of files being gotten at once added into the menu ( defaults to 5);; About all I can think of; There are still some bugs in the program which I'm trying to find, but other than that it seems to work great.;; Renamed the program to Autoget because there is already a program for ! triggers named Autoleech. I don't think sOs will mind since his; program is part of it. And Autoget just seemed to reflect the Fserve style more.; ; As above, there are still a few bugs in the program, so I hope that others will take up work on debugging it as well.;; And, incidently, as above, this was my first attempt at scripting also. If you want to learn mirc scripting just read this program,; it will teach you just about every basic bit of code that you could need.;; Logan6;;;; Note from _Blade_; ; This is my first REAL attempt at scripting so if there is anything that looks different; you will know why. This script was based on the "autoget script by sOs of #sirc";; I downloaded the autoget script and it did not work for me. I had to change it to; get it to work but it was a good base for a start. The initial autoget script ; allowed users to browse directories and download files just by clicking on them. After; fixing the script so that it worked with Polaris, I decided to try and add some more ; functionality to the script and get it to automatically queue and download files for me.;; I hope everyone that uses it finds it as usefull as I did.;;; ====================== Instructions for Autoget! =================================================================;; First of all, you must make a directory under mirc called /leech. So mirc/leech. This is where the que file leech(n).lee; is stored. It holds the directory you are downloading from, the fserv's nick, etc. It also holds the names of all the files queued; and whether they are done, queued, or still awaiting attention. These files remain after the download is completed or if something goes; wrong. If something goes wrong and you stop the program, you can continue later from where you left off by selecting from the mirc; menu commands, autoget, load leech file. Then just choose the leech file that didn't complete downloading at that point, and the downloads; will continue from where they left off. The old files can build up, so you may want to delete them once in a while when your done with; them.;; Now for how to use the downloading features:; You can pick and choose one file at a time to download manually by using sOs's mouse driven program which is; the heart of Autoget. To manuever through the mouse driven menus right click on the directory that you want to enter and choose cd from; the popup menu. When you see the file that you want to download, double click on it, and it will send the get command to the fserv.; You can also pick a range of files to download manually by highlighting them, then right clicking, and choosing get selected. Also added; a CD/ selection that will take all the way out back to root. To go back up just one directory, select cd..;; Now if you want to use Autoget for walk away downloading :; Get into the directory and highlight all the files you want, then right click just like you were doing a get selected. But this time,; choose Autoget from the menu. You will asked for the trigger that calls the fserv (i.e. /ctcp jack files! or somesuch). Enter the; trigger and hit ok. Thats it. If you have selected a lot of files (say 300 or more) there will be a slight hang on the machine as; the sort routine sorts smallest to largest. Don't worry, its normal. Then the program will call the fserv and start its downloads. ;; When the new fserve pops up, you will see the Autoleech window like normal, and you will see the computer doing the downloads for you.; A new menu will also pop up and you can configure some things. First of all there is the delay for when nothing is going on and the; computer needs to call the fserv again. I have defaulted at between 60 and 60 seconds. But you can set it to what you want. Original; was between 120 and 240, which gave the computer a random time between the two.;; The other thing that can be set is the maximum files to download at once. This is necessary for fserves that have a lot of queues available; or for instasends. If you try to download 300 files at once, and they all turn out to be instasends (small files that are not queued and sent; immediately) you may get 300 files all trying to download at once! Instant chaos! So by setting the files at once to a reasonable number,; Autoget will only try to download that amount at any one time.;; The other windows can also be set, but they should be left alone as they directly affect the program and were meant to be automatically; set by the program. When the computer is instasending they will look wrong as the computer doesn't worry about them until we start getting; downloads queued. Then maxques will probably look too high for a few minutes, but eventually the computer will sort everything out and find; the real maxques, so just leave it alone.; ; On another note, I have found that most fservs consider a sending file as part of the que. Therefore if one file is sending and two are; queued, then Autoget considers 3 files to be queued. And if maxque is showing 3, then the program will not call the server again, until; one of the files has completed downloading. This is to keep from hammering the server when you are already at maxques. You wouldn't want to do; that if the computer is having to wait for an hour or two for a download! Be one pissed off server.;; Known bugs:;; First of all, always reload the script before you use it, every time. Bugs seem to really appear when you use it, and then use it again; without reloading.;; There appears to be a bug in the system that I think I have headed off, but may not have. That is that sometimes the fserv does not change; directory to where the files are that you are downloading and you get a file does not exist. I think has something to do with the; current event variable which can be -1, 1, 2, or 3. 1 should be just starting a new fserv, 3 means that it is in the right directory to; start the get. 2 is somewhere in between. -1 means there was an error and were trying to adjust for it. This is in the majority that Blade; wrote so Im not quite sure about it. Most of my work was in debugging his programming and adding the logic to catch all the Fservs messages.;; Also, sometimes the Maxque or the total queues/sends numbers may mess up by 1 or 2. Usually the total queues/sends. Haven't figured this one; out yet. Usually happens in long mixed instasend/queued downloads. Usually instasends only don't mess up as they don't mess with queues.; And oddly, straight queued only downloads don't seem to mess up. Just when they are mixed. Have to work on it ( help would be appreciated!).;; If you are an irc script programmer and want to build on the program, please upload your improvements to the script server where you got; this program. Just call it 1.1 or something. Really could use some help on getting rid of these bugs.;; I have included a lot of echo's to the server window to try to show what the program is doing. I wish there was an mirc debugger program!; If you want to turn them off, just go through the script and make them comments.;; ---------------- Clear all queues before using autoget and start fresh! ----------------------------------------on *:LOAD: { echo 4 -s Entered on Start unset all set %leechin.no.no $addtok(%leechin.no.no,Chanserv,32) ; chanserv is the bot that monitors irc channels s set %leechstatus on set %autoget off set %eggie on ; eggie is whether the exclude list is on or not set %mqflag 0 set %maxqueflag 0 set %crashflag 0 set %totsqcnt 0}alias leech.light { echo 4 -s Entered alias leech.light if ($1 == on) { return [ON] } else { return [off] }}; alias delay { old delay system worked but took up all the cpu time. Uses the system clock to try to; set %counter 0 make a delay timer in seconds. /timer allows the cpu to multitask but doesn't halt the program. ; set %time $time(s); :point; set %time2 $time(s); If (%time != %time2) {; inc %counter; echo -s %counter; set %time %time2; }; If (%counter = %input) { goto end }; goto point; :end; echo -s exiting!; unset %counter %time %time2 %input; }menu Menubar { autoget $leech.light(%leechstatus) .:{ if (%leechstatus == OFF) { set %leechstatus ON } else { set %leechstatus OFF } } . $leech.light(%eggie) ..: { if (%eggie == off) { /set %eggie on } else { /set %eggie off } } ..- ..add $leech.menu.nick :{ if ($snick(#,1) != $null) { set %leechin.no.no $addtok(%leechin.no.no,$snick(#,1),32) } elseif ($active !ischan) { set %leechin.no.no $addtok(%leechin.no.no,$active,32) } else { set %leech.add $?="Nick to exclude" | set %leechin.no.no $addtok(%leechin.no.no,%leech.add,32) | unset %leech.add } } ..remove $leech.menu.nick :{ if ($snick(#,1) != $null) { set %leechin.no.no $remtok(%leechin.no.no,$snick(#,1),32) } elseif ($active !ischan) { set %leechin.no.no $remtok(%leechin.no.no,$active,32) } else { set %leech.add $?="Nick to exclude" | set %leechin.no.no $remtok(%leechin.no.no,%leech.add,32) | unset %leech.add } } ..- ..list :{ /leechnolist } .Load Leech File:{ set %leefile $dir="Choose Leech File (Cancel = None)" leech\*.lee if (%leefile != $null) { echo -s Loading Leech file %leefile ;Extract the Nick from the file set %WrkNick $readini -n %leefile Settings Nick set %WrkChan $readini -n %leefile Settings Channel if (%WrkNick !ison %WrkChan) { echo -s User %WrkNick is not on Channel %WrkChan , aborting load } else { unset % [ $+ [ %WrkNick ] $+ ] * set %autoget ON set % [ $+ [ %WrkNick ] $+ ] -LeechFile %leefile set % [ $+ [ %WrkNick ] $+ ] -bNextCase $true set % [ $+ [ %WrkNick ] $+ ] -bDirOnly $true set % [ $+ [ %WrkNick ] $+ ] -bLoggedIn $false set % [ $+ [ %WrkNick ] $+ ] -CurEvent 1 ; was -1 echo -s Leech file loaded for %WrkNick enable-al-timer %WrkNick run-al-timer %WrkNick 30 echo -s autoget for %WrkNick is now ON } unset %WrkChan unset %WrkNick } unset %leefile }}alias leechnolist { echo 4 -s Entered alias leechnolist window -c @Leech-no-no /window -aolpk +bt @Leech-no-no 248 4 200 240 @Leech-no-no set %leechin.no.total $numtok(%leechin.no.no,32) if (%leechin.no.total == 0) { window -c @Leech-no-no } set %leechin.no.cur 0 :leechcycle inc %leechin.no.cur if (%leechin.no.cur > %leechin.no.total) { goto itstheendoftheroadmyfriend } if ($gettok(%leechin.no.no,%leechin.no.cur,32)) { aline @Leech-no-no -> $gettok(%leechin.no.no,%leechin.no.cur,32) goto leechcycle } :itstheendoftheroadmyfriend aline @Leech-no-no Double Click to remove from list unset %leechin.no.total %leechin.no.cur}menu @Leech-no-no { dclick: { set %remove.leech $sline($active,1).ln set %leechin.no.no $remtok(%leechin.no.no,%remove.leech,32) /leechnolist unset %remove.leech } Add:{ set %leech.add $?="Nick to exclude" | set %leechin.no.no $addtok(%leechin.no.no,%leech.add,32) /leechnolist unset %leech.add }}alias leech.menu.nick { echo 4 -s Entered alias leech.menu.nick if ($snick(#,1) != $null) { return $remove($snick(#,1),nu.nick) } elseif ($active !ischan) { return $remove($active,nu.nick) } else { return nick }}on *:CHAT:*:{ echo 4 -s entered On Chat :forcechat ; ---------------------------------- Got a Closing window response ---------------------------------------- ; set %lname $len($gettok($1-,1,32)) ; get the length of the nick's name out of the line ; set %lname %lname + 1 ; add the space to the length ; if ($pos($1-,closing) > %lname || $pos($1-,idle) > %lname) { ; msg = [ $+ [ $Nick ] ] c ; send the window a c to keep the window open ; } ; ----------------------------------------------------------------------------------------------------------- if (%leechstatus == ON || %autoget == ON) { ; were coming in from the autoleech startup. If the script is active either way do it. ; or we are coming in from the get command in the autoget-file procedure if ($findtok(%leechin.nicks, $nick, 32) != $null) { if ($findtok(%leechin.no.no, $nick, 32) == $null || %eggie == off) { if (['C' for more, 'S' to stop] isin $1-) { ; were stopped so do a dir .msg =$nick Dir | halt } else { inc % [ $+ [ $nick ] $+ ] -leechin ; if $window( [ @Autoget [ $+ [ $nick ] ] leechin [ $+ [ $nick ] ] ] != $null ) { aline [ @Autoget [ $+ [ $nick ] ] leechin [ $+ [ $nick ] ] ] $1- sline [ @Autoget [ $+ [ $nick ] ] ] [ % [ $+ [ $nick ] $+ ] -leechin ] ; add the new line from the fserv into our autoget window and select it. ; ------------------------- CD\ Code -------------------------------------------------- set %getline 0 if (%cdflag == 1) { ; yes, we did a cd\ so trigger this code set %jack $line($active,0) ; get the number of lines in the window sline $active %jack ; make sure the last line is selected set %getline $strip($sline($active,1)) set %placehold $pos(%getline,$chr(32)) inc %placehold ; get over one to get rid of the space char. set %fdir $mid(%getline,%placehold,2) ; get the first 2 characters after the first space, is it a [\ ? Yes, so this line has a directory in it. set %fdiryes $mid(%getline,%placehold,3) ; get the first three characters, are they [\] ? Yes, we are at the root. if (%fdir == [\) { set %dirline 1 } ; set the directory flag if (%dirline == 1 && %fdiryes != [\]) { msg = $+ $remove($active,@Autoget) CD.. set %dirline 0 } ; if its a directory line but not the root, we issue a cd.. again because were not to the root yet. ; reset the directory flag for the next line coming in. We want to check every line for directory. if (%dirline == 1 && %fdiryes = [\]) { msg = $+ $remove($active,@Autoget) DIR ; send the directory command to the window set %cdflag 0 ; close the door on our way out! } ; Were there! now shut it down till next time cd\ ; if not, then we sail out of the on chat dialogue and wait for the next chat line to trigger it again. ; so the incoming lines themselves are the loop. Multitasking :) the program is free to go on and no cpu time is wasted. ; first cd.. will trigger the on chat dialogue and the cdflag 1 will enable it. } ; ---------------------------- End CD\ Code -------------------------------------------------------- if (%autoget == ON && % [ $+ [ $nick ] $+ ] -bNextCase == $true) { ; bnextcase is true when we are coming in from the autoget get which will send us back throught autoget-case and autoget-file for the response check if (% [ $+ [ $nick ] $+ ] -bDirOnly == $true && ($pos($1-, [\) > 0) && ($pos($1-, ]) > 0)) { /autoget-case $nick } elseif (% [ $+ [ $nick ] $+ ] -bDirOnly == $false) { /autoget-case $nick } } ;} } } } } }on *:open:=:{ echo 4 -s Entered On Open Fserv ; on opening of the fserv window if (%leechstatus == ON || %autoget == ON) { ; if we have set the script active in commands or we have clicked autoget in the menu if ($findtok(%leechin.no.no, $nick, 32) == $null || %eggie == off) { ; if the nick is not in the exclude list or we have the exclude list turned off set %leechin.nicks $addtok(%leechin.nicks,$nick,32) ; add the nick to the list of people who we are currently leeching from window -lk @Autoget [ $+ [ $Nick ] ] @Leechin ; ---------------- open the autoleech window -------------------------- /titlebar @Autoget [ $+ [ $Nick ] ] (Autoget 1.0) by Blade / Logan6 ; set the title in the titlebar set % [ $+ [ $nick ] $+ ] -leechin 0 if (% [ $+ [ $nick ] $+ ] -bSentTrigger != $true) { .msg =$nick Dir } halt } }}on *:CLOSE:@Autoget*: { echo 4 -s Entered On Close @Autoget set %leechin.nicks $remtok(%leechin.nicks , $remove($active,@Autoget) , 32) unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -leechin* unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bLoggedIn unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bSentTrigger msg = [ $+ [ $remove($active,@Autoget) ] ] exit}on *:CLOSE:=:{ echo 4 -s Entered On Close Fserv if ($findtok(%leechin.nicks, $nick, 32) != $null ) { ;if ($pos($active, @Autoget) > 0) { if (%leechstatus == ON || %autoget == ON) { unset % [ $+ [ $nick ] $+ ] -leechin* unset % [ $+ [ $nick ] $+ ] -bLoggedIn unset % [ $+ [ $nick ] $+ ] -bSentTrigger window -c @Autoget [ $+ [ $Nick ] ] /close -c $Nick } ;} set %leechin.nicks $remtok(%leechin.nicks,$nick,32) }}Menu @Leechin { dclick { set %fserve.line $strip($sline($active,1)) if ($pos(%fserve.line,$chr(32)) > 0) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %leecher.name $remove($active,@Autoget) if (%fserve.line === $upper(%fserve.line)) { msg = $+ %leecher.name cd %fserve.line | msg = $+ %leecher.name dir } else { if (%fserve.line == ..) { msg = $+ %leecher.name CD.. | /msg = $+ %leecher.name DIR } set %fserve.tmpa $wildtok(%fserve.line,*.??,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) } if (%fserve.tmpa == $null) { msg = $+ %leecher.name cd %fserve.line | msg = $+ %leecher.name dir } else { set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file get set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end msg = $+ %leecher.name %fserve.file unset %fserve.tmp %fserve.tmp2 %fserve.file %fserve.tmpa } } unset %leecher.name } unset %fserve.line } - ; Autoget Menu item Autoget: { echo 4 -s Entered Menu Autoget ; ----------------- Heres where we start the autoget ---------------------------------------- echo 5 -s ***************** STARTED NEW AUTOGET ************************************************ set %filenum 0 unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bNextCase ; lets create a leech file called leech var %searchleech = 0 :searchleechloop inc %searchleech var %leechfile = leech\ $+ [ leech [ $+ [ %searchleech ] ] ] $+ .lee ; above line is where the leech directory\leechfile name is created and stored in %leechfile ; check if the file already exists and if so delete it if ($exists(%leechfile) == $true) { goto searchleechloop } ; Lets test if we can write the leech file or not ; You should have created a /leech directory under mirc. So mirc/leech. writeini %leechfile Settings LeechInfo This Leech file was created with Logan6's autoget if ($exists(%leechfile) == $false) { echo -s Unable to create Leech Configuration File : %leechfile goto select-end } set % [ $+ [ $remove($active,@Autoget) ] $+ ] -LeechFile %leechfile ; --------------------- start the sort loop ---------------------------------------------------- :selloop set %worknum %filenum + 1 ; here we start stripping the filenames out of the lines and putting them into the leech file. set %fserve.line $strip($sline($active,%worknum)) if (%fserve.line == $null) { goto selend } if ($pos(%fserve.line,$chr(32)) > 0) { set %xx $numtok(%fserve.line,32) dec %xx ; get the total number of tokens in the line ; and then get the next to last one which will be the number (last is kb or mb) set %numvar [ $+ [ %worknum ] ] $gettok(%fserve.line,%xx,32) ; get the byte number into numvar[worknum] inc %xx ; reset xx to the last token if ($gettok(%fserve.line,%xx,32) == mb) { set %numvar [ $+ [ %worknum ] ] [ %numvar [ $+ [ %worknum ] ] * 1000 ] } ; if the number is in megabytes, multiply it by a 1000 to get kilobytes set %fserve.line $mid(%fserve.line, $pos(%fserve.line ,$chr(32))+1, $len(%fserve.line)) ; get rid of the nick set %fserve.tmpa $wildtok(%fserve.line,*.??,1,32) ; get the extension out of the line if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) } ; if its just two characters still get it, like for .rm files (real player) set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) ; get the position of the extension out of the line set %fserve.tmp2 0 set %fserve.tmp5 $gettok(%fserve.line,0,32) ; return how many spaces there are in the line if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } ; if none set it to a ridiculous number unset %fserve.file :sortloop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } ; if the position of the extension is less than one or the number of spaces in the line is less than one get out of the loop set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) ; goto sortloop :end inc %filenum set %fserve.file [ $+ [ %worknum ] ] %fserve.file echo 2 -s %fserve.file [ $+ [ %worknum ] ] ; write the filename into the fserv.file array } goto selloop :selend ; ------------------ got the array filled, now begin the sort ( straight selection sort ) ---------- set %current 1 dec %worknum while (%current < %worknum ) { set %smallest $mindex(%current, %worknum) set %swaptemp %numvar [ $+ [ %current ] ] set %swapfile %fserve.file [ $+ [ %current ] ] set %numvar [ $+ [ %current ] ] %numvar [ $+ [ %smallest ] ] set %fserve.file [ $+ [ %current ] ] %fserve.file [ $+ [ %smallest ] ] set %numvar [ $+ [ %smallest ] ] %swaptemp set %fserve.file [ $+ [ %smallest ] ] %swapfile set %current %current + 1 } ; --------------------- sort done, put the names in the leech file ------------------------------------------ set %number 1 :select-loop if (%fserve.file [ $+ [ %number ] ] == $null) { goto select-end } writeini %leechfile Files File $+ %number %fserve.file [ $+ [ %number ] ] inc %number ; write the filename into the appropriate place in the leech file goto select-loop :select-end ; if we have added some files then save the rest of the details if (%filenum > 0) { ; save the settings that we have writeini %leechfile Settings Nick $remove($active,@Autoget) writeini %leechfile Settings TotalFiles %filenum ; now ----------- get the current directory through the autoget-case system ------------------ set %autoget ON set % [ $+ [ $remove($active,@Autoget) ] $+ ] -bNextCase $true set % [ $+ [ $remove($active,@Autoget) ] $+ ] -bDirOnly $true ; unset the variables just in case something bad happened last time unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -CurEvent unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -status unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bLoggedIn unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -bSentTrigger unset % [ $+ [ $remove($active,@Autoget) ] $+ ] -CurFileNum msg = $+ $remove($active,@Autoget) dir ; so here we are going to trigger the on CHAT function by cd ( which will show the directory) ; had to change to dir because cd does not always bring up the dir on the servers, then you have to use string functions ; to get rid of the *.* out of the directory line } unset %leechfile %filenum %fserve.line %worknum %fserve.tmp %fserve.tmp2 %fserve.file %fserve.tmpa %number set %number 1 :unloop if (%fserve.file [ $+ [ %number ] ] == $null) { goto unend } unset %fserve.file [ $+ [ %number ] ] inc %number goto unloop :unend } - Queue selected: { echo 4 -s Entered Menu Queue Selected set %fserve.line $strip($sline($active,1)) if ($pos(%fserve.line,$chr(32)) > 0) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.????,1,32) } set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file queue set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end msg = $+ $remove($active,@Autoget) %fserve.file unset %fserve.tmpa %fserve.tmp %fserve.tmp2 %fserve.file } unset %fserve.line } Get selected: { echo 4 -s Entered Menu Get Selected set %linenum 1 set %x 1 set %num 0 :getloop set %fserve.line $strip($sline($active,%linenum)) if (%fserve.line != $null) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %fserve.tmpa $wildtok(%fserve.line,*.??,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) } set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file get set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end timer $+ %x 1 %num msg = $+ $remove($active,@Autoget) %fserve.file inc %linenum if (%x == 1) { set %num %num + 1 } ; want instant at first, but then make up for it so we can still get 2 seconds at least next inc %x set %num %num + 2 ; was set %num %num + $rand(2,12) to make it random between 2 and 12 but was getting to long ; set %input 1 old delay system worked but took up all the cpu time, no multitask ; /delay old delay system as above, timer on line 335 works much better and lets cpu multitask. unset %fserve.tmpa %fserve.tmp %fserve.tmp2 %fserve.file %fserve.line goto getloop } unset %linenum %input %x %num } Read: { echo 4 -s Entered Menu Read set %fserve.line $strip($sline($active,1)) if ($pos(%fserve.line,$chr(32)) > 0) { %fserve.line = $mid(%fserve.line, $pos(%fserve.line,$chr(32))+1, $len(%fserve.line)) set %fserve.tmpa $wildtok(%fserve.line,*.???,1,32) if (%fserve.tmpa == $null) { set %fserve.tmpa $wildtok(%fserve.line,*.????,1,32) } set %fserve.tmp $findtok(%fserve.line,%fserve.tmpa,32) set %fserve.tmp2 0 set %fserve.file read set %fserve.tmp5 $gettok(%fserve.line,0,32) if (%fserve.tmp5 == $null) { set %fserve.tmp5 40 } :loop inc %fserve.tmp2 if (%fserve.tmp < %fserve.tmp2 || %fserve.tmp2 > %fserve.tmp5) { goto end } set %fserve.file %fserve.file $gettok(%fserve.line,%fserve.tmp2,32) goto loop :end msg = $+ $remove($active,@Autoget) %fserve.file unset %fserve.tmpa %fserve.tmp %fserve.tmp2 %fserve.file } unset %fserve.line } - Stats: { msg = $+ $remove($active,@Autoget) STATS } Dir: { msg = $+ $remove($active,@Autoget) DIr } Sends { msg = $+ $remove($active,@Autoget) sends } Queues: { msg = $+ $remove($active,@Autoget) queues } Who: { msg = $+ $remove($active,@Autoget) who } CD..: { msg = $+ $remove($active,@Autoget) CD.. msg = $+ $remove($active,@Autoget) DIR } CD\: { set %cdflag 1 set %dirline 0 msg = $+ $remove($active,@Autoget) CD.. } Exit: { msg = $+ $remove($active,@Autoget) exit } - Continue_Msg: { msg = $+ $remove($active,@Autoget) C } Stop_Msg: { msg = $+ $remove($active,@Autoget) S } Command: { msg = $+ $remove($active,@Autoget) $?="message" }}Menu @autogetin { - Exit: { msg = $+ $remove($active,@autogetin) exit }}; ****************************************************************; This alias is the main autoget script and is triggered from ; the autoget menu; ****************************************************************; Parameters passed :; $1 = Leech Nick; Variables Used :; %-CurEvent = Current Event to be processed ; ****************************************************************alias autoget-case { echo 4 -s Entered alias Autoget-case If (% [ $+ [ %WrkNick ] $+ ] -CurEvent == $null) { echo 14 -s Current Event is Null } else { echo 14 -s Current Event is % [ $+ [ %WrkNick ] $+ ] -CurEvent } ; coming in from the on CHAT function ; This is basically like a big case statement to get triggered events ; for the autoget process if ($1 != $null) { set %WrkNick $1 echo -s Entered autoget-case for Nick : %WrkNick if (% [ $+ [ %WrkNick ] $+ ] -CurEvent == $null) { ; if we are just starting go ahead, otherwise go to the appropriate Event Level (its a big if statement) ; we need to get the directory and save it in the config file var %leechfile = % [ $+ [ %WrkNick ] $+ ] -LeechFile var %wrkline = $sline(@Autoget [ $+ [ %WrkNick ] ] ,1) %wrkline = $mid(%wrkline, $pos(%wrkline,$chr(32))+1, $len(%wrkline)) if ($pos(%wrkline,$chr(91)) > 0 && $pos(%wrkline,$chr(93)) > 0) { ; ------------- lets get the directory line ------------------------------ ; we need to go through all this bullshit to cut a line, what a crock! var %pos1 = $pos(%wrkline,$chr(91)) ;var %pos2 = $pos(%wrkline,$chr(93)) var %pos2 = $len(%wrkline)-%pos1 inc %pos1 dec %pos2 var %pos3 = %pos2 %pos3 = %pos3 - %pos1 inc %pos3 set % [ $+ [ %WrkNick ] $+ ] -Directory $mid(%wrkline, %pos1, %pos3) ; check if the directory has a \ at the start if ($mid(% [ $+ [ %WrkNick ] $+ ] -Directory , 1, 1) == \ || $mid(% [ $+ [ %WrkNick ] $+ ] -Directory , 1, 1) == / && % [ $+ [ %WrkNick ] $+ ] -Directory != / && % [ $+ [ %WrkNick ] $+ ] -Directory != \) { set %pos1 $len(% [ $+ [ %WrkNick ] $+ ] -Directory) dec %pos1 var %workdir = % [ $+ [ %WrkNick ] $+ ] -Directory % [ $+ [ %WrkNick ] $+ ] -Directory = $mid(%workdir , 2, %pos1) var %tempdir = $mid(%workdir , 2, %pos1) if (*.* isin %tempdir) { var %tdir = $len(%tempdir) - 4 set % [ $+ [ %WrkNick ] $+ ] -Directory $mid(%tempdir,1,%tdir) } } ; ------- we just got the directory so now lets prompt for the rest of the details --------------- ; create the dialog to get the settings dialog -mrv al_setup- [ $+ [ %WrkNick ] ] alsetup ; Setup the dialog window where we ask for the trigger and display it ; also do a check to see what channel %wrknick is on did -o al_setup- [ $+ [ %WrkNick ] ] 5 1 $comchan(%WrkNick,1) ; overwrite the al_setup id 5 (id from the table) with the first channel name that wrknick and I am on. ; **TODO** we need to check if the Nick on this channel has a +V ; (just in case he is on multiple channels and only advertising on one) ; When we exit out of this routine on the first time, we are going to put our trigger in the dialog and hit ok. This is ; going to trigger two on dialog events and pass us on to the next routine if (% [ $+ [ %WrkNick ] $+ ] -Directory != $null) { writeini %leechfile Settings Directory % [ $+ [ %WrkNick ] $+ ] -Directory } else { writeini %leechfile Settings Directory ERROR - UNABLE TO GET DIRECTORY } ; set a few variables up unset % [ $+ [ %WrkNick ] $+ ] -Directory set % [ $+ [ %WrkNick ] $+ ] -bLoggedIn $false ; -bloggedIn is the flag to whether we have a dcc session up or not. set % [ $+ [ %WrkNick ] $+ ] -CurEvent -1 } else { echo -s Unable to get current directory from line : %wrkline echo -s Aborting autoget ;window -c @AutoLeech- [ $+ [ %WrkNick ] ] unset % [ $+ [ %WrkNick ] $+ ] -CurEvent unset % [ $+ [ %WrkNick ] $+ ] -Directory unset % [ $+ [ %WrkNick ] $+ ] -bDirOnly } } elseif (% [ $+ [ %WrkNick ] $+ ] -CurEvent == 1) { ; we just sent the trigger so now we need to change directory echo -s Changing Directory after Trigger ; need to store the directory so we can change into it if (% [ $+ [ %WrkNick ] $+ ] -WrkDir == $null) { var %store1 = $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) set % [ $+ [ %WrkNick ] $+ ] -WrkDir %store1 } echo -s Work Directory is : % [ $+ [ %WrkNick ] $+ ] -WrkDir ; alstatus 20 = Directory if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) == \ || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) == / ) { set % [ $+ [ %WrkNick ] $+ ] -CurEvent 2 msg = $+ $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,14) cd } elseif ($pos(% [ $+ [ %WrkNick ] $+ ] -WrkDir, \) > 0) { var %pos1 = $pos(% [ $+ [ %WrkNick ] $+ ] -WrkDir, \) dec %pos1 var %wrkline = % [ $+ [ %WrkNick ] $+ ] -WrkDir set %chngdir $mid(%wrkline , 1, %pos1) echo -s Change to Directory is : %chngdir inc %pos1 inc %pos1 var %pos3 = $len(%wrkline) %pos3 = %pos3 - %pos1 inc %pos3 set % [ $+ [ %WrkNick ] $+ ] -WrkDir $mid(%wrkline , %pos1, %pos3) msg = $+ $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,14) cd %chngdir unset %chngdir } else { set % [ $+ [ %WrkNick ] $+ ] -CurEvent 2 msg = $+ $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,14) cd % [ $+ [ %WrkNick ] $+ ] -WrkDir unset % [ $+ [ %WrkNick ] $+ ] -WrkDir } } elseif (% [ $+ [ %WrkNick ] $+ ] -CurEvent == 2) { ; we just cd'd after the change directory echo -s Verify Directory ; verify that we changed into the directory, alstatus 20 = Directory if ($pos($sline(@Autoget [ $+ [ %WrkNick ] ],1), $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20)) %lenname || $pos(%response,queueing) > %lenname || $pos(%response,queued) > %lenname || $pos(%response,qúeued) > %lenname || $pos(%response,adding) > %lenname || $pos(%response,added) > %lenname) { ; do not use the word queue as it is used in other situations as well (i.e. sorry, all queue slots are full (which happens to be a max queue situation, not a queued file one)). ; Update the status screen did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 27 1 Queued file %leech_file ; tell the user we queued the file did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 26 1 %totsqcnt ; increment the queue number in the number of files queued dialog writeini %leechfile Files File [ $+ [ %filenum ] ] [ #Q# [ $+ [ %leech_file ] ] ] ; we are queued so modify the line in the ini file to be #Q# (queued) unset % [ $+ [ %WrkNick ] $+ ] -NumQ unset % [ $+ [ %WrkNick ] $+ ] -CurFileNum unset % [ $+ [ %WrkNick ] $+ ] -ErrorCnt } ; --------------------- The file is being sent -------------------------------------------- elseif ($pos(%response,[) > %lenname || $pos(%response,sent) > %lenname || $pos(%response,sending) > %lenname || %response == $null) { ; see if its the directory line. Sometimes the server says nothing. Otherwise looks for sending or sent. If no response OK, were at check and through, no get. (happens with instasends) if (%response == $null) { echo 15 -s Response was NULL } goto ok } ; ========================= Invalid File Name - Fatal Error ===================================================== elseif ($pos(%response,invalid file name) > %lenname || $pos(%response,doesn't exist) > %lenname || $pos(%response,does not exist) > %lenname) { set %crashflag 1 ech0 13 -s F A T A L C R A S H - H A L T I N G P R O G R A M !!! halt } ; ######################### Error - Something went wrong #################################### else { ; --------- we don't know what the message is so notify the user of the message -------------- ; ******************** WE NEED TO WORK ON THIS!!! ********************************************** dec %totsqcnt ; decrement the total number sending and queued because we aren't really getting a file echo -s Unknown Status message encountered : %response splay -w c:\windows\media\ding.wav ; -------- it couldn't understand the command I sent, try again -------------------- ; unset Our Work Variables and loop again unset % [ $+ [ %WrkNick ] $+ ] -CurFileNum ; ------------ we need to make sure we don't get this more than 3 times otherwise quit --------- if (% [ $+ [ %WrkNick ] $+ ] -ErrorCnt > 0) { inc % [ $+ [ %WrkNick ] $+ ] -ErrorCnt if (% [ $+ [ %WrkNick ] $+ ] -ErrorCnt > 3) { echo -s FATAL ERRORS encountered with autoget system, Aborting disable-al-timer %WrkNick msg = $+ %WrkNick exit unset % [ $+ [ %WrkNick ] $+ ] -ErrorCnt goto exitauto } } else { set % [ $+ [ %WrkNick ] $+ ] -ErrorCnt 1 } disable-al-timer %WrkNick goto end-files } :ok unset %response goto file-loop :end-files ; unset the error count to reset it unset % [ $+ [ %WrkNick ] $+ ] -ErrorCnt unset %response ; ----------- if we are logged in then exit out ------------------------ if (% [ $+ [ %WrkNick ] $+ ] -bLoggedIn == $true) { msg = $+ %WrkNick exit } set % [ $+ [ %WrkNick ] $+ ] -bNextCase $false ; --------- so heres where it catches any files left over after the queues are full ---------------- ; ---------- re-start the timer if we have some files left to get ------------------------ if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] , 24) != $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] , 22)) { enable-al-timer %WrkNick } else { echo -s ***** autoget COMPLETE for %WrkNick ***** did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 27 1 ***** autoget COMPLETE ***** } :exitauto ; unset all the variables unset %leechfile %filenum %leech_file } else { echo -s Could not find Leech file : %leech_file echo -s Aborting autoget disable-al-timer %WrkNick } } } else { echo -s Please pass the Users Nick as the 1st Parameter }}; ****************************************************************; This Alias is used to update the Status Screen; This is called from the Timer which is started from the autoget case; ****************************************************************; Parameters passed :; $1 = Leech Nick; $2 = true or nothing (to force the run); ****************************************************************alias autoget-timer { echo 4 -s Entered alias Autoget-timer if ($1 != $null) { ; Store the Nick for later use var %WrkNick = $1 ; check if we are forcing the run of the file get if ($2 == 1) { echo 3 -s Timer forced for %WrkNick } if (% [ $+ [ %WrkNick ] $+ ] -CurEvent == $null) { ; we shouldn't be running if CurEvent is not set ; unset all the variables and disable the timer echo 7 -s CurEvent IS NULL E R R O R goto unsetmyvars } else { ; Turn the timer off so we don't get hit again while we a busy disable-al-timer %WrkNick set % [ $+ [ %WrkNick ] $+ ] -bNextCase $true ; Verify we have all the variables available if (% [ $+ [ %WrkNick ] $+ ] -status == $null) { var %leechfile = % [ $+ [ %WrkNick ] $+ ] -LeechFile ; Load the status dialog as it is going to hold everything (close it first just in case it already exists) dialog -mrv al_status- [ $+ [ %WrkNick ] ] alstatus ; so dialog is the command, -mrv options, al_status- [ $+ [ %WrkNick ] ] is what we will call it, and alstatus is the table. set % [ $+ [ %WrkNick ] $+ ] -status $true set % [ $+ [ %WrkNick ] $+ ] -dlgname %WrkNick ; we need to load these variables in did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 10 1 %leechfile did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 12 1 $readini -n %leechfile Settings Channel did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 16 1 $readini -n %leechfile Settings Trigger did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 20 1 $readini -n %leechfile Settings Directory did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 14 1 $readini -n %leechfile Settings Nick did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 30 1 60 ; originally 120 did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 31 1 60 ; originally 240 did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 41 1 5 ; set the maximum number of files sent or queued at any one time did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 51 1 0 ; set the starting value of the total sent/queued if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,12) == $null || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,16) == $null || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,20) == $null) { ; Abort Connection, could't get all values from Config File echo -s Aborting autoget, couldn't get all values from Config File. ; unset all the variables goto unsetmyvars } ; Check the counter variables ; alstatus 22 = Total Files if ($did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,22) == $null || $did(al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] ,22) 0 ; so if total files - the number completed and queued is more than zero, than there are still files waiting to be gotten. Go get them. ; if all the files left over are queued we just need to wait for them to come down from the server. /autoget-file %WrkNick %bRunFile = $true } } } if (%bRunFile == $false) { enable-al-timer %WrkNick set % [ $+ [ %WrkNick ] $+ ] -bNextCase $false } } } unset %leechfile goto conttimer :unsetmyvars ; tell the system we have no status screen unset % [ $+ [ %WrkNick ] $+ ] -status unset % [ $+ [ %WrkNick ] $+ ] -dlgname unset % [ $+ [ %WrkNick ] $+ ] -bSentTrigger unset % [ $+ [ %WrkNick ] $+ ] -bDirOnly disable-al-timer %WrkNick ; update the status screen (if available) echo -s autoget for %WrkNick is now OFF if (% [ $+ [ %WrkNick ] $+ ] -CurEvent != $null) { did -o al_status- [ $+ [ % [ $+ [ %WrkNick ] $+ ] -dlgname ] ] 27 1 Error occured, everything cleared. } :conttimer}; ****************************************************************; This is the Dialog setup for the Channel and Trigger info; This is called from the autoget-case on initial autoget setup; ****************************************************************dialog alsetup { title "autoget Settings" size -1 -1 334 125 Text "Enter Channel" , 4 , 20 20 80 20 Edit "" , 5 , 100 20 220 20 Text "Enter Trigger" , 6 , 20 60 80 20 Edit "" , 7 , 100 60 220 20 Button "OK" , 8 , 110 100 80 20 , ok}; ****************************************************************; set the Channel Variable; ****************************************************************on *:dialog:al_setup*:edit:5: { echo 4 -s Entered dialog alsetup 5 ; set some local variables var %setupnick = $remove($dname,al_setup-) var %setupfile = % [ $+ [ %setupnick ] $+ ] -LeechFile ; we need to extract the trigger from the dialog and write the ini file if ($did(al_setup- [ $+ [ %setupnick ] ] ,5) != $null) { writeini %setupfile Settings Channel $did(al_setup- [ $+ [ %setupnick ] ] ,5) }}; ****************************************************************; set the Trigger Variable; ****************************************************************on *:dialog:al_setup*:edit:7: { echo 4 -s Entered dialog alsetup 7 ; set some local variables var %setupnick = $remove($dname,al_setup-) var %setupfile = % [ $+ [ %setupnick ] $+ ] -LeechFile ; we need to extract the trigger from the dialog and write the ini file if ($did(al_setup- [ $+ [ %setupnick ] ] ,7) != $null) { writeini %setupfile Settings Trigger $did(al_setup- [ $+ [ %setupnick ] ] ,7) }}; ****************************************************************; Check the close of the dialog box; ****************************************************************on *:dialog:al_setup*:sclick:8: { echo 4 -s Entered dialog alsetup 8 ; set some local variables var %setupnick = $remove($dname,al_setup-) var %setupfile = % [ $+ [ %setupnick ] $+ ] -LeechFile ; Make sure we are up to date if ($did(al_setup- [ $+ [ %setupnick ] ] ,5) != $null) { writeini %setupfile Settings Channel $did(al_setup- [ $+ [ %setupnick ] ] ,5) } if ($did(al_setup- [ $+ [ %setupnick ] ] ,7) != $null) { writeini %setupfile Settings Trigger $did(al_setup- [ $+ [ %setupnick ] ] ,7) } ; write the leech file with channel and trigger ; start the timer enable-al-timer %setupnick run-al-timer %setupnick 5 echo -s autoget for %setupnick is now ON ; Send an exit to the current window to close it ; Close the chat window .msg = $+ %setupnick exit}; ****************************************************************; This is the Dialog for the autoget status screen; This also stores all of the Settings for each autoget process; ****************************************************************dialog alstatus { title "autoget-Status" size -1 -1 408 369 Text "LeechFile" , 9 , 20 25 70 20 Edit "" , 10 , 90 20 300 20 , autohs Text "Channel" , 11 , 20 65 70 20 Edit "" , 12 , 90 60 300 20 , autohs Text "Nick" , 13 , 20 95 70 20 Edit "" , 14 , 90 90 300 20 , autohs Text "Trigger" , 15 , 20 125 70 20 Edit "" , 16 , 90 120 300 20 , autohs Text "Directory" , 19 , 20 155 70 20 Edit "" , 20 , 90 150 300 20 , autohs Text "MaxQueue" , 17 , 20 185 70 20 Edit "" , 18 , 100 180 40 20 , autohs Text "Delay (sec)" , 29 , 165 185 65 20 Edit "" , 30 , 230 180 40 20 , autohs Edit "" , 31 , 290 180 40 20 , autohs Text "Max Files at Once" , 40 , 165 220 100 25 Edit "" , 41 , 262 215 40 20 autohs Text "Total Send/Queue Count" , 50 , 165 255 120 25 Edit "" , 51 , 300 250 40 20 Text "Total Files" , 21 , 20 215 70 20 Edit "" , 22 , 100 210 40 20 , autohs Text "Num Completed" , 23 , 20 245 80 20 Edit "" , 24 , 100 240 40 20 , autohs Text "Num Queued" , 25 , 20 275 70 20 Edit "" , 26 , 100 270 40 20 , autohs Text "Status" , 27 , 5 300 320 20 Button "Close" , 28 , 300 320 80 20 , ok}; ****************************************************************; set the Channel Variable; ****************************************************************on *:dialog:al_status*:edit:12: { echo 4 -s Entered dialog alstatus 12 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,12) != $null) { writeini %setupfile Settings Channel $did(al_status- [ $+ [ %setupnick ] ] ,12) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Channel }}; ****************************************************************; set the Nick Variable; ****************************************************************on *:dialog:al_status*:edit:14: { echo 4 -s Entered dialog alstatus 14 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { writeini %setupfile Settings Nick $did(al_status- [ $+ [ %setupnick ] ] ,14) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Nick }}; ****************************************************************; set the Trigger Variable; ****************************************************************on *:dialog:al_status*:edit:16: { echo 4 -s Entered dialog alstatus 16 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ %setupnick ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,16) != $null) { writeini %setupfile Settings Trigger $did(al_status- [ $+ [ %setupnick ] ] ,16) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Trigger }}; ****************************************************************; set the MaxQueue Variable; ****************************************************************on *:dialog:al_status*:edit:18: { echo 4 -s Entered dialog alstatus 18 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,18) != $null) { writeini %setupfile Settings MaxQueue $did(al_status- [ $+ [ %setupnick ] ] ,18) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for MaxQueue }}; ****************************************************************; set the Directory Variable; ****************************************************************on *:dialog:al_status*:edit:20: { echo 4 -s Entered dialog alstatus 20 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; we need to extract the trigger from the dialog and write the ini file if ($did(al_status- [ $+ [ %setupnick ] ] ,20) != $null) { writeini %setupfile Settings Directory $did(al_status- [ $+ [ %setupnick ] ] ,20) ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Config File Updated for Directory }}; ****************************************************************; Check the close of the dialog box; ****************************************************************on *:dialog:al_status*:sclick:28: { echo 4 -s Entered dialog alstatus 28 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) ; stop the timer disable-al-timer %setupnick echo -s autoget for %setupnick is now OFF ; unset everything unset % [ $+ [ %setupnick ] $+ ] -bNextCase unset % [ $+ [ %setupnick ] $+ ] -bLoggedIn unset % [ $+ [ %setupnick ] $+ ] -CurEvent unset % [ $+ [ %setupnick ] $+ ] -status unset % [ $+ [ %setupnick ] $+ ] -bSentTrigger unset % [ $+ [ %setupnick ] $+ ] -TrigCnt unset % [ $+ [ %setupnick ] $+ ] -bDirOnly unset % [ $+ [ %setupnick ] $+ ] -CurFileNum ; just in case unset % [ $+ [ %setupnick ] $+ ] * ; prompt to delete autoget file $$?!="Delete autoget file? if ($1 == $true) { /remove %setupfile }}; ****************************************************************; Change the Delay for the Timer; ****************************************************************on *:dialog:al_status*:edit:30: { echo 4 -s Entered dialog alstatus 30 ; set some local variables var %setupnick = $remove($dname,al_status-) if ($did(al_status- [ $+ [ %setupnick ] ] ,14) != $null) { var %setupnick = $did(al_status- [ $+ [ % [ $+ [ %setupnick ] $+ ] -dlgname ] ] ,14) } if (% [ $+ [ %setupnick ] $+ ] -status == $true) { var %setupfile = $did(al_status- [ $+ [ %setupnick ] ] ,10) var %newtime = 120 if ($did(al_status- [ $+ [ %setupnick ] ] ,30) != $null && $did(al_status- [ $+ [ %setupnick ] ] ,30) > 9 ) { %newtime = $did(al_status- [ $+ [ %setupnick ] ] ,30) ; stop the timer disable-al-timer %setupnick ; restart the timer with the new time in Seconds enable-al-timer %setupnick %newtime ; update the status screen did -o al_status- [ $+ [ %setupnick ] ] 27 1 Timer Updated } }}; ****************************************************************; Change the Max Send/Queues; ****************************************************************on *:dialog:al_status*:edit:41 { }; ****************************************************************; Enable the autoget Timer; ****************************************************************alias enable-al-timer { echo 4 -s Entered alias Enable-al-timer if ($1 != $null) { if ($2 != $null) { var %wrktime = $2 } else { var %wrktime = 60 ; was 120 if (% [ $+ [ $1 ] $+ ] -status == $true) { %wrktime = $rand( $did(al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] ,30), $did(al_status- [ $+ [ % [ $+ [ $1 ] $+ ] -dlgname ] ] ,31) ) ; get the timer range from the dialog echo -s Restarting timer with Randmized time of %wrktime } } /timer- [ $+ [ $1 ] ] 0 %wrktime autoget-timer $1 }}; ****************************************************************; Disable the autoget Timer; ****************************************************************alias disable-al-timer { echo 4 -s Entered alias Disable-al-timer if ($1 != $null) { /timer- [ $+ [ $1 ] ] off }}; ****************************************************************; Run the autoget-timer command NOW; ****************************************************************alias run-al-timer { echo 4 -s Entered alias Run-al-timer if ($1 != $null) { if ($2 != $null) { var %wrktime = $2 } else { var %wrktime = 5 } /timer- [ $+ [ $1 ] $+ ] -2 1 %wrktime autoget-timer $1 1 }}; ****************************************************************; This procedure marks the file as downloaded if we are autogeting; ****************************************************************on *:filercvd:*.*:{ echo 4 -s Entered On Filercvd set %rq 0 if (%crashflag == 1) { echo 8 -s CRASHED On File Received HALTING halt } ; Find the file name and Mark it as #D# for Downloaded if ($nick != $null) { if (% [ $+ [ $nick ] $+ ] -status == $true) { var %rcvdfile = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] ,10) ; %rcvdfile = the name of the current leech file. echo -s File Received, checking Autoget for file $nopath($filename) in %rcvdfile ; checking Autoget for the name of the file received in the leechfile being used. if ($exists(%rcvdfile) == $true) { var %filenum = 0 :file-loop inc %filenum var %leech_file = $readini -n %rcvdfile Files File [ $+ [ %filenum ] ] ; leech file is going to have the #D# or #Q# in it if it is done or queued. ; read the name of file number filenum from the leech file if (%leech_file == $null) { goto exit-file-loop } ; if were at the end of the list exit the loop var %wrk_leech_file = %leech_file ; leech_file is the filename got from the leech file echo -s Checking file %leech_file ; create a variable with the name of the file without the spaces in it var %wrk_leech_file = $replace(%wrk_leech_file, $chr(32), _) ; so wrk_leech_file is leech_file without any spaces. Sometimes the file sent has _ instead of spaces like the name in the original directory. if (%leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ] || %wrk_leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ] || %leech_file == $nopath($filename) || %wrk_leech_file == $nopath($filename) ) { ; so if the file downloaded is equal to the name of the file in the leech file with spaces or _ and with or without #Q# ; if not then its already done on that file, goto the end, loop, and look at the next filename ; if so, then its one of the not done or queued filenames we wanted to download, continue if (%leech_file != $nopath($filename) && %wrk_leech_file != $nopath($filename)) { ; it has a #Q# in front of it so remove it and set the flag that we have received a queued file var %origfile = $mid(%leech_file, 4, $len(%leech_file)) set %rq 1 echo 2 -s Recvdqueued flag = %rq echo 2 -s Queued File has been received. echo 2 -s leech_file was %leech_file } else { var %origfile = %leech_file ; else it doesn't, its an unqueued file, so leave it alone echo 2 -s Recvdqueued flag = %rq echo 2 -s Non-queued File has been received. echo 2 -s leech_file was %leech_file } writeini %rcvdfile Files File [ $+ [ %filenum ] ] [ #D# [ $+ [ %origfile ] ] ] ; write it down in the leech file as Done. echo 2 -s [ [ $nick ] $+ ] -status = % [ $+ [ $nick ] $+ ] -status echo 2 -s Recvdqueued flag before loop = %rq ; we also need to reduce the Queued File Counter and increase the Completed Counter set %nickstat % [ $+ [ $nick ] $+ ] -status ; have to use nickstat because the if statement doesn't like the -status var for some reason. if (%nickstat == $true && %rq == 1) { ; if were not just beginning (I think thats what that flag is for) and the file was queued (important!) ; if the file wasn't queued then don't decrement the total queued dialog! var %tempQ = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] , 26) ; set tempQ to total number queued set % [ $+ [ $nick ] $+ ] -NumQ %tempQ dec % [ $+ [ $nick ] $+ ] -NumQ ; reduce the total number queued by 1 if (% [ $+ [ $nick ] $+ ] -NumQ < 0) { set % [ $+ [ $nick ] $+ ] -NumQ 0 } ; but don't let it go below zero did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 26 1 % [ $+ [ $nick ] $+ ] -NumQ echo 2 -s Decremented the queue number ; set the new total queued number in the total queued dialog } if (% [ $+ [ $nick ] $+ ] -status == $true) { var %tempQ = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] , 24) set % [ $+ [ $nick ] $+ ] -NumQ %tempQ inc % [ $+ [ $nick ] $+ ] -NumQ did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 24 1 % [ $+ [ $nick ] $+ ] -NumQ ; inc the total number completed and set it in the dialog echo 2 -s incremented the total number completed dec %totsqcnt did -o al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] 51 1 %totsqcnt ; update the status screen and the dialog 51 ; decrement the total files sending or queued } goto exit-file-loop } goto file-loop :exit-file-loop ; clean ourselves up unset % [ $+ [ $nick ] $+ ] -NumQ unset %recvdqueued if (%mqflag == 1) { /run-al-timer $nick set %mqflag 0 } } } } ; if (% [ $+ [ $nick ] $+ ] -status == $true) { ; run the auto=leech-file to see if we can get the next file ; /run-al-timer $nick ; }}; ****************************************************************; This procedure Find the file name and Remove the #Q# from the ; so it can be queued again ; ****************************************************************on *:getfail:*.*:{ echo 4 -s Entered On Getfail if (%crashflag == 1) { echo 8 -s CRASHED On Getfail HALTING halt } if ($nick != $null) { if (% [ $+ [ $nick ] $+ ] -status == $true) { var %failfile = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] ,10) echo 7 -s File Received FAILED, checking Autoleech for file $nopath($filename) if ($exists(%failfile) == $true) { var %filenum = 0 :file-loop inc %filenum var %leech_file = $readini -n %failfile Files File [ $+ [ %filenum ] ] ; are we at the end of our files if (%leech_file == $null) { goto exit-file-loop } var %wrk_leech_file = %leech_file ; create a variable with the name of the file without the spaces in it var %wrk_leech_file = $replace(%wrk_leech_file, $chr(32), _) if (%leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ] || %wrk_leech_file == [ #Q# [ $+ [ $nopath($filename) ] ] ]) { ; re-write the config file without the #Q# var %origfile = $mid(%leech_file, 4, $len(%leech_file)) writeini %failfile Files File [ $+ [ %filenum ] ] %origfile goto exit-file-loop } goto file-loop :exit-file-loop ; we also need reduce the Queued File Counter if (% [ $+ [ $nick ] $+ ] -status == $true) { var %tempQ = $did(al_status- [ $+ [ % [ $+ [ $nick ] $+ ] -dlgname ] ] , 26) set % [ $+ [ $nick ] $+ ] -NumQ %tempQ dec
0
J4Gu4R Messages postés 385 Date d'inscription samedi 7 août 2004 Statut Membre Dernière intervention 3 juillet 2007
3 janv. 2005 à 17:22
reuhh !!

heu si t'a un code interessant vaut mieux le poster dans les sources en l'expliquant un minimum bien sur (et surtout si c toi l'auteur ) mais merci pour la source corrigée

-J4Gu4R-
0
Rejoignez-nous