QuickLink Message Center 2.X Script Commands AddFile(char *filename) Description Adds a file to the internal linked list. Each time this is called, memory is allocated. Return value Returns TRUE if successful, otherwise returns FALSE. Example main() { Echo("Adding filename to list.\r\"); ClearList(); AddFile("C:\\AUTOEXEC.BAT"); AddFile("GOLDHOST.SRP"); } See also: ClearList(). _______________________________________________________________________ AllowUploads() Return value Returns TRUE if "Allow uploads" is checked in Host Setup, otherwise returns FALSE. Example main() { if (AllowUploads()) Echo("Uploads OK."); } _______________________________________________________________________ Atol(char *string) Description Takes a NULL terminated character string and converts it to an integer value. Return value Returns the integer value produced by interpreting the input characters as a number. The return value is 0 if the input can not be converted to an integer. Example main() { int number; Echo("Calling AtoI.\r\n"); number = AtoI("123456"); } _______________________________________________________________________ Baud(int BaudRate) Description Sets the baud rate Return value Returns TRUE if BaudRate valid, otherwise FALSE. Example main() { Echo("Changing the baud rate to 2400bps .\r\n"); Baud(2400); } _______________________________________________________________________ Beep() Description Emits a simple beep for a second. Return value None. Example main() { Echo("This is a beep.\r\n"); Beep(); } _______________________________________________________________________ CompuAcct() Return value Returns a pointer to the string in your services setup for the CompuServe account number. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(CompuAcct(), number); } _______________________________________________________________________ CallDetected() Description Waits for the line to ring, then answers it. Return value Returns baud rate of connection if a call has come in, otherwise returns FALSE. Example main() { while(!Call Detected()); } _______________________________________________________________________ Capture(char *filename) Description Turns the file capture on or off. To turn it on, just specify a file name. To turn it off, use the "off" parameter. Return value None. Example main() { Echo("Turning file capture on.\r\n"); Capture("BBS.TXT"); Echo("Turning file capture off.\r\n"); Capture("off"); } _______________________________________________________________________ ClearList() Description Clears the internal linked list that was created with AddFile. Return value None. Example main() { Echo("Clearing list of files.\r\n"); ClearList(); } See also: AddFile(). _______________________________________________________________________ CompuPass() Return value Returns a pointer to the string in your services setup for the CompuServe password. Example main() { char number[50]; echo("Copying info into number.\r\n"); StrCpy(CompuPass(), number); } _______________________________________________________________________ Close(int handle) Description Closes the file associated with handle. Return value If successful the function returns 0, otherwise the return value is -1. Example main() { int filehandle; filehandle = Open("C:\\AUTOEXEC.BAT", 0); Echo("Closing file.\r\n"); Close(filehandle); } See also: Open() _______________________________________________________________________ Cls() Description Clears the screen. Return value None. Example main() { Echo("Clearing the screen.\r\n"); Cls(); } _______________________________________________________________________ CompuNetwork() Return value Returns an integer corresponding to the network selected in your services setup: 0 = Compunet 1 = Telenet 2 = Tymnet; Example main() { int network; Echo("Getting Compuserve network.\r\n"); network = CompuNetwork(); } _______________________________________________________________________ CompuPhone() Return value Returns a pointer to the string in your services setup for the CompuServe number. Example main() { char number [50]; Echo("Copying info into number.\r\n"); StrCpy(CompuPhone(), number); } _______________________________________________________________________ Copy(char *source, char *dest, int count) Description Copies count bytes from source to dest. Return value None. Example main() { char source[30] = "This is the TEXT", dest[30]; Echo("Copying the word TEXT to dest.\r\n"); Copy(&source[12], dest, 4); } _______________________________________________________________________ CurrentBaud() Return value Returns an integer corresponding to the current baud rate. Example main() { int baud; Echo("Getting baud rate.\r\n"); baud = CurrentBaud(); } _______________________________________________________________________ Data(int DataBits) Description Sets the number of data bits. Return value Returns TRUE if data bits are valid, otherwise FALSE. Example main() { Echo("Changing the data bits to eight.\r\n"); Data(8); } _______________________________________________________________________ Dial(char *Number) Description Dials a number. Return value Returns FALSE if invalid number or dial attempt failed, otherwise returns TRUE. Example main() { Echo("Dialing 555-1212.\r\n"); Dial("555-1212"); } _______________________________________________________________________ DowNetwork() Return value Returns an integer corresponding to the network selected in your services setup: 0 = Telenet 1 = Tymnet Example main() { int network; Echo("Getting Dow Jones network.\r\n"); network = DowNetwork(); } _______________________________________________________________________ Download(int protocol [,chr *filename]) Description Begins the receiving of a file. The filename parameter is only required for ASCII and Xmodem transfers. 1 = ASCII 2 = Kermit 3 = Xmodem 4 = Xmodem (CRC) 5 = X-modem 1K 6 = Ymodem 7 = Y-modem G 8 = Zmodem Return value Returns TRUE if successful, otherwise FALSE. Example main() { Echo("Begin receiving a Ymodem transfer.\r\n"); Download(6); } _______________________________________________________________________ DowPass() Return value Returns a pointer to the string in your services setup for the Dow Jones password. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(DowPass(), number); } _______________________________________________________________________ Echo(char *string) Description Sends string to the screen. Return value None. Example main() { char string[30] = "Hello, world.\r\n"; Echo(string); } _______________________________________________________________________ Exists(char *FileName) Description Determines if the file specified by FileName exists. Return value The function returns 0 if the file exists, otherwise -1 is returned. Example main() { if (Exists("C:\\AUTOEXEC.BAT\r\n")) Echo("AUTOEXEC.BAT does not exist.\r\n"); } _______________________________________________________________________ GeniePass() Return value Returns a pointer to the string in your services setup for the Genie password. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(GeniePass(), number); } _______________________________________________________________________ GeniePhone() Return value Returns a pointer to the string in your services setup for the Genie number. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(GeniePhone(), number); } _______________________________________________________________________ GenieUser() Return value Returns a pointer to the string in your services setup for the Genie account number. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(GenieUser(), number); } _______________________________________________________________________ GetDirectory() Description Gets the current working directory. Return value Returns a pointer to the name of the current directory. Example main() { Echo("The current directory is "); Echo(GetDirectory()); Echo(".\r\n"); } _______________________________________________________________________ GetKeyStroke() Description Gets a key stroke from the operators keyboard and ignores any characters from the modem. Return value The function returns 0 if the keyboard buffer is empty, otherwise the key is returned or -1 if the Esc key was hit. Example main() { Echo("Please hit a key to continue.\r\n"); GetKeyStroke(); } _______________________________________________________________________ GetUserInput(char *string, char echo, int timeOut) Description Builds a string, either from the remote user or from the keyboard, and fills the string parameter with the characters entered by the user. If echo is TRUE, characters will be echoed to the remote user. Return value The function returns FALSE after TimeOut seconds or -1 if the Esc key is pressed, otherwise it returns TRUE after the Enter key is pressed. Example main() { char name[82]; Echo("\r\nPlease enter your name: "); GetUserInput(name, TRUE, 120); } _______________________________________________________________________ Hangup() Description Hangs up the line. Return value None. Example main() { if (CarrierDetect()) Hangup(); } _______________________________________________________________________ HomePath() Description Gets the directory where Quick Link Gold is installed. Return value Returns a pointer to the name of the directory where Quick Link Gold is installed. Example main() { Echo("\r\nQuick Link Gold was installed in: "); Echo(HomePath()); Echo(".\r\n"); } _______________________________________________________________________ HostInit() Return value Returns a pointer to the string in the init string edit field in your Host mode setup. Example main() { Echo("Setting up modem...\r\n"); Out(HostInit()); } _______________________________________________________________________ HostPath() Return value Returns a pointer to the string in the host edit field in your host setup. Example main() { char path[144]; Echo("Get the host path and copy into path.\r\"); StrCpy(HostPath(), path); } _______________________________________________________________________ HostSpeed() Return value Returns an integer corresponding to the line setting in host setup. Example main() { int hostspeed; Echo("Getting the host speed.\r\n"); hostspeed = HostSpeed(); } _______________________________________________________________________ HostTimeout() Return value Returns the integer corresponding to the host timeout in host setup. Example main() { int HOSTTIMEOUT; Echo("Getting Host Timeout.\r\n"); HOSTTIMEOUT = (HostTimeout()*60); } _______________________________________________________________________ In(char *string [, int seconds]) Description If seconds are specified, the function will wait for seconds until string is received by the modem; otherwise, the next character coming over the modem will be appended to the string. Return value Returns FALSE if timed out, otherwise returns TRUE. Example main() { char string[50]; Echo("Adding a character to string.\r\n"); In(string); } _______________________________________________________________________ ItoA(int number, char *string) Description Takes number and converts it to an ASCII string. Return value None. Example main() { int number = 12345; char string[20]; Echo("Converting a number to a string.\r\n"); ItoA(number, string); Echo(string); } _______________________________________________________________________ KBytesFree(char DriveLetter) Description Retrieves the number of Kbytes free on specified DriveLetter. Return value Returns Kbytes free if successful otherwise returns FALSE. Example main() { Echo("This is the available space on drive C. \r\n"); KBytesFree('c'); } _______________________________________________________________________ LocalEcho(int ON_or_OFF) Description Turns local echo on or off. Return value Returns TRUE if ON or OFF valid, otherwise FALSE. Example main() { Echo("Turning local echo on.\r\n"); LocalEcho(1); } _______________________________________________________________________ LogonDelay() Description Waits for the number of seconds specified in host setup before starting. Return value None. Example main() { Echo("Waiting for logon delay.\r\n"); LogonDelay(); } _______________________________________________________________________ Max(int Number1, int Number2) Description Determines which number is larger. Return value Returns the value of the larger number. Example main() { int i; Echo("Setting i to 125.\r\n"); i = Max(5, 125); } _______________________________________________________________________ Min(int Number1, int Number2) Description Determines which number is smaller. Return value Returns the value of the smaller number. Example main() { int i; Echo("Setting i to 5.\r\n"); i = Min(5, 125); } _______________________________________________________________________ MovePassword() Return value Returns a pointer to the string in the move password edit field in your host setup. Example main() { char movepassword[50]; Echo("Get the host move password and copy into movepassword.\r\n"); StrCpy(MovePassword(), movepassword); } _______________________________________________________________________ Open(char *path, int mode) Description Opens the file associated with path and prepares the file for reading and writing in the given mode. The mode argument must be either 0 (for text mode) or 1 (for binary mode). If a file is opened in text mode, carriage-return-line-feed (CR-LF) combinations are translated into single line feeds (LF) on input and LF characters are translated into CR-LF combinations on output. If a file is opened in binary mode, the above translations are suppressed. Return value If successful the function returns 0, otherwise the return value is -1. Example main() { int filehandle; Echo("Opening file in text mode.\r\n"); filehandle = Open("C:\\AUTOEXEC.BAT", 0); } _______________________________________________________________________ Out(char *string) Description Sends string to the modem. Return value None. Example main() { char string[30] = "Hello, world.\r\n"; Out(string); } _______________________________________________________________________ OutFile(char *fileName) Description The OutFile function takes the text file, fileName and transmits a page at a time to the remote computer. After each full screen of text a prompt is displayed and the remote user has the option to either display the next page or cancel the operation. Return value TRUE if file Name is a valid file, otherwise FALSE. Example main() { Echo("Here goes the file.\r\n"); OutFile("C:\\AUTOEXEC.BAT"); } _______________________________________________________________________ OutBuffer(char *string, int n) Description Sends n characters from string to the modem. Return value None. Example main() { char string[30]="Hello, world"; OutBuffer(string,StrLen(string)); } _______________________________________________________________________ Parity(char N) Description Sets the parity. Valid parameters include: M - Mark N - None S - Space O - Odd E - Even Return value Returns FALSE if invalid parity, otherwise TRUE. Example main() { Echo("Setting parity to even.\r\n"); Parity("E"); } _______________________________________________________________________ Password() Return value Returns a pointer to the string in the password edit field in your host setup. Example main() { char password[50]; Echo("Get the host password and copy into password.\r\n"); StrCpy(Password(), password); } _______________________________________________________________________ PlaySound(char *filename) Description Plays the wave file specified by the filename. Return value None. Example main() { Echo("Playing wave file \r\n"); PlaySound("C:\\Windows\\sound.wav"); } Note: Requires Windows 3.1 and above _______________________________________________________________________ Read(int filehandle, char *buffer, int count) Description The read function attempts to read count bytes into buffer from the file associated with filehandle. The read operation begins at the current position of the file pointer associated with the given file. After the read the file pointer points to the next unread character. Return value The Read function returns the number of bytes actually read, which may be less than count if there are fewer than count bytes left in the file or if the file was opened in text mode. The return value 0 indicates an attempt to read at end of file. The return value -1 indicates an error. Example main() { int filehandle; char buffer[256]; if (Read(filehandle,buffer,256)==256 Echo("Just read the first 256 bytes of AUTOEXEC.BAT\r\n"); } _______________________________________________________________________ Remove(char *filename) Description Deletes the file associated with filename. Return value None. Example main() { Echo("Deleting my AUTOEXEC.BAT file.\r\n"); Remove("C:\\AUTOEXEC.BAT"); } _______________________________________________________________________ RtsCts(char *ON_or_OFF) Description Sets hardware flow control. Return value TRUE if set was accomplished, otherwise FALSE. Example main() { Echo("Setting hardware flow control.\r\n"); RtsCts("ON"); } _______________________________________________________________________ Seek(int handle, int offset, int origin) Description The seek function moves the file pointer associated with handle to a new location that is offset bytes from origin. The next operation on the file occurs at the new location. The origin must be one of the following: 0 (beginning of file), 1 (current position), or 2 (end of file). Return value The seek function returns the offset, in bytes, of the new position from the beginning of the file. A return value of -1 indicates an error. Example main() { int filehandle; filehandle = Open("C:\\AUTOEXEC.BAT", 0); Echo("Moving 256 bytes past beginning of file.\r\n"); Seek(filehandle, 256, 0); Close(filehandle); } _______________________________________________________________________ SetDirectory(char *Dir) Description Sets the current working directory to the directory specified in Dir. Return value None. _______________________________________________________________________ SetLocalHost(char TRUEorFALSE) Description Toggles the local host mode emulator. Return value None. _______________________________________________________________________ Sprintf(char *buffer, format[, argument]...) Description The sprintf function formats and stores a series of characters and values in buffer. Each argument is converted and output according to the corresponding format. Specifications. Format specifiers begin with the % and include zero or more of the Following conversion specification elements (optional fields are in brackets). % [option flags] [field size] conversion Some of these elements are optional, but if present, they must be specified in the order in which the are described below. Option flags (optional): left justify output in field, pad on right (default is to right justify). 0 = use zero (0) rather than space for the pad character. Field size specification (optional) - the minimum field width, expressed as a decimal integer. The corresponding paramter will be printed in a field at least this wide. Conversion characters (required): c = parameter is a character i = parameter is an integer s = parameter is a null terminated string % = print a %, no parameter used The format specification elements must correspond to the following parameters. Return value None. Example main() { char k = 'Z', m[80] = "C:\\AUTOEXEC.BAT"; int n = 5; sprintf("Unrecognized character %c on line %i of file %s.\r\n", k, n, m); } _______________________________________________________________________ Stop(char *StopBits) Description Sets the stop bits. Valid parameters include:"1", "1.5", and "2" Return value Returns FALSE if invalid stop bits, otherwise TRUE. Example main() { Echo("Setting stop bits to one.\r\n"); Stop("1"); } _______________________________________________________________________ StrCat(char *String1, char *String2) Description Appends String2 to the end of String1, terminating the resulting string with a null character. Return value The function returns a pointer to String1. _______________________________________________________________________ StrCpy(char *String1, char *String2) Description Copies String1 to String2, including the terminating null character. Return value The function returns a pointer to String2. _______________________________________________________________________ StrLen(char *string) Description The StrLen function returns the length in bytes of string, not including the terminating Null chracter ('\0'). Return value The StrLen function returns the string length. Example main() { int i; char string[20] = "STRING"; Echo("Getting length of string.\r\n"); i = StrLen(string); } _______________________________________________________________________ StrnCmp(char *String1, char *String2, int n) Description The StrnCmp function compares at most, the first n characters of String1 and String2 and returns a value indicating the relationship between the strings, as listed below. Return value The StrnCmp function returns less than zero if String1 < String2, greater than zero if String1 > String2, and zero (0) if String1 is equivalent to String2. Example main() { char String1[30] = "apple"; char String2[30] = "bannana"; if (!StrnCmp(String1, String2, 5)) Echo("String1 and String2 are the same.\r\n"); } _______________________________________________________________________ StrnCmpI(char *String1, char *String2, int n) Description This is the case-insensitive version of StrnCmp. _______________________________________________________________________ Time (int &year, int &month, int &day, int &dayofweek, int &hour, int &minute, int &second, int &hsecond) Description Fills the parameters with the appropriate values. Return value Returns the time in seconds elapsed since the system was booted Example main() { int year, month, day, dayofweek, hour; int minute, second, hsecond, numseconds; Echo("Getting the time.\r\n"); numseconds = Time(&year, &month, &day, &dayofweek, &hour, &minute, &second, &hsecond); } _______________________________________________________________________ TelenetPhone() Return value Returns a pointer to the string in your services setup for the Telenet number. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(TelenetPhone(), number); } _______________________________________________________________________ TymnetPhone() Return value Returns a pointer to the string in your services setup for the Tymnet number. Example main() { char number[50]; Echo("Copying info into number.\r\n"); StrCpy(TymnetPhone(), number); } _______________________________________________________________________ Until(char *TimeOfDay) Description Pauses until TimeOfDay. Return value FALSE if the Esc key was hit, otherwise TRUE. Example main() { Echo("Waiting until 4:47 pm.\r\n"); Until("16:47"); } _______________________________________________________________________ Upload(int protocol [,char *filename]) Description Begins the sending of a file or multiple files. Kermit, Ymodem, and Zmodem require previous calls to AddFile(). For other protocols, the file name must be passed as a parameter. 1 = ASCII 2 = Kermit 3 = Xmodem 4 = X-modem 1K 5 = Ymodem 6 = Y-modem G 7 = Zmodem Return value Returns TRUE if successful, otherwise returns FALSE. Example main() { Echo("Adding filename to list.\r\n"); ClearList(); AddFile("C:\\AUTOEXEC.BAT"); Addfile("GOLDHOST.SRP"); Echo("Sending two files via Kermit protocol.\r\n"); Upload(2); ClearList(); Echo("Sending a file via ASCII protocol.\r\n"); Upload(1, "README.DOC"); } _______________________________________________________________________ UseMovePassword() Return value Returns TRUE if "Use move password" is selected in host setup, otherwise returns FALSE. Example main() { if (UseMovePassword()) Echo("Passwords are required to change directories.\r\n"); } _______________________________________________________________________ UsePassword() Return value Returns TRUE if "Use password" is selected in host setup, otherwise returns FALSE. Example main() { if (UsePassword()) Echo("Passwords are required.\r\n"); } _______________________________________________________________________ Wait(int NumSeconds) Description Pauses until NumSeconds. Return value Always returns TRUE. Example main() { Echo("Waiting ten seconds.\r\n"); Wait(10); } _______________________________________________________________________ WaitAnyInput(int seconds) Description The WaitAnyInput function will wait the specified number of seconds for any input from the remote computer or from the keyboard. Return value The WaitAnyInput function returns -1 if Esc key was hit before timing out, 0 if no input was attained before the timeout, otherwise it returns the key which was hit. Example main() { char name[80]; Echo("Please hit a key to continue.\r\n"); WaitAnyInput(120); } _______________________________________________________________________ WaitFor(char *string, int seconds) Description The WaitFor function will wait the specified number of seconds for the stream string from the remote computer. Return value Returns TRUE if the specified string was found within the given time period, otherwise returns FALSE. Example main() { char string[30] = "apple"; if (WaitFor(string, 30)) Echo("The word apple came across the modem port.\r\n"); } _______________________________________________________________________ Write(int handle, char *buffer, int count) Description The Write function writes count bytes from buffer into the file associated with handle. The write operation begins at the current position of the file pointer associated with the given file. After the write operation the file pointer is increased by the number of bytes actually written. Return value The Write function returns the number of bytes actually written. The return value may be less than count if disk space is depleted before count bytes are written. Example main() { int filehandle; char buffer[256] = "This is the buffer"; if (Write(filehandle, buffer, StrLen(buffer)) == StrLen(buffer)) Echo("Just wrote buffer to disk.\r\n"); } _______________________________________________________________________ XonXoff(char *ON_or_OFF) Description Sets software flow control. Return value TRUE if set was accomplished, otherwise FALSE. Example main() { Echo("Setting software flow control.\r\n"); XonXoff("ON"); } _______________________________________________________________________ YieldToSystem() Description Gives processing time back to Windows to allow for multitasking. Return value None. Example main() { Echo("Do nothing.\r\n"); While(1) YieldToSystem(); }