-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.au3
40 lines (33 loc) · 1.37 KB
/
config.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Func toBoolean($var)
If IsBool($var) then
return $var
elseif IsNumber($var) then
return $var = 0 ? False : True
elseif IsString($var) then
local $str = StringLower($var)
if $str = "true" or $str = "1" or $str = "+" or $str = "y" or $str = "yes" then
return True
elseif $str = "false" or $str = "0" or $str = "-" or $str = "n" or $str = "no" then
return False
endif
else
MsgBox(16, @ScriptName, "toBoolean conversion error" & @CRLF _
& "Could not convert input to boolean." & @CRLF _
& "Value (as String):" & @CRLF _
& String($var) _
)
endif
endfunc
; this is executed before single-instance check, idc
Global Const $CFG_NAME = "wc3-code-paste-config.ini"
If FileExists($CFG_NAME) = 0 then
IniWrite($CFG_NAME, "general", "SendKeyDelay", "50")
IniWrite($CFG_NAME, "general", "SendKeyDownDelay", "100")
IniWrite($CFG_NAME, "sound", "enabled", "true")
IniWrite($CFG_NAME, "warcraft", "chat_length_limit", "127")
Endif
Global Const $CFG_SEND_KEY_DELAY = Number(IniRead($CFG_NAME, "general", "SendKeyDelay", 50))
Global Const $CFG_SEND_KEY_DOWN_DELAY = Number(IniRead($CFG_NAME, "general", "SendKeyDownDelay", 100))
Global Const $CFG_ENABLE_SOUND = toBoolean(IniRead($CFG_NAME, "sound", "enabled", True))
; inclusive 127 UTF-8 characters. Tested on v1.32.10
Global Const $WC3_CHAT_LENGTH_LIMIT = Number(IniRead($CFG_NAME, "warcraft", "chat_length_limit", 127))