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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can you make procomm wait for keypresses before proceeding..

Status
Not open for further replies.

matt1981m

Technical User
Jul 1, 2006
32
US
I am using a dialog box that has 3 separate editbox's in a row. They are set to only allow 3, 3, and 4 characters. it is designed for entering a customers phone number into a switch. I have set the script to place the cursor in the first box automatically. Since the number is always a variable and never a constant, how do I make the dialog box wait for 3 keypresses and then have it proceed with the script (I can have it use "sendvkey 0x09" to tab to the next box and then wait for 3 more keypresses, and then after going to the last box, wait for 4 keypresses and then "sendvkey 0x09" to tab to the "ok" button), ultimately waiting until i click on the ok button before it processes what I have entered. I will enter the dialog box when I get to work today.... The problem I have encountered so far, is that I can't find a way to wait for 3 presses, but can wait for specific keys... I want it to treat the keypresses like the variables they must be.
 
I don't think there's a truly good way to do this. You can check the $KEYHIT variable to see if there are keypresses available and then use the keyget command to process it. However, the help discussion for keyget says it only works if Procomm's main window has focus, which makes me think a script cannot access the keypresses (haven't had a chance to test that theory yet).

Probably the only real way to check is to check the length of the first string in your while loop that is processing dialog events then tab to the next edit field when the string is the proper length. You can use the strlen command to get the string length.

 
man ur fast...lol... do you have a sample of a while loop that includes the strlen command. I have not been able to compile any script i have had with the strlen command inserted... i thought that would be the way to go but have almost given up "hope" on that approach..
 
I have reached another road block.... what am i doing wrong... i tried to set the desired string length but it kept telling me "Invalid integer variable" when i would compile.... this is what i have come up with so far... where did i go wrong????

;THIS SCRIPT USES POP-UP BOXES TO ENTER THE MSID INTO THE CORRECT STRING TO PROCESS A QMOB
proc main
string MSID_NPA,MSID_NXX,MSID_NXXX
integer ENTER
integer len1 = 3
integer len2 = 3
integer len3 = 4
dialogbox 0 148 83 242 113 2 "MSID"
pushbutton 33 72 66 40 16 "OK" OK
pushbutton 34 124 66 37 17 "CANCEL" CANCEL
editbox 20 70 40 32 16 MSID_NPA 3
editbox 21 102 40 32 16 MSID_NXX 3
editbox 22 136 40 32 16 MSID_NXXX 4
text 24 70 30 32 9 "NPA" center
text 23 102 30 32 9 "NXX" center
text 25 136 30 32 9 "NXXX" center
text 32 70 16 100 12 "PLEASE ENTER MSID HERE:" center
text 11 45 4 150 12 "USE TAB TO MOVE BETWEEN FIELDS" center
enddialog
sendvkey 0x09
sendvkey 0x09
while 1
dlgevent 0 ENTER
switch ENTER
case 0
endcase
case 20
strlen MSID_NPA len1
sendvkey 0x09

endcase
CASE 21
strlen MSID_NXX len2
sendvkey 0x09
ENDCASE
CASE 22
strlen MSID_NXXX len3
sendvkey 0x09
ENDCASE
CASE 33
EXITWHILE
ENDCASE
endswitch
endwhile
dlgdestroy 34 CANCEL
transmit "quit all^M"
waitfor ">"
transmit "servord^M"
waitfor "SO:"
transmit "qmob min "
transmit MSID_NPA
transmit " "
transmit MSID_NXX
transmit " "
transmit MSID_NXXX
transmit " extmtx^M"
endproc
 
I have procomm 4.8...when i enter 3 dig in field MSID_NPA it does nothing, if you hit tab or click out of the field, it then does the auto tab or sendvkey 0x09 entered and skips over MSID_NXX and goes directly to MSID_NXXX
 
Well it looks like I may have led you down the wrong path. After reading the help file on the editbox command, the string in that field is only updated once the control loses focus, so there appears to be no way of getting the value in a field unless you tabbed away or selected a different control.

 
is there another type of box that will allow text entry??? or am i grasping at straws here...
 
ok then how about this question.... how can i make a specific variable in a listbox the default one selected. According to the help file it states "The listbox can only occur within a dialogbox statement group. The strvar parameter can be initialized to a specific item, causing that item to be pre-selected when the dialog box is displayed." under the commments section. HOW DO YOU INITIALIZE THE STRVAR PARAMETER!!!!!!

;Recorded script. Editing may be required.
string MDN_NPA,MDN_NXX,MDN_NXXX,BKDR,szList,szItem
INTEGER ENTER,MDNBKDR,CFUDN
proc main
szList = "25, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40"
dialogbox 0 148 81 242 147 2 "CALL FORWARDING RESET"
editbox 20 68 26 32 16 MDN_NPA 3
editbox 21 100 26 32 16 MDN_NXX 3
editbox 25 134 26 32 16 MDN_NXXX 4
text 22 68 17 32 9 "NPA" center
text 23 100 17 32 9 "NXX" center
text 24 134 17 32 9 "NXXX" center
editbox 19 48 58 98 16 BKDR 10
text 18 29 47 140 9 "ENTER VM BKDR (OR CFU DN) HERE:" center
text 32 69 5 100 9 "PLEASE ENTER CTN HERE:" center
pushbutton 7 74 124 40 16 "OK" OK
pushbutton 8 125 124 40 16 "CANCEL" CANCEL
text 12 38 111 166 11 "NOTE: USE TAB TO MOVE BETWEEN FIELDS." center
checkbox 26 42 95 162 9 "USE MDN FOR BKDR (EX. CNPANXXNXXX)" MDNBKDR
checkbox 27 42 82 108 9 "SET CFU TO CFU DN ONLY" CFUDN
LISTBOX 15 176 58 32 16 szList single szItem sort
text 16 167 47 40 9 "TIMEOUT:" center
enddialog
while 1
dlgevent 0 ENTER
switch ENTER
case 0
endcase
case 7
exitwhile
endcase
endswitch
endwhile
dlgdestroy 8 CANCEL
IF (CFUDN) && (MDNBKDR)
usermsg "ONLY CHECK ONE BOX!"
ELSEIF (! CFUDN) && (! MDNBKDR)
CALL CFRESET
ELSEIF (CFUDN)
CALL CFUACT
ELSEIF (MDNBKDR)
CALL CMDN
ENDIF
ENDPROC

PROC CFRESET
transmit "ado^M"
waitfor ">"
transmit "^M"
waitfor ">"
transmit MDN_NPA
transmit MDN_NXX
transmit MDN_NXXX
transmit "^M"
waitfor ">"
transmit "cfna^M"
waitfor ">"
transmit bkdr
transmit "^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "y^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit SZITEM
transmit "^M"
waitfor ">"
transmit "cfb^M"
waitfor ">"
transmit bkdr
transmit "^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "y^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "cfu^M"
waitfor ">"
transmit "$^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "$^M"
waitfor ">"
transmit "y^M"
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"
waitfor "SO:"
transmit "QDN "
transmit MDN_NPA
transmit " "
transmit MDN_NXX
transmit MDN_NXXX
transmit "^M"
endproc

PROC CMDN
transmit "ado^M"
waitfor ">"
transmit "^M"
waitfor ">"
transmit MDN_NPA
transmit MDN_NXX
transmit MDN_NXXX
transmit "^M"
waitfor ">"
transmit "cfna^M"
waitfor ">"
transmit "C"
TRANSMIT MDN_NPA
TRANSMIT MDN_NXX
TRANSMIT MDN_NXXX
transmit "^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "y^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "25^M"
waitfor ">"
transmit "cfb^M"
waitfor ">"
transmit "C"
TRANSMIT MDN_NPA
TRANSMIT MDN_NXX
TRANSMIT MDN_NXXX
transmit "^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "y^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "cfu^M"
waitfor ">"
transmit "$^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "$^M"
waitfor ">"
transmit "y^M"
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"
waitfor "SO:"
transmit "QDN "
transmit MDN_NPA
transmit " "
transmit MDN_NXX
transmit MDN_NXXX
transmit "^M"
endproc

PROC CFUACT
transmit "ado^M"
waitfor ">"
transmit "^M"
waitfor ">"
transmit MDN_NPA
transmit MDN_NXX
transmit MDN_NXXX
transmit "^M"
waitfor ">"
transmit "cfu^M"
waitfor ">"
TRANSMIT BKDR
transmit "^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "n^M"
waitfor ">"
transmit "$^M"
waitfor ">"
transmit "y^M"
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"
waitfor "SO:"
transmit "QDN "
transmit MDN_NPA
transmit " "
transmit MDN_NXX
transmit MDN_NXXX
transmit "^M"
endproc
 
how do i do that... i tried to add it before, during, and after the dialog box and failed each time....
 
You would set the individual item by a line like this prior to the dialogbox command:

szitem = "20"

You also need to remove all spaces from the declaration of szList at the beginning of your script. The script considers all spaces as part of the item string so setting szItem to "20" as above would not appear to work because the actual string in the dialog is " 20".

 
dude you rock!!! i had entered that before, but it didnt work... the spaces got me.... the script works like a charm now!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top