スクリプトをバックグラウンドで実行し、CTRL + 1などのホットキーを押すと、変数の内容を現在アクティブなテキストフィールドに貼り付けます。私がこれまでに持っていたコード:powershellスクリプトの機能にホットキーを割り当てます。
function Send($key)
{
$wsh.SendKeys($key)
}
$wsh = New-Object -ComObject WScript.Shell
$c1 = "Text to be sent #1"
$c2 = "Text to be sent #2"
$c3 = "Text to be sent #3"
$c4 = "Text to be sent #4"
$c0 = "Text to be sent #5"
switch ($check)
{
1 {Send($c1)}
2 {Send($c2)}
3 {Send($c3)}
4 {Send($c4)}
0 {Send($c0)}
default {Sleep(1)}
}
私は検索してみると、解決策は見つかりませんでした。 私は現在similairの機能を持つAutoItスクリプトを使用していますが、私はこれを書いていませんが、残念なことに著者を知らないのです。
#include <Misc.au3>
Func _SendEx($ss, $warn = "")
Local $iT = TimerInit()
While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12")
If $warn <> "" And TimerDiff($iT) > 1000 Then
MsgBox(262144, "Avertissement", $warn)
EndIf
Sleep(50)
WEnd
Send($ss)
EndFunc;==>_SendEx
HotKeySet ("^1", "c1")
HotKeySet ("^2", "c2")
HotKeySet ("^3", "c3")
HotKeySet ("^4", "c4")
HotKeySet ("^0", "c0")
While True
Sleep (10000)
WEnd
Func c1()
_SendEx ("text 1")
EndFunc
Func c2()
_SendEx ("text 2")
EndFunc
Func c3()
_SendEx ("text 3")
EndFunc
Func c4()
_SendEx ("text 4")
EndFunc
Func c0()
_SendEx ("text 0")
EndFunc
私はその機能にホットキーを割り当てる方法をpowershellで再作成したいと思いますか?