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!

Need to repeat command and increment 1?? 1

Status
Not open for further replies.

Stanggrn

Technical User
Feb 13, 2003
12
US
I am relatively new to writing scripts in Aspect. I have run accros a rather difficult problem. I am trying to repeat the command and increment the variable that is inputed by 1. I would like to also be able to set when to stop the repeat of the command.
Here is an example of what I am trying to do.

Code:
string X
proc main
   transmit "ed-t1::"					; initial start of command
   dialogbox 0 42 32 125 59 91 "Access Identifier (AID)"; begins box to input data 
   text 1 2 12 38 11 "Enter AID:" left 			; part of dialog box
   editbox 5 52 11 34 11 X				; box where user inputs data   
pushbutton 2 39 39 40 13 "OK" OK DEFAULT		; button for OK
   pushbutton 3 84 39 40 13 "Cancel" CANCEL 		; button for Cancel
   enddialog 						; ends box
   transmit X						; adds the data that the user inputed
   transmit ":CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;^M"	; completes command
endproc

So the two problems (that I see) is
1. I dont know how to make the command repeat
2. Dont know how to make it increment the variable in the dialog box by 1
I appreciate if someone could help. Thanks
Jason
 
Are you trying to have the user repeat/transmit the same command up to a certain number of times? If so, you could use the for command to do so.
aspect@aspectscripting.com
 
Hello,

Is the Repeat a Standard number of Times or does it Change ?? With the FOR Command you'll need to Set the Number of times the FOR Repeats...

Hank camphm@bellsouth.net
 
The number of times to repeat can change.
 
To increment the variable that the user inputted by one, you would use the postfix operator as such:

X++

I'm not sure what you mean by having the command repeat (if you mean the entire script or just the transmit ":CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;^M" line). Is the variable X that the user inputs the number of times that the command(s) should be repeated?
aspect@aspectscripting.com
 
Sorry for the confusion

This is what the command looks like complete

ed-t1::281:CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;

X=281 (what the user inputed)

I would like for it to go to the next one like this

ed-t1::282:CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;

I am trying to repeat the transmit at the begining of the dialog and the transmit immediatly following the dialog with the variable incrementing by 1.

Also below is the script I wrote without repeating automatically and I couldnt get it to work.... Here you go

Code:
string X
proc main
   transmit "ed-t1::"					
   dialogbox 0 42 32 125 59 91 "Access Identifier (AID)"
   text 1 2 12 38 11 "Enter AID:" left 			
   editbox 5 52 11 34 11 X				
   pushbutton 2 39 39 40 13 "OK" OK DEFAULT		
   pushbutton 3 84 39 40 13 "Cancel" CANCEL 		
   enddialog 						
   transmit X						
   transmit ":CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;^M"
   transmit "ed-t1::"
   transmit X++
   transmit ":CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;^M"
endproc

I get the Error message below when trying to Compile the script:

Error C110 Line 14: Invalid operand

Thanks for your help Knob
 
Hello,

After looking over your Code I see the Problem. You're Failing when you try to Increment within the Transmit Command. First of all you can't increment a String !!

In Your example the 281 will need to be set to an Integer so it can be Incremented. Here is a Basic Termwrites Example that may put you on Track.

Proc Main
Integer X = 281
String Go
strfmt Go "ed-1::d%:CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;" X
Termwrites Go
X++
Termwrites "`n`r"
strfmt Go "ed-t1::%d:CTAG::CST:FMT=ESF,ALM=INH,MODE=FRCD;" X
Termwrites Go
Termwrites "`n`r"
Endproc

If you modify it for Transmits, I think this should Work..

Hank

camphm@bellsouth.net
 
Sorry for the delay if any. Thanks Knob and Hank. I have gotten the script to work now. I had to convert the string variable to an integer useing atoi and the convert it back to transmit useing itoa. Heres the script complete.
Code:
string A
string C
integer B
integer D
integer Event
proc main
dialogbox 0 60 25 96 49 91 "Access Identifier (AID)" 
   editbox 2 58 2 34 11 A 
   editbox 4 58 20 34 11 C 
   pushbutton 3 6 35 40 13 "OK" OK DEFAULT
   pushbutton 62 54 35 40 13 "Cancel" CANCEL 
   text 1 2 3 34 11 "Enter First:" left 
   text 15 2 19 34 11 "Enter Last:" left 
enddialog  
while 1
dlgevent 0 Event
      switch Event
      case 0
      endcase
      case 1
      endcase
      case 4
      endcase
      Case 62            ; Cancel button was pressed
        exit
      endcase  
      default 
         exitwhile
      endcase
    endswitch
endwhile
   atoi C D
   transmit "ed-t1::"				 	
   transmit A
   transmit ":CTAG::CST:FMT=ESF,MODE=FRCD;^M"
while 2
   atoi A B
   B++
   itoa B A
   transmit "ed-t1::"
   transmit A
   transmit ":CTAG::CST:FMT=ESF,MODE=FRCD;^M"
if B == D
   call RTRV
else
   loopwhile
endif
endwhile
endproc

proc RTRV
   usermsg "You have edited all T1's"
   exit
endproc[\code]

Thanks again
 
Hello,

Just for reference, what type of System are you communicating with ?

Thanks

Hank
 
Hank,

The above script was written for the GTD5 due to there is no command (that I know of) that can do a through command... but the commands in the script are Titan 5500 DCS, because I knew those commands already. Now I can easily transfer the commands.

Thanks,

Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top