1

This code from here: https://stackoverflow.com/questions/1687 ... autohotkey

My question is: Is it possible to divide the code into two files?

  • Part 1 into "*.ahk"
  • Part 2 into "*.ini"

If someone could show me how to do this, I would be very grateful!

; --------------------------------------------------------------part  1

#SingleInstance Force
Flag:=0
Return

^+!F7::
Flag:=0
TrayTip, AutoHotKey, Keyboard setting Default, 1
Return

^+!F4::
Flag:=1
TrayTip, AutoHotKey, Keyboard setting A, 1
Return

^+!F8::
Flag:=2
TrayTip, AutoHotKey, Keyboard setting B, 1
Return
; ----------------------------------------------------------part  2
#If (Flag=1)
x::SoundBeep, 500, 100
k::l
#If

#If (Flag=2)
x::SoundBeep, 2000, 100
l::Numpad5
#If
Community
  • 1
  • 1
asad41163
  • 49
  • 11

1 Answers1

0

Sure it is possible, but I don't really get the point of storing autohotkey code in a .ini file.
Use #Include.

part1.ahk

;--------------------------------------------------------------part 1
#SingleInstance Force
Flag:=0
Return

^+!F7::
Flag:=0
TrayTip, AutoHotKey, Keyboard setting Default, 1
Return

^+!F4::
Flag:=1
TrayTip, AutoHotKey, Keyboard setting A, 1
Return

^+!F8::
Flag:=2
TrayTip, AutoHotKey, Keyboard setting B, 1
Return

#Include part2.ini

part2.ini

; ----------------------------------------------------------part  2
#If (Flag=1)
x::SoundBeep, 500, 100
k::l
#If

#If (Flag=2)
x::SoundBeep, 2000, 100
l::Numpad5
#If
Forivin
  • 14,780
  • 27
  • 106
  • 199