Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Set Registry Entry depending on CheckBox

Hi

I want add a custom dialog to give the user the option if an autostart option is written into the registry.
For example:
My custom dialog should have a checkbox lit this:
[ ] Autologon and start application on Windows start

If Checked the registry settings will done hidden.
If not checked no registry settings are done.

How can I do that?

THX Horst
reditec
Posts: 4
Joined: Wed Mar 13, 2013 5:47 pm

Re: Set Registry Entry depending on CheckBox

This is possible with the "Dialogs - Menu".
You just have to edit the exit dialogs there.
For exampel replace the ReadMe - text with your text above and then click on the mark.
I don't know how to make this wit hthe registry, but you can make this by a new "Published event", which copies a link or a file into the Autostart folder...
Hope this is enough help, I'm beginner :D
Schreib mal, wenn du Deutscher bist :)
Oder heißt du wirklich Horst und kommst nicht aus Deutschland???
Yours sincelery, REDITEC
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

THX reditec
No, I'm nor from Germany :-(
I'm from Switzerland ;-)

The sample with the ExitDialog I saw too.
But how I can write values into the registry is my big question?!

Gruss aus der Schweiz :mrgreen:
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Set Registry Entry depending on CheckBox

Hello Horst,

Here are the steps:
- add a checkbox from the Dialogs page and get its attached public property from the right pane (e.g. CHECKBOX_1_PROP)
- go to the Registry page and add your entry
- press F8 while the registry entry is selected in the Registry page
- in the Organization page add the checkbox property name in the "Condition" field of the registry entry's component

This way the registry entry will be installed only if the checkbox is checked.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

Hi Mihai

Thanks for your swift feedback! :P
I have add the CheckBox into the ExitDialog.
If the user uninstall our Software the checkbox will be shown also checked.
Is there a way to uncheck the checkBox and hide it on uninstall?

Horst
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

Hi Mihai

I have done what you wrote me.
But it dosn't work :-(

In the ExitDialog I have add a CheckBox named "CheckBox_AutoStart" with a property called "CheckBox_AutoStart_Checked".
I have select "AutoAdminLogon" in Regestry settings, press F8,
then copy the property name into the Condition.

See my attached image.

Remark: At the propertyname there appears a warning. Why?

I also have tested it with a properyname called "CHECKBOX_1_PROP_1": without success :-(

Any idea what I'm doing wrong?

Best regards Horst
Attachments
Settings.png
Settings.png (115.95 KiB) Viewed 12950 times
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

I have moved the CheckBox from the ExitDialog to the VerifyReadyDlg.
Set the Contitions again and now it works?!?
Can't I do this conditions settings in the Exit Dialog?

Another question:
If I select "Modify" (after installation)
And I uncheck my checkbox the Registry Settings will be not removed.
What must I do to to that?

Best regards
Horst
reditec
Posts: 4
Joined: Wed Mar 13, 2013 5:47 pm

Re: Set Registry Entry depending on CheckBox

Hi, wenn du Skype hast, adde mal spielereditec !
Vielleicht kann ich dir helfen, wenn ich das sehn kann :)
Hoffe es ist nicht zu geheim! :D
VG aus Deutschland!
Reditec
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Set Registry Entry depending on CheckBox

Hello Horst,
I have moved the CheckBox from the ExitDialog to the VerifyReadyDlg.
Set the Contitions again and now it works?!?
Can't I do this conditions settings in the Exit Dialog?
You cannot achieve this on "ExitDialog". Please keep in mind that registries entries (added in our "Registry" page) are created during "Install Execution Stage -> Add Resources -> WriteRegistryValues" standard action which is executed before "ExitDialog". So, in order to achieve what you want you should add the related check box control on a dialog before "ProgressDlg".
If I select "Modify" (after installation)
And I uncheck my checkbox the Registry Settings will be not removed.
What must I do to to that?
I'm afraid this is the normal behavior. A registry entry installed by your installation package will be uninstalled only when its containing feature, from "Organization" page, will be uninstalled from target machine. However, in order to achieve what you want you can develop your own custom action which will delete the related registry entry when the installation is launch in "Modify" mode and the check box control isn't checked. The custom action should be added after "Install Execution Stage -> Add Resources" action group and should use a condition like this:

Code: Select all

((AI_INSTALL_MODE = "Change") AND (NOT CHECKBOX_1_PROP_1))
All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

Dear Daniel

Thanks four your Support.
I understand the solution you wrote.
But I'm confused about the way how to to it.
I'm a beginner in using Advansed installert and I don't know where I have to set this Settings.
You you please explain a little bit more Details where I have to do what?

Best regards
Horst
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Set Registry Entry depending on CheckBox

Hello Horst,

I've attached a sample, created with version 10.0 of Advanced Installer, which implements a similar scenario.
sample.zip
(2.59 KiB) Downloaded 1222 times
Also, you can take a look on "REG Command in Windows XP" article which could be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

Hello Daniel

Thanks a lot for the sample!
I found your Extension in Tab "Custom Behaviour" -> "Custom Actions"!
It helps me to understand how to do it!!!

Also the link to REG Command is very helpfull.

Horst
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

Hi Daniel

I have add the command "REG DELETE HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon /v DefaultUserName" to the custom action.
But it dosn't work :-(
After running the Setup a error message box is shown.

If I run the command in the CMD promt this error is shown:
"Invalid command-line Parameters"

I cant see what i wrong.

Horst
Horst1701
Posts: 15
Joined: Wed Mar 13, 2013 6:02 pm

Re: Set Registry Entry depending on CheckBox

After Lunch
I found the reason in the after read the original documentation Microsofts documentation :mrgreen: :

Quotation marks helps! :roll:

Code: Select all

REG DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
           /\                                                         /\
Best regards
Horst
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Set Registry Entry depending on CheckBox

Hello Horst,

I'm glad you got this working.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”