home *** CD-ROM | disk | FTP | other *** search
- $MACRO_FILE COMUTIL;
- {******************************************************************************
- MULTI-EDIT MACRO FILE COMUTIL
-
- COM_MEFT_XFER - File transfer interface to the external program MEFT.
- COM_DSZ_XFER - File transfer interface to the external program DSZ.
- COM_LOG_WBBS - Auto log-on macro for WBBS.
- COM_LOG_COMPU - Auto log-on macro for Compuserve.
- COM_LOG_RBBS - Auto log-on macro for most RBBS and PC-Board systems.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO COM_MEFT_XFER TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_MEFT_XFER
-
- Description: A comunications module macro. Provides an interface to the
- external protocol program MEFT.EXE.
-
- Parameters:
- /MY= The Y coordinate to reference screen output to.
- /DIR= The direction of the transfer. Legal values are:
- UP - for upload
- DOWN - for download
- /FN= The file name. Not needed if YMODEM batch.
- /BATCH= Only needed if /PRO=YMODEM and batch. It is the name of
- the file list for YMODEM batch uploading.
- /PRO= The protocol name. Legal names are:
- XMODEM
- XMODEM-CRC
- XMODEM-1K
- YMODEM
-
- Returns:
- Return_Int = 0 - Transfer was probably successful.
- Return_Int = -1 - Transfer was unsuccessful.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Str(Direction[8],Tstr,Protocol[20],
- prot[4] );
- Def_Int(Menu_Y,Error,Port_Num,jx);
-
- port_num := global_int('COM_PORT_NUM');
- Menu_Y := Parse_Int('/MY=',MParm_Str);
- IF (Menu_Y < 1) THEN
- Menu_Y := 3;
- END;
- Direction := Parse_Str('/DIR=',MParm_Str);
- Tstr := Parse_Str('/FN=',MParm_Str);
- Protocol := Caps(Parse_Str('/PRO=',MParm_Str));
- Error := XPos('(',Protocol,1);
- IF (Error) THEN
- Protocol := Copy(Protocol,1,Error - 1);
- END;
- IF protocol = 'XMODEM' THEN
- prot := 'X';
- ELSIF copy(protocol,1,10) = 'XMODEM-CRC' THEN
- prot := 'XC';
- ELSIF copy(protocol,1,9) = 'XMODEM-1K' THEN
- prot := 'XC1K';
- ELSIF copy(protocol,1,6) = 'YMODEM' THEN
- prot := 'YC';
- IF direction = 'UP' THEN
- IF parse_str('/BATCH=', mparm_str) <> '' THEN
- tstr := '@' + parse_str('/BATCH=', mparm_str );
- END;
- END;
- ELSE
- invalid_parameter:
- RM('MEERROR^MessageBox /T=ERROR/B=2/M=Invalid protocol name for MEFT file transfer.');
- goto exit;
- END;
- Put_Box(5,Menu_Y + 1,76,Menu_Y + 12,0,M_B_Color,'FILE ' + Direction + 'LOAD'
- ,True);
- Write('Press <CtrlX> to abort',29,Menu_Y + 11,0,M_B_Color);
-
- {We must not swap ME out for this since we use some of the kernal's routines}
- GotoXY(6,Menu_Y + 2);
-
- {We must not swap ME out for this since we use some of the kernal's routines}
- RETURN_STR := me_path + 'MEFT.EXE ' + prot + ' ' + Copy(Direction,1,1) +
- ' ' + Str( port_num ) + ' ' + tstr;
- RM('MEUTIL1^EXEC /SWAP=1');
- Return_Int := -1;
- write_com( port_num, '|17|13', jx );
- error := Exit_Code;
- IF (Error = 10) THEN
- Error := 0;
- END;
- If error <> 0 then
- IF ((Error > 66) and (Error < 70)) THEN
- TSTR := Protocol + ' ' + Lower(Direction) +
- 'load cancelled by ' + Remove_Space(Copy('sender receiveruser',
- ((Error - 67) * 8) + 1,8)) + '.';
- ELSE
- Return_Int := Error;
- RM('MECOM^COM_ERROR');
- Tstr := Protocol + ' error - ' + Return_Str;
- Return_Int := -1;
- END;
- ELSE
- IF (Error_Level <> 0) THEN
- RM('Meerror');
- TSTR := Protocol + ' ' + Lower(Direction) +'load terminated.';
- ELSE
- TSTR := Protocol + ' ' +
- Copy('receivesend',((Direction = 'UP') * 7) + 1,7) + ' of ' + TStr +
- ' complete.';
- Return_Int := 0;
- END;
- end;
- RM('MECOM^COM_XFER_BEEP');
- Write(Tstr,6,Menu_Y + 10,0,M_S_Color);
- Write('════Press any key═════',29,Menu_Y + 11,0,M_B_Color);
- Read_Key;
- Kill_Box;
- exit:
- END_MACRO;
-
- $MACRO COM_DSZ_XFER TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_DSZ_XFER
-
- Description: A comunications module macro. Provides an interface to the
- external protocol program DSZ.
-
- Parameters:
- /CMD= The DSZ command(usually indicates protocol and direction),
- but may include the following aliases:
- <DLDIR> Will insert the user-defined download directory
- specification if one exists.
- <ULDIR> Will insert the user-defined upload directory
- specification if one exists.
- <FILE> Will insert /FN=.
-
- /FN= The file name. Not used if /BATCH= <> ''.
- /BATCH= If = '', then use /FN= for single file transfer.
- Otherwise, indicates the name of the file containing filenames
- for batch transfer.
- /NPX= if 1, don't use the DSZ portx command, but instead use the
- default COM1 or COM2 address and interrupt. Only to be
- used if your version of DSZ does not support the portx
- command.
-
- Returns:
- Return_Int = 0 - Transfer was probably successful(Provided you
- don't use COMMAND.COM to run DSZ)
- Return_Int = -1 - Transfer was unsuccessful.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Str(Port_Str[2],Command_Line,Batch[80]);
- Def_Int(File_Count,Active_Window,Error,T_Int);
-
- Port_Str := Str(global_int('COM_PORT_NUM'));
- Command_Line := Parse_Str('/CMD=',MParm_Str);
- {Check for special aliases in command line and process accordingly}
- T_Int := XPos('<DLDIR>',Caps(Command_Line),1);
- IF (T_Int > 0) THEN
- Return_Str := Parse_Str('/DP=',Global_Str('Com_General_Params'));
- {Strip trailing backslash}
- Return_Str := Copy(Return_Str,1,Length(Return_Str) - 1);
- Command_Line := Copy(Command_Line,1,T_Int - 1) + Return_Str +
- Copy(Command_Line,T_Int + 7,255);
- END;
- T_Int := XPos('<ULDIR>',Caps(Command_Line),1);
- IF (T_Int > 0) THEN
- Command_Line := Copy(Command_Line,1,T_Int - 1) +
- Parse_Str('/UP=',Global_Str('Com_General_Params')) +
- Copy(Command_Line,T_Int + 7,255);
- END;
- T_Int := XPos('<FILE>',Caps(Command_Line),1);
- IF (T_Int > 0) THEN
- Command_Line := Copy(Command_Line,1,T_Int - 1) +
- Parse_Str('/FN=',MParm_Str) +
- Copy(Command_Line,T_Int + 6,255);
- END;
-
- Batch := Parse_Str('/BATCH=',MParm_Str);
- IF (Batch <> '') THEN
- Command_Line := Command_Line + ' @' + Batch;
- END;
-
- {This will insure that we have the best chance of being able to have enough
- room to run DSZ}
-
- {This SHELL_TO_DOS statement uses COMMAND.COM run DSZ. We leave it there
- just in case the one below does not work. Just be sure that the DOS path
- in the environment includes the directory where DSZ.COM or DSZ.EXE resides!
- Shell_To_Dos('DSZ portx ' +
- Lower(Hex_Str(Parse_Int('/A' + Port_Str + '=',Global_Str('Com_Line_Params'))))
- + ',' + Parse_Str('/I' + Port_Str + '=',
- Global_Str('Com_Line_Params')) + ' ' + Command_Line,True );
- }
-
- {This SHELL_TO_DOS statement uses the EXEC function to run DSZ.COM. We use our
- own path search routine using the DOS path. The advantage here is that
- we will return an error level, whereas COMMAND.COM will not}
-
- Return_Str := Get_Environment('PATH') + ';' + Me_Path;
- RM('PATHSEARCH /F=DSZ.COM');
- if (return_int = 0) then
- {If we can't find DSZ.COM, look for DSZ.EXE}
- RM('PATHSEARCH /F=DSZ.EXE');
- end;
- if (return_Int = 0) then
- ERROR_LEVEL := 3002;
- RM('MEERROR /EM=THE PROGRAM DSZ NOT FOUND!');
- Error := 3002;
- Goto NO_PROGRAM;
- else
- {01-31-90 03:38pm - I just discovered that not all versions of DSZ support the
- portx command. This is unfortunately very bad if you want to use it for
- MECOM, since MECOM allows up to 8 com ports and you can specify any address
- and interrupt you wish for each. Portx is the only way I know to tell DSZ
- an explicit address and interrupt. If the user has a version of DSZ that does
- not support portx, the only way he can use it in MECOM is if he restricts his
- com port activity to COM1 or COM2, using the following addresses and
- interrupts:
- COM1 address 3F8 interrupt 4
- COM2 address 2F8 interrupt 3
-
- After the above criteria are met, the user can add to the macro command line
- of every file transfer record that calls this macro:
- /NPX=1
- }
- IF (Parse_Int('/NPX=',Mparm_Str)) THEN
- return_str := Return_Str + ' port ' + Port_Str + ' ' + Command_Line;
- ELSE
- return_str := Return_Str + ' portx ' +
- Lower(Hex_Str(Parse_Int('/A' + Port_Str + '=',Global_Str('Com_Line_Params'))))
- + ',' + Parse_Str('/I' + Port_Str + '=',
- Global_Str('Com_Line_Params')) + ' ' + Command_Line;
- END;
- RM('MEUTIL1^EXEC /MEM=5500/CMD=0/SWAP=0/SCREEN=1');
- end;
-
- Return_Int := 0;
- Error := Exit_Code;
- NO_PROGRAM:
- IF (Error) THEN
- Error_Level := Error;
- RM('MEERROR /EM=DSZ error: ' + str(Error));
- Return_Int := -1;
- ELSIF (Error_Level) THEN
- RM('MEERROR');
- Return_Int := -1;
- ELSE
- RM('MECOM^COM_XFER_BEEP');
- END;
- ABORT:
- END_MACRO;
-
- $MACRO COM_LOG_MAJORBBS TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_LOG_MAJORBBS
-
- Description: A comunications module macro. Automatically logs on to
- Galacticom's MajorBBS boards if you are registered, and if you have your
- user id in the first name field, and your password field entered in the
- phone dialing list.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {Need to log on and confirm the prompts}
-
- Def_Str(First_Name[9],Password[9]);
- Def_Int(Jx);
-
- {Take first name from phone number global}
-
- First_Name := Parse_Str('FN=',Global_Str('PHONE'));
-
- IF (First_Name = '') THEN
- RM('MEERROR^MessageBox /T=ERROR/M=Logon parameters not found!');
- Goto EXIT;
- ELSE
- Password := Parse_Str('PW=',Global_Str('PHONE'));
- END;
-
- {Wait for a connection}
- RM('MECOM^COM_CONNECT_WAIT ' + MParm_Str);
- IF (Return_Int = 0) THEN
- Goto EXIT;
- END;
-
- {Wait for the user id prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1="new":');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send user id}
- Return_Str := First_Name + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Wait for the password prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=Password');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send password}
- Return_Str := Password + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- EXIT:
- END_MACRO;
-
- $MACRO COM_LOG_WBBS TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_LOG_WBBS
-
- Description: A comunications module macro. Automatically logs on to WBBS
- boards if you are registered, and if you have your first and last name, and
- your password fields entered in the phone dialing list. Optionally captures
- all mail and/or messages to the file WBBS.LOG.
-
- Parameters:
- /MSG=1 Capture messages to WBBS.LOG
- /MAIL=1 Capture Mail to WBBS.LOG
- /LOGOFF=1 Log off at the end.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Str(First_Name[20],Last_Name[20],Password[20],ASCII_NAME[80]);
- Def_Int(Jx,Resume_Ascii_Download,Capture,Capture_Mail,Capture_Messages,
- Log_Open);
-
- {Take first name from phone number global}
-
- First_Name := Parse_Str('FN=',Global_Str('PHONE'));
-
- IF (First_Name = '') THEN
- RM('MEERROR^MessageBox /T=ERROR/M=Logon parameters not found!');
- Goto EXIT;
- ELSE
- Last_Name := Parse_Str('LN=',Global_Str('PHONE'));
- Password := Parse_Str('PW=',Global_Str('PHONE'));
- END;
-
- Capture_Messages := Parse_Int('/MSG=',MParm_Str);
- Capture_Mail := Parse_Int('/MAIL=',MParm_Str);
-
- {Wait for a connection}
- RM('MECOM^COM_CONNECT_WAIT ' + MParm_Str);
- IF (Return_Int = 0) THEN
- Goto EXIT;
- END;
-
-
- {Wait for the WBBS name prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=Enter your first and last name:');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send first and last name}
- Return_Str := First_Name + ' ' + Last_Name + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Wait for the WBBS password prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=Password?');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send password}
- Return_Str := Password + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- IF ((Capture_Messages and Capture_Mail) = 0) THEN
- Goto EXIT;
- END;
-
- {Wait for the WBBS mail prompt for 60 seconds}
- {Notice the two slashes(//) between the Y and n. This is because, the
- Parse_Str function used by COM_WAIT_FOR_STR to parse out the string will
- return a single slash if a double slash is encountered}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=You have mail waiting. Read it? (Y//n):'
- + '/S2=Sorry, no mail for you today');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
- Jx := Return_Int;
-
- {Begin an ASCII download to capture all mail, messages, etc.}
- {If we are already ASCII downloading, close that file and we will reopen it
- at the conclusion of this macro.}
-
- IF (Global_Int('COM_ASCII_DOWNLOAD')) THEN
- Ascii_Name := Global_Str('COM_ASCII_FILENAME');
- RM('COM_ASCII_DOWN /QUIT=1');
- Resume_Ascii_Download := True;
- ELSE
- Resume_Ascii_Download := False;
- END;
-
-
- {If there is mail waiting, get it captured to the file}
-
- IF (Jx = 1) THEN
- Return_Str := 'Y|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto RESUME_ASCII;
- END;
-
- IF (Capture_Mail) THEN
- Return_Str := 'WBBS.LOG';
- RM('COM_ASCII_DOWN /OVERWRITE=1');
- Log_Open := True;
- ELSE
- Log_Open := False;
- END;
-
- MORE_MAIL:
- {Wait for 60 seconds for more mail}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=Mail:/S2=<Press ENTER>/S3=(? for menu):');
- IF (Return_Int < 1) THEN
- Goto CLOSE;
- END;
- Jx := Return_Int;
- Return_Str := '|13';
- IF (Jx = 3) THEN
- Return_Str := 'Z' + Return_Str;
- END;
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto CLOSE;
- END;
- IF (Jx < 3) THEN
- Goto MORE_MAIL;
- END;
- END;
-
- IF (Capture_Messages) THEN
- IF (Log_Open = False) THEN
- Return_Str := 'WBBS.LOG';
- RM('COM_ASCII_DOWN /OVERWRITE=1');
- Log_Open := True;
- END;
- ELSE
- IF (Log_Open) THEN
- RM('COM_ASCII_DOWN /QUIT=1');
- END;
- Log_Open := False;
- END;
-
- MORE_MESSAGES:
- {Wait for 60 seconds for more messages}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=(? for menu):/S2=<Press ENTER>/S3=Done with zip read');
- IF (Return_Int < 1) THEN
- Goto CLOSE;
- END;
- IF (Return_int < 3) THEN
- Return_Str := '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto CLOSE;
- END;
- Goto MORE_MESSAGES;
- END;
-
- {Log off}
- IF (Parse_Int('/LOGOFF=',MParm_Str)) THEN
- Return_Str := 'GY|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto CLOSE;
- END;
- END;
-
-
- CLOSE:
- {Close the capture file}
- IF (Log_Open) THEN
- RM('COM_ASCII_DOWN /QUIT=1');
- END;
-
- RESUME_ASCII:
- {If we were downloading ascii before, resume by appending}
-
- IF (Resume_ASCII_DOWNLOAD) THEN
- Return_Str := Ascii_Name;
- RM('COM_ASCII_DOWN /APPEND=1');
- END;
-
- EXIT:
- END_MACRO;
-
- $MACRO COM_LOG_COMPU TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_LOG_COMPU
-
- Description: A comunications module macro. Automatically logs on to
- COMPUSERVE. You must have your user id entered as the first name, and your
- password entered in the phone dialing list.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Str(First_Name[20],Password[20]);
-
- {Take first name from phone number global}
-
- First_Name := Parse_Str('FN=',Global_Str('PHONE'));
-
- IF (First_Name = '') THEN
- RM('MEERROR^MessageBox /T=ERROR/M=Logon parameters not found!');
- Goto EXIT;
- ELSE
- Password := Parse_Str('PW=',Global_Str('PHONE'));
- END;
-
- {Wait for a connection}
- RM('MECOM^COM_CONNECT_WAIT ' + MParm_Str);
- IF (Return_Int = 0) THEN
- Goto EXIT;
- END;
-
- {Send a carriage return}
- Return_Str := '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Wait for the host name prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /EI=4/T=60/S1=Host Name:');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send Host name CIS}
- Return_Str := 'CIS|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Wait for the user id prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /EI=4/T=60/S1=User ID:');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send user id (first name)}
- Return_Str := First_Name + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Wait for the password prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /EI=4/T=60/S1=Password:');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send password}
- Return_Str := Password + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- EXIT:
- END_MACRO;
-
- $MACRO COM_LOG_RBBS TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_LOG_RBBS
-
- Description: A comunications module macro. Automatically logs on to RBBS.
- You must have your first name, last name, and password entered in the phone
- dialing list.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Str(First_Name[20],Last_Name[20],Password[20]);
-
- {Take first name from phone number global}
-
- First_Name := Parse_Str('FN=',Global_Str('PHONE'));
-
- IF (First_Name = '') THEN
- RM('MEERROR^MessageBox /T=ERROR/M=Logon parameters not found!');
- Goto EXIT;
- ELSE
- Last_Name := Parse_Str('LN=',Global_Str('PHONE'));
- Password := Parse_Str('PW=',Global_Str('PHONE'));
- END;
-
- {Wait for a connection}
- RM('MECOM^COM_CONNECT_WAIT ' + MParm_Str);
- IF (Return_Int = 0) THEN
- Goto EXIT;
- END;
-
- {Send an escape character. Seems most RBBS and PCBoards expect this}
- Return_Str := '|27';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Wait for the first name prompt for 60 seconds}
- RM('MECOM^COM_WAIT_FOR_STR /T=60/S1=What is your FIRST name?');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- {Send first name, last name, and password in RBBS shorthand}
- Return_Str := First_Name + ';' + Last_Name + ';' + Password + '|13';
- RM('MECOM^COM_SEND_STR /T=10');
- IF (Return_Int < 1) THEN
- Goto EXIT;
- END;
-
- EXIT:
- END_MACRO;
-