Counter Problem
Moderators: Dorian (MJT support), JRL
Counter Problem
Hey i am trying to get a counter to work in a dialog box. so that every time i run something from the dialog box it will count it in a list box in the dialog.
here is my script but it dosn't count it stays at 0. I want Edit=msEdit1 to be a continuis counter.
let>k=0
Dialog>MyDialog
Caption=This is My Dialog
Top=300
Width=305
Left=300
Height=120
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
MessageModal>%MyDialog.MyEdit%
END>SayHello
SRT>PlayWav
let>k=%k%+1
PlayWav>Chimes.wav
End>PlayWav
Label>End
any suggestions please?
here is my script but it dosn't count it stays at 0. I want Edit=msEdit1 to be a continuis counter.
let>k=0
Dialog>MyDialog
Caption=This is My Dialog
Top=300
Width=305
Left=300
Height=120
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
MessageModal>%MyDialog.MyEdit%
END>SayHello
SRT>PlayWav
let>k=%k%+1
PlayWav>Chimes.wav
End>PlayWav
Label>End
any suggestions please?
You need to use ResetDialogAction. Like this:
let>k=0
Dialog>MyDialog
Caption=This is My Dialog
Top=300
Width=305
Left=300
Height=120
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
Let>MyDialog.msEdit1=k
ResetDialogAction>MyDialog
MessageModal>%MyDialog.MyEdit%
END>SayHello
SRT>PlayWav
let>k=%k%+1
PlayWav>Chimes.wav
End>PlayWav
Label>End
However, this sort of thing would work best with a non-modal dialog.
let>k=0
Dialog>MyDialog
Caption=This is My Dialog
Top=300
Width=305
Left=300
Height=120
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
Let>MyDialog.msEdit1=k
ResetDialogAction>MyDialog
MessageModal>%MyDialog.MyEdit%
END>SayHello
SRT>PlayWav
let>k=%k%+1
PlayWav>Chimes.wav
End>PlayWav
Label>End
However, this sort of thing would work best with a non-modal dialog.
MJT Net Support
[email protected]
[email protected]
ResetDialogAction was added in 7.3. You need to upgrade. The upgrade from 7.2 to 7.3 is free. Go to http://www.mjtnet.com/dldregd.htm
MJT Net Support
[email protected]
[email protected]
ok i upgraded no how about if i wanted to do too counters. I can get them to count sepretly they count together. here is my script:
let>k=0
let>count=0
Dialog>MyDialog
Caption=This is My Dialog
Width=304
Height=121
Top=225
Left=339
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
Edit=myEdit2,192,0,49,%Count%
Button=fail,216,56,75,25,4
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
if>result=4,fail
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
Let>%MyDialog.msEdit1%=k
ResetDialogAction>MyDialog
messagemodal>ok this sayhello
END>SayHello
srt>fail
let>count=%count%+1
Let>%MyDialog.myEdit2%=count
ResetDialogAction>MyDialog
messagemodal>ok this is failed
end>fail
srt>error
messagemodal>error message
end>error
SRT>PlayWav
PlayWav>Chimes.wav
End>PlayWav
Label>End
is there a way to do this thanks
let>k=0
let>count=0
Dialog>MyDialog
Caption=This is My Dialog
Width=304
Height=121
Top=225
Left=339
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
Edit=myEdit2,192,0,49,%Count%
Button=fail,216,56,75,25,4
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
if>result=4,fail
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
Let>%MyDialog.msEdit1%=k
ResetDialogAction>MyDialog
messagemodal>ok this sayhello
END>SayHello
srt>fail
let>count=%count%+1
Let>%MyDialog.myEdit2%=count
ResetDialogAction>MyDialog
messagemodal>ok this is failed
end>fail
srt>error
messagemodal>error message
end>error
SRT>PlayWav
PlayWav>Chimes.wav
End>PlayWav
Label>End
is there a way to do this thanks
I'm not sure what you want to do but the two Let statements where you are setting "count" and "k" to the values defined by the dialog are incorrect. Don't use percents on the variable that you are defining.
The two lines now look like this:
Let>%MyDialog.msEdit1%=k
and
Let>%MyDialog.myEdit2%=count
They should look like this:
Let>MyDialog.msEdit1=%k%
and
Let>MyDialog.myEdit2=%count%
You say you want the counts to show up in a list box. Are you creating another dialog later in the script?
Keep working at it. You'll get it if you keep at it.
Good luck,
Dick
The two lines now look like this:
Let>%MyDialog.msEdit1%=k
and
Let>%MyDialog.myEdit2%=count
They should look like this:
Let>MyDialog.msEdit1=%k%
and
Let>MyDialog.myEdit2=%count%
You say you want the counts to show up in a list box. Are you creating another dialog later in the script?
Keep working at it. You'll get it if you keep at it.
Good luck,
Dick
no i tryed that but it still counts in both boxs. Ok this is my problem in this script i have to boxs (x) and (k). when i press one button i want it to count only in box (k) and the other button to ONLY count in box (x). But no matter what button i push it count in both (x) and (k). I don't know why but it dose. Here is the script agin:
let>k=0
let>count=0
Dialog>MyDialog
Caption=This is My Dialog
Width=304
Height=121
Top=225
Left=339
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
Edit=myEdit2,192,0,49,%Count%
Button=fail,216,56,75,25,4
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
if>result=4,fail
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
ResetDialogAction>MyDialog
messagemodal>ok this sayhello
Let>%MyDialog.msEdit1%=k
END>SayHello
srt>fail
let>count=%count%+1
messagemodal>ok this is failed
ResetDialogAction>MyDialog
Let>%MyDialog.myEdit2%=count
end>fail
srt>error
messagemodal>some message here
end>error
SRT>PlayWav
PlayWav>Chimes.wav
End>PlayWav
Label>End
let>k=0
let>count=0
Dialog>MyDialog
Caption=This is My Dialog
Width=304
Height=121
Top=225
Left=339
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
Edit=myEdit2,192,0,49,%Count%
Button=fail,216,56,75,25,4
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
if>result=4,fail
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
ResetDialogAction>MyDialog
messagemodal>ok this sayhello
Let>%MyDialog.msEdit1%=k
END>SayHello
srt>fail
let>count=%count%+1
messagemodal>ok this is failed
ResetDialogAction>MyDialog
Let>%MyDialog.myEdit2%=count
end>fail
srt>error
messagemodal>some message here
end>error
SRT>PlayWav
PlayWav>Chimes.wav
End>PlayWav
Label>End
Removed the percents as I mentioned before and moved teh ResetDialogAction line to after the the same changed lines.
Try this:
let>k=0
let>count=0
Dialog>MyDialog
Caption=This is My Dialog
Width=304
Height=121
Top=225
Left=339
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
Edit=myEdit2,192,0,49,%Count%
Button=fail,216,56,75,25,4
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
if>result=4,fail
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
messagemodal>ok this sayhello
Let>MyDialog.msEdit1=k
ResetDialogAction>MyDialog
END>SayHello
srt>fail
let>count=%count%+1
messagemodal>ok this is failed
Let>MyDialog.myEdit2=count
ResetDialogAction>MyDialog
end>fail
srt>error
messagemodal>some message here
end>error
SRT>PlayWav
PlayWav>Chimes.wav
End>PlayWav
Label>End
Does this work for you?
Try this:
let>k=0
let>count=0
Dialog>MyDialog
Caption=This is My Dialog
Width=304
Height=121
Top=225
Left=339
Label=Type Something Here:,5,5
Edit=MyEdit,5,22,230,Type Something Here and Press 'Display'
Button=Display,240,22,50,20,3
Button=Exit Macro,5,50,100,20,2
CheckBox=MyCheckBox,Play Chimes?,130,50,90,False
Edit=msEdit1,128,0,49,%k%
Edit=myEdit2,192,0,49,%Count%
Button=fail,216,56,75,25,4
EndDialog>MyDialog
Label>MainLoop
Show>MyDialog,result
if>result=4,fail
If>result=2,End
If>result=3,SayHello
if>MyDialog.MyCheckBox=True,PlayWav
Goto>MainLoop
SRT>SayHello
let>k=%k%+1
messagemodal>ok this sayhello
Let>MyDialog.msEdit1=k
ResetDialogAction>MyDialog
END>SayHello
srt>fail
let>count=%count%+1
messagemodal>ok this is failed
Let>MyDialog.myEdit2=count
ResetDialogAction>MyDialog
end>fail
srt>error
messagemodal>some message here
end>error
SRT>PlayWav
PlayWav>Chimes.wav
End>PlayWav
Label>End
Does this work for you?