Created
July 5, 2026 02:05
-
-
Save terremoth/3e2ba8bb013e0ed71013f3bfd6e0edeb to your computer and use it in GitHub Desktop.
Less than 1kb Notepad program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add-Type -AssemblyName System.Windows.Forms | |
| $f=[Windows.Forms.Form]::new();$f.Text="MicroPad";$f.Width=640;$f.Height=480 | |
| $t=[Windows.Forms.TextBox]::new();$t.Multiline=$true;$t.Dock="Fill";$t.ScrollBars="Both" | |
| $m=[Windows.Forms.MenuStrip]::new() | |
| $a=[Windows.Forms.ToolStripMenuItem]::new("Arquivo") | |
| $n=[Windows.Forms.ToolStripMenuItem]::new("Novo") | |
| $n.add_Click({$t.Text=""}) | |
| $o=[Windows.Forms.ToolStripMenuItem]::new("Abrir...") | |
| $o.add_Click({$d=[Windows.Forms.OpenFileDialog]::new();if($d.ShowDialog() -eq "OK"){$t.Text=[IO.File]::ReadAllText($d.FileName)}}) | |
| $s=[Windows.Forms.ToolStripMenuItem]::new("Salvar...") | |
| $s.add_Click({$d=[Windows.Forms.SaveFileDialog]::new();if($d.ShowDialog() -eq "OK"){[IO.File]::WriteAllText($d.FileName,$t.Text)}}) | |
| $e=[Windows.Forms.ToolStripMenuItem]::new("Sair") | |
| $e.add_Click({$f.Close()}) | |
| $a.DropDownItems.AddRange(@($n,$o,$s,$e)) | |
| $m.Items.Add($a) | |
| $f.Controls.AddRange(@($t,$m)) | |
| $f.MainMenuStrip=$m | |
| [Windows.Forms.Application]::Run($f) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To execute:
or once for all time, at the powershell: