/
Functions.au3
133 lines (101 loc) · 3.33 KB
/
Functions.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <Date.au3>
#include <MsgBoxConstants.au3>
Func _OpenTask($appTitle,$taskToOpen)
ControlSetText($appTitle, "", "[CLASS:Edit; INSTANCE:1]", $taskToOpen)
ControlFocus($appTitle,"","[CLASS:Edit; INSTANCE:1]")
Send("{ENTER}")
EndFunc
Func _SearchWithTitle($WndHandle,$searchText)
Local $id = "[CLASS:TEdit; INSTANCE:2]"
ControlSetText($WndHandle, "",$id, $searchText)
ControlFocus($WndHandle,"",$id)
Send("{ENTER}")
Sleep(1000)
EndFunc
Func _GetDateTime()
;~ Return (_NowDate() &" "& _NowTime())
Return (@MDAY & "-" & @MON& "-" &@YEAR& "--" &@HOUR& "-" &@MIN& "-" & @SEC)
EndFunc
Func _OpenFirstItem($WndHandle,$GridID)
Sleep(1000)
Local $iPos = ControlGetPos($WndHandle, "", $GridID)
ControlFocus($WndHandle,"",$GridID)
Sleep(100)
ControlClick($WndHandle,"",$GridID,"left",1, ($iPos[2] / 2),($iPos[3] / 2))
Sleep(100)
Send("{HOME}")
Sleep(100)
Send("{ALTDOWN}e{ALTUP}")
EndFunc
Func _RunReport($runWnd,$resGrid,$timerStart,$log1)
Local $lPos = ControlGetPos($runWnd,"",$resGrid)
WinActivate($runWnd,"")
MouseMove($lPos[2]/2,$lPos[3]/2)
$timerStart = TimerInit() ; Starts the Timer when Report is Run
Send("{ALTDOWN}r{ALTUP}")
Local $iCursor = MouseGetCursor()
Do
Sleep(500)
$iCursor = MouseGetCursor()
Until $iCursor = 2 Or $iCursor = 0 ;~~~~~~~~~~~~~~~~~ 2-ARROW, 15-BUSY
$timerDurationRun = TimerDiff($timerStart)
Local $roundedTime = Round($timerDurationRun/1000,1)
FileWrite($log1,(@CRLF & "Report Ran for "& $roundedTime & " Seconds"))
Sleep(500)
;~ Local $timesec=($timerDurationRun)/1000)
;~ MsgBox($MB_SYSTEMMODAL, '', "Done Loading after"&$timesec)
EndFunc
Func _SaveToFile($runWnd,$fileName)
Local $gPos = ControlGetPos($runWnd,"","[CLASS:TwoDBGrid; INSTANCE:1]")
MouseClick("right",$gPos[2]/2,$gPos[3]/2)
Send("{UP}")
Sleep(200)
Send("{UP}")
Sleep(200)
Send("{RIGHT}")
Sleep(200)
Send("{ENTER}")
Sleep(200)
Send($fileName)
Send("{ENTER}")
Local $WOMsg = WinWait("WideOrbit Message","",0)
Sleep(500)
;~ ControlClick($WOMsg,"","[CLASS:TButton; INSTANCE:2]","left",1) ;---- Unstable
Send("{ALTDOWN}n{ALTUP}")
EndFunc
Func _SaveToFile2($runWnd,$fileName)
Local $gPos = ControlGetPos($runWnd,"","[CLASS:TdxTreeList; INSTANCE:1]")
MouseClick("right",(($gPos[2]/2)+288), (($gPos[3]/2)+163)) ;~~~ 288,163 is Position Offset
Send("{UP}")
Sleep(200)
;~ Send("{UP}")
Sleep(200)
Send("{RIGHT}")
Sleep(200)
Send("{ENTER}")
Sleep(200)
Send($fileName)
Send("{ENTER}")
Local $WOMsg = WinWait("WideOrbit Message","",0)
Sleep(500)
;~ ControlClick($WOMsg,"","[CLASS:TButton; INSTANCE:2]","left",1) ;---- Unstable
Send("{ALTDOWN}n{ALTUP}")
EndFunc
Func _RunReport2($runWnd,$resGrid,$timerStart1,$log1)
Local $lPos = ControlGetPos($runWnd,"",$resGrid)
WinActivate($runWnd,"")
MouseMove($lPos[2]/2,$lPos[3]/2)
$timerStart1 = TimerInit() ; Starts the Timer when Report is Run
Send("{ALTDOWN}r{ALTUP}")
Local $iCursor1 = MouseGetCursor()
Do
Sleep(250)
$iCursor1 = MouseGetCursor()
;~ FileWrite($log,$iCursor1 )
Until $iCursor1 = 2 Or $iCursor1 = 0 ;~~~~~~~~~~~~~~~~~ 2-ARROW, 15-BUSY, 0- Resize (somewhere in grid)
$timerDurationRun = TimerDiff($timerStart1)
Local $roundedTime = Round($timerDurationRun/1000,1)
FileWrite($log1,(@CRLF & "Report Ran for "& $roundedTime & " Seconds"))
;~ MsgBox($MB_SYSTEMMODAL, '', "Done Loading")
;~ Sleep(15000)
EndFunc