KNOB,
I was able to solve some of my problems here is the LISTBOX script I have. I think it looks pretty good, however if you have any suggestions??.
Next I need to link this script to my export script. So that the Tables selected in the 1st script are exported. Since the Number of Tables will be variable, I am unsure how to proceed. The Table names have been saved to a TEXT file called:
"C:\Temp Data Files\Raw Data\Temp Export Tables.txt"
My second Script works for exporting ONE table. When you need to export MULTIPLE Tables you just keep entering the TABLE names at the "Table ? " PROMPT. Once the last table is sent you just nned to enter a SemiColon to indicate there are no more tables to be entered. The system responds with a list of Tables you have selected. I have included a snapshot of how this works.
Any and all help you can provide will be greatly appreciated.
1st Script for selecting Tables to be EXPORTED:
#define WorkDir "C:\Temp Data Files\Raw Data\"
#define SaveDir "C:\Temp Completed Reports\"
#define sEnter "^M"
#define szSpace " "
;****************************************************************************************/
;* Procedure: Main() Called by: */
;* Last Modified: 01/14/2004 */
;* Purpose: */
;* */
;****************************************************************************************/
proc main
integer Event, iSystem, iLen, ivar, len
integer nItem = 0 ; Integer to indicate current file.
string szList, szNewItem
string fEnd = ".csv"
string sProfiles, sSystem, sCallProcess, sDlist, sNetwork, sComma, szItem
string fName2 = "Temp Export Tables.txt"
string sTok1, sLine
sProfiles = "SACT,AS,US,SMSGS,COS,DELCOS,DELUP"
sSystem = "SPCFG,SPBIL,SPNBIL,NPSTND,NPPBX,SASTAT,SSSTAT,SMSTAT,SOSTAT"
sCallProcess = "CPMENU,CPLO,CPLR"
sDlist = "DLIST"
sNetwork = "SN,NPROF,SPNBIL,NPN,NPSAN,NETSTS,NETSTU,NETSMT,NGSP,NLSP,NSS,COSOPT,NETP"
sComma = ","
dialogbox 100 198 96 253 154 3 " PhoneMail EXPORT Table Selection Screen "
pushbutton 101 20 7 100 24 "PhoneMail Box Exports"
pushbutton 102 20 46 100 24 "PhoneMail System Exports"
pushbutton 103 135 6 100 24 "Call Processing Exports"
pushbutton 104 136 46 100 24 "Distribution List Exports"
pushbutton 105 78 83 100 24 "PhoneMail Network Exports"
pushbutton 106 88 117 24 19 "OK" OK
pushbutton 107 122 118 50 19 "CANCEL" CANCEL
enddialog
while 1
dlgevent 100 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 100 ; No event occurred.
endcase
case 101 ; Something was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
chdir WorkDir
fopen 2 fName2 CREATE TEXT
dialogbox 0 264 99 150 156 11 " Select The TABLES you want Exported"
listbox 1 45 11 61 103 sProfiles multiple szList sort
pushbutton 2 40 130 22 14 "&OK" OK
pushbutton 3 73 130 40 14 "&CANCEL" CANCEL DEFAULT
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1 ; Something was chosen.
endcase
case 2
dlgsave 0 1
exitwhile
endcase
case 3
exitwhile
default ; Exit case chosen.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
if nullstr szList ; Check to see if text is null.
fclose 2
else
fputs 2 szList
fclose 2
endif
exitwhile
endcase
case 102 ; Something was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
chdir WorkDir
fopen 2 fName2 CREATE TEXT
dialogbox 0 264 99 150 156 11 " Select The TABLES you want Exported"
listbox 1 45 11 61 103 sSystem multiple szList sort
pushbutton 2 40 130 22 14 "&OK" OK
pushbutton 3 73 130 40 14 "&CANCEL" CANCEL DEFAULT
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1 ; Something was chosen.
endcase
case 2
dlgsave 0 1
exitwhile
endcase
case 3
exitwhile
default ; Exit case chosen.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
if nullstr szList ; Check to see if text is null.
fclose 2
else
fputs 2 szList
fclose 2
endif
exitwhile
endcase
case 103 ; Something was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
chdir WorkDir
fopen 2 fName2 CREATE TEXT
dialogbox 0 264 99 150 156 11 " Select The TABLES you want Exported"
listbox 1 45 11 61 103 sCallProcess multiple szList sort
pushbutton 2 40 130 22 14 "&OK" OK
pushbutton 3 73 130 40 14 "&CANCEL" CANCEL DEFAULT
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1 ; Something was chosen.
endcase
case 2
dlgsave 0 1
exitwhile
endcase
case 3
exitwhile
default ; Exit case chosen.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
if nullstr szList ; Check to see if text is null.
fclose 2
else
fputs 2 szList
fclose 2
endif
exitwhile
endcase
case 104 ; Something was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
chdir WorkDir
fopen 2 fName2 CREATE TEXT
dialogbox 0 264 99 150 156 11 " Select The TABLES you want Exported"
listbox 1 45 11 61 103 sDlist multiple szList sort
pushbutton 2 40 130 22 14 "&OK" OK
pushbutton 3 73 130 40 14 "&CANCEL" CANCEL DEFAULT
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1 ; Something was chosen.
endcase
case 2
dlgsave 0 1
exitwhile
endcase
case 3
exitwhile
default ; Exit case chosen.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
if nullstr szList ; Check to see if text is null.
fclose 2
else
fputs 2 szList
fclose 2
endif
exitwhile
endcase
case 105 ; Something was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
chdir WorkDir
fopen 2 fName2 CREATE TEXT
dialogbox 0 264 99 150 166 11 " Select The TABLES you want Exported"
listbox 1 45 11 61 112 sNetwork multiple szList sort
pushbutton 2 40 137 22 14 "&OK" OK
pushbutton 3 74 137 40 14 "&CANCEL" CANCEL DEFAULT
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1 ; Something was chosen.
endcase
case 2
dlgsave 0 1
exitwhile
endcase
case 3
exitwhile
default ; Exit case chosen.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
if nullstr szList ; Check to see if text is null.
fclose 2
else
fputs 2 szList
fclose 2
endif
exitwhile
endcase
case 106 ; Something was chosen.
exitwhile ; Exit the loop.
endcase
case 107 ; Something was chosen.
exitwhile ; Exit the loop.
endcase
default ; Exit case chosen.
endcase
endswitch
endwhile
dlgdestroy 100 CANCEL ; Destroy the dialog box.
endproc
2nd script for Exporting Tables:
I selected 3 Tables to be Exported: CPLO,CPLR,DLIST
proc main
integer iStatus
string NewItem, iTable ; Item selected from list.
when target 0 "Start Date [MM/DD/YY hh:mm" call Enter
when target 1 "Do you wish to send the file (Y/N)" call sYes
NewItem = iTable
sdlginput "Export Table" "Enter Table to be Exported:" iTable
waitfor "Login:" 30
execute "Log-SA.wax" ; This will LOG you into the PhoneMail System
waitfor "Function: " FOREVER
transmit "EXPORT^M"
waitfor "Destination ?" FOREVER
transmit "FILE^M"
waitfor "Table ?" 10
transmit iTable ;THIS IS THE DATA THAT COMES FROM THE listbox (textfile)
transmit "^M" ;AFTER EACH ENTRY NEED TO SEND AN ENTER AND THEN WAIT FOR
;THE NEXT "Table ?" PROMPT, AND THEN SEND THE NEXT ENTRY. WHEN
waitfor "Table ? " 10 ;ALL TABLES ARE ENTERED NEED TO SEND ";^M" TO INDICATE NO MORE TABLES
transmit ";^M" ;THE SYSTEM WILL RESPOND WITH A LIST OF ALL TABLES SELECTED FOR EXPORT
waitfor "Is this correct (y/n) ? " ;AND ASK "Is this correct (y/n)"
transmit "Y^M"
waitfor "The file will be transferred" FOREVER
transmit "^M"
waitfor "YMODEM receive."
getfile YMODEM
iStatus = $XFERSTATUS
while iStatus
yield
iStatus = $XFERSTATUS
endwhile
waitfor "Please enter valid password:" FOREVER
transmit $PASSWORD ;AFTER ALL TABLES HAVE BEEN RECEIVED THE SYSTEM WILL PROMPT FOR A PASSWORD
mspause 150 ;SEND $PASSWORD, THEN LOGOUT OF THE PHONEMAIL SYSTEM
transmit "^M"
waitfor "Function: " FOREVER
transmit "LOG^M"
waitfor "Action: " FOREVER
transmit "LOG^M"
hangup
endproc
proc Enter
Transmit "^M"
endproc
proc sYes
Transmit "Y^M"
endproc
3rd here is the Capture file for the above script:
Function: EXPORT
Wed Jan 14, 2004 10:12 AM
Export Data Utility Version 1.1
Querying Nodes.
.........
Node #1 has responded..
Node #2 has responded.
All nodes have responded.
Reading Export Table Configuration..
Destination ? FILE
Table ? CPLO
Start Date [MM/DD/YY hh:mm] ?
All records will be exported.
Table ? CPLR
Start Date [MM/DD/YY hh:mm] ?
All records will be exported.
Table ? DLIST
Start Date [MM/DD/YY hh:mm] ?
All records will be exported.
Table ? ;
Selected tables are :
CPLO DLIST
Is this correct (y/n) ? Y
Table selection finished.
Analyzing CPLO...
Approx. time to transfer on 1200bps Term port #6: 1 minute per 120 records
Approx. time to transfer on 9600bps Term port #4: 1 minute per 960 records
Gathering data......
Copying ...........
File Name : E:\SYS\CPLO00.TXT
File Size in Bytes: 2047
Block Size in Bytes: 1024
Total Blocks : 2
Approximate Transfer Time at 1200bps on Term port #6 (Min:Sec): 0:25
Approximate Transfer Time at 9600bps on Term port #4 (Min:Sec): 0:03
Do you wish to send the file (Y/N) : Y
The file will be transferred using the YMODEM BATCH protocol.
After reading this message, start the "Receive files using YMODEM BATCH
protocol" function in your local communications software.
If you are running PROCOMM press CTRL-ALT-4 and select YMODEM BATCH,
to transfer file from PhoneMail to the PC
Send Complete -- CPLO00.TXT
Analyzing CPLR...
Approx. time to transfer on 1200bps Term port #6: 1 minute per 120 records
Approx. time to transfer on 9600bps Term port #4: 1 minute per 960 records
Gathering data.....Node 1 has no data to export at this time.
..Node 2 has no data to export at this time.
...Analyzing DLIST...
Approx. time to transfer on 1200bps Term port #6: 1 minute per 120 records
Approx. time to transfer on 9600bps Term port #4: 1 minute per 960 records
Gathering data.........
Copying ......Node 2 has no data to export at this time.
File Name : E:\SYS\DLIST00.TXT
File Size in Bytes: 603
Block Size in Bytes: 1024
Total Blocks : 1
Approximate Transfer Time at 1200bps on Term port #6 (Min:Sec): 0:17
Approximate Transfer Time at 9600bps on Term port #4 (Min:Sec): 0:02
Do you wish to send the file (Y/N) : Y
The file will be transferred using the YMODEM BATCH protocol.
After reading this message, start the "Receive files using YMODEM BATCH
protocol" function in your local communications software.
If you are running PROCOMM press CTRL-ALT-4 to transfer file from PhoneMail to the PC
Send Complete -- DLIST00.TXT
Export exiting...done.
Please enter valid password:
Returning to the main System Administration menu
(this could take up to 5 minutes) ...
PhoneMail release 6.4.3.2
CPU Type of local node is 80386 33MHz.
PhoneMail (Node 1 of 2) is active with 16 Channels
Function: lo
Wed Jan 14, 2004 10:21 AM
Action: lo
Login:
AS ALWAYS YOU ASSISTANCE IS GREATLY APPRECIATED.