Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Global (system-wide) hotkey with Powershell

$
0
0
 

Hi, i have a winform which is minimized/or hidden and would like to make it appear with a global (system wide) hotkey. (see bogus "new-hotkey"-cmdlet below)

[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

$form1 = New-Object 'System.Windows.Forms.Form'
$form1.ClientSize = '300, 250'
$form1.windowstate = "minimized"

# -- bogus(!) code --
$hk = new-hotkey -scope Global -keys "Ctrl,Shift,Z" -action ({$form1.windowstate = "normal" })
# ----------------

$form1.ShowDialog() 
 

I searched the web intensively but only found C# solutions, which i could not translate into powershell (v3). I tried but it did not work: http://stackoverflow.com/questions/23855928/acessing-c-sharp-code-in-powershell
The trouble is: even if i manage to use some C# code in my script, because i do not understand C#, i can't debug it.

I tried a few third-party tools, like WASP, Pseventing, Autohotkey, but they all have disadvantages or did not work correctly, so using C# in Powershell is seemingly the way to go.
I'm sorry, cause i know its not appreciated, but i need a working solution, not just tips how the get started.

thanks a lot, Rob


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>