スクリプト
Set_Registry_Editor_AutoHotkeyScript.ahk
; Set text editor for editing AutoHotKey script.
ShowUsage(){
msgbox, [Usage]: %A_ScriptName% [FullPath of editor application]
}
ContainSpace(s)
{
StringGetPos, Pos, s, %A_Space% ,
return Pos >= 0
}
SurroundByDoubleQuoteIfNeed(s)
{
if(ContainSpace(s))
s = `"%s%`"
return s
}
SetRegistryForAutoHotKeyScriptEditor(EditorPath)
{
EditorPath := SurroundByDoubleQuoteIfNeed(EditorPath)
EditorPath = %EditorPath%%A_Space%`"`%1`"
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Edit\Command, , %EditorPath%
return ErrorLevel = 0
}
ArgCount=%0%
IfNotEqual ArgCount, 1
{
ShowUsage()
return
}
EditorPath=%1%
IfNotExist, %EditorPath%
{
MsgBox, ファイルが見つかりません: %EditorPath% .
return
}
; エディタの実行ファイルが ~.exe でなければエラー。
StringCaseSense, Off
StringGetPos, Pos, EditorPath, .exe , R
IfEqual, Pos, 0
{
msgbox, .exe ファイルではありません: %EditorPath%
return
}
if( SetRegistryForAutoHotKeyScriptEditor(EditorPath) )
{
MsgBox "AutoHotKeyスクリプト用のエディタを設定しました"
}
else
{
MsgBox "AutoHotKeyスクリプト用のエディタに失敗しました"
}
使い方
こんな感じで、エディタとして使いたい実行ファイるを本スクリプトファイルにドロップしてください。
あとは、.ahk ファイルを右クリックして [Edit Script]を選択すれば、上記手順で設定したテキストエディタで、.ahkファイルが開かれます!!