Default value for a variable

Common questions about using Actual Installer.
Post Reply
UFa
Posts: 7
Joined: Tue Dec 08, 2020 10:09 am

Default value for a variable

Post 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
Leo
Site Admin
Posts: 455
Joined: Fri Jan 22, 2010 12:40 pm

Re: Default value for a variable

Post by Leo »

When using MSG in the Default Data field, add [x], where x - it's a default data.
Leo,
Actual Installer Team
https://www.actualinstaller.com
UFa
Posts: 7
Joined: Tue Dec 08, 2020 10:09 am

Re: Default value for a variable

Post 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)
Leo
Site Admin
Posts: 455
Joined: Fri Jan 22, 2010 12:40 pm

Re: Default value for a variable

Post 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>)
Leo,
Actual Installer Team
https://www.actualinstaller.com
UFa
Posts: 7
Joined: Tue Dec 08, 2020 10:09 am

Re: Default value for a variable

Post 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?
Post Reply