Abhinay
Posts: 36
Joined: Wed Feb 27, 2019 9:33 am

How to get the value of the checkbox

How to get the value of the chekbox.

Code: Select all

Param()
# Your code goes here.
Add-Type -AssemblyName PresentationFramework

cd "C:\Program Files\Weir Minerals\RSP Firmware\RSP Firmware\"

  #Choose the Device to update Firmware
$SP1 = AI_GetMsiProperty CHECKBOX_SP1
$DAQ1 = AI_GetMsiProperty CHECKBOX_DAQ1

[System.Windows.MessageBox]::Show("$SP1")    ---- if i run this it gives me the output on the message box as checkbox but i need the value of it like true or 				 
                                                                             false

if ($SP1 -eq "True")
   {
   $a = .\SinetProg.exe /i /a:192.168.29.20
  [System.Windows.MessageBox]::Show("SP1 $a")
   } 

elseif ($DAQ1 -eq "True")
   {
  $b = .\SinetProg.exe /i /a:192.168.29.21 
  [System.Windows.MessageBox]::Show("DAQ1 $b")
   }
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to get the value of the checkbox

Hello,

Please note that when a checkbox is ticked its property is set to the string you set in the "Value" field from "Properties" right pane.
Capture.JPG
Capture.JPG (205.94 KiB) Viewed 7378 times
When it is not checked, then its property value will be set to empty string ("").

So you should check within your script if statement that the property value is equal or not with the string set in the "Value" field from "Properties" right pane.

Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Abhinay
Posts: 36
Joined: Wed Feb 27, 2019 9:33 am

Re: How to get the value of the checkbox

Thank you it helped.. But i had different requirement and was able to resolve it myself.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to get the value of the checkbox

You are always welcome.

I am glad you got this resolved.

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

Return to “Common Problems”