Thank you for your encouragement.

I just picked up programming the script in a day, so I apologize in advance the horrible look of it. I tried this script out my passion to learn and nothing more. The purpose of the script is to automatically get files from a remote server. It requires a text file containing a list of commands to trigger file transfers. The text should contain /ctcp <name> <category> <filename>. The remote server runs a fully working script written by someone else.

Here is my script:

;The following should be in the Aliases:
/getFile {
if ($len(%AG_filename) > 0) {
%AG_pathFile = $getdir $+ %AG_filename

if (%AG_lineNo < line(%AG_pathFile)) {
/echo %AG_lineNo : %AG_pathFile
%AG_command = $read -l %AG_lineNo %AG_pathFile
/echo %AG_pathFile
}
else {
return /echo AG: finish downloading file(s)
}
}
else {
return /echo error: please specify an input file [note: type /setfile]
}

if ($len(%AG_command) > 0) {
/echo excuting %AG_command
return %AG_command
}
else {
return /echo there is no command
}
}

/doCheckFile {
if ($len(%AG_command) > 0) {
%AG_sender = $gettok(%AG_command, 2, 32)
%AG_fileToGet = $gettok(%AG_command, 4, 32)

if (($len(%AG_fileToGet) > 0) && ($len(%AG_sender) > 0)) {
/echo the nick is $1
/echo the file is $2
/echo %AG_sender
/echo %AG_fileToGet
if (($1 == %AG_sender) && ($2 == %AG_fileToGet)) {
/echo AG: getting the next file
/timer 1 10 $getFile
}
}
}
else {
/echo error: internal error in AutoGet script
}
}

/get $getFile()
/setFile %AG_filename = $?="Enter file name" | $reset
/reset %AG_lineNo = 1
/checkFile $doCheckFile($1, $2)

;The following should be in the Remote:
1:FILERCVD:*.*:{%AG_lineNo = %AG_lineNo + 1 | /checkFile $nick $nopath($filename)}
on 1:GETFAIL:*.*:{/checkFile $nick $nopath($filename)}

I want to add a feature to auto-resume when file already exists without manually configuring it in the DCC options.