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

Dialogbox creation with output to command line 1

Status
Not open for further replies.

tievom

Technical User
May 13, 2003
11
US
I've read through several posts trying to find enough lines of code to create a dialogbox program from scratch. I am not all familar with Aspect but once it is done in front of me I can walk my way through it and understand the steps on how it works. I just have a hard time putting it together on my own from the "help" menu. Here is an overview of what I am trying to do:

1. Operate a craftshell session via telnet on a Lucent based system.
2. Use a dialogbox to transmit several lines of commands repetitively and at the same time, changing different fields through radiobuttons, pushbuttons and an editfield.

I have the dialogbox created but my trouble is getting it all to work together. The box needs to stay open while the parent window is open too. Here is what I have so far on the dialog box code:

proc main
string sCell
integer Choice = 2
dialogbox 1 81 51 160 184 70 "CFR Tool"
editbox 2 40 5 24 11 sCell 3
radiogroup 20 Choice
radiobutton 3 40 29 20 11 "1"
radiobutton 4 40 42 20 11 "2"
radiobutton 5 40 55 20 11 "3"
endgroup
radiogroup 21 Choice
radiobutton 6 40 85 20 11 "1"
radiobutton 7 40 98 20 11 "2"
radiobutton 8 40 111 20 11 "3"
endgroup
pushbutton 9 110 3 40 13 "Start CFR"
pushbutton 10 110 27 40 13 "Config CBR"
pushbutton 11 110 54 40 13 "CDMADPC"
pushbutton 12 110 80 40 13 "Add CE"
pushbutton 13 110 105 40 13 "XMITC 300"
pushbutton 14 110 131 40 13 "XMITC 301"
pushbutton 15 110 157 40 13 "End CFR"
text 16 3 6 34 11 "Cell Site:" right
text 17 3 30 34 11 "CDM:" right
text 18 3 86 34 11 "CBR:" right
enddialog
endproc

What I am trying to do is --> enter a number into the "cell site" field; click on a "cdm" and "cbr" and start pressing the buttons(the value transmitted from the "cdm" button needs to be set at a fixed value of 1, 2, and 3, while the "cbr" button transmits "multi cbr 1", 2, and 3. The "cdmadpc" field transmits 120, 80, or 60 depending on the "cdm" value. If the "cdm" value is 1, then the "cdmadpc" value is 120. If "cdm" is 2, then "cdmadpc" is 80, and so forth.)

The more I think about it, the more it kicks my ass.[dazed] This is something that would actually help quite a few switch and field techs who do power calibrations on Lucent CDMA Modcells(Verizon, Sprint, US Cellular, Cricket, and other cdma carriers). If anyone knows what I am talking about, carpel tunnel just loves us.

Here is an example of the commands that need to be transmitted from beginning to end(this is for just ONE sector on a 3 sectored cell site. Multiply that by 2 or 3 times for a higher capacity site!!):

"cfr:cell 123,multi;start" ;starts calibration session
"cfr:cell 123,cdm 1,multi cbr 1;config 150" ;cbr setup
"cfr:cell 123,cdm 1,multi cbr 1;cdmadpc 120" ;attenuation
"cfr:cell 123,cdm 1,multi cbr 1;addce 7" ;adding ce's
"cfr:cell 123,cdm 1,multi cbr 1;xmitc 300" ;turn on tx
"cfr:cell 123,cdm 1,multi cbr 1;xmitc 301" ;turn off tx
"cfr:cell 123,multi;mstop" ;ends calibration session

So would anyone have any templates to work from? From a template I think I could figure my way around.
 
Hey now you are talking my language!! I am a field tech with Telus Mobility in Canada. (Stupid Modcell's)

First things first:

radiogroup 20 Choice
Needs to be changed to radiogroup 20 CDM

radiogroup 21 Choice
Needs to be changed to radiogroup 21 CBR

Otherwise when you pick a cdm it will change the cbr var as well.

Next you need to do a conversion of some of the data:

string scdm,scbr

if cdm == 3
scdm = "1"
elseif cdm == 4
scdm = "2"
else
scdm = "3"
endif

if cbr == 6
scbr = "1"
elseif cbr == 7
scbr = "2"
else
scbr = "3"
endif

Now to transmit the command to the craft shell:

**** end of the dialog ****

Make a while event loop on the dialog box

case 9
command = "cfr:cell " ;notice the space after cell
strcat command scell
strcat command ",multi;start"
transmit command
case 10
command = "cfr:cell "
strcat command scell
strcat command ",cdm "
strcat command scdm
strcat command ",multi cbr "
strcat command scbr
strcat commadn ";config 150"
transmit command
endcase
case 11
command = "cfr:cell "
strcat command scell
strcat command ",cdm "
strcat command scdm
strcat command ",multi cbr "
strcat command scbr
strcat command ";cdmadpc "
if cbr == 6
strcat command "120"
elseif cbr == 7
strcat command "80"
else
strcat command "60"
endif
transmit command
endcase
case 12
command = "cfr:cell "
strcat command scell
strcat command ",cdm "
strcat command scdm
strcat command ",multi cbr "
strcat command scbr
strcat commadn ";addce 7"
transmit command
endcase
case 13
command = "cfr:cell "
strcat command scell
strcat command ",cdm "
strcat command scdm
strcat command ",multi cbr "
strcat command scbr
strcat commadn ";xmitc 300"
transmit command
endcase
case 14
command = "cfr:cell "
strcat command scell
strcat command ",cdm "
strcat command scdm
strcat command ",multi cbr "
strcat command scbr
strcat commadn ";xmitc 301"
transmit command
endcase
case 15
command = "cfr:cell " ;notice the space after cell
strcat command scell
strcat command ",multi;mstop"
transmit command
endcase



I hope this gets you going, and when it's done I want a copy!! :)
 
Sorry, those if's, elseif's and while's get me really confused. I'm not sure where to place them.
 
The conversion's need to take place before the commands are transmited. The cases need to be placed within a while loop that looks for a event (a button to be pressed) after displaying the dialog box.

Somthing like:

.
.
Dialogbox code
.
.
while 1 ; Loop Forever
dlgevent 0 event ; Get dialog event.
switch event ; Evaluate dialog event.
case 0 ; No event occurred.
.
.
conversion if's
.
.
endcase
.
.
the rest of the cases
.
.
endswitch
endwhile

Don't forget a "Exit" key and a exit case

case 999 ; Exit Button
exitwhile
endcase

Oh and you should make buttons for rmv/rst the CTRM and alw/inh RTDIAG.
 
Here is what I came up with. It compiles successfully, but does not send the info to the terminal. Some programmer eyes would be helpful!


proc main
string sCell
string sCdm
string sCbr
string sCdma
string sCfrcell = "cfr:cell "
string sMultistart = ",multi;start^M"
string sMultistop = ",multi;mstop^M"
string sConfig = ";config 150^M"
string sCdmadpc = ";cdmadpc "
string sAddce = ";addce 7^M"
string sXmitcOn = ";xmitc 300^M"
string sXmitcOff = ";xmitc 301^M"
integer CDM
integer CBR
dialogbox 1 81 51 160 184 70 "CFR Tool"
editbox 2 40 5 24 11 sCell 3
radiogroup 20 CDM
radiobutton 3 40 29 20 11 "1"
radiobutton 4 40 42 20 11 "2"
radiobutton 5 40 55 20 11 "3"
endgroup
radiogroup 21 CBR
radiobutton 6 40 85 20 11 "1"
radiobutton 7 40 98 20 11 "2"
radiobutton 8 40 111 20 11 "3"
endgroup
pushbutton 9 110 3 40 13 "Start CFR"
pushbutton 10 110 27 40 13 "Config CBR"
pushbutton 11 110 54 40 13 "CDMADPC"
pushbutton 12 110 80 40 13 "Add CE"
pushbutton 13 110 105 40 13 "XMITC 300"
pushbutton 14 110 131 40 13 "XMITC 301"
pushbutton 15 110 157 40 13 "End CFR"
text 16 3 6 34 11 "Cell Site:" right
text 17 3 30 34 11 "CDM:" right
text 18 3 86 34 11 "CBR:" right
enddialog
while 1
dlgevent 1
switch 1
case 0
if CDM == 3
sCdm = "1"
elseif CDM == 4
sCdm = "2"
else
sCdm = "3"
endif
if CBR == 6
sCbr = "multi cbr 1"
elseif CBR == 7
sCbr = "multi cbr 2"
else
sCbr = "multi cbr 3"
endif
if CDM == 3
sCdma = "120^M"
elseif CDM == 4
sCdma = "80^M"
else
sCdma = "60^M"
endif
endcase
case 9
strcat sCfrcell sCell
strcat sCfrcell sMultistart
transmit sCfrcell
endcase
case 10
strcat sCfrcell sCell
strcat sCfrcell sCdm
strcat sCfrcell sCbr
strcat sCfrcell sConfig
transmit sCfrcell
endcase
case 11
strcat sCfrcell sCell
strcat sCfrcell sCdm
strcat sCfrcell sCbr
strcat sCfrcell sCdma
transmit sCfrcell
endcase
case 12
strcat sCfrcell sCell
strcat sCfrcell sCdm
strcat sCfrcell sCbr
strcat sCfrcell sAddce
transmit sCfrcell
endcase
case 13
strcat sCfrcell sCell
strcat sCfrcell sCdm
strcat sCfrcell sCbr
strcat sCfrcell sXmitcOn
transmit sCfrcell
endcase
case 14
strcat sCfrcell sCell
strcat sCfrcell sCdm
strcat sCfrcell sCbr
strcat sCfrcell sXmitcOff
transmit sCfrcell
endcase
case 15
strcat sCfrcell sCell
strcat sCfrcell sMultistop
transmit sCfrcell
endcase
endswitch
endwhile
endproc
 
I have noticed a few problems with your script.

[li]You should not be using a deadend dialogbox (change from type 70 to 6)[/li]
[li]You should specify an integer with your dlgevent and switch functions[/li]
[li]case -1 required to stop processing when dialogbox is closed[/li]

I have ammended your script (see below). This ammended script may still need some more modifications, but at least it should get you on the right track.

Code:
proc main
string sCell
string sCdm
string sCbr
string sCdma
string sCfrcell = "cfr:cell "
string sMultistart = ",multi;start^M"
string sMultistop = ",multi;mstop^M"
string sConfig = ";config 150^M"
string sCdmadpc = ";cdmadpc "
string sAddce = ";addce 7^M"
string sXmitcOn = ";xmitc 300^M"
string sXmitcOff = ";xmitc 301^M"
integer CDM
integer CBR
integer event                            ; Added this integer to use 
                                         ; for dlgevent & switch
dialogbox 1 81 51 160 184 6 "CFR Tool"   ; Changed dialog type from 70 to 6
                                         ; (removed dead end dialog)
   editbox 2 40 5 24 11 sCell 3 
   radiogroup 20 CDM
      radiobutton 3 40 29 20 11 "1" 
      radiobutton 4 40 42 20 11 "2" 
      radiobutton 5 40 55 20 11 "3" 
   endgroup
   radiogroup 21 CBR
      radiobutton 6 40 85 20 11 "1" 
      radiobutton 7 40 98 20 11 "2" 
      radiobutton 8 40 111 20 11 "3" 
   endgroup
   pushbutton 9 110 3 40 13 "Start CFR" 
   pushbutton 10 110 27 40 13 "Config CBR" 
   pushbutton 11 110 54 40 13 "CDMADPC" 
   pushbutton 12 110 80 40 13 "Add CE" 
   pushbutton 13 110 105 40 13 "XMITC 300" 
   pushbutton 14 110 131 40 13 "XMITC 301" 
   pushbutton 15 110 157 40 13 "End CFR" 
   text 16 3 6 34 11 "Cell Site:" right 
   text 17 3 30 34 11 "CDM:" right 
   text 18 3 86 34 11 "CBR:" right 
enddialog 
while 1

;    dlgevent 1       ; replaced these 2 lines
;    switch 1         ; with the following 2 lines

    dlgevent 1 event  ; dlgevent and switch functions 
    switch event      ; require an integer variable

        case -1       ; Added this case option to
           exitwhile  ; stop script processing when
        endcase       ; dialogbox is closed.
        
        case 0
            if CDM == 3
               sCdm = "1"
            elseif CDM == 4
               sCdm = "2"
            else
               sCdm = "3"
            endif
            if CBR == 6
               sCbr = "multi cbr 1"
            elseif CBR == 7
               sCbr = "multi cbr 2"
            else
               sCbr = "multi cbr 3"
            endif
            if CDM == 3
               sCdma = "120^M"
            elseif CDM == 4
               sCdma = "80^M"
            else
               sCdma = "60^M"
            endif
        endcase
            case 9
                strcat sCfrcell sCell
                strcat sCfrcell sMultistart
                transmit sCfrcell
            endcase
            case 10
                strcat sCfrcell sCell
                strcat sCfrcell sCdm
                strcat sCfrcell sCbr
                strcat sCfrcell sConfig
                transmit sCfrcell
            endcase
            case 11
                strcat sCfrcell sCell
                strcat sCfrcell sCdm
                strcat sCfrcell sCbr
                strcat sCfrcell sCdma
                transmit sCfrcell                 
            endcase
            case 12
                strcat sCfrcell sCell
                strcat sCfrcell sCdm
                strcat sCfrcell sCbr
                strcat sCfrcell sAddce
                transmit sCfrcell
            endcase
            case 13  
                strcat sCfrcell sCell
                strcat sCfrcell sCdm
                strcat sCfrcell sCbr
                strcat sCfrcell sXmitcOn
                transmit sCfrcell
            endcase
            case 14
                strcat sCfrcell sCell
                strcat sCfrcell sCdm
                strcat sCfrcell sCbr
                strcat sCfrcell sXmitcOff
                transmit sCfrcell
            endcase
            case 15
                strcat sCfrcell sCell
                strcat sCfrcell sMultistop
                transmit sCfrcell
            endcase
        endswitch
    endwhile
endproc
 
Sweet! Alright, the box now sends the commands to the port. But the buttons are sending the same command - "cfr:cell xxx,multi;start" The cell # changes correctly, but now I have to figure out the verbage and the buttons. I should be able to bang those out.

Thanks a LOT!
 
One other thing I noticed is that you have a case 0 but no values in your dialogbox are set to 0, therefore the tasks for this case will never happen. If you want these commands to be executed by default, change case 0 to default and place it at the end of the switch.

Example
Code:
switch event
   case 9   ;execute commands if option 9 selected

   endcase
   case 10  ;execute commands if option 10 selected

   endcase
   default  ;execute commands regardless

   endcase
endswitch
 
Thanks, I figured it all out. It is now working how I wanted it to. I am just adding a few more features to it before I put it up here.
 
Here is the final working script. Thanks to the folks who helped point me in the right direction. I am also putting the .WAS file up at
Any suggestions or improvements can be sent to me at josh 'at' lansingwireless.com.


proc main
;#####---Begin Variables---#####
;
string sCell
string sCdm
string sCbr
string sCfrcell
string sCtrm
string sMra
integer iCdm
integer iCbr
integer Event
integer iFtype
;
;#####---End Variables---#######
;
;#####------Begin Dialog Box------#############
;
dialogbox 1 125 49 213 112 6 "CFR Tool"
editbox 2 98 2 24 11 sCell 3
radiogroup 19 iCdm
radiobutton 3 88 41 20 11 "1"
radiobutton 4 112 41 20 11 "2"
radiobutton 5 137 41 20 11 "3"
endgroup
radiogroup 20 iCbr
radiobutton 6 88 58 20 11 "1"
radiobutton 7 112 58 20 11 "2"
radiobutton 8 137 58 20 11 "3"
endgroup
radiogroup 27 iFtype
radiobutton 28 88 19 21 11 "F1"
radiobutton 29 112 19 21 11 "F2"
radiobutton 30 137 19 21 11 "F3"
endgroup
pushbutton 9 172 2 40 13 "Start CFR"
pushbutton 10 172 18 40 13 "Config CBR"
pushbutton 11 172 34 40 13 "CDMADPC"
pushbutton 12 172 50 40 13 "Add CE"
pushbutton 13 172 66 40 13 "XMITC 300"
pushbutton 14 172 82 40 13 "XMITC 301"
pushbutton 15 172 98 40 13 "End CFR"
text 16 59 5 34 11 "Cell Site:" right
text 17 63 42 20 9 "CDM:" right
text 18 64 59 19 11 "CBR:" right
pushbutton 21 81 97 40 13 "Exit" CANCEL
pushbutton 22 1 2 40 13 "Rmv CTRM"
pushbutton 23 1 18 40 13 "Rst CTRM"
pushbutton 24 1 43 40 13 "Rmv:cbr;ucl"
pushbutton 25 1 59 40 13 "Rst:cbr;ucl"
text 31 51 19 34 9 "Site Type:" left
pushbutton 26 1 84 40 13 "Dump:mra"
enddialog
;
;#####------End Dialog Box------###############
while 1
dlgevent 1 Event
switch Event
case -1
endcase
case 9
if iCdm == 3
sCdm = "1"
elseif iCdm == 4
sCdm = "2"
else
sCdm = "3"
endif
if iCbr == 6
sCbr = "1"
elseif iCbr == 7
sCbr = "2"
else
sCbr = "3"
endif
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",multi;start^M"
transmit sCfrcell
endcase
case 10
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",multi cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";config 150^M"
transmit sCfrcell
endcase
case 11
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",multi cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";cdmadpc "
if iFtype == 28
strcat sCfrcell "120^M"
elseif iFtype == 29
strcat sCfrcell "80^M"
else
strcat sCfrcell "60^M"
endif
transmit sCfrcell
endcase
case 12
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",multi cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";addce 7^M"
transmit sCfrcell
endcase
case 13
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",multi cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";xmitc 300^M"
transmit sCfrcell
endcase
case 14
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",multi cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";xmitc 301^M"
transmit sCfrcell
endcase
case 15
sCfrcell = "cfr:cell "
strcat sCfrcell sCell
strcat sCfrcell ",multi;mstop^M"
transmit sCfrcell
endcase
case 22
sCtrm = "rmv:cell "
strcat sCtrm sCell
strcat sCtrm ",ctrm;ucl^M"
transmit sCtrm
endcase
case 23
sCtrm = "rst:cell "
strcat sCtrm sCell
strcat sCtrm ",ctrm;ucl^M"
transmit sCtrm
endcase
case 24
if iCdm == 3
sCdm = "1"
elseif iCdm == 4
sCdm = "2"
else
sCdm = "3"
endif
if iCbr == 6
sCbr = "1"
elseif iCbr == 7
sCbr = "2"
else
sCbr = "3"
endif
sCfrcell = "rmv:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";ucl^M"
transmit sCfrcell
endcase
case 25
if iCdm == 3
sCdm = "1"
elseif iCdm == 4
sCdm = "2"
else
sCdm = "3"
endif
if iCbr == 6
sCbr = "1"
elseif iCbr == 7
sCbr = "2"
else
sCbr = "3"
endif
sCfrcell = "rst:cell "
strcat sCfrcell sCell
strcat sCfrcell ",cdm "
strcat sCfrcell sCdm
strcat sCfrcell ",cbr "
strcat sCfrcell sCbr
strcat sCfrcell ";ucl^M"
transmit sCfrcell
endcase
case 26
sMra = "dump:cell "
strcat sMra sCell
strcat sMra ":mra^M"
transmit sMra
endcase
endswitch
endwhile
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top