TIP: Click on subject to list as thread! ANSI
echo: telix
to: LUC LEBRUN
from: RICK COLLINS
date: 1997-11-21 20:59:00
subject: mail upload script

Hi Luc,
In a message to All you wrote:
 LL> Hi to ALL
 LL> I need to know if there's a script who detect if you have a
 LL> reply packet in your upload directory and if so, dial the number 
 LL> of the bbs...if not 
 LL> just dial the next entry where you have a reply packet.
Here's one way. 
if (fileattr(d:\comm\up\hbeat131.rep") > 0)	goto dodial ;
looks in the upload directory for a reply packet, and if it finds one (>0) it 
jumps to the routine to dial, or whatever.
 LL> Also i need to know how to perform the upload itself when your in
 LL> the script. (press pgup, choose the transfer protocol, tag the
 LL> reply packet file and then begin the upload)
The following will do that:
result = Send('Z',"D:\comm\up\hbeat131.rep");
That tells Telix to start a ZModem upload, and to upload the file as 
indicated.  You then have to include either a WAITFOR or a tracking loop to 
watch for whatever the BBS sends when the upload is complete.
Those came (slightly modified) from the following script.  This script is 
designed for a MAXIMUS BBS system.  The script is called from the dialing 
directory when Telix connects or it can be called from a dialing script which 
is what you seem to want to do.  The script does the complete logon, 
downloads any waiting packets, uploads any packets destined for that BBS, and 
logs off.  The script is for Telix 3.51 but should work with previous 
versions and (with some modifications) with TFW.
=== begin HEART.SLT ===
/////////////////////////////   MAXIMUS   ///////////////////////
// The logon questions are handled in any order,
// and optional prompts are ok.
////////////////////////////////////////////////////////////////////////////
str user_name[] = "Rick Collins";
str up_file[] = "d:\comm\up\hbeat131.rep";
int stat, trk1, trk2, trk3, trk4, trk5, trk6, trk7, trk8, tmark, wtime;
int trk9, trk10, trk11, trk12, trk13, trk14, trk15;
int result = 0, ypos=0, comp=0, tstflg=0;
//
// Login strings
//
str escreq[] ="for Maximus";
str files[] = "les [Y,n]?";
str more[] = "More [Y,n,=]?";
str name[] = "name:";
str namever[] =" Collins [Y,n]?";
str pass[] = "Password:";
str cont[] = "TER to continue";
str mail[] = "for mail? [Y,n]";
str sel[] = "Select:";
str tstr[6]=" ";
//
main()
{
	ustamp("************ HEARTBEAT ***********",0,1);
	result = do_login();    //run the login stuff
	if (result == 10)
	{
		ustamp("**Login Failed",1,1);
		goto GOODBYE;
	}
	cputs("no^M");
	waitfor("Select:",60);
	//
	// Leaves us at the Offline menu
	//
	if (fileattr(up_file) > 0)	
	do_up();   // Do the standard upload
	do_down();     // Do the standard download
	track_free (0);
	cputs("gyn ^M");
	//
	// Hangup after CARRIER drops
	//
	trk14 = track ("]",1);
	while (carrier())
	{
		terminal();
		stat = track_hit(0);
		if (stat == trk14) cputs("n^M"); 
	}
	GOODBYE:
	hangup();
}
do_login()
{
	int ctr = 0;
	trk1 = track (escreq, 1);
	trk2 = track (files,1);
	trk3 = track (name,1);
	trk4 = track (namever,1);
	trk5 = track (pass, 1);
	trk6 = track (cont,1);
	trk7 = track (mail,1);
	trk8 = track (more,1);
	//
	// Allow 1 minute for all login prompts to be handled
	//
	tmark = timer_start (600);
	while (not time_up (tmark))
	{
		terminal();             // let Telix process any chars and keys
		stat = track_hit (0);   // see which (if any) track was hit
		if (stat == trk7)
		{
			break;
		}
		else if (stat == trk6)
		{
			cputs("^M");
		}
		else if (stat == trk2)
		{
			cputs("n^M");
			track_free (trk2);
		}
		else if (stat == trk8)
		{
			cputs("n^M");
		}       
		else if (stat == trk5)
		{
			cputs(_entry_pass);
			cputs("^M");
			track_free (trk5);
		}
		else if (stat == trk3)
		{
			cputs(user_name);
			cputs("^M");
			track_free (trk3);
		}
		else if (stat == trk4)
		{
			cputs("Y^M");
			track_free (trk4);
		}
		else if (stat == trk1)
		{
			delay (5);
			cputs("^[");  delay_scr(5);  cputs("^[");
			track_free (trk1);
		}
	}
	if (time_up (tmark))  
	{
		timer_free (tmark);                    // free timer channel          
		track_free (0);                        // and all track channels         
		status_wind("Logon failed!",30);               
		return (10);
	}
	timer_free (tmark);                    // free timer channel          
	track_free (0);                        // and all track channels
	return (1);
}              
do_down()
{
	track_free(0);
	cputs("D^M");
	trk11 = track("QWK format [Y,n]?",1);
	trk12 = track(" to abort:",1);
	trk13 = track("Select: ",1);
	while (1==1)
	{
		terminal();
		stat = track_hit(0);
		if (stat == trk11) cputs("Y^M");
		if (stat == trk12) cputs("^M");
		if (stat == trk13) break;
	}
	track_free(0);
}
do_up()
{
	int tmr1=0;
	trk9=track("Select:",0);	
	trk10=track("Area",0);
	cputs("U^M");
	waitfor("*00",100);
	result = Send('Z', up_file);
	while (1)
	{
		terminal();
		stat=track_hit(0);
		if (stat == trk10) tstflg=tstflg+1;
		if(stat==trk9)
		{
			break;
		}
	}
	track_free (0);
	if (tstflg == 0)
	{
		do_test();
	}
	else 
	{
		fdelete(up_file);
		ustamp("== Area# hit.  File Deleted",1,1);
	}
	return;
}
do_test()
{
    fdelete(up_file);
}
=== end HEART.SLT ===
You'll have to go through that to make sure the prompts match whatever BBS 
system you want to use, and, of course, to replace my specific info (names, 
file names, directories, etc) with your own info.  The script assumes the bbs 
password is defined in the dialing directory entry for that BBS.
NOTE:  The "DO_TEST" portion of the script is likely not needed - that was 
included to address a specific problem with a specific system.  It contained 
code that is not in the public domain, and so I have deleted it from the 
script. 
Have fun - and post again if you need more help.
Rick
--- 
---------------
* Origin: The Warlock's Cave (1:163/215.39)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.