Reputation: 1631
I have created a tool for my functionalities using powershell, i want to update few of my files in my machine locally before launching my tool. i have added below message box to display that files are getting updated loacally. when i click on my tool the below messages should display dynamicaly in the message box.
[system.windows.forms.messagebox]::show("updating file1", "message")
[system.windows.forms.messagebox]::show("updating file2", "message")
[system.windows.forms.messagebox]::show("updating file3", "message")
[system.windows.forms.messagebox]::show("updating file4", "message")
[system.windows.forms.messagebox]::show("updating file5", "message")
for this it is displaying 5 different message box and i should click on OK on each message box. i want to load these messages dynamically in a single message box. could you please help in resolving it?
Upvotes: 0
Views: 2791
Reputation: 1
I think you are looking for the Notify option in Powershell forms. Use the below code for it .
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
$objNotifyIcon.Icon = "C:\Scripts\Forms\Folder.ico"
$objNotifyIcon.BalloonTipIcon = "Error"
$objNotifyIcon.BalloonTipText = "A file needed to complete the operation could not be found."
$objNotifyIcon.BalloonTipTitle = "File Not Found"
$objNotifyIcon.Visible = $True
$objNotifyIcon.ShowBalloonTip(10000)
Let me know if it works or require more details on this.
Vishnu Gupthan
Upvotes: 0
Reputation: 301087
Something like this?
$message = @("updating file1")
$message+="updating file 2"
[system.windows.forms.messagebox]::show(($message -join "`n"), "message")
Upvotes: 1