dialog edit restriction help

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Nagarules
Junior Coder
Posts: 24
Joined: Tue Nov 21, 2006 9:33 pm

dialog edit restriction help

Post by Nagarules » Thu Nov 30, 2006 2:50 pm

how do i make the things they type in a edit box in my dialog be only numbers and be between 5 and 160.

for example if they type 180 it wont let them click on START script

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Thu Nov 30, 2006 3:11 pm

take the result of the edit box(maybe MyDialog.msEdit1) and then call VBScript IsNumeric. If it returns False, then show a warning message like mdl>This value must be numeric between 5 and 160 then you'll want to reset the dialog (rda>MyDialog) then go back to the loop where you are getting the result...(GetDialogAction>MyDialog,myresult

here is a bit of code to get you started.....

vbstart
vbend
let>EditVAR=1
VBEval>IsNumeric("%EditVAR%"),IsNumResult
mdl>%IsNumResult% %EditVAR%

You'll want to use the Dialog var instead of my var, of course.

Nagarules
Junior Coder
Posts: 24
Joined: Tue Nov 21, 2006 9:33 pm

:(

Post by Nagarules » Thu Nov 30, 2006 5:38 pm

Is there a way to do this without VB because i dont understand VB :(

and what does MDL stand for?

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Thu Nov 30, 2006 5:50 pm

there is no need to understand VB. You can use the code almost EXACTLY as I have written it. Just pass the variable from your dialog to the IsNumeric function instead of the example variable.

sorry, MDL stands for MessageModal.....Most MacroScript commands have abbreviations and I am in the habit of using them.

Don't fear VBScript....for example IsNumeric is built in so that you do not need to even see the code....just run the code I sent, you'll see.

Nagarules
Junior Coder
Posts: 24
Joined: Tue Nov 21, 2006 9:33 pm

tt

Post by Nagarules » Thu Nov 30, 2006 6:07 pm

im a real noob at this thing and i dont know what to put in the isnumresult and isnumeric...


And im not sure where i put this o.O


vbstart
vbend
let>natb.delay=1
VBEval>IsNumeric("%natb.delay%"),IsNumResult
mdl>%IsNumResult% %natb.delay%

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Thu Nov 30, 2006 7:22 pm

You are correct in putting your variable in the IsNumeric call the way you did. Now, the result of that function will be in the IsNumResult (you can call that whatever you want, but I name it that for clarity) then you can test the variable and take the appropriate action.


if>IsNumResult=False
messagemodal>%natb.delay% is not a number
rda>natb
goto>getNATB
else>
do something useful.....
endif>

why don't you post your code so we an take a look at the entire program.

Nagarules
Junior Coder
Posts: 24
Joined: Tue Nov 21, 2006 9:33 pm

tt

Post by Nagarules » Thu Nov 30, 2006 7:35 pm

I have added u to msn for more help :) :lol:

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts