Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [AutoHotkey.ahk]
  2. ; Includeするファイルリスト
  3. #Include %A_ScriptDir%
  4. includeFiles := "InputA,InputB"     ;この部分だけ書き換えたらInitもIncludeも自動的にされるようにしたい
  5.  
  6. ; 各ファイルのInitセクションへGoSub
  7. Loop, PARSE, includeFiles, `,
  8. {
  9.     If (isLabel("initLabel_" . A_LoopField))
  10.         GoSub, initLabel_%A_LoopField%
  11. }
  12.  
  13. ; Autoexecuteここまで
  14. Return
  15.  
  16. ; LoopでIncludeしたい(#Includeは変数で指定できない 困った)
  17. ;Loop, PARSE, includeFiles, `,
  18. ;   #Include %A_LoopField%.ahk
  19.  
  20. ; (これなら正常動作するけど、結局全部手打ちだから避けたい)
  21. #Include InputA.ahk
  22. #Include InputB.ahk
  23.  
  24. ;============================================================
  25. [InputA.ahk]
  26. initLabel_InputA:
  27.     textA := "A"
  28. Return
  29. a::MsgBox, % textA
  30. d::MsgBox, % (textA . "D")
  31.  
  32. ;============================================================
  33. [InputB.ahk]
  34. initLabel_InputB:
  35.     textB := "B"
  36. Return
  37.  
  38. b::MsgBox, % textB
  39. c::MsgBox, % (textB . "C")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement