Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting ProComm Directories from a Dropdown box

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
I am trying to write a script to Ask the user to:

1. Select a ProComm Directory from a Dropdown box
2. Select a Folder from within the Directory (i.e. Switches, VoiceMails).
3. Set off a subscript to dail all Entries (when connected execute the Export.wax script).

Needless to say I could use some help

1. How do I get the List box to point to the correct directory.
2. Once the file has been selected I assume a DIALLOAD will load the directory.
3. How do I diplay the list of Folder witin the Directory.
4. Finally how do i get procomm to dial each entry and execute the Export.wax script.

I think I have the basic format.
However, it has been a long time since I wrote aspect script.

Here is part of the Script I have so Far:


proc main

string DirName, FNameVar1
string SelectVar1, ListItem
string FNameVar1, SelectVar2
integer count = 0, len = 0, Event, nItem = 0

case 103 ; MultiSite ProComm Directory was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
usermsg "RUN MultiSite ProComm Directory Selection"

dialogbox 0 193 54 238 199 2 " CBX MultiDial ProComm Group Select"
groupbox 3 13 2 214 36 "ProComm Group Folder Select"
flistbox 4 31 17 182 13 FNameVar1 SINGLE SelectVar1
pushbutton 13 61 174 53 14 "Run"
pushbutton 15 147 174 53 14 "&Exit"
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.
switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 3 ; Something was chosen.
usermsg "`"%s`" selected!" ListItem
endcase
case 4 ; Something was chosen.
usermsg "`"%s`" selected!" ListItem
endcase
case 13 ; RUN was chosen.
usermsg "RUN selected!"
endcase
case 15 ; EXIT was chosen.
usermsg "EXIT selected!"
endcase
default ; Exit case chosen.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.

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
 
You can use the dirlistbox command to display the list of .DIR files in your Procomm directory (you'll need to specify the path and *.DIR in the arguments to the command).

Once the user selects one of the .DIR files, your script would use dialload to load that Connection Directory.

You can then use the dialcount command to find out the number of groups in the Connection Directory and their names.

To dial all of the entries in the group, probably the easiest way would be to use code similar to that in the dialcount section of the ASPECT help file to loop through the entries. After the dial command and some code to make sure you have a good connection (or that could be placed in export.wax), you would use the execute command to launch export.wax. Once that script was done, control would be returned to your script.

 
Knob,

Most of my Directories have multiple Folders in them. How ould they select the Specific folder they want.

Thanks
 
Ah, forgot that part. You can use the dialcount command to get the list of groups in the Connection Directory, then display that list using the listbox command inside a dialog. Your user would then choose the group they wanted from that list. The script would then use the dialcount command, as mentioned in the last paragraph above, to get name of all entires in that particular group and then dial them one at a time.

 
Knob,

I know I am doing something wrong here but all this seems to do is count the Entries, NOT the Groups.

proc main
integer NumGrps ; Used to count Number of Groups.
integer NumEnt ; Used to count Number of Entries.
integer Count ; Used for loop.
string GrpName ; Name of Group.
string EntName ; Name of Entry

dialcount DATA NumGrps ; Get number of DATA entries.
for Count = 0 upto (NumGrps - 1) ; dialname zero-based.
dialname DATA GROUP Count GrpName ; Get name of entry.
endfor
usermsg "`"%d`" Count: " Count
usermsg "`"%s`" Name: " GrpName

endproc


Any Idea what I am doing wrong?
 
KNOB,

Ok disregard my last post. Figured that part out.
However,how do I get all 3 Group Names to appear in the list box?

Here is my complete script to this point. I am currently working on case 103

proc main
string s_line = "", s_Bucket = "", s_CbxType = "", sSmrVer = ""
string s_CbxRel = "", s_CbxMod = "", s_CbxPtch, s_KV = "", ListItem
string FNameVar1
string Ver2 = "9006.2", Ver3 = "9006.3", Ver4 = "9006.4", Ver5 = "9006.5", Ver6 = "9006.6"
string GrpName ; Name of Group.
string EntName ; Name of Entry
string SelectVar1 ; Name of Selected Group
integer count = 0, len = 0, Event, nItem = 0
integer NumGrps ; Used to count Number of Groups.
integer NumEnt ; Used to count Number of Entries.
strcpy FNameVar1 DirName

dialogbox 100 192 96 149 154 3 " Capacity Study Report Type Selection"
pushbutton 101 26 7 100 24 "Single Site from ProComm"
pushbutton 102 26 46 100 24 "Single Site Manual Dial"
pushbutton 103 26 83 100 24 "MultiSite ProComm Directory"
pushbutton 107 47 125 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 ; Single Site from ProComm was chosen
dlgdestroy 100 CANCEL ; Destroy the dialog box.
usermsg "RUN Single site from ProComm Directory"
sdlginput "Account" "Enter CMR Number:" AcctNum
; strcpy sAcctNum AcctNum

; dialload DirName ; Load the specified directory.
dialsave
dialcount DATA iEntries ;Get number of data entries
for iCount = 0 upto (iEntries - 1)
dialname DATA iCount sName ;Get name of entry based on index
set dialentry access DATA sName ;Turn on dialentry for the current entry
fetch dialentry areacode sAreaCode
fetch dialentry phonenumber sPhoneNumber
fetch dialentry company sCompany
fetch userid sUserID
fetch password sPassword
fetch misc sMisc
IF strcmp sCompany AcctNum
usermsg "strcmp Match Company is: %s" sCompany
usermsg "strcmp Match sName is: %s" sName
usermsg "The two strings are identical."
dial DATA sName
while $DIALING ; Loop while dialing.
endwhile
IF $CARRIER ; See IF we're connected.
transmit "^M" ; Send a string to say hello.
Waitquiet 2
transmit "^M"
execute "SCSCKey.wax"
execute "9006 Diag.wax"
isfile "C:\program files\symantec\procomm plus\capture\OutFile.txt"
IF SUCCESS
CAPTURE OFF
fopen 1 "C:\program files\symantec\procomm plus\capture\OutFile.txt" READ TEXT
fgets 1 s_line
strfind s_line "Release is :"
IF SUCCESS
substr s_Bucket s_line 22 6
strcpy s_CbxRel s_Bucket
s_Bucket = ""
; See IF the two strings match.
IF strcmp s_CbxRel Ver2
execute "9006 Ver 62 Capacity Study.wax"
ELSE
IF strcmp s_CbxRel Ver3
execute "9006 Ver 63 Capacity Study.wax"
ELSE
IF strcmp s_CbxRel Ver4
execute "9006 Ver 64 Capacity Study.wax"
ELSE
IF strcmp s_CbxRel Ver5
execute "9006 Ver 65 Capacity Study.wax"
ELSE
IF strcmp s_CbxRel Ver6
execute "9006 Ver 66 Capacity Study.wax"
ELSE
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ELSE
errormsg "Sorry, not connected."
usermsg "Error No Carrier"
ENDIF
usermsg "End of Script"
ENDIF
exitfor
ENDIF
endfor
; usermsg "CBX Release is: %s" s_CbxRel
fgets 1 s_line
strfind s_line "CBX type is :"
IF SUCCESS
substr s_Bucket s_line 22 6
strcpy s_CbxMod s_Bucket
s_Bucket = ""
ENDIF
; usermsg "CBX Model is: %s" s_CbxMod
fgets 1 s_line
fgets 1 s_line
fgets 1 s_line
fgets 1 s_line
strfind s_line "KV :"
IF SUCCESS
substr s_Bucket s_line 22 3
strcpy s_KV s_Bucket
s_Bucket = ""
ENDIF
; usermsg "CBX KV Revision is: %s" s_KV
fgets 1 s_line
strfind s_line "Patch Version :"
IF SUCCESS
substr s_Bucket s_line 22 3
strcpy s_CbxPtch s_Bucket
s_Bucket = ""
ENDIF
; usermsg "CBX Patch Version is: %s" s_CbxPtch
fgets 1 s_line
strfind s_line "SMR Version :"
IF SUCCESS
substr s_Bucket s_line 22 4
strcpy sSmrVer s_Bucket
s_Bucket = ""
ENDIF
dlgdestroy 0 CANCEL ; Destroy the dialog box.
exitwhile ; Exit the loop.
endcase
;
case 102 ; Single Site Manual Dial was chosen.
dlgdestroy 100 CANCEL ; Destroy the dialog box.
usermsg "RUN Single with MANUAL DIAL and Manual Input"
dialload "Manual Dial Test.DIR" ; Load the specified directory.
dialsave
; dialcount DATA iEntries ;Get number of data entries
; for iCount = 0 upto (iEntries - 1)
; dialname DATA iCount sName ;Get name of entry based on index
sdlginput "Manual Dial" "Entry Name:" sName
dialadd DATA sName ;Add an Entry into Directory
set dialentry access DATA sName ;Turn on dialentry for the current entry
sdlginput "Manual Dial" "Area Code:" sAreaCode
set dialentry AreaCode sAreaCode
sdlginput "Manual Dial" "Phone Number:" sPhoneNumber
set dialentry phonenumber sPhoneNumber
sdlginput "Manual Dial" "CMR Number:" sCompany
set dialentry company sCompany
sdlginput "Manual Dial" "Login:" sUserID
set userid sUserID
sdlginput "Manual Dial" "Password:" sPassword
set password sPassword
set misc sPassword
dialinsert DATA "CBX" sname ;Insert entry into CBX Folder
dialsave ;List'group and Save the Connection Directory
IF strcmp sCompany AcctNum
usermsg "strcmp Match Company is: %s" sCompany
usermsg "strcmp Match sName is: %s" sName
usermsg "The two strings are identical."
ENDIF
dlgdestroy 0 CANCEL ; Destroy the dialog box.
endcase
;
case 103 ; MultiSite ProComm Directory was chosen.
usermsg "RUN MultiSite ProComm Directory Selection"
dialcount DATA GROUP NumGrps ; Get number of DATA entries.
for Count = 0 upto (NumGrps - 1) ; dialname zero-based.
dialname DATA GROUP Count GrpName ; Get name of entry.
dialogbox 0 8 20 264 169 2 "Caption"
listbox 1 71 29 132 96 GrpName SINGLE SelectVar1
enddialog
endfor
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.
usermsg "Case 1 Selected"
usermsg "`"%d`" selected!" SelectVar1
endcase
default ; Exit case chosen.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 100 CANCEL ; Destroy the dialog box.
;
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

 
Sorry, I've been away from the computer with the holiday. What you want to do is build a comma-delimited string with the different group names in it and move the dialogbox command you have now after the endfor command. The way you have it right now, I believe you will only have one group name (the current value coming back from the dialname command) in the dialog.

 
KNOB,

Got it to work. Here is the script I have to open a Directory and display all the folders. Thought it may be helpful for someone else. I really appricate the help.


#define SaveDir "C:\Program Files\Symantec\Procomm Plus\Aspect\"
string DirPathID = "C:\Program Files\Symantec\Procomm Plus\*.DIR"
string AcctNum = "" ; User Input Company (CMR) Number
string sComma = ","
string fName = $DDIRFNAME
string sDirName = "TempDir.txt"
string EntName ; Name of directory entry.
string sGroups
string ListItem ; Item selected from list.
string Directory ; Path for dirpath control.
string FileToFind ; File from directory list box.
string sAreaCode ; Area Code String
string sPhoneNumber ; Phone Number String
string sCompany ; Company (CMR) String
string sUserID ; Login String
string sPassword ; Password String
string sMisc ; Misc Field
string sName ; Name of Directory entry
integer NumEnts ; Used to count entries.
integer Count ; Used for loop.
integer cCount ; Count of Folders in Directory
integer iEntries ; Number Entries in dialing class
integer iCount ; Loop variable
integer Event

proc main
; Display a dialog box with a dirpath and directory list box.
dialogbox 0 280 66 158 192 11 "Choose a file"
dirpath 1 34 2 90 13 Directory
dirlistbox 2 8 17 142 129 DirPathID SINGLE FileToFind 1 SORT
pushbutton 3 57 159 40 14 "&OK" OK DEFAULT
enddialog
WHILE 1
dlgevent 0 Event ; Get the dialog event.
SWITCH Event ; Evaluate the event.
CASE 0 ; No event occurred.
ENDCASE
CASE 2 ; Something was chosen.
dialload FileToFind
dialsave
dialcount DATA iEntries ; Get number of data entries
FOR iCount = 0 upto (iEntries - 1)
dialname DATA iCount sName ; Get name of entry based on index
set dialentry access DATA sName ; Turn on dialentry f/Current entry
fetch dialentry areacode sAreaCode
fetch dialentry phonenumber sPhoneNumber
fetch dialentry company sCompany
fetch userid sUserID
fetch password sPassword
fetch misc sMisc
ENDFOR
dlgdestroy 0 CANCEL ; Destroy the dialog box.
dialcount DATA GROUP sGroups NumEnts ; Get number of DATA entries.
cCount = 0
chdir SaveDir
fopen 2 sDirName CREATE TEXT
FOR Count = 0 upto (NumEnts - 1) ; dialname zero-based.
dialname DATA GROUP sGroups Count EntName ; Get name of entry.
fputs 2 EntName
cCount ++
ENDFOR
fclose 2
usermsg "Directory %s" SaveDir
dialogbox 0 0 0 100 50 11 "File List Box Example"
flistbox 1 5 5 90 40 sDirName SINGLE ListItem
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.
usermsg "`"%s`" selected!" ListItem
EXITWHILE ; Exit the loop.
ENDCASE
default ; Exit case chosen.
EXITWHILE ; Exit the loop.
ENDCASE
ENDSWITCH
ENDWHILE
dlgdestroy 0 CANCEL ; Destroy the dialog box.
EXITWHILE
ENDCASE
CASE 3 ; Something was chosen.
ENDCASE
default ; Exit case chosen.
dlgdestroy 0 CANCEL ; Destroy the dialog box.
ENDCASE
ENDSWITCH
ENDWHILE
dlgdestroy 100 CANCEL ; Destroy the dialog box.
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top