2022/05/02

220502 無変換キー2回押しで半角英数

Macの日本語キーボードの場合、誤ってIMEオンのまま入力しても英数キーを2回押しで半角英数に変換してIMEオフになる。
Windowsだと入力中にCtrl+Tで半角英数に変換できるが、改めてするIMEをオフにする必要があるので、Macと同じ感覚で無変換キーを2回押すことで半角英数変換とIMEオフできるようにした。

IMEの設定でスクリプトを書き直す必要があると思われるので、自分の設定は下記の通り。

Windows 10でIMEはGoogle日本語入力を使用。
タスクバーのIMEのアイコン上で右クリックし「プロパティ」を選択。
「一般」タブの「キー設定」にある「キー設定の選択」の「編集」クリック。
入力キーでソートし、「Muhenkan」の「入力文字なし」は「IMEを無効化」、それ以外は「半角英数に変換」を選択。
同様に「Henkan」は「変換中」のみ「次候補を選択」、それ以外は「IMEを有効化」を選択して、「OK」を押す。
プロパティも「OK」を押して、メモ帳か適当なソフトでIME切り替えを確認。

以下のスクリプトをAutoHotkeyに追加する。


~sc07B up::
If (A_PriorHotKey == A_ThisHotKey && A_TimeSincePriorHotkey < 500) ; 0.5秒以内に無変換キー(sc07B)を2回押し
{
    Send, +{Space} ; 無変換キーで1回変換しているため、Shift+Spaceで一つ前の候補に戻す
    Sleep, 50
    Gosub, imeoff
}
Return

; IME有効化(ここではimeonはなくても動く)
imeon:
{
    Sleep, 100
    Gosub, IMEGetstate
    If (vimestate = 1)
    {
    }
    else
    {
    Send, {vkf3}
    }
    return
}

; IME無効化
imeoff:
{
    Sleep, 100
    Gosub, IMEGetstate
    If (vimestate = 0)
    {
    }
    else
    {
    Send, {vkf3}
    }
    return
}

; IMEの状態を取得
IMEGetstate:
{
    DetectHiddenWindows, ON
    WinGet, vcurrentwindow, ID, A
    vgetdefault := DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint", vcurrentwindow)
    vimestate := DllCall("user32.dll\SendMessageA", "UInt", vgetdefault, "UInt", 0x0283, "Int", 0x0005, "Int", 0)
    DetectHiddenWindows, Off
    return
}

; IME制御の参考ページ
; https://qiita.com/neokix/items/83ac2ac8e1dd405528b0
; https://morakana.hatenadiary.org/entry/20080213/1202876561
x

2022/04/02

220402 AutoHotkeyでPath Finderライクなファイル名変更

Windowsのエクスプローラーでファイル名を変更している途中で勝手に選択されてしまう問題が解決できないので、AutoHotkeyで別ウィンドウでファイル名を変更できるようにした。

こちらのサイトを参考にした。
how to get selected file in explorer


;#########スクリプトはここから#########
#IfWinActive ahk_class CabinetWClass


+F2::Send, {F2} ; Original rename by Shift+F2

F2::
{
ClipSaved := ClipboardAll
Clipboard =
Send, ^c
ClipWait
FilePath = %Clipboard%
FileGetAttrib, FileOrDir, %FilePath%
SplitPath, FilePath, Filename, FileDir
InputBox, NewFilename, F2 rename, Enter new file name., , , 130, , , , , %Filename%
If ErrorLevel = 0
{
If (FileOrDir = "D" or FileOrDir = "AD") ; Directory is selected
{
NewPath = %FileDir%\%NewFilename%
FileMoveDir, %FilePath%, %NewPath%
}
Else ; File is selected
{
NewPath = %FileDir%\%NewFilename%
FileMove, %FilePath%, %NewPath%
}
                Clipboard := ClipSaved
         ClipSaved =
}
Return
}

#IfWinActive
; #########ここまで#########

エクスプローラーでファイルを1つ選択してF2を押すと下記のウィンドウが表示され、ファイル名を編集してEnterで変更される(ややタイムラグあり)。
Shift+F2で通常のファイル名変更になる。


ahk_class CabinetWClassでエクスプローラーを指定しているので、デスクトップのファイルを変更する時は適応されない。

*4/4追記
ファイル名変更でコピーしてキャンセルするとクリップボードも消えてしまうので修正した。

2022/03/03

220303 AutoHotkeyで改行を削除してペースト

 タイトルの通りですが、コピーした文字列に含まれる改行やタブを半角スペースにして、2個以上のスペースを1個にまとめてペーストするスクリプトを書きました。

良く論文で行をまたぐ単語をハイフンで切ったりしますが、「ハイフン改行」も削除します(ハイフンありが正しい場合は注意)。

普通にコピーしておき、Ctrl+Shift+Vで改行なしでペーストできます。


^+v::

{

Mytext = %clipboard%

Mytext := RegExReplace(Mytext, "\r", " ")

Mytext := RegExReplace(Mytext, "\n", " ")

Mytext := RegExReplace(Mytext, "\t", " ")

Mytext := RegExReplace(Mytext, "\s{2,}", " ")

Mytext := RegExReplace(Mytext, "-\s")

clipboard = %Mytext%

Send, ^{v}

Return

}


2022/02/27

220227 AutoHotkeyで画面を暗くする

 夜に暗い部屋でPC作業する時に、PangoBrightというソフトでマルチディスプレイの明るさをまとめて調整していたが、AutoHotkeyでも同様のことができた。


参考: 3 ways to dim the screen

https://www.autohotkey.com/boards/viewtopic.php?t=39580


3番目のスクリプトを参考にしたが、最初にマルチモニタ全体のサイズを出しておき、GUIで黒い半透明のレイヤーを表示させる。

Win+Alt+8、9で黒いレイヤーの透明度をDimに代入し実行、Win+Alt+0でもとに戻す。



#!0::GUI, Destroy


#!9::

{

Dim := 127 ; 0 (Bright) ~ 255 (Black)

Gosub, DimScreen

Return

}


#!8::

{

Dim := 191 ; 0 (Bright) ~ 255 (Black)

Gosub, DimScreen

Return

}


DimScreen:

{

WinGet, hWnd, ID, A

global MonitorLeft, MonitorRight, MonitorTop, MonitorBottom

global PrevMonitorLeft := 0, PrevMonitorRight := 0, PrevMonitorTop  := 1,  PrevMonitorBottom := 1

SysGet, MonitorCount, MonitorCount

Loop, %MonitorCount%

{

SysGet, Monitor, Monitor, %A_Index%

MonitorLeft := min(MonitorLeft, PrevMonitorLeft)

MonitorRight := max(MonitorRight, PrevMonitorRight)

MonitorTop := min(MonitorTop, PrevMonitorTop)

MonitorBottom := max(MonitorBottom, PrevMonitorBottom)

PrevMonitorLeft := MonitorLeft

PrevMonitorRight := MonitorRight

PrevMonitorTop := MonitorTop

PrevMonitorBottom := MonitorBottom

}

Gui, Color, 000000

Gui, -Caption +AlwaysOnTop +E0x20 +HwndhGui +ToolWindow

Gui, Show, % Format("x{} y{} w{} h{}", MonitorLeft, MonitorTop, MonitorRight - MonitorLeft, MonitorBottom - MonitorTop), dimmer

WinSet, Transparent, % Dim, % "ahk_id " hGui

WinActivate, % "ahk_id " hWnd

Return

}


2021/07/12

210712 AutoHotkeyでスナップ機能

Windowsのデフォルトのスナップ機能(Win+矢印)が使いにくいので、Autohotkey使ってコマンドでできるようにした。

; ChangeKeyでCapslockをF24に置き換え
; F24 + i for special character insertion
F24 & i::
WinGet, vcurrentwindow, ID, A
vimestate := DllCall("user32.dll\SendMessageA""UInt"DllCall("imm32.dll\ImmGetDefaultIMEWnd""Uint", vcurrentwindow), "UInt"0x0283"Int"0x0005"Int"0)
If (vimestate=0) {
    } Else {
    Send, {vkf3}
    } ; cf. https://qiita.com/neokix/items/83ac2ac8e1dd405528b0
InputBox, charstr, Autohotkey insertion, Enter key strings or "h" for help, , 240130
If ErrorLevel = 0
    If charstr = l ; 左
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , 00A_ScreenWidth / 2A_ScreenHeight
        }
    If charstr = r ; 右
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , A_ScreenWidth / 20A_ScreenWidth / 2A_ScreenHeight
        }
    If charstr = lu ; 左上
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , 00A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = ul ; 左上
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , 00A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = ll ; 左下
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , 0A_ScreenHeight / 2A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = ru ; 右上
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , A_ScreenWidth / 20A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = ur ; 右上
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , A_ScreenWidth / 20A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = rl ; 右下
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , A_ScreenWidth / 2A_ScreenHeight / 2A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = lr ; 右下
        {
        WinGetTitle, Title, A
        WinGetPos, x, y, w, h, %Title%
        WinMove, %Title%, , A_ScreenWidth / 2A_ScreenHeight / 2A_ScreenWidth / 2A_ScreenHeight / 2
        }
    If charstr = h ; ヘルプ
        MsgBox, Autohotkey insertion help ("h")`n`n"l"`tMove window to the left of minotor`n"r"`tMove window to the right of minotor`n"lu"/"ul"`tMove window to the left upper of minotor`n"ll"`tMove window to the left lower of minotor`n"ru"/"ur"`tMove window to the right upper of minotor`n"rl"/"lr"`tMove window to the right lower of minotor`n`n
Return

2021/02/27

210227.Disable Thunderbird shortcut keys

メーラはMozilla Thunderbirdを昔から使っているが、バージョンが更新されるたびにアドオンが使えなくなることが多く、要らないショートカットキーを無効化できなくなってしまったので、AutoHotkeyで対応した。

主にTwitterやRSS readerでJ/Kキーで次/前の記事に移動するのになれてしまい、ThunderbirdでJを入力するとジャンクメールとして認識してしまうので、J/Kキーあたりで使わないショートカットキーを無効化する。

ただThuderbirdがアクティブな時にJ/Kキーを無効化すると、メール本文入力時も使えなくなってしまうので、本体のみ指定する(Window SpyのWindow Titleを確認)。

#IfWinActive, .* - Mozilla Thunderbird
{
c::Return
k::Return
+k::Return
j::Return
+j::Return
w::Return
}
#IfWinActive

追記:本体で検索する場合や、オプションやアカウント設定でも上記のキーが使えなくなってしまうので、メモ帳や適当なアプリで打ってコピペする必要がある。

2020/09/19

200919 AutoHotkeyの自分用まとめ

Windows 10で使用しているAutoHotkeyの機能が大体決まってきたのでバックアップ。

おもにCapsLockの機能をChangeKeyというソフトでF24キーに変更し、修飾キーとして他のキーとのコンビネーションキーに使用している。

右手がキーボードとマウスを行き来するのを減らすため、マウス操作時にキーボード右側にあるDelete、Backspace、Enter、方向キーを左手のみで入力できるようにしてあり、CapsLockとマウス右クリック、中央クリックでもEnterとDeleteを入力できるようにしている。

また、使用しているトラックボールにティルトホイールが付いてないため、Shiftキー+ホイールで横スクロールに対応させている。

CapsLock+iを入力すると入力ボックスが表示され、"e"を入力するとテキストエディタMeryでスクリプトを編集でき(Autohotkey用の構文ファイルを.ahkに登録するとハイライトできる)、保存してCapsLock+i後に"r"を入力するとスクリプトファイルが再読み込みされる。"h"を入力するとヘルプが表示される。

定型文や特殊文字を登録しておき、固有の文字列で呼び出せる(主にメール署名と論文執筆に使うギリシャ文字や記号などを登録している)。また、アクティブなウィンドウを中央に移動したり、大きさを変えたり、現在の位置とサイズを保存して復元することも出来る。

マルチディスプレイを繋いでいるUSB type Cケーブルの接触が不安定で、サブディスプレイのウィンドウがメインディスプレイに集まってしまうため、あらかじめアクティブなウィンドウの位置とサイズを"rm"でコピーし、スクリプト編集で"wr"の下に入力しておき、"wr"で元に戻せる。

必要な機能のみコピペで追加編集するか、不要な機能を削除かコメントアウト(文頭に;を追加)で利用できるが、#IfWinExistや#IfWinActiveやIfWinNotActiveといったアプリケーションの指定に注意する。

以下がスクリプト:


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.

; #Warn  ; Enable warnings to assist with detecting common errors.

SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; Version 1.1.30.00


; 追加設定

; 参照: http://did2.blog64.fc2.com/blog-entry-368.html

#InstallKeybdHook ; キー入力の記録、すり抜け防止

#UseHook ; ホットキーラベルの不具合防止


; アプリケーションの指定変更

SetTitleMatchMode, RegEx ; アプリケーションのタイトルを正規表現で指定

StringCaseSense, On ; 大文字小文字を区別


; 横スクロール用にホットキー繰り返し警告を緩和

#HotkeyInterval 100 ; デフォルトは2000

#MaxHotkeysPerInterval 5000 ; デフォルトは70


; 管理者権限でChangeKeyを起動し、CapsLockキーをF24キー(0x0076)に変更する

; 元々のCapsLockキーを使いたい場合はWin+CapsLockで切り替え

#F24::

If GetKeyState("CapsLock", "T") = 1 {

SetCapsLockState, Off

}

Else If GetKeyState("CapsLock", "T") = 0 {

SetCapsLockState, On

}

Return


; Alt+Escでアクティブなウィンドウを最小化

IfWinNotActive ahk_class Windows.UI.Core.CoreWindow

#Esc::WinMinimize A

IfWinNotActive


; Win+Alt+↑, ↓で音量調節

#!up::Send {Volume_Up 1}

#!down::Send {Volume_Down 1}


; 右Shiftキーをマウス左クリックとして使う

RShift::LButton


; 右Ctrlキーをマウス右クリック(コンテキストメニュー)として使う

RCtrl::AppsKey


; F1キーをEscキーに変更(ヘルプ起動を抑制)

; Win+F1で元々のF1キー

F1::Esc

#F1::Send {F1}


; CapsLock (→F24)キーでカーソル移動

F24 & h::Left

F24 & j::Down

F24 & k::Up

F24 & l::Right

F24 & w::Up

F24 & a::Left

F24 & s::Down

F24 & d::Right

F24 & ,::Home

F24 & .::End

F24 & [::PgUp

F24 & ]::PgDn

F24 & b::Backspace

F24 & e::Del

F24 & r::Enter


; CapsLock (→F24)キーと方向キーでマウスポインター移動

; Shift, Ctrl同時押しで減速

; 参考: https://gist.github.com/toriwasa/64fc9e1a8cce620b8ff92f0ae38075f7

F24 & Up::

F24 & Down::

F24 & Left::

F24 & Right::

While (GetKeyState("F24", "P")) {

MoveX := 0, MoveY := 0

MoveY += GetKeyState("Up", "P") ? -25 : 0

MoveY += GetKeyState("Down", "P") ? 25 : 0

MoveX += GetKeyState("Left", "P") ? -25 : 0

MoveX += GetKeyState("Right", "P") ? 25 : 0

MoveY *= GetKeyState("Shift", "P") ? 0.2 : 1

MoveX *= GetKeyState("Shift", "P") ? 0.2 : 1

MoveY *= GetKeyState("LCtrl", "P") ? 0.04 : 1

MoveX *= GetKeyState("LCtrl", "P") ? 0.04 : 1

MouseMove, %MoveX%, %MoveY%, 0, R

Sleep, 1

}

Send, {LButton Up}

Return


; CapsLock (→F24)キー+mでポインターをウィンドウ右端へ移動

F24 & m::

WinGetActiveStats, Title, Width, Height, X, Y

MouseMove, Width * 0.99, Height / 2, 0

Return


; CapsLock (→F24)キー+tでポインターをウィンドウタイトルバーへ移動

F24 & t::

WinGetActiveStats, Title, Width, Height, X, Y

MouseMove, Width / 2, Height * 0.01, 0

Return


; CapsLock (→F24)キーと中央クリックでdelete

F24 & MButton::Send {Del}


; CapsLock (→F24)キーと右クリックでEnter

F24 & RButton::Send {Enter}


; Shift+ホイールで横スクロール

; Excel用

#IfWinActive ahk_class XLMAIN

+WheelUp::

SetScrollLockState, On

SendInput {Left}

SetScrollLockState, Off

Return

+WheelDown::

SetScrollLockState, On

SendInput {Right}

SetScrollLockState, Off

Return

#IfWinActive

; Excel以外用

IfWinNotActive ahk_class XLMAIN

+WheelUp::Send {WheelLeft}

+WheelDown::Send {WheelRight}

IfWinNotActive


; Win+Alt+1でウィンドウ透明度を元に戻す

#!1::

WinSet, Transparent, Off, A

WinSet, TransColor, Off, A

Return


; Win+Alt+2~4でウィンドウを半透明化

#!2::WinSet, Transparent, 193, A

#!3::WinSet, Transparent, 129, A

#!4::WinSet, Transparent, 65, A


/*

5. Application-specific control

*/


; Win+zでGoogle Chromeを起動または最前面化

#z::

IfWinExist .* - Google Chrome

WinActivate

Else

Run C:\Users\<ユーザ名>\AppData\Local\Google\Chrome\Application\chrome.exe

WinWait, .* - Google Chrome

WinActivate

Return


; ChromeでCtrl+ホイールの拡大縮小を抑制(Ctrlと+,−,0の拡大縮小は使える)

#IfWinActive ahk_class Chrome_WidgetWin_1

{

^WheelDown::Return

^WheelUp::Return

}

Return

#IfWinActive


; QTTabBarのショートカットキー変更

#IfWinExist ahk_class CabinetWClass

; エクスプローラー起動済みならWin+Eで最前面化

#e::WinActivate


#IfWinActive ahk_class CabinetWClass

; Escキーでフォルダービューにフォーカスを戻す(Alt+qの代わり).

~Esc::!q


; Ctrl+tで指定したフォルダを開く

^t::Run, "C:\shortcut"


; Ctrl+Shift+tで閉じたタブを復元(Ctrl+shift+zの代わり)

^+t::^+z


; 詳細表示の列の幅の自動調節

!v::

{

Send, {LAlt}

Sleep, 50

Send, v

Sleep, 50

Send, sf

Return

}

Return

#IfWinActive


; Meryを起動または最前面化

#n::

IfWinExist ahk_class TChildForm

WinActivate, ahk_class TChildForm

Else

Run C:\Users\<ユーザ名>\AppData\Roaming\Mery\Mery.exe

return


; Ctrl+backspaceで単語ごと削除

#IfWinActive ahk_class TChildForm

^Backspace::

Send, ^+{Left}

Send, {Del}

Return


; Ctrl+Shift+sで別名保存

; Excel用

#IfWinActive ahk_class XLMAIN

^+s::Send {F12}


; Word用

#IfWinActive ahk_class OpusApp

^+s::Send {F12}


; RStudio用

#IfWinActive ahk_class Qt5QWindowIcon

^+s::

Send, !f

Sleep, 50

Send, a

Return

#IfWinActive


; CapsLock (→F24)キー+iで文字列挿入、スクリプト編集更新、ウィンドウ位置の記録復元

F24 & i::

WinGet, vcurrentwindow, ID, A

vimestate := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint", vcurrentwindow), "UInt", 0x0283, "Int", 0x0005, "Int", 0)

If (vimestate=0) {

} Else {

Send, {vkf3}

} ; IMEを英数へ変換(参考: https://qiita.com/neokix/items/83ac2ac8e1dd405528b0)

InputBox, charstr, Autohotkey insertion, Enter key strings or "h" for help, , 240, 130

If ErrorLevel = 0

If charstr = e ; "e"入力でスクリプト編集(ドキュメントのAutoHotkey.ahkをMeryで編集)

Run, "C:\Users\<ユーザ名>\AppData\Roaming\Mery\Mery.exe" "C:\Users\<ユーザ名>\Documents\AutoHotkey.ahk"

If charstr = r ; "r"入力でスクリプト更新

Reload

If charstr = - ; ハイフンをマイナスへ変換

Send {U+2212} ; − minus

If charstr = dash

Send {U+2014} ; — Em dash

If charstr = d

Send {U+00B0} ; ° degree

If charstr = u

Send {U+00B5} ; µ micro

If charstr = micro

Send {U+00B5} ; µ micro

If charstr = ^2

Send {U+00B2} ; ² superscript two

If charstr = ^3

Send {U+00B3} ; ³ superscript three

If charstr = +-

Send {U+00B1} ; ± plus-minus

If charstr = x

Send {U+00D7} ; × Multiplication sign

If charstr = `<

Send {U+2266} ; ≦ Less-than over equal to

If charstr = `>

Send {U+2267} ; ≧ greater-than over equal to

If charstr = `=

Send {U+2252} ; ≒ Approximately equal

If charstr = root

Send {U+221A} ; √ Root

If charstr = alpha ; アルファベットをギリシャ文字に変換

Send {U+03B1} ; α alpha

If charstr = Alpha

Send {U+0391} ; Α Alpha

If charstr = beta

Send {U+03B2} ; β beta

If charstr = Bata

Send {U+0392} ; Β Beta

If charstr = gamma

Send {U+03B3} ; γ gamma

If charstr = Gamma

Send {U+0393} ; Γ Gamma

If charstr = delta

Send {U+03B4} ; δ delta

If charstr = Delta

Send {U+0394} ; Δ Delta

If charstr = epsilon

Send {U+03B5} ; ε epsilon

If charstr = Epsilon

Send {U+0395} ; Ε Epsilon

If charstr = zeta

Send {U+03B6} ; ζ zeta

If charstr = Zeta

Send {U+0396} ; Ζ Zeta

If charstr = eta

Send {U+03B7} ; η eta

If charstr = Eta

Send {U+0397} ; Η Eta

If charstr = theta

Send {U+03B8} ; θ theta

If charstr = Theta

Send {U+0398} ; Θ Theta

If charstr = iota

Send {U+03B9} ; ι iota

If charstr = Iota

Send {U+0399} ; Ι Iota

If charstr = kappa

Send {U+03BA} ; κ kappa

If charstr = Kappa

Send {U+039A} ; Κ Kappa

If charstr = lambda

Send {U+03BB} ; λ lambda

If charstr = Lambda

Send {U+039B} ; Λ Lambda

If charstr = mu

Send {U+03BC} ; μ mu

If charstr = Mu

Send {U+039C} ; Μ Mu

If charstr = nu

Send {U+03BD} ; ν nu

If charstr = Nu

Send {U+039D} ; Ν Nu

If charstr = xi

Send {U+03BE} ; ξ xi

If charstr = Xi

Send {U+039E} ; Ξ Xi

If charstr = omicron

Send {U+03BF} ; ο omicron

If charstr = Omicron

Send {U+039F} ; Ο Omicron

If charstr = pi

Send {U+03C0} ; π pi

If charstr = Pi

Send {U+03A0} ; Π Pi

If charstr = rho

Send {U+03C1} ; ρ rho

If charstr = Rho

Send {U+03A1} ; Ρ Rho

If charstr = sigma

Send {U+03C3} ; σ sigma

If charstr = Sigma

Send {U+03A3} ; Σ Sigma

If charstr = tau

Send {U+03C4} ; τ tau

If charstr = Tau

Send {U+03A4} ; Τ Tau

If charstr = upsilon

Send {U+03C5} ; υ upsilon

If charstr = Upsilon

Send {U+03A5} ; Υ Upsilon

If charstr = phi

Send {U+03C6} ; φ phi

If charstr = Phi

Send {U+03A6} ; Φ Phi

If charstr = chi

Send {U+03C7} ; χ chi

If charstr = Chi

Send {U+03A7} ; Χ Chi

If charstr = psi

Send {U+03C8} ; ψ psi

If charstr = Psi

Send {U+03A8} ; Ψ Psi

If charstr = omega

Send {U+03C9} ; ω omega

If charstr = Omega

Send {U+03A9} ; Ω Omega

If charstr = h ; "h"入力でヘルプ表示(`nで改行、`tでタブ)

MsgBox, Autohotkey insertion help ("h")`n`nEdit or reload AHK file:`n"e"`tedit`n"r"`treload`n`nSpecial characters:`n"d"`t°`n"u"`tμ`n"-" `t− (Chage hyphen to minus)`n"dash"`t—`n"^2"`t²`n"^3"`t³`n"+-"`t±`n"x"`t×`n"<"`t≦`n"="`t≒`n`nGreek letters (Case-sensitive):`n"alpha"`tα`n"Delta"`tΔ`n`nEmail sign insetion:`n"sj"`tJapanese sign`n"se"`tEnglish sign`n`nWindow size/position control:`n"h-"`tShorten window height.`n"b-"`tShorten both height and width`n"wc"`tMove window to the center of monitor`n"wm"`tCopy window information in clipboard`n`tAdd the information in script`n"wr"`tRestore window size and position`n`n

If charstr = sj ; メール署名(日本語)

SendRaw, -- `n氏名`n所属`n部署`n〒郵便番号`n住所`nTel`nMail`n

If charstr = se ; メール署名(英語)

SendRaw, -- `nName`nAffiliation`nAddress`nTel`nMail`n

If charstr = h- ; "h-"入力でウィンドウの縦の長さを半分にする

{

WinGetTitle, Title, A

WinGetPos, X, Y, Width, Height, %Title%

MsgBox, 4, Resize window height, Window size is width %Width% and height %Height%.`nDo you shorten the height?

IfMsgBox Yes

WinMove, %Title%, , , , , Height / 2

}

If charstr = b- ; "b-"入力でウィンドウの縦横の長さを半分にする

{

WinGetTitle, Title, A

WinGetPos, X, Y, Width, Height, %Title%

MsgBox, 4, Resize window height, Window size is width %Width% and height %Height%.`nDo you shorten the window?

IfMsgBox Yes

WinMove, %Title%, , , , Width / 2, Height / 2

}

If charstr = wc ; "wc"入力でウィンドウをディスプレイ中央へ移動

{

WinGetTitle, Title, A

WinGetPos, X, Y, Width, Height, %Title%

MsgBox, 4, Move window center,Do you move active window to the center?

IfMsgBox Yes

WinMove, %Title%, , (A_ScreenWidth / 2) - (Width / 2), (A_ScreenHeight / 2) - (Height / 2), ,

}

If charstr = wm ; "wm"入力で現在アクティブなウィンドウのタイトルと位置、サイズをクリップボードへ格納する

{

WinGetTitle, Title, A

WinGetPos, X, Y, Width, Height, %Title%

clipboard = WinMove, %Title%, , %X%, %Y%, %Width%, %Height%

}

If charstr = wr ; "wr"入力で下記の登録情報に従ってウィンドウの位置とサイズを復元する

{

; "wm"実行後、下記にペーストし、タイトル部分を編集する

; サブディスプレイがメインディスプレイの左上の場合、位置はマイナス表記

; WinMove, Title, , X, Y, Width, Height

WinMove, .* - Google Chrome, , 377, 0, 1496, 1028

WinMove, .* - PDF-XChange Editor, , 1249, -1073, 1627, 998

WinMove, RStudio, , 1293, -1058, 1411, 1008

WinMove, .* - Excel, , 1248, -1055, 1619, 989

}

Return