From 0722af4b745d4573a7f30098175a141bfd01433a Mon Sep 17 00:00:00 2001 From: Jed Laundry Date: Sat, 25 Jun 2022 17:31:17 +1200 Subject: [PATCH] v1.4.0: Add option to type newlines --- TypeClipboard/App.config | 3 ++ TypeClipboard/Form1.Designer.cs | 33 ++++++++++++++++--- TypeClipboard/Form1.cs | 14 ++++++-- TypeClipboard/Form1.resx | 9 +++++ TypeClipboard/Properties/AssemblyInfo.cs | 6 ++-- TypeClipboard/Properties/Settings.Designer.cs | 14 +++++++- TypeClipboard/Properties/Settings.settings | 3 ++ TypeClipboard/TypeClipboard.csproj | 2 +- TypeClipboard/Typer.cs | 21 ++++++++++-- TypeClipboardAppx/Package.appxmanifest | 2 +- TypeClipboardAppx/TypeClipboardAppx.wapproj | 3 +- 11 files changed, 95 insertions(+), 15 deletions(-) diff --git a/TypeClipboard/App.config b/TypeClipboard/App.config index d51dc91..bb5e701 100644 --- a/TypeClipboard/App.config +++ b/TypeClipboard/App.config @@ -13,6 +13,9 @@ False + + False + diff --git a/TypeClipboard/Form1.Designer.cs b/TypeClipboard/Form1.Designer.cs index aaad192..c5d8e0c 100644 --- a/TypeClipboard/Form1.Designer.cs +++ b/TypeClipboard/Form1.Designer.cs @@ -28,12 +28,15 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.chkHotkey = new System.Windows.Forms.CheckBox(); this.button2 = new System.Windows.Forms.Button(); this.textBox2 = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); + this.chkEnter = new System.Windows.Forms.CheckBox(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.SuspendLayout(); // // textBox1 @@ -58,11 +61,12 @@ // chkHotkey // this.chkHotkey.AutoSize = true; - this.chkHotkey.Location = new System.Drawing.Point(213, 40); + this.chkHotkey.Location = new System.Drawing.Point(172, 42); this.chkHotkey.Name = "chkHotkey"; - this.chkHotkey.Size = new System.Drawing.Size(109, 17); + this.chkHotkey.Size = new System.Drawing.Size(73, 17); this.chkHotkey.TabIndex = 2; - this.chkHotkey.Text = "Enable F8 hotkey"; + this.chkHotkey.Text = "F8 hotkey"; + this.toolTip1.SetToolTip(this.chkHotkey, "Enables the F8 hotkey"); this.chkHotkey.UseVisualStyleBackColor = true; this.chkHotkey.CheckedChanged += new System.EventHandler(this.chkHotkey_CheckedChanged); // @@ -91,14 +95,33 @@ this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(154, 22); this.button3.TabIndex = 6; - this.button3.Text = "Copy clipboard to macro"; + this.button3.Text = "Copy clipboard to buffer"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // + // chkEnter + // + this.chkEnter.AutoSize = true; + this.chkEnter.Location = new System.Drawing.Point(244, 42); + this.chkEnter.Name = "chkEnter"; + this.chkEnter.Size = new System.Drawing.Size(78, 17); + this.chkEnter.TabIndex = 7; + this.chkEnter.Text = "Type Enter"; + this.toolTip1.SetToolTip(this.chkEnter, "If set, Type will type newline (\\n) as Enter, which is useful for large blobs of " + + "text.\r\n\r\nIf unset, Type will stop before the first newline, which is useful for " + + "passwords."); + this.chkEnter.UseVisualStyleBackColor = true; + this.chkEnter.CheckedChanged += new System.EventHandler(this.chkEnter_CheckedChanged); + // + // toolTip1 + // + this.toolTip1.ShowAlways = true; + // // Form1 // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(334, 99); + this.Controls.Add(this.chkEnter); this.Controls.Add(this.button3); this.Controls.Add(this.textBox2); this.Controls.Add(this.button2); @@ -129,6 +152,8 @@ private System.Windows.Forms.Button button2; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button button3; + private System.Windows.Forms.CheckBox chkEnter; + private System.Windows.Forms.ToolTip toolTip1; } } diff --git a/TypeClipboard/Form1.cs b/TypeClipboard/Form1.cs index 7867b99..8828c42 100644 --- a/TypeClipboard/Form1.cs +++ b/TypeClipboard/Form1.cs @@ -90,11 +90,14 @@ namespace TypeClipboard private void Form1_Load(object sender, EventArgs e) { _listener = new LowLevelKeyboardListener(); - // Changing the Checked property also hooks the listener + // Changing the chkHotkey.Checked property also hooks the listener chkHotkey.Checked = Properties.Settings.Default.enableHotkey; - + _tc = new Typer(); + // Changing the chkEnter.Checked property also changes _tc.TypeEnter property + chkEnter.Checked = Properties.Settings.Default.enableEnter; + ClipboardNotification.ClipboardUpdate += delegate (object cb_sender, EventArgs cb_e) { UpdateTextbox(); }; @@ -132,5 +135,12 @@ namespace TypeClipboard String clipboard = Clipboard.GetText(TextDataFormat.UnicodeText); textBox2.Text = clipboard; } + + private void chkEnter_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.enableEnter = chkEnter.Checked; + _tc.TypeEnter = chkEnter.Checked; + Properties.Settings.Default.Save(); + } } } diff --git a/TypeClipboard/Form1.resx b/TypeClipboard/Form1.resx index 1af7de1..69363bf 100644 --- a/TypeClipboard/Form1.resx +++ b/TypeClipboard/Form1.resx @@ -117,4 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 17, 17 + + + 17, 17 + \ No newline at end of file diff --git a/TypeClipboard/Properties/AssemblyInfo.cs b/TypeClipboard/Properties/AssemblyInfo.cs index 9aade3b..071ed29 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, 2021")] +[assembly: AssemblyCopyright("Copyright © Jed Laundry, 2022")] [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.8.0")] -[assembly: AssemblyFileVersion("1.3.8.0")] +[assembly: AssemblyVersion("1.4.0.0")] +[assembly: AssemblyFileVersion("1.4.0.0")] diff --git a/TypeClipboard/Properties/Settings.Designer.cs b/TypeClipboard/Properties/Settings.Designer.cs index c891a62..b0cb55d 100644 --- a/TypeClipboard/Properties/Settings.Designer.cs +++ b/TypeClipboard/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace TypeClipboard.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -34,5 +34,17 @@ namespace TypeClipboard.Properties { this["enableHotkey"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool enableEnter { + get { + return ((bool)(this["enableEnter"])); + } + set { + this["enableEnter"] = value; + } + } } } diff --git a/TypeClipboard/Properties/Settings.settings b/TypeClipboard/Properties/Settings.settings index cf7ba8c..d0c1464 100644 --- a/TypeClipboard/Properties/Settings.settings +++ b/TypeClipboard/Properties/Settings.settings @@ -5,5 +5,8 @@ False + + False + \ No newline at end of file diff --git a/TypeClipboard/TypeClipboard.csproj b/TypeClipboard/TypeClipboard.csproj index a4e3021..08f6935 100644 --- a/TypeClipboard/TypeClipboard.csproj +++ b/TypeClipboard/TypeClipboard.csproj @@ -25,7 +25,7 @@ false true 0 - 1.1.0.%2a + 1.4.0.%2a false true diff --git a/TypeClipboard/Typer.cs b/TypeClipboard/Typer.cs index c77ec0e..4b2b85e 100644 --- a/TypeClipboard/Typer.cs +++ b/TypeClipboard/Typer.cs @@ -12,6 +12,9 @@ namespace TypeClipboard { private const int INTERKEY_DELAY = 20; + private bool _typeEnter = false; + public bool TypeEnter { get => _typeEnter; set => _typeEnter = value; } + public void Type(String str, int delay = 2000) { Thread.Sleep(delay); @@ -22,9 +25,23 @@ namespace TypeClipboard switch (c) { case '\n': - return; + if (_typeEnter) + { + SendKeys.Send("{ENTER}"); + break; + } else + { + return; + } case '\r': - return; + if (_typeEnter) + { + break; + } + else + { + return; + } case '{': SendKeys.Send("{{}"); break; diff --git a/TypeClipboardAppx/Package.appxmanifest b/TypeClipboardAppx/Package.appxmanifest index 8b3cc3f..32758bf 100644 --- a/TypeClipboardAppx/Package.appxmanifest +++ b/TypeClipboardAppx/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="1.4.0.0" /> TypeClipboard diff --git a/TypeClipboardAppx/TypeClipboardAppx.wapproj b/TypeClipboardAppx/TypeClipboardAppx.wapproj index 7081107..37b36b7 100644 --- a/TypeClipboardAppx/TypeClipboardAppx.wapproj +++ b/TypeClipboardAppx/TypeClipboardAppx.wapproj @@ -63,7 +63,8 @@ neutral C:\temp 0 - DFF25B896771BFB75D948AD107C34534A21A08B1 + 0AF17626AE23A8AA61789F56A539111877550E76 + TypeClipboardAppx_TemporaryKey.pfx Always