DAM> A sample mex will be great help. Thanks.
Here it is!
-----------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// File: PHONE.mex
//
// Desc: Check user's VOICE and COMPUTER phone numbers
//
/////////////////////////////////////////////////////////////////////////////
#define INCL_global
#include
#include // MNU_CHG_HOTKEYS
void main()
{
int: ch,
loop,
save_hot;
string: phone,
dataphone,
template,
choice,
str_enter_ph;
save_hot := usr.hotkeys; // Save Hot Key setting
// if the number is already 14 characters long - exit
if (strlen(usr.phone)=14) goto chek2;
// if the number is in the old 13 character format - convert to 14
if (strlen(usr.phone)=13)
{
phone := substr(usr.phone,1,5)+" "+substr(usr.phone,6,8);
usr.phone := phone;
return;
}
// print("\nYour VOICE phone number has not been entered or " +
// "was entered incorrectly\n");
str_enter_ph := "Please enter your VOICE number:";
template := str_enter_ph + " (...) ...-....";
loop := 0;
// Turn Hot Keys on temporarily if not already on
if (usr.hotkeys 1) menu_cmd(MNU_CHG_HOTKEYS,"");
while (loop=0)
{ // Start While
do
{ // Start Do While
if (strlen(phone)=0) phone := str_enter_ph + " (";
if (strlen(phone)=strlen(str_enter_ph)+5) phone := phone + ") ";
if (strlen(phone)=strlen(str_enter_ph)+10) phone := phone + "-";
print("\r",template,"\r",phone);
choice := "0123456789";
if (strlen(phone)=(strlen(str_enter_ph)+2)) choice := "23456789";
if (strlen(phone)=(strlen(str_enter_ph)+7)) choice := "23456789";
ch := input_list(choice, CINPUT_FULLPROMPT |
CINPUT_NOLF, "", "\r"+template+"\r"+phone, "");
phone := phone + itostr(ch-48);
} while (strlen(phone)strlen(str_enter_ph)+15);
print("\r",phone,"\n\n");
ch := input_list("yn", 0, "", "",
"Was your phone number entered correctly");
if (ch 89) phone := "";
else loop := 1;
} // End While
usr.phone := substr(phone,strlen(phone)-13,14);
chek2:
// if the number is already 14 characters long - exit
if (strlen(usr.dataphone)=14) return;
// if the number is in the old 13 character format - convert to 14
if (strlen(usr.dataphone)=13)
{
dataphone := substr(usr.dataphone,1,5)+"
"+substr(usr.dataphone,6,8);
usr.dataphone := dataphone;
return;
}
// print("\nYour COMPUTER phone number has not been entered or " +
// "was entered incorrectly\n");
str_enter_ph := "Please enter your COMPUTER number:";
template := str_enter_ph + " (...) ...-....";
loop := 0;
// Turn Hot Keys on temporarily if not already on
if (usr.hotkeys 1) menu_cmd(MNU_CHG_HOTKEYS,"");
while (loop=0)
{ // Start While
do
{ // Start Do While
if (strlen(dataphone)=0) dataphone := str_enter_ph + " (";
if (strlen(dataphone)=strlen(str_enter_ph)+5) dataphone := dataphone
+ ") ";
if (strlen(dataphone)=strlen(str_enter_ph)+10) dataphone := dataphone
+ "-";
print("\r",template,"\r",dataphone);
choice := "0123456789";
if (strlen(dataphone)=(strlen(str_enter_ph)+2)) choice := "23456789";
if (strlen(dataphone)=(strlen(str_enter_ph)+7)) choice := "23456789";
ch := input_list(choice, CINPUT_FULLPROMPT |
CINPUT_NOLF, "", "\r"+template+"\r"+dataphone, "");
dataphone := dataphone + itostr(ch-48);
} while (strlen(dataphone)strlen(str_enter_ph)+15);
print("\r",dataphone,"\n\n");
ch := input_list("yn", 0, "", "",
"Was your COMPUTER number entered correctly");
if (ch 89) dataphone := "";
else loop := 1;
} // End While
usr.dataphone := substr(dataphone,strlen(dataphone)-13,14);
usr.hotkeys := save_hot; // Reset Hot Key Setting
print ('\n',
"Thank you, I've updated the records to show the following:",
'\n', "Voice phone # = ",usr.phone, '\n',
"Data phone # = ",usr.dataphone, '\n');
sleep (15);
return;
}
------------------------------------------------------------------
I don't understand a lick of it, but someone gave it to me and it works. It
will ask new users for both, and it will ask existing users for the missing
data number.
Robby
--- Maximus 3.01
---------------
* Origin: Red Shift BBS ... Snellville, Ga. ... (770) 979-9467 (1:133/8003)
|