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

Before installing i need to give option or checkbox for that software to install

Actually user wants a checkbox to select between the devices to which he wants to install the software, based on user checks the checkbox it should install only to those devices and ignore others. i had written the below code where there are list of ips that corresponds to different devices.
Now user wants that DHCP to assign the IP and based on the ping response being successful with the response information (like Device Type: SP650 and Firmware Version: 1.1.73) user should be able to select the checkbox to those devices he wants to update the software

Code: Select all

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

$rspIps = "192.168.29.20","192.168.29.21","192.168.29.22","192.168.29.23","192.168.29.24","192.168.29.25","192.168.29.26","192.168.29.27"

foreach ($rspIp in $rspIps)
{
   
   if (Test-Connection $rspIp -Count 1 -ea 0 -Quiet)
   {

     if((($rspIp.Substring(11,2)) % 2) -eq 0)
     {

	.\SinetProg.exe /i /a:$rspIp
        .\SinetProg.exe /f:20181109-01_SP650_V1.1.073.bin /a:$rspIp
        .\SinetProg.exe /i /a:$rspIp /r:a
     }
     if((($rspIp.Substring(11,2)) % 2) -ne 0)
     {
     

	.\SinetProg.exe /i /a:$rspIp
	.\SinetProg.exe /f:20181130-01_DAQ650_V1.1.075.bin /a:$rspIp
	.\SinetProg.exe /i /a:$rspIp /r:a
    }

	
   }
   else
   {
       Write-Output " $rspIp could not be pinged"
   }
}
Ping Response

Code: Select all

PS D:\RSP Firmware Update\RSP_Firmware> .\SinetProg.exe /i /a:192.168.29.20
Device Type: SP650
Device Revision: 0
Encoded Serial Number: 1922376193
Real Serial Number: SP094967295
Firmware Version: 1.1.73
Device Time: August 7, 2019 10:58:06
Device Status: x0000
Device Uptime: 19:33:22
If this is the code for combo box

Code: Select all

Param()
   # Your code goes here.
	Add-Type -AssemblyName PresentationFramework
   #fetch the SiteName from combobox

   $SiteName = AI_GetMsiProperty EDIT_1_PROP


 if ($SiteName -match '[^a-zA-Z0-9.-_]')
   {
     [System.Windows.MessageBox]::Show('The value is invalid. Please re-enter the value.')
     $SiteNameValidation =$false
   } 
   else
   {
     AI_SetMsiProperty CONDITION_PROP "true"
           $prop = AI_GetMsiProperty CONDITION_PROP
           #[system.windows.messagebox]::show("$prop")
     $SiteNameValidation = $true
   }

#fetch the  EquipmentPhysicalIdentifier from combobox
   $EquipmentPhysicalIdentifier = AI_GetMsiProperty EDIT_2_PROP


   if($EquipmentPhysicalIdentifier.length -gt 12)
   {
					[System.Windows.MessageBox]::Show('The value is invalid. Please re-enter the value.')
           $EqIdValidation =$false

   }
How do i do it similarly for checkbox

Code: Select all

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

$rspIps = "192.168.29.20","192.168.29.21","192.168.29.22","192.168.29.23","192.168.29.24","192.168.29.25","192.168.29.26","192.168.29.27"

foreach ($rspIp in $rspIps)
{
   
   if (Test-Connection $rspIp -Count 1 -ea 0 -Quiet)
   {

     if((($rspIp.Substring(11,2)) % 2) -eq 0)
     {

	$a = .\SinetProg.exe /i /a:$rspIp
        Write-output "Your Current " $a[0] "and your current " $a[4]
       
     }
     if((($rspIp.Substring(11,2)) % 2) -ne 0)
     {
     

	$b = .\SinetProg.exe /i /a:$rspIp
        Write-output "Your Current " $b[0] "and your current " $b[4]
	
    }

	
   }
   else
   {
       Write-Output " $rspIp could not be pinged"
   }
}


Your Current 
Device Type: SP650
and your current 
Firmware Version: 1.1.73
Your Current 
Device Type: DAQ650
and your current 
Firmware Version: 1.1.75
 192.168.29.22 could not be pinged
 192.168.29.23 could not be pinged
 192.168.29.24 could not be pinged
 192.168.29.25 could not be pinged
 192.168.29.26 could not be pinged
 192.168.29.27 could not be pinged
Abhinay
Posts: 36
Joined: Wed Feb 27, 2019 9:33 am

Re: Before installing i need to give option or checkbox for that software to install

Do you think this will work,
Scenario is if 1st check box is checked it should install the firmware and similarly for other checkboxes, when unchecked it should do nothing, Code is written in powershell, Please suggest.

Code: Select all

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

   #Choose the Device to update Firmware
$SP1 = AI_GetMsiProperty CHECKBOX_1_PROP
if (AI_SetMsiProperty CHECKBOX_1_PROP "true")
   {
     .\SinetProg.exe /f:20181109-01_SP650_V1.1.073.bin /a:$rspIp
     .\SinetProg.exe /i /a:$rspIp /r:a
   } 
$DAQ1 = AI_GetMsiProperty CHECKBOX_1_PROP_1
if (AI_SetMsiProperty CHECKBOX_1_PROP_1 "true")
   {
	.\SinetProg.exe /f:20181130-01_DAQ650_V1.1.075.bin /a:$rspIp
	.\SinetProg.exe /i /a:$rspIp /r:a
   }
$SP2 = AI_GetMsiProperty CHECKBOX_1_PROP_2
if (AI_SetMsiProperty CHECKBOX_1_PROP_2 "true")
   {
     .\SinetProg.exe /f:20181109-01_SP650_V1.1.073.bin /a:$rspIp
     .\SinetProg.exe /i /a:$rspIp /r:a
   } 
$DAQ2 = AI_GetMsiProperty CHECKBOX_1_PROP_3
if (AI_SetMsiProperty CHECKBOX_1_PROP_3 "true")
   {
	.\SinetProg.exe /f:20181130-01_DAQ650_V1.1.075.bin /a:$rspIp
	.\SinetProg.exe /i /a:$rspIp /r:a
   }
$SP3 = AI_GetMsiProperty CHECKBOX_1_PROP_4
if (AI_SetMsiProperty CHECKBOX_1_PROP_4 "true")
   {
     .\SinetProg.exe /f:20181109-01_SP650_V1.1.073.bin /a:$rspIp
     .\SinetProg.exe /i /a:$rspIp /r:a
   } 
$DAQ3 = AI_GetMsiProperty CHECKBOX_1_PROP_5
if (AI_SetMsiProperty CHECKBOX_1_PROP_5 "true")
   {
	.\SinetProg.exe /f:20181130-01_DAQ650_V1.1.075.bin /a:$rspIp
	.\SinetProg.exe /i /a:$rspIp /r:a
   }
$SP4 = AI_GetMsiProperty CHECKBOX_1_PROP_6
if (AI_SetMsiProperty CHECKBOX_1_PROP_6 "true")
   {
     .\SinetProg.exe /f:20181109-01_SP650_V1.1.073.bin /a:$rspIp
     .\SinetProg.exe /i /a:$rspIp /r:a
   }
$DAQ4 = AI_GetMsiProperty CHECKBOX_1_PROP_7 
if (AI_SetMsiProperty CHECKBOX_1_PROP_7 "true")
   {
	.\SinetProg.exe /f:20181130-01_DAQ650_V1.1.075.bin /a:$rspIp
	.\SinetProg.exe /i /a:$rspIp /r:a
   }
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Before installing i need to give option or checkbox for that software to install

Hello,

Please check my reply on "How to get the value of the checkbox" forum thread.

If you have any questions or doubts just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Before installing i need to give option or checkbox for that software to install

You are always welcome.

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

Return to “Common Problems”