PowerShell: How to check which button is clicked -



PowerShell: How to check which button is clicked -

i have gui buttons check scheme informations. routine same, don't want write 5 times. how can check button user has pressed?

for example:

foreach ($server in $serverlist) { if ( (test-connection $server -quiet -count 1) ) { if ($button1.clicked) { #get os info } else {} if ($button2.clicked) { #get disk info } else {} else { write-output "`r`n$server not available...`r`n" | out-file c:\temp\error.txt } } else {} } [reflection.assembly]::loadwithpartialname('system.windows.forms'); [system.windows.forms.messagebox]::show('query complete')

rather multiple if($buttonwhatever.clicked), attach an event handler button , create work.

$btngetosinfo.add_click( { # stuff getting os } ) $btngetdiskinfo.add_click( { # stuff getting disk info } )

powershell button user-interface

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -