-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateInput.au3
91 lines (78 loc) · 2.75 KB
/
generateInput.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIMisc.au3>
#include <Misc.au3>
#include <debugBox.au3>
#include <const.au3>
_Singleton ('PlayTogetherAuto_generate_input', 0)
AutoItSetOption('GUIOnEventMode', 1)
local $X1 = 0
local $Y1 = 0
local $X2 = 0
local $Y2 = 0
local $labelUpdated = false
local $isdone = false
local $isexit = false
func genLabel()
return 'Current position:' & @CRLF & _
'X = ' & $X1 & @CRLF & _
'Y = ' & $Y1 & @CRLF & _
@CRLF & _
"Press F2 to capture current position:" & @CRLF & _
"X = " & $X2 & @CRLF & _
"Y = " & $Y2
endfunc
func Capture()
$X2 = $X1
$Y2 = $Y1
$labelUpdated = true
EndFunc
Func _Cancel()
_log('User canceled')
$isexit = true
EndFunc
Func _Generate()
_log('User pressed save')
IniWrite($inputPath, "Exclaimation Mark", "exclaimationX", $X2)
IniWrite($inputPath, "Exclaimation Mark", "exclaimationY", $Y2)
$rodPosition = IniRead($inputPath, "General", "RodPosition", 1)
$minimumIdleRod = IniRead($inputPath, "General", "MinimumIdleRod", 13)
$maximumTimeFishing = IniRead($inputPath, "General", "MaximumTimeFishing", 60)
IniWrite($inputPath, "General", "RodPosition", $rodPosition)
IniWrite($inputPath, "General", "MinimumIdleRod", $minimumIdleRod)
IniWrite($inputPath, "General", "MaximumTimeFishing", $maximumTimeFishing)
$isdone = true
EndFunc
func generateInput()
local const $Form1 = GUICreate("Capture ! position", 280, 208)
local const $Label1 = GUICtrlCreateLabel(genLabel(), 12, 12, 255, 150)
GUICtrlSetFont($Label1, 12)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Cancel", $Form1)
local const $ButtonGenerate = GUICtrlCreateButton("Save settings", 48, 168, 80, 25)
local const $ButtonCancel = GUICtrlCreateButton("Cancel", 144, 168, 75, 25)
GUICtrlSetOnEvent($ButtonGenerate, '_Generate')
GUICtrlSetOnEvent($ButtonCancel, '_Cancel')
HotKeySet("{F2}", "Capture")
GUISetState(@SW_SHOW)
While not $isdone and not $isexit
$mousepos = _WinAPI_GetMousePos()
$X1_new = DllStructGetData($mousepos, "X")
$Y1_new = DllStructGetData($mousepos, "Y")
if $X1_new <> $X1 or $Y1_new <> $Y1 then
$X1 = $X1_new
$Y1 = $Y1_new
$labelUpdated = true
endif
if $labelUpdated then
GUICtrlSetData($Label1, genLabel())
$labelUpdated = false
endif
WEnd
GUIDelete($Form1)
if $isexit then
_log('Exiting program')
exit
endif
EndFunc