Page 1 of 1

Default value for a variable

Posted: Wed Feb 03, 2021 2:05 pm
by UFa
I use INPUTBOX to request a number to be entered by the user, which is stored in the variable <MyCnter>. If the user makes no input, the variable <MyCnter> should be filled with the default value 1.
Populating DefaultData with 1 doesn't seem to work, since I output an MSG with the variable <MyCnter> after the INPUTBOX. IF an input is made, it shows up in the MSG output as well.
What am I doing wrong or have I not understood?
Thanks for any support.

Regards,
Uli

Re: Default value for a variable

Posted: Sat Feb 13, 2021 12:54 pm
by Leo
When using MSG in the Default Data field, add [x], where x - it's a default data.

Re: Default value for a variable

Posted: Tue Mar 02, 2021 9:26 am
by UFa
Leo, thank you very much for your answer.
Unfortunately, I do not understand it. Perhaps I have not formulated my request precisely.
So: I want to know from the user via INPUTBOX how many instances he wants to install. I store his answer in the variable <MyCnter>. If he makes no input here, <MyCnter> should take a default value of 1. In the next step I output a window with the command MSG. In this window the variable <MyCnter> (which contains the user input OR the default value of 1) is displayed.
The problem now is that I can't see a default value (value: 1) at MSG when the user didn't made any input.
What am I doing wrong?
Thanks already once for your efforts.

Kind regards,
Uli


Translated with http://www.DeepL.com/Translator (free version)

Re: Default value for a variable

Posted: Mon Mar 08, 2021 12:28 pm
by Leo
In this case you need two entries in Variables:

1.
Variable: <MyCnter>
Reg Key: INPUTBOX
Reg Value: your text
Default Data: 1

2.
Variable: <MyCnter2>
Reg Key and Reg Value leave empty
Default Data: MSG(your text <MyCnter>)

Re: Default value for a variable

Posted: Mon Mar 15, 2021 2:39 pm
by UFa
Thank you for your response, Leo.
I already used those 2 variabels as you suggested, but the second variable (<MyCnter2>) does not show up in the MSG (windows) the content of <MyCnter> with the Deault value '1' if nothing (= left blank) is entered in INPUTBOX with <MyCnter>.
If I am entering any number in the INPUTBOX dialog this number is shown in the MSG.
The expected default value of '1' for <MyCnter> seems to be lost when displaying with MSG (your text <MyCnter>) as there is no content displayed with(in) <MyCnter>.
Any idea?