Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; 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スクリプト用のエディタに失敗しました"
- }
Add Comment
Please, Sign In to add comment