private/Show-Form.ps1
# Function to present GUI. function Show-Form { [CmdletBinding()] [OutputType([void])] param ( ) #region begin WinFormObjects # Create WinForm objects. $form = New-Object Windows.Forms.Form; $notifyIcon = New-Object Windows.Forms.NotifyIcon; $statusStrip = New-Object Windows.Forms.StatusStrip; $statusStripLabel = New-Object Windows.Forms.ToolStripStatusLabel; $tabControl = New-Object Windows.Forms.TabControl; $tabPageInsert = New-Object Windows.Forms.TabPage; $tabPageSaved = New-Object Windows.Forms.TabPage; $tabPageSettings = New-Object Windows.Forms.TabPage; $buttonTypeSaveToFile = New-Object Windows.Forms.Button; $buttonTypeClear = New-Object Windows.Forms.Button; $buttonTypeSave = New-Object Windows.Forms.Button; $buttonTypeSend = New-Object Windows.Forms.Button; $buttonTypeCancel = New-Object Windows.Forms.Button; $buttonSavedExport = New-Object Windows.Forms.Button; $buttonSavedImport = New-Object Windows.Forms.Button; $buttonSavedCopyToClipboard = New-Object Windows.Forms.Button; $richTextBoxInsert = New-Object Windows.Forms.RichTextBox; $richTextBoxSaved = New-Object Windows.Forms.RichTextBox; $textBoxDelayKey = New-Object Windows.Forms.TextBox; $textBoxDelayWait = New-Object Windows.Forms.TextBox; $labelDelayKey = New-Object Windows.Forms.Label; $labelDelayWait = New-Object Windows.Forms.Label; $splitContainerSaved = New-Object Windows.Forms.SplitContainer; $listBoxSaved = New-Object Windows.Forms.ListBox; $groupBoxSettingsDelay = New-Object Windows.Forms.GroupBox; $contextMenuStrip = New-Object System.Windows.Forms.ContextMenuStrip #endregion #region begin Icon # Convert Base64 string to bitmap to use as an icon. $iconBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7d15uF1Vefjx781ESAgqqICEGSGAAgKCUsFZFJUwiFVsqa0dHSqOaLU/h2oVcai1tVptq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2PJ00t9VKHU8xDQJHkwYspy0zx1eSe5xvB15EulNbKuEG0noWN2f+nC0yx1eyVeb4PwReS5rbaqWOBQCkgXotcEbViajW7iK9T+D6qhNR59xC2vfuqDoR1dqPgCNJb4CsnboWALCmCPhBpviLM8XVunKN8x2k9wkszBRfGs/1pIV7chUBHqPKyDXOPwAOJ730SZM0g3QmIPqazIcL9qHL9id+290F7FayE9IYnk66FBW9n+9bshMdluONfz/CtRzCzCRdR4ncQN5hW8YU0iNNUdvtDmDXoj2Qxrcrad+M3M8Hivaguw4gdm75IU7+4WYAZxKzgc4rnHvXvZOY7XYXsHvh3KWJ2oW4IuC4wrl33U+J2W5n4eSfzUzSAPezgQaB/Uon3nEzScub9rPdFpPeJyDV2Tz6X/jqWpxESjuA/pcCdvIvYCPg+0x+I/11+ZRFOjA+yOS22d3AHuVTlialn8sBD+O+XpU/Y/Lzytmkd56ogJnAAnrbQCtIi9KoOgfQ+4HxSlzkR82zE3AVve3rd5C+I6rO20lzRS/bbQH+8q/EXzCxG8wuJS3coeo9jfTip1WMvc2WA/8MzKkmTalvmwJfIO3LY+3rq4Bvkn9BGk3M84HLGH9euRP484py1LDZwJ+SXq94A/Ao6b3zVwFfBg7Fu2nraA/gY8CvSddMB0m/gM4F3oev81V7bE/ap88j7eODpH3+QtI7STzlXz8DwCuBfweuJs0pj5LWfvge8EZgVlXJRfn/W8h+8W9g2oMAAAAASUVORK5CYII='; $iconBytes = [Convert]::FromBase64String($iconBase64); $iconStream = [System.IO.MemoryStream]::new($iconBytes, 0, $iconBytes.Length); $iconBitmap = [System.Drawing.Icon]::FromHandle(([System.Drawing.Bitmap]::new($iconStream).GetHIcon())); #endregion #region begin General # Set form properties. $form.Text = 'AutoTyper'; $form.Size = New-Object Drawing.Size @(1162, 770); $form.StartPosition = 'CenterScreen'; $form.FormBorderStyle = 'FixedSingle'; $form.MaximizeBox = $false; $form.MinimizeBox = $true; $form.Name = 'formMain'; $form.Icon = $iconBitmap; # Set notify icon properties. $notifyIcon.Icon = $iconBitmap; $notifyIcon.Visible = $true; $notifyIcon.Text = 'AutoTyper'; # Set tab control properties. $tabControl.Dock = 'Fill'; $tabControl.Name = 'tabControl'; $tabControl.Size = New-Object Drawing.Size @(1162, 712); $tabControl.Location = New-Object Drawing.Point @(0, 0); # Set status strip properties. $statusStrip.Dock = 'Bottom'; $statusStrip.Text = 'Status'; $statusStrip.Name = 'statusStrip'; $statusStrip.Size = New-Object Drawing.Size @(1148, 22); $statusStrip.Location = New-Object Drawing.Point @(0, 712); $null = $statusStrip.Items.Add($statusStripLabel); # Set status strip label properties. $statusStripLabel.Text = 'Ready'; $statusStripLabel.Name = 'statusStripLabel'; #endregion #region begin trayArea $contextMenuItemOpen = $contextMenuStrip.Items.Add('Open'); $contextMenuItemExit = $contextMenuStrip.Items.Add('Exit'); #endregion #region begin tabPageInsert # Set tab page for "tabPageInsert" properties. $tabPageInsert.Text = 'Typer'; $tabPageInsert.Name = 'tabPageInsert'; $tabPageInsert.Location = New-Object Drawing.Point @(4, 24); $tabPageInsert.Size = New-Object Drawing.Size @(1140, 684); $tabPageInsert.Padding = New-Object System.Windows.Forms.Padding(3); $tabPageInsert.UseVisualStyleBackColor = $true; # Set richTextBoxInsert properties. $richTextBoxInsert.Location = New-Object Drawing.Point @(6, 6); $richTextBoxInsert.Size = New-Object Drawing.Size @(1035, 675); $richTextBoxInsert.Name = 'richTextBoxInsert'; $richTextBoxInsert.Text = '<insert text that should be typed here>'; $richTextBoxInsert.ScrollBars = 'Vertical'; $richTextBoxInsert.TabIndex = 0; # Set buttonSaveToFile properties. $buttonTypeSaveToFile.Text = 'Save to File'; $buttonTypeSaveToFile.Size = New-Object Drawing.Size @(87, 32); $buttonTypeSaveToFile.Location = New-Object Drawing.Point @(1047, 120); $buttonTypeSaveToFile.Name = 'buttonTypeSaveToFile'; $buttonTypeSaveToFile.UseVisualStyleBackColor = $true; $buttonTypeSaveToFile.TabIndex = 4; # Set buttonClear properties. $buttonTypeClear.Text = 'Clear'; $buttonTypeClear.Size = New-Object Drawing.Size @(87, 32); $buttonTypeClear.Location = New-Object Drawing.Point @(1047, 158); $buttonTypeClear.Name = 'buttonTypeClear'; $buttonTypeClear.UseVisualStyleBackColor = $true; $buttonTypeClear.TabIndex = 2; # Set buttonSave properties. $buttonTypeSave.Text = 'Save'; $buttonTypeSave.Size = New-Object Drawing.Size @(87, 32); $buttonTypeSave.Location = New-Object Drawing.Point @(1047, 82); $buttonTypeSave.Name = 'buttonTypeSave'; $buttonTypeSave.UseVisualStyleBackColor = $true; $buttonTypeSave.TabIndex = 3; # Set buttonSend properties. $buttonTypeSend.Text = 'Send'; $buttonTypeSend.Size = New-Object Drawing.Size @(87, 32); $buttonTypeSend.Location = New-Object Drawing.Point @(1047, 6); $buttonTypeSend.Name = 'buttonTypeSend'; $buttonTypeSend.UseVisualStyleBackColor = $true; $buttonTypeSend.TabIndex = 1; # Set buttonTypeCancel properties. $buttonTypeCancel.Text = 'Cancel'; $buttonTypeCancel.Size = New-Object Drawing.Size @(87, 32); $buttonTypeCancel.Location = New-Object Drawing.Point @(1047, 44); $buttonTypeCancel.Name = 'buttonTypeCancel'; $buttonTypeCancel.UseVisualStyleBackColor = $true; #endregion #region begin tabPageSaved # Set tab page for "tabPageSaved" properties. $tabPageSaved.Text = 'Saved'; $tabPageSaved.Name = 'tabPageSaved'; $tabPageSaved.Location = New-Object Drawing.Point @(4, 24); $tabPageSaved.Size = New-Object Drawing.Size @(1140, 684); $tabPageSaved.Padding = New-Object System.Windows.Forms.Padding(3); $tabPageSaved.UseVisualStyleBackColor = $true; # Set splitContainerSaved properties. $splitContainerSaved.Name = 'splitContainerSaved'; $splitContainerSaved.Location = New-Object Drawing.Point @(6, 6); $splitContainerSaved.Size = New-Object Drawing.Size @(1035, 672); $splitContainerSaved.SplitterDistance = 206; $splitContainerSaved.IsSplitterFixed = $false; # Set listBoxSaved properties. $listBoxSaved.Name = 'listBoxSaved'; $listBoxSaved.Size = New-Object Drawing.Size @(206, 672); $listBoxSaved.ItemHeight = 15; $listBoxSaved.Location = New-Object Drawing.Point @(0, 0); $listBoxSaved.SelectionMode = 'One'; $listBoxSaved.Dock = 'Fill'; $listBoxSaved.FormattingEnabled = $true; # Set richTextBoxSaved properties. $richTextBoxSaved.Name = 'richTextBoxSaved'; $richTextBoxSaved.Size = New-Object Drawing.Size @(825, 672); $richTextBoxSaved.Location = New-Object Drawing.Point @(0, 0); $richTextBoxSaved.ScrollBars = 'Vertical'; $richTextBoxSaved.Dock = 'Fill'; $richTextBoxSaved.Text = ''; $richTextBoxSaved.ReadOnly = $true; # Set buttonSavedExport properties. $buttonSavedExport.Text = 'Export'; $buttonSavedExport.Size = New-Object Drawing.Size @(87, 32); $buttonSavedExport.Location = New-Object Drawing.Point @(1047, 6); $buttonSavedExport.Name = 'buttonSavedExport'; $buttonSavedExport.UseVisualStyleBackColor = $true; # Set buttonSavedImport properties. $buttonSavedImport.Text = 'Import'; $buttonSavedImport.Size = New-Object Drawing.Size @(87, 32); $buttonSavedImport.Location = New-Object Drawing.Point @(1047, 44); $buttonSavedImport.Name = 'buttonSavedImport'; $buttonSavedImport.UseVisualStyleBackColor = $true; # Set buttonSavedCopyToClipboard properties. $buttonSavedCopyToClipboard.Text = 'Copy to Clipboard'; $buttonSavedCopyToClipboard.Size = New-Object Drawing.Size @(87, 32); $buttonSavedCopyToClipboard.Location = New-Object Drawing.Point @(1047, 82); $buttonSavedCopyToClipboard.Name = 'buttonSavedCopyToClipboard'; $buttonSavedCopyToClipboard.UseVisualStyleBackColor = $true; #endregion #region begin tabPageSettings # Set tab page for "tabPageSettings" properties. $tabPageSettings.Text = 'Settings'; $tabPageSettings.Name = 'tabPageSettings'; $tabPageSettings.Location = New-Object Drawing.Point @(4, 24); $tabPageSettings.Size = New-Object Drawing.Size @(1140, 684); $tabPageSettings.Padding = New-Object System.Windows.Forms.Padding(3); $tabPageSettings.UseVisualStyleBackColor = $true; # Set groupBoxSettingsDelay properties. $groupBoxSettingsDelay.Text = 'Delays'; $groupBoxSettingsDelay.Size = New-Object Drawing.Size @(300, 95); $groupBoxSettingsDelay.Location = New-Object Drawing.Point @(8, 6); # Set labelDelayWait properties. $labelDelayWait.Text = 'Delay before typing (seconds):'; $labelDelayWait.Size = New-Object Drawing.Size @(167, 15); $labelDelayWait.Location = New-Object Drawing.Point @(6, 29); $labelDelayWait.Name = 'labelDelayWait'; # Set labelDelayKey properties. $labelDelayKey.Text = 'Delay between each key (miliseconds):'; $labelDelayKey.Size = New-Object Drawing.Size @(210, 15); $labelDelayKey.Location = New-Object Drawing.Point @(6, 60); $labelDelayKey.Name = 'labelDelayKey'; # Set textBoxDelayWait properties. $textBoxDelayWait.Size = New-Object Drawing.Size @(67, 23); $textBoxDelayWait.Location = New-Object Drawing.Point @(222, 26); $textBoxDelayWait.Name = 'textBoxDelayWait'; $textBoxDelayWait.Text = '5'; # Set textBoxDelayKey properties. $textBoxDelayKey.Size = New-Object Drawing.Size @(67, 23); $textBoxDelayKey.Location = New-Object Drawing.Point @(222, 57); $textBoxDelayKey.Name = 'textBoxDelayKey'; $textBoxDelayKey.Text = '5'; #endregion #region begin AddControls # Add elements togroupBoxSettingsDelay. $groupBoxSettingsDelay.Controls.Add($labelDelayWait); $groupBoxSettingsDelay.Controls.Add($labelDelayKey); $groupBoxSettingsDelay.Controls.Add($textBoxDelayWait); $groupBoxSettingsDelay.Controls.Add($textBoxDelayKey); # Add elements to splitContainerSaved. $splitContainerSaved.Panel1.Controls.Add($listBoxSaved); $splitContainerSaved.Panel2.Controls.Add($richTextBoxSaved); # Add elements to tabPageInsert. $tabPageInsert.Controls.Add($richTextBoxInsert); $tabPageInsert.Controls.Add($buttonTypeSaveToFile); $tabPageInsert.Controls.Add($buttonTypeClear); $tabPageInsert.Controls.Add($buttonTypeSave); $tabPageInsert.Controls.Add($buttonTypeSend); $tabPageInsert.Controls.Add($buttonTypeCancel); # Add elements to tabPageSaved. $tabPageSaved.Controls.Add($buttonSavedExport); $tabPageSaved.Controls.Add($buttonSavedImport); $tabPageSaved.Controls.Add($buttonSavedCopyToClipboard); $tabPageSaved.Controls.Add($splitContainerSaved); # Add elements to tabPageSettings. $tabPageSettings.Controls.Add($groupBoxSettingsDelay); # Add elements to tabControl. $tabControl.TabPages.Add($tabPageInsert); $tabControl.TabPages.Add($tabPageSaved); $tabControl.TabPages.Add($tabPageSettings); # Add elements to contextMenuStrip. $notifyIcon.ContextMenuStrip = $contextMenuStrip; # Add elements to form. $form.Controls.Add($tabControl); $form.Controls.Add($statusStrip); #endregion #region begin AddEventHandlers # Add event handler for Open context menu item. $contextMenuItemOpen.Add_Click( { # Show the form. $form.Visible = $true; # Bring to the front. $form.BringToFront(); # Set the form to normal state. $form.WindowState = 'Normal'; } ); # Add event handler for Exit context menu item. $contextMenuItemExit.Add_Click( { # Close the form. $null = $form.Close(); # Dispose the form. $null = $form.Dispose(); # Dispose the notify icon. $null = $notifyIcon.Dispose(); } ); # Add event handler for form closing. $form.Add_FormClosing( { # Close all runspace in the list. foreach ($runspace in $Script:runspaces) { # Close the runspace. $null = $runspace.Dispose(); } } ); # Add event handler for clicking on button Send. $buttonTypeSend.Add_Click( { # Get the text from the rich text box. $textRichTextBoxInsert = $richTextBoxInsert.Text; # Get the delay before typing. $delayWait = $textBoxDelayWait.Text; # Get the delay between each key. $delayKey = $textBoxDelayKey.Text; # Create a new runspace. $runspace = Get-PowerShellRunspace; # Create script block. $sendKeyScriptBlock = { [CmdletBinding()] param ( # The input string to send. [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$InputString, # The delay between each key press. [Parameter(Mandatory = $false)] [ValidateNotNullOrEmpty()] [int]$DelayBeforeTypingInSeconds = 5, # The delay between each key press. [Parameter(Mandatory = $false)] [ValidateNotNullOrEmpty()] [int]$DelayInMiliseconds = 200, # The reference to the form. [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.Windows.Forms.Form]$Form ) # Loop for X seconds before typing. for ($i = 0; $i -lt $DelayBeforeTypingInSeconds; $i++) { # Update the status. $Form.Controls['statusStrip'].Items[0].Text = ('Waiting {0} seconds before typing' -f ($DelayBeforeTypingInSeconds - $i)); # Sleep for some seconds Start-Sleep -Seconds 1; } # Update the status. $Form.Controls['statusStrip'].Items[0].Text = 'Typing now'; # Send keyboard input. Send-KeyboardInput -InputString $InputString -DelayInMiliseconds $DelayInMiliseconds -DelayBeforeTypingInSeconds 0; # Update the status. $Form.Controls['statusStrip'].Items[0].Text = 'Ready'; }; # Add the script block with arguments to the runspace. $null = $runspace.AddScript($sendKeyScriptBlock); $null = $runspace.AddArgument([ref]$textRichTextBoxInsert); $null = $runspace.AddArgument([ref]$delayWait); $null = $runspace.AddArgument([ref]$delayKey); $null = $runspace.AddParameter('Form', $form); # Invoke the runspace(s). $null = $runspace.BeginInvoke(); # Unlock the GUI. [System.Windows.Forms.Application]::DoEvents(); # Add runspace to the list. $null = $Script:runspaces.Add($runspace); } ); # Add event handler for clicking on button Clear. $buttonTypeClear.Add_Click( { # Clear the text from the rich text box. $richTextBoxInsert.Clear(); } ); # Make sure only integers are allowed in textBoxDelayWait. $textBoxDelayWait.Add_KeyPress( { if (-not [char]::IsControl($_.KeyChar) -and -not [char]::IsDigit($_.KeyChar)) { $_.Handled = $true; } } ); # Make sure only integers are allowed in the textBoxDelayKey. $textBoxDelayKey.Add_KeyPress( { if (-not [char]::IsControl($_.KeyChar) -and -not [char]::IsDigit($_.KeyChar)) { $_.Handled = $true; } } ); # Add event handler for clicking on button Save. $buttonTypeSave.Add_Click( { # Enter name of the saved item. $name = [Microsoft.VisualBasic.Interaction]::InputBox('Enter a name for the saved item:', 'Save', (Get-Date).ToString('yyyyMMddHHmmss')); # If name is empty. if ([string]::IsNullOrEmpty($name)) { # Show a message box. [System.Windows.Forms.MessageBox]::Show('Name cannot be empty.', 'Save', 'OK', 'Error'); # Return from event handler. return [void]; } # Generate ID. $id = [System.Guid]::NewGuid().ToString(); # Full name. $fullName = ('{0} ({1})' -f $name, $id); # Get the text from the rich text box. $textRichTextBoxInsert = $richTextBoxInsert.Text; # Add to object array saved. $null = $Script:saved.Add( [PSCustomObject]@{ Id = $id; FullName = $fullName; Name = $name; Text = $textRichTextBoxInsert; DateTime = (Get-Date); } ); # Add to list box. $null = $listBoxSaved.Items.Add($fullName); # Set the text in the status strip. $statusStripLabel.Text = ("Saved item '{0}'" -f $name); } ); # Add event handler when selecting an item in the list box. $listBoxSaved.Add_SelectedIndexChanged( { # Get the selected item. $selectedItem = $listBoxSaved.SelectedItem; # Get the object from the saved array. $selectedObject = $Script:saved | Where-Object { $_.FullName -eq $selectedItem }; # Set the text in the rich text box. $richTextBoxSaved.Text = $selectedObject.Text; } ); # Add event handler for clicking on button Save To File. $buttonTypeSaveToFile.Add_Click( { # Create a save file dialog. $saveFileDialog = New-Object -TypeName 'System.Windows.Forms.SaveFileDialog'; # Set the title. $saveFileDialog.Title = 'Save to File'; # Set the filter. $saveFileDialog.Filter = 'Text files (*.txt)|*.txt|All files (*.*)|*.*'; # Set the initial directory. $saveFileDialog.InitialDirectory = [Environment]::GetFolderPath('Desktop'); # Show the dialog. $saveFileDialog.ShowDialog(); # Get the file name. $fileName = $saveFileDialog.FileName; # Get the text from the rich text box. $textRichTextBoxInsert = $richTextBoxInsert.Text; # Save the text to the file. $textRichTextBoxInsert | Set-Content -Path $fileName -Force -Encoding UTF8; # Set the text in the status strip. $statusStripLabel.Text = ("Saved input to file '{0}'" -f $fileName); } ); # Add event handler for clicking on button Export. $buttonSavedExport.Add_Click( { # If saved array is empty. if ($Script:saved.Count -eq 0) { # Show a message box. [System.Windows.Forms.MessageBox]::Show('There is nothing to export.', 'Export', 'OK', 'Information'); # Return from event handler. return [void]; } # Create a save file dialog. $saveFileDialog = New-Object -TypeName 'System.Windows.Forms.SaveFileDialog'; # Set the title. $saveFileDialog.Title = 'Export'; # Set the filter. $saveFileDialog.Filter = 'AutoTyper (*.autotyper)|*.autotyper|All files (*.*)|*.*'; # Set the initial directory. $saveFileDialog.InitialDirectory = [Environment]::GetFolderPath('Desktop'); # Show the dialog. $saveFileDialog.ShowDialog(); # Get the file name. $fileName = $saveFileDialog.FileName; # Convert the saved array to JSON. $jsonSaved = $Script:saved | ConvertTo-Json -Depth 100; # Try to save the file. Try { # Save to the file. $jsonSaved | Set-Content -Path $fileName -Force -Encoding UTF8; # Show a message box. [System.Windows.Forms.MessageBox]::Show('Exported successfully.', 'Export', 'OK', 'Information'); # Set the text in the status strip. $statusStripLabel.Text = ("Exported saved items to file '{0}'" -f $fileName); } catch { # Show a message box. [System.Windows.Forms.MessageBox]::Show('Export failed.', 'Export', 'OK', 'Error'); } } ); # Add event handler for clicking on button Import. $buttonSavedImport.Add_Click( { # Create an open file dialog. $openFileDialog = New-Object -TypeName 'System.Windows.Forms.OpenFileDialog'; # Set the title. $openFileDialog.Title = 'Import'; # Set the filter. $openFileDialog.Filter = 'AutoTyper (*.autotyper)|*.autotyper|All files (*.*)|*.*'; # Set the initial directory. $openFileDialog.InitialDirectory = [Environment]::GetFolderPath('Desktop'); # Show the dialog. $openFileDialog.ShowDialog(); # Get the file name. $fileName = $openFileDialog.FileName; # If the file name is empty. if ([string]::IsNullOrEmpty($fileName)) { # Return from event handler. return [void]; } # Try to read the file. Try { # Read the file. $jsonSaved = Get-Content -Path $fileName -Raw; # Convert the JSON to an object array. $saved = $jsonSaved | ConvertFrom-Json; # Clear the list box. $listBoxSaved.Items.Clear(); # Clear the saved array. $Script:saved.Clear(); # Add the items to the list box. foreach ($item in $saved) { # If all the properties are not present. if (-not $item.PSObject.Properties.Match('Id') -or -not $item.PSObject.Properties.Match('FullName') -or -not $item.PSObject.Properties.Match('Name') -or -not $item.PSObject.Properties.Match('Text') -or -not $item.PSObject.Properties.Match('DateTime')) { # Continue to the next item. continue; } # Add to object array saved. $null = $Script:saved.Add( [PSCustomObject]@{ Id = $item.Id; FullName = $item.FullName; Name = $item.Name; Text = $item.Text; DateTime = $item.DateTime; } ); # Add to list box. $null = $listBoxSaved.Items.Add($item.FullName); } # Show a message box. [System.Windows.Forms.MessageBox]::Show('Imported successfully.', 'Import', 'OK', 'Information'); # Set the text in the status strip. $statusStripLabel.Text = ("Imported saved items successfully from file '{0}'" -f $fileName); } catch { # Show a message box. [System.Windows.Forms.MessageBox]::Show('Import failed.', 'Import', 'OK', 'Error'); } } ); # Add event handler for clicking on button Copy to Clipboard. $buttonSavedCopyToClipboard.Add_Click( { # Get the selected item. $selectedItem = $listBoxSaved.SelectedItem; # Get the object from the saved array. $selectedObject = $Script:saved | Where-Object { $_.FullName -eq $selectedItem }; # If the selected object is null. if (-not $selectedObject) { # Show a message box. [System.Windows.Forms.MessageBox]::Show('No item selected.', 'Copy to Clipboard', 'OK', 'Error'); # Return from event handler. return [void]; } # Set the text in the status strip. $statusStripLabel.Text = 'Copied to clipboard'; # Set the text in the clipboard. [System.Windows.Forms.Clipboard]::SetText($selectedObject.Text); # Show a message box. [System.Windows.Forms.MessageBox]::Show('Copied to clipboard.', 'Copy to Clipboard', 'OK', 'Information'); } ); # Add event handler for clicking on button Cancel. $buttonTypeCancel.Add_Click( { # Set the text in the status strip. $statusStripLabel.Text = 'Cancelled'; # Close all runspace in the list. foreach ($runspace in $Script:runspaces) { # Close the runspace. $runspace.Dispose(); } # Run garbage collection. [System.GC]::Collect(); } ); #endregion # Force garbage collection just to start slightly lower RAM usage. [System.GC]::Collect(); # Bring the form to the front. $form.BringToFront(); # Always show tray icon. $notifyIcon.Visible = $true; # Set app id for window. $null = [PSAppID]::SetAppIdForWindow($form.Handle, 'AutoTyper.App'); # Hide console. $null = Hide-Console; # Display the form. $null = $form.ShowDialog(); # Close all runspace in the list. foreach ($runspace in $Script:runspaces) { # Close the runspace. $null = $runspace.Dispose(); } # Dispose the notify icon. $notifyIcon.Dispose(); # Dispose the form. $form.Dispose(); } |