PDA

View Full Version : Conditional Text and settings on a dialog



mcooper
07-31-2011, 06:56 AM
Hi All. I am brand new to Setup Factory and am wanting to replace my existing installer with this product. Setup Factory seems to have everytihing that I need, but I am unable to figure out this scenario.

During our installation, we determine whether or not our runtime has already been installed in which case we want to give the user the option of using the currently installed runtime (default) or reinstalling it. Users that never have had the runtime component installed should not get any choice at it... it just installs.

We determine this by querying the existance of a Registry key.... so I built this Global Function:



-- Checks to see if VDF16.1 is installed
VDFInstalled = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Data Access Worldwide\\Visual Dataflex\\15.1");

if (VDFInstalled) then
SessionVar.Set("%InstallVDF%" , "False");
SessionVar.Set("InstallVDFText%", "The runtime component is already installed. It is recommended that you do not re-install the runtime.");
else
SessionVar.Set("%InstallVDF%" , "True");
SessionVar.Set("InstallVDFText%", "The runtime component NEEDS TO BE INSTALLED.");
end



But it seems that my InstallVDF and my InstallVDFText variables to not take on the values in this function... At least the Dialog in which I use these two variables do not show the values assigned by the script.

If somebody has an idea of how to do what I need to do, it would be awesome.

Lastly, the script that is used is not familiar to me. Can somebody let me know the script language so that I can start to study it a bit more?

Thanks in advance,

Mike

Ulrich
07-31-2011, 07:32 AM
Setup Factory uses Lua (http://www.lua.org/manual/5.1/). You can find the description of all custom functions in the documentation.

You can also find a method to uninstall the former version with one of my screens (http://www.mindquake.com.br/en/screens/uninstall).

Ulrich

mcooper
07-31-2011, 11:45 AM
Thank Ulrich...

I must be really missing the boat here:

To do a simple function for example, is to set the label of a checkbox depending on whether or not a key exists in the Registry...

So I have a Checkbox item on a screen and give it the label of "Test". Then I have the following script in the "Global Functions"



-- Checks to see if VDF16.1 is installed
VDFInstalled = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Data Access Worldwide\\Visual Dataflex\\15.1");

if (VDFInstalled == true) then
--SessionVar.Set("%InstallVDF%" , "false");
--SessionVar.Set("InstallVDFText%", "The runtime component is already installed. It is recommended that you do not re-install the runtime.");
DlgCheckBox.SetProperties(CTRL_CHECK_BOX_01, {Label = "VDF Installed", Enabled = true})
else
--SessionVar.Set("%InstallVDF%" , "true");
--SessionVar.Set("InstallVDFText%", "The runtime component NEEDS TO BE INSTALLED.");
DlgCheckBox.SetProperties(CTRL_CHECK_BOX_01, {Label = "VDF NOT Installed", Enabled = false});
end



So I would expect the Label of the CTRL_CHECK_BOX_01 to be either "VDF Installed", or "VDF NOT Installed" but instead, it just shows "Test"...

So this tells me (I think) that either my script is not running, or it is being ignored.

I also tried it in the "Pre-Install" and the "Startup" sections, but it never seems to set the Label of the checkbox.

Any help is appreciated.

Mike

mcooper
07-31-2011, 12:45 PM
OK... I think I figured out some logic that works, so I am OK... (for now) Pretty sure that I will have more questions though as I continue to switch over.

Mike