2 Commits

Author SHA1 Message Date
Jed Laundry
264ba03421 Update 1.3.7.0
Add macro text box, allow minimizing
2021-08-14 12:44:11 +12:00
Jed Laundry
60e7804aba Create README.md 2020-09-16 16:50:57 +12:00
8 changed files with 94 additions and 50 deletions

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# TypeClipboard
For IT professionals everywhere who are sick of typing long complex passwords into remote consoles. Just copy the password into your clipboard, select the password box, and press F8 or click Type!
(Doesn't have to be a password either, also useful for URLs, Base64-encoded things, etc.)
Also, if you don't want to compile yourself, this is also available in the Windows Store:
https://www.microsoft.com/en-us/p/type-clipboard/9p5r4jk7r8h5
Tested with a wide variety of consoles, including vSphere, Horizon (HTML5), and Citrix. There is a known issue where VMWare Horizon's client seems to be using a very low-level keyboard driver, so it doesn't work with it. Sorry.

View File

@@ -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;
}
}

View File

@@ -121,5 +121,10 @@ namespace TypeClipboard
Properties.Settings.Default.Save();
}
private void button2_Click(object sender, EventArgs e)
{
_tc.Type(textBox2.Text);
}
}
}

View File

@@ -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")]

View File

@@ -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);
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -9,7 +9,7 @@
<Identity
Name="3373JedLaundry.TypeClipboard"
Publisher="CN=CE320BA0-58BC-4F47-AF5B-94DB661147CC"
Version="1.3.5.0" />
Version="1.3.7.0" />
<Properties>
<DisplayName>TypeClipboard</DisplayName>

View File

@@ -63,7 +63,7 @@
<AppxBundlePlatforms>neutral</AppxBundlePlatforms>
<AppInstallerUri>C:\temp</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<PackageCertificateThumbprint>F1AC865F3B57360B33C17D9B7ECE4A4BFD2EC9CC</PackageCertificateThumbprint>
<PackageCertificateThumbprint>DFF25B896771BFB75D948AD107C34534A21A08B1</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AppxBundle>Always</AppxBundle>
@@ -109,7 +109,6 @@
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
<None Include="Package.StoreAssociation.xml" />
<None Include="TypeClipboardAppx_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TypeClipboard\TypeClipboard.csproj" />