From 264ba03421ef2a81237f07e02baf4f291f7c8088 Mon Sep 17 00:00:00 2001 From: Jed Laundry Date: Sat, 14 Aug 2021 12:44:11 +1200 Subject: [PATCH] Update 1.3.7.0 Add macro text box, allow minimizing --- TypeClipboard/Form1.Designer.cs | 29 ++++++- TypeClipboard/Form1.cs | 5 ++ TypeClipboard/Properties/AssemblyInfo.cs | 6 +- TypeClipboard/Typer.cs | 87 +++++++++++--------- TypeClipboard/typeclipboard.ico | Bin 11502 -> 11502 bytes TypeClipboardAppx/Package.appxmanifest | 2 +- TypeClipboardAppx/TypeClipboardAppx.wapproj | 3 +- 7 files changed, 82 insertions(+), 50 deletions(-) diff --git a/TypeClipboard/Form1.Designer.cs b/TypeClipboard/Form1.Designer.cs index f0ebc79..6b4b924 100644 --- a/TypeClipboard/Form1.Designer.cs +++ b/TypeClipboard/Form1.Designer.cs @@ -31,6 +31,8 @@ this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.chkHotkey = new System.Windows.Forms.CheckBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // textBox1 @@ -63,19 +65,38 @@ this.chkHotkey.UseVisualStyleBackColor = true; this.chkHotkey.CheckedChanged += new System.EventHandler(this.chkHotkey_CheckedChanged); // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBox2.Location = new System.Drawing.Point(12, 64); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(201, 22); + this.textBox2.TabIndex = 3; + this.textBox2.Text = "(non-clipboard macro)"; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(219, 64); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(103, 22); + this.button2.TabIndex = 4; + this.button2.Text = "Type (2s delay)"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // // Form1 // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(334, 66); + this.ClientSize = new System.Drawing.Size(334, 99); + this.Controls.Add(this.button2); + this.Controls.Add(this.textBox2); this.Controls.Add(this.chkHotkey); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; - this.MinimizeBox = false; this.Name = "Form1"; this.ShowIcon = false; - this.ShowInTaskbar = false; this.Text = "Type Clipboard"; this.TopMost = true; this.Activated += new System.EventHandler(this.Form1_Activated); @@ -93,6 +114,8 @@ private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.CheckBox chkHotkey; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button2; } } diff --git a/TypeClipboard/Form1.cs b/TypeClipboard/Form1.cs index 0c6328a..74e4fcc 100644 --- a/TypeClipboard/Form1.cs +++ b/TypeClipboard/Form1.cs @@ -121,5 +121,10 @@ namespace TypeClipboard Properties.Settings.Default.Save(); } + + private void button2_Click(object sender, EventArgs e) + { + _tc.Type(textBox2.Text); + } } } diff --git a/TypeClipboard/Properties/AssemblyInfo.cs b/TypeClipboard/Properties/AssemblyInfo.cs index 5af9ce5..dcaad5a 100644 --- a/TypeClipboard/Properties/AssemblyInfo.cs +++ b/TypeClipboard/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jed Laundry")] [assembly: AssemblyProduct("Type Clipboard")] -[assembly: AssemblyCopyright("Copyright © Jed Laundry, 2020")] +[assembly: AssemblyCopyright("Copyright © Jed Laundry, 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.6.0")] -[assembly: AssemblyFileVersion("1.3.6.0")] +[assembly: AssemblyVersion("1.3.7.0")] +[assembly: AssemblyFileVersion("1.3.7.0")] diff --git a/TypeClipboard/Typer.cs b/TypeClipboard/Typer.cs index 43038a8..c77ec0e 100644 --- a/TypeClipboard/Typer.cs +++ b/TypeClipboard/Typer.cs @@ -12,52 +12,57 @@ namespace TypeClipboard { private const int INTERKEY_DELAY = 20; + public void Type(String str, int delay = 2000) + { + Thread.Sleep(delay); + foreach (Char c in str.ToCharArray()) + { + // Some characters have special meaning + // https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/sendkeys-statement + switch (c) + { + case '\n': + return; + case '\r': + return; + case '{': + SendKeys.Send("{{}"); + break; + case '}': + SendKeys.Send("{}}"); + break; + case '+': + SendKeys.Send("{+}"); + break; + case '^': + SendKeys.Send("{^}"); + break; + case '%': + SendKeys.Send("{%}"); + break; + case '~': + SendKeys.Send("{~}"); + break; + case '(': + SendKeys.Send("{(}"); + break; + case ')': + SendKeys.Send("{)}"); + break; + default: + SendKeys.Send(c.ToString()); + break; + } + Thread.Sleep(INTERKEY_DELAY); + } + } + public void TypeClipboard(int delay = 2000) { if (Clipboard.ContainsText(TextDataFormat.UnicodeText)) { String clipboard = Clipboard.GetText(TextDataFormat.UnicodeText); - Thread.Sleep(delay); - foreach (Char c in clipboard.ToCharArray()) - { - // Some characters have special meaning - // https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/sendkeys-statement - switch (c) - { - case '\n': - return; - case '\r': - return; - case '{': - SendKeys.Send("{{}"); - break; - case '}': - SendKeys.Send("{}}"); - break; - case '+': - SendKeys.Send("{+}"); - break; - case '^': - SendKeys.Send("{^}"); - break; - case '%': - SendKeys.Send("{%}"); - break; - case '~': - SendKeys.Send("{~}"); - break; - case '(': - SendKeys.Send("{(}"); - break; - case ')': - SendKeys.Send("{)}"); - break; - default: - SendKeys.Send(c.ToString()); - break; - } - Thread.Sleep(INTERKEY_DELAY); - } + this.Type(clipboard, delay); } } } diff --git a/TypeClipboard/typeclipboard.ico b/TypeClipboard/typeclipboard.ico index 582c200f829acc899f496a34874a6a186be91496..77ab272a52743532afaf67306064392dbfb0a613 100644 GIT binary patch delta 521 zcmaDC`7Uw;6Vt>5hMMj?baQ~l%wrUWz`KUqPG zW%2n2b)Y*$Cl^Tb0BIp`7y>pcM&|$je@@Qh zQ8fO*|8qW&4Z`!74^+-!Y_Pl(}3;b-%|9^a#?4Yg-6lb3tq?2M%W5>WyA&0;q be*HfNhU8-m4313*4B~^tZGiF(j0_9_APuQX delta 594 zcmaDC`7Uw;6Vv1eS}cY+|HGN4R3a5 z)nuGJg-sNwiGOl}4$tHTY@9$g&*Ufp9=88rF!?o`;^Y`D&dDFyq`|Z)lf>joZQjWZ zoE(!47&#|9@Uvm?hpU>cY{o$UicT(&<_FT8lP|Ebfx>ySB9|W%+Xw!i^B=HJF6GhG zn8SR)at33ABt8sMv-ucLl@hq%UeoPrk(jiV&8`{92-u5AbnL z-m9eoj7c6Ktq+&`ul1Gr|Bnxo@3YBIex@xr*;8Ewm=f402kE3()Y&mG)X1UY`hN@z V$;TKN9Gg%vNZbafzJZZ}0RZ + Version="1.3.7.0" /> TypeClipboard diff --git a/TypeClipboardAppx/TypeClipboardAppx.wapproj b/TypeClipboardAppx/TypeClipboardAppx.wapproj index f27a557..7081107 100644 --- a/TypeClipboardAppx/TypeClipboardAppx.wapproj +++ b/TypeClipboardAppx/TypeClipboardAppx.wapproj @@ -63,7 +63,7 @@ neutral C:\temp 0 - F1AC865F3B57360B33C17D9B7ECE4A4BFD2EC9CC + DFF25B896771BFB75D948AD107C34534A21A08B1 Always @@ -109,7 +109,6 @@ -