Trigger an action like installing application using dropdown list and button

I asked this before but got no results, so I am asking again. I made sure and searched, while also trying to own code (trial and error) to figure it out before posting. I am trying to create a kiosk or applet of some sort that will allow the an action to happen when an item is selected from the list then a button clicked. This could be anything like installing an application, or launching a console, or running a script. I have another one that uses button tied to functions, but it is getting crowded with a bunch of buttons so I figured the list would be cleaner.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Add-type -AssemblyName system.windows.forms
$formobject = [System.Windows.forms.form]
$OfficeMenuForm=New-object $formobject
$OfficeMenuForm.clientsize= '750,500' #set the height and width
$OfficeMenuForm.text ='Office Installation Menu'
$OfficeMenuForm.backcolor='White'
$DefaultFont='Verdana,10'
$OfficeMenuForm.Font=$DefaultFont
#Build form
$labelobject = [System.Windows.Forms.Label]
$ComboBoxObject=[System.Windows.Forms.ComboBox]
$LabelTitle=New-Object $labelobject
$LabelTitle.Text='Make a selection from the dropdown menu then click the Install button'
$LabelTitle.AutoSize=$true
$LabelTitle.Location=New-Object System.Drawing.Point(10,10)
$BtnObject= [System.Windows.Forms.Button]
$BtnInstall=New-Object $BtnObject
$BtnInstall.Text='Install'
$BtnInstall.AutoSize=$true
$BtnInstall.font='Verdana,10'
$BtnInstall.Location=New-Object System.Drawing.Point(550,250)
$DDLOffice=New-Object $ComboBoxObject
$DDLOffice.Width='300'
$DDLOffice.Location=New-Object System.Drawing.Point(30,40)
#Add items to the dropdownlist
@('LTSC 2021 STD x64','LTSC 2021 STD+Project+Visio Std x64','LTSC 2021+Project
STD')|ForEach-Object {[void]$DDLOffice.Items.Add($_)}
#Select default value
$DDLOffice.SelectedIndex=0
#lable to confirm selection
$LabelObject1=[System.Windows.Forms.Label]
$LabelOutPut=New-Object $LabelObject1
$LabelOutPut.Text="You selected: $Choice"
$LabelOutPut.AutoSize=$true
$LabelOutPut.location=new-object System.Drawing.Point (100,400)
#catch selection
$DDLOffice.add_SelectedIndexChanged({
$choice=$DDLOffice.SelectedItem
$LabelOutPut.Text="You selected: $Choice"
})
Function install{
if ($DDLOffice.SelectedIndex='2'){
start-process notepad.exe
}
}
$BtnInstall.Add_Click({Install})
#create an array to accept all the controls you want to appear on the form
$OfficeMenuForm.Controls.AddRange(@($LabelTitle,$BtnInstall,$DDLOffice,$LabelOutPut))
$OfficeMenuForm.showdialog() #displays the form
$OfficeMenuForm.dispose() #cleans up form
</code>
<code>Add-type -AssemblyName system.windows.forms $formobject = [System.Windows.forms.form] $OfficeMenuForm=New-object $formobject $OfficeMenuForm.clientsize= '750,500' #set the height and width $OfficeMenuForm.text ='Office Installation Menu' $OfficeMenuForm.backcolor='White' $DefaultFont='Verdana,10' $OfficeMenuForm.Font=$DefaultFont #Build form $labelobject = [System.Windows.Forms.Label] $ComboBoxObject=[System.Windows.Forms.ComboBox] $LabelTitle=New-Object $labelobject $LabelTitle.Text='Make a selection from the dropdown menu then click the Install button' $LabelTitle.AutoSize=$true $LabelTitle.Location=New-Object System.Drawing.Point(10,10) $BtnObject= [System.Windows.Forms.Button] $BtnInstall=New-Object $BtnObject $BtnInstall.Text='Install' $BtnInstall.AutoSize=$true $BtnInstall.font='Verdana,10' $BtnInstall.Location=New-Object System.Drawing.Point(550,250) $DDLOffice=New-Object $ComboBoxObject $DDLOffice.Width='300' $DDLOffice.Location=New-Object System.Drawing.Point(30,40) #Add items to the dropdownlist @('LTSC 2021 STD x64','LTSC 2021 STD+Project+Visio Std x64','LTSC 2021+Project STD')|ForEach-Object {[void]$DDLOffice.Items.Add($_)} #Select default value $DDLOffice.SelectedIndex=0 #lable to confirm selection $LabelObject1=[System.Windows.Forms.Label] $LabelOutPut=New-Object $LabelObject1 $LabelOutPut.Text="You selected: $Choice" $LabelOutPut.AutoSize=$true $LabelOutPut.location=new-object System.Drawing.Point (100,400) #catch selection $DDLOffice.add_SelectedIndexChanged({ $choice=$DDLOffice.SelectedItem $LabelOutPut.Text="You selected: $Choice" }) Function install{ if ($DDLOffice.SelectedIndex='2'){ start-process notepad.exe } } $BtnInstall.Add_Click({Install}) #create an array to accept all the controls you want to appear on the form $OfficeMenuForm.Controls.AddRange(@($LabelTitle,$BtnInstall,$DDLOffice,$LabelOutPut)) $OfficeMenuForm.showdialog() #displays the form $OfficeMenuForm.dispose() #cleans up form </code>
Add-type -AssemblyName system.windows.forms
$formobject = [System.Windows.forms.form] 
$OfficeMenuForm=New-object $formobject
$OfficeMenuForm.clientsize= '750,500' #set the height and width
$OfficeMenuForm.text ='Office Installation Menu'
$OfficeMenuForm.backcolor='White'
$DefaultFont='Verdana,10'
$OfficeMenuForm.Font=$DefaultFont

#Build form
$labelobject = [System.Windows.Forms.Label]
$ComboBoxObject=[System.Windows.Forms.ComboBox]
$LabelTitle=New-Object $labelobject
$LabelTitle.Text='Make a selection from the dropdown menu then click the Install button'
$LabelTitle.AutoSize=$true
$LabelTitle.Location=New-Object System.Drawing.Point(10,10)
$BtnObject= [System.Windows.Forms.Button]
$BtnInstall=New-Object $BtnObject
$BtnInstall.Text='Install'
$BtnInstall.AutoSize=$true
$BtnInstall.font='Verdana,10'
$BtnInstall.Location=New-Object System.Drawing.Point(550,250)
$DDLOffice=New-Object $ComboBoxObject
$DDLOffice.Width='300'
$DDLOffice.Location=New-Object System.Drawing.Point(30,40)
#Add items to the dropdownlist
@('LTSC 2021 STD x64','LTSC 2021 STD+Project+Visio Std x64','LTSC 2021+Project 
STD')|ForEach-Object {[void]$DDLOffice.Items.Add($_)}
#Select default value
$DDLOffice.SelectedIndex=0

#lable to confirm selection
$LabelObject1=[System.Windows.Forms.Label]
$LabelOutPut=New-Object $LabelObject1
$LabelOutPut.Text="You selected: $Choice"
$LabelOutPut.AutoSize=$true
$LabelOutPut.location=new-object System.Drawing.Point (100,400)
#catch selection
$DDLOffice.add_SelectedIndexChanged({
$choice=$DDLOffice.SelectedItem
$LabelOutPut.Text="You selected: $Choice"
})
Function install{

if ($DDLOffice.SelectedIndex='2'){
start-process notepad.exe
}

}


$BtnInstall.Add_Click({Install})

#create an array to accept all the controls you want to appear on the form
$OfficeMenuForm.Controls.AddRange(@($LabelTitle,$BtnInstall,$DDLOffice,$LabelOutPut))
$OfficeMenuForm.showdialog() #displays the form
$OfficeMenuForm.dispose() #cleans up form

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật