Skip to content

Instantly share code, notes, and snippets.

@beckorz
Created April 23, 2014 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beckorz/11206586 to your computer and use it in GitHub Desktop.
Save beckorz/11206586 to your computer and use it in GitHub Desktop.
キー割り当て変更(バイト配列書き込み)
<job>
<script language="vbscript" src="..\..\_lib\util.vbs"/> <!-- utilityモジュール -->
<script language="javascript" src="..\..\_lib\util.js"/> <!-- utilityモジュール -->
<script language="vbscript">
' キー割り当ての変更スクリプト
hexText = ""
' ヘッダー(DWORD)
hexText = hexText & "00000000" ' (Null固定)
' ヘッダー(DWORD)
hexText = hexText & "00000000" ' (Null固定)
' 総データ数(DWORD)
hexText = hexText & "04000000" ' 総マッピング割り当て数(データ末尾のターミネート数含む)
' 1つめ(DWORD)
hexText = hexText & "1d003a00" ' CapsLock(0x3a) > 左Ctrl(0x1d)
' 2つめ(DWORD)
hexText = hexText & "79005ce0" ' 右Win(0xe05c) > 変換(0x79)
' 3つめ(DWORD)
hexText = hexText & "53e00e00" ' Backspace(0x0e) > delete(0xe053)
' 4つめ(DWORD)
hexText = hexText & "00000000" ' ターミネート(Null固定)
bytArr = HexTextToByteArray(hexText) ' 16進文字列からバイト配列に変換
' レジストリへ書き込み
root = HKLM
keyName = "SYSTEM\CurrentControlSet\Control\Keyboard Layout"
call regSetBinaryValue(root, keyName, "Scancode Map", bytArr)
' 16進文字列からバイト配列に変換
private function HexTextToByteArray(HexText)
With CreateObject("Microsoft.XMLDOM").createElement("tmp")
.DataType = "bin.hex"
.Text = HexText
HexTextToByteArray = .NodeTypedValue
End With
End Function
</script>
</job>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment