but it failed somehow by showing me 'Error: Break/Continue must be enclosed by a Loop.' Line # 157: Break
Hopefully someone can help me out. I'm new to C++. I used to work with VBA only so it's kind of a transfer error for me (quite similar but not really).
Code: Select all
; This script was created using Pulover's Macro Creator
; www.macrocreator.com
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
F3::
Macro1:
InputBox, ISSNo, Contract Renewal Automation System (v.0.1), Please Input the ISS No. you would like to initiate for Contract Renewal
WinActivate, ahk_exe chrome.exe
Sleep, 333
Loop
{
Send, {Control Down}
Send, {Tab}
Sleep, 150
Sleep, 150
Send, {Control Up}
WinGetTitle, TabName, ahk_exe chrome.exe
If TabName = NRC Information System - Google Chrome
{
Break
}
}
Sleep, 300
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, Search Record
Sleep, 300
Send, {Escape}
Sleep, 300
Send, {Enter}
Sleep, 500
Send, {Control Down}{a Down}
Sleep, 300
Send, {Control Up}{a Up}
Sleep, 300
Send, {Delete}
Sleep, 300
SendRaw, %ISSNo%
Sleep, 300
Send, {Enter}
Sleep, 1000
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, PRIMARY CLIENT
Sleep, 300
Send, {Escape}
Sleep, 300
Send, {Shift Down}{Tab}
Sleep, 300
Send, {Shift Up}
Sleep, 300
Send, {Enter}
Sleep, 500
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0x35B128, 0, Fast RGB
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
Return
Sleep, 300
Send, {Enter}
Sleep, 2000
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, Status Remarks
Sleep, 300
Send, {Escape}
Sleep, 300
Send, {Enter}{Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, Date:
Sleep, 300
Send, {Escape}
Sleep, 300
Send, {Tab 5}
Sleep, 300
Sleep, 300
Send, {Down}
Sleep, 2000
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, Notes Sponsor
Sleep, 300
Send, {Escape}
Sleep, 300
Send, {Enter}
Click, Rel 0, 250 Left, 1
Sleep, 10
SendRaw,
(LTrim
Update:
1) CR completed. Client seems fine and healthy
2) Client submitted all receipts and present food card according to CO`s instructions. Client was praised for the great cooperation
3) All personal particulars updated/remain the same
)
Sleep, 300
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, Case No.:
Sleep, 300
Send, {Escape}
Sleep, 300
Send, {Shift Down}
Send, {Tab 2}
Sleep, 150
Sleep, 300
Send, {Shift Up}
Sleep, 300
Send, {Enter}
Sleep, 3000
Loop
{
Send, {Control Down}
Send, {Tab}
Sleep, 150
Sleep, 150
Send, {Control Up}
WinGetTitle, TabName, ahk_exe chrome.exe
If TabName = Roster System - Google Chrome
{
Break
}
}
Sleep, 300
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
Sleep, 500
SendRaw, Roster
Sleep, 300
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0xFFFF00, 0, Fast RGB
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
Return
Sleep, 300
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0x00FFFF, 0, Fast RGB
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
Break
Sleep, 500
SendRaw, %ISSNo%
Sleep, 500
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
SendRaw, Start
Sleep, 300
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0xFF9632, 0, Fast RGB
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
Return
MsgBox, 262192, Paused, Please select Roster Time for the client. Click OK when ready.
Sleep, 300
Loop
{
Send, {Control Down}
Send, {Tab}
Sleep, 150
Sleep, 150
Send, {Control Up}
WinGetTitle, TabName, ahk_exe chrome.exe
If TabName = Food System - Google Chrome
{
Break
}
}
Sleep, 300
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
Sleep, 500
SendRaw, Add Food
Sleep, 300
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0xFF9632, 0, Fast RGB
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
Return
Sleep, 1000
SendRaw, %ISSNo%
Sleep, 300
Loop
{
Send, {Control Down}
Send, {Tab}
Sleep, 150
Sleep, 150
Send, {Control Up}
WinGetTitle, TabName, ahk_exe chrome.exe
If TabName = Travelling Allowance System - Google Chrome
{
Break
}
}
Sleep, 300
Send, {Control Down}{f Down}
Sleep, 300
Send, {Control Up}{f Up}
Sleep, 500
SendRaw, Add Record
Sleep, 300
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 0, 0, 1920, 1080, 0xFF9632, 0, Fast RGB
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
Return
Sleep, 1000
SendRaw, %ISSNo%
Sleep, 300
MsgBox, 262192, Paused,
(LTrim
Confirm with the client:
1) How many toiletries are needed to be issued
2) Confirm Regular Transportation Allowance (RTA) eligibility
3) Other issues
)
Return
F8::ExitApp
F12::Pause
/*
PMC File Version 5.0.5
---[Do not edit anything in this section]---
[PMC Code v5.0.5]|F3||1|Window,2,Fast,0,1,Input,-1,-1,1|1|Macro1
1|InputBox|ISSNo, Contract Renewal Automation System (v.0.1), Please Input the ISS No. you would like to initiate for Contract Renewal|1|0|InputBox|||||
2|WinActivate||1|333|WinActivate||ahk_exe chrome.exe|||
3|[LoopStart]|LoopStart|0|0|Loop|||||
4|Control|{Control Down}|1|0|Send|||||
5|Tab|{Tab}|1|150|Send|||||
6|[Pause]||1|150|Sleep|||||
7|Control|{Control Up}|1|0|Send|||||
8|WinGetTitle|TabName|1|0|WinGetTitle||ahk_exe chrome.exe|||
9|Compare Variables|TabName = NRC Information System - Google Chrome|1|0|If_Statement|||||
10|Break||1|0|Break|||||
11|[End If]|EndIf|1|0|If_Statement|||||
12|[LoopEnd]|LoopEnd|1|0|Loop|||||
13|[Pause]||1|300|Sleep|||||
14|Control|{Control Down}|1|0|Send|||||
15|f|{f Down}|1|0|Send|||||
16|[Pause]||1|300|Sleep|||||
17|Control|{Control Up}|1|0|Send|||||
18|f|{f Up}|1|0|Send|||||
19|[Text]|Search Record|1|0|SendRaw|||||
20|[Pause]||1|300|Sleep|||||
21|Escape|{Escape}|1|0|Send|||||
22|[Pause]||1|300|Sleep|||||
23|Enter|{Enter}|1|0|Send|||||
24|[Pause]||1|500|Sleep|||||
25|Control|{Control Down}|1|0|Send|||||
26|a|{a Down}|1|0|Send|||||
27|[Pause]||1|300|Sleep|||||
28|Control|{Control Up}|1|0|Send|||||
29|a|{a Up}|1|0|Send|||||
30|[Pause]||1|300|Sleep|||||
31|Delete|{Delete}|1|0|Send|||||
32|[Pause]||1|300|Sleep|||||
33|[Text]|%ISSNo%|1|0|SendRaw|||||
34|[Pause]||1|300|Sleep|||||
35|Enter|{Enter}|1|0|Send|||||
36|[Pause]||1|1000|Sleep|||||
37|Control|{Control Down}|1|0|Send|||||
38|f|{f Down}|1|0|Send|||||
39|[Pause]||1|300|Sleep|||||
40|Control|{Control Up}|1|0|Send|||||
41|f|{f Up}|1|0|Send|||||
42|[Text]|PRIMARY CLIENT|1|0|SendRaw|||||
43|[Pause]||1|300|Sleep|||||
44|Escape|{Escape}|1|0|Send|||||
45|[Pause]||1|300|Sleep|||||
46|Shift|{Shift Down}|1|0|Send|||||
47|Tab|{Tab}|1|0|Send|||||
48|[Pause]||1|300|Sleep|||||
49|Shift|{Shift Up}|1|0|Send|||||
50|[Pause]||1|300|Sleep|||||
51|Enter|{Enter}|1|0|Send|||||
52|[Pause]||1|500|Sleep|||||
53|Left Click, Stop, FoundX, FoundY|0, 0, 1920, 1080, 0x35B128, 0, Fast RGB|1|0|PixelSearch||Window|||
54|[Pause]||1|300|Sleep|||||
55|Enter|{Enter}|1|0|Send|||||
56|[Pause]||1|2000|Sleep|||||
57|Control|{Control Down}|1|0|Send|||||
58|f|{f Down}|1|0|Send|||||
59|[Pause]||1|300|Sleep|||||
60|Control|{Control Up}|1|0|Send|||||
61|f|{f Up}|1|0|Send|||||
62|[Text]|Status Remarks|1|0|SendRaw|||||
63|[Pause]||1|300|Sleep|||||
64|Escape|{Escape}|1|0|Send|||||
65|[Pause]||1|300|Sleep|||||
66|Enter|{Enter}|1|0|Send|||||
67|Control|{Control Down}|1|0|Send|||||
68|f|{f Down}|1|0|Send|||||
69|[Pause]||1|300|Sleep|||||
70|Control|{Control Up}|1|0|Send|||||
71|f|{f Up}|1|0|Send|||||
72|[Text]|Date:|1|0|SendRaw|||||
73|[Pause]||1|300|Sleep|||||
74|Escape|{Escape}|1|0|Send|||||
75|[Pause]||1|300|Sleep|||||
76|Tab|{Tab}|5|300|Send|||||
77|[Pause]||1|300|Sleep|||||
78|Down|{Down}|1|0|Send|||||
79|[Pause]||1|2000|Sleep|||||
80|Control|{Control Down}|1|0|Send|||||
81|f|{f Down}|1|0|Send|||||
82|[Pause]||1|300|Sleep|||||
83|Control|{Control Up}|1|0|Send|||||
84|f|{f Up}|1|0|Send|||||
85|[Text]|Notes Sponsor|1|0|SendRaw|||||
86|[Pause]||1|300|Sleep|||||
87|Escape|{Escape}|1|0|Send|||||
88|[Pause]||1|300|Sleep|||||
89|Enter|{Enter}|1|0|Send|||||
90|Left Move & Click|Rel 0, 250 Left, 1|1|10|Click|||||
91|[Text]|Update:`n1) CR completed. Client seems fine and healthy`n2) Client submitted all receipts and present food card according to CO`s instructions. Client was praised for the great cooperation`n3) All personal particulars updated/remain the same|1|0|SendRaw|||||
92|[Pause]||1|300|Sleep|||||
93|Control|{Control Down}|1|0|Send|||||
94|f|{f Down}|1|0|Send|||||
95|[Pause]||1|300|Sleep|||||
96|Control|{Control Up}|1|0|Send|||||
97|f|{f Up}|1|0|Send|||||
98|[Text]|Case No.:|1|0|SendRaw|||||
99|[Pause]||1|300|Sleep|||||
100|Escape|{Escape}|1|0|Send|||||
101|[Pause]||1|300|Sleep|||||
102|Shift|{Shift Down}|1|0|Send|||||
103|Tab|{Tab}|2|150|Send|||||
104|[Pause]||1|300|Sleep|||||
105|Shift|{Shift Up}|1|0|Send|||||
106|[Pause]||1|300|Sleep|||||
107|Enter|{Enter}|1|0|Send|||||
108|[Pause]||1|3000|Sleep|||||
109|[LoopStart]|LoopStart|0|0|Loop|||||
110|Control|{Control Down}|1|0|Send|||||
111|Tab|{Tab}|1|150|Send|||||
112|[Pause]||1|150|Sleep|||||
113|Control|{Control Up}|1|0|Send|||||
114|WinGetTitle|TabName|1|0|WinGetTitle||ahk_exe chrome.exe|||
115|Compare Variables|TabName = Roster System - Google Chrome|1|0|If_Statement|||||
116|Break||1|0|Break|||||
117|[End If]|EndIf|1|0|If_Statement|||||
118|[LoopEnd]|LoopEnd|1|0|Loop|||||
119|[Pause]||1|300|Sleep|||||
120|Control|{Control Down}|1|0|Send|||||
121|f|{f Down}|1|0|Send|||||
122|[Pause]||1|300|Sleep|||||
123|Control|{Control Up}|1|0|Send|||||
124|f|{f Up}|1|0|Send|||||
125|[Pause]||1|500|Sleep|||||
126|[Text]|Roster|1|0|SendRaw|||||
127|[Pause]||1|300|Sleep|||||
128|Left Click, Stop, FoundX, FoundY|0, 0, 1920, 1080, 0xFFFF00, 0, Fast RGB|1|0|PixelSearch||Window|||
129|[Pause]||1|300|Sleep|||||
130|Left Click, Break, FoundX, FoundY|0, 0, 1920, 1080, 0x00FFFF, 0, Fast RGB|1|0|PixelSearch||Window|||
131|[Pause]||1|500|Sleep|||||
132|[Text]|%ISSNo%|1|0|SendRaw|||||
133|[Pause]||1|500|Sleep|||||
134|Control|{Control Down}|1|0|Send|||||
135|f|{f Down}|1|0|Send|||||
136|[Pause]||1|300|Sleep|||||
137|Control|{Control Up}|1|0|Send|||||
138|f|{f Up}|1|0|Send|||||
139|[Text]|Start|1|0|SendRaw|||||
140|[Pause]||1|300|Sleep|||||
141|Left Click, Stop, FoundX, FoundY|0, 0, 1920, 1080, 0xFF9632, 0, Fast RGB|1|0|PixelSearch||Window|||
142|[MsgBox]|Please select Roster Time for the client. Click OK when ready.|1|0|MsgBox|262192|Paused|||
143|[Pause]||1|300|Sleep|||||
144|[LoopStart]|LoopStart|0|0|Loop|||||
145|Control|{Control Down}|1|0|Send|||||
146|Tab|{Tab}|1|150|Send|||||
147|[Pause]||1|150|Sleep|||||
148|Control|{Control Up}|1|0|Send|||||
149|WinGetTitle|TabName|1|0|WinGetTitle||ahk_exe chrome.exe|||
150|Compare Variables|TabName = Food System - Google Chrome|1|0|If_Statement|||||
151|Break||1|0|Break|||||
152|[End If]|EndIf|1|0|If_Statement|||||
153|[LoopEnd]|LoopEnd|1|0|Loop|||||
154|[Pause]||1|300|Sleep|||||
155|Control|{Control Down}|1|0|Send|||||
156|f|{f Down}|1|0|Send|||||
157|[Pause]||1|300|Sleep|||||
158|Control|{Control Up}|1|0|Send|||||
159|f|{f Up}|1|0|Send|||||
160|[Pause]||1|500|Sleep|||||
161|[Text]|Add Food|1|0|SendRaw|||||
162|[Pause]||1|300|Sleep|||||
163|Left Click, Stop, FoundX, FoundY|0, 0, 1920, 1080, 0xFF9632, 0, Fast RGB|1|0|PixelSearch||Window|||
164|[Pause]||1|1000|Sleep|||||
165|[Text]|%ISSNo%|1|0|SendRaw|||||
166|[Pause]||1|300|Sleep|||||
167|[LoopStart]|LoopStart|0|0|Loop|||||
168|Control|{Control Down}|1|0|Send|||||
169|Tab|{Tab}|1|150|Send|||||
170|[Pause]||1|150|Sleep|||||
171|Control|{Control Up}|1|0|Send|||||
172|WinGetTitle|TabName|1|0|WinGetTitle||ahk_exe chrome.exe|||
173|Compare Variables|TabName = Travelling Allowance System - Google Chrome|1|0|If_Statement|||||
174|Break||1|0|Break|||||
175|[End If]|EndIf|1|0|If_Statement|||||
176|[LoopEnd]|LoopEnd|1|0|Loop|||||
177|[Pause]||1|300|Sleep|||||
178|Control|{Control Down}|1|0|Send|||||
179|f|{f Down}|1|0|Send|||||
180|[Pause]||1|300|Sleep|||||
181|Control|{Control Up}|1|0|Send|||||
182|f|{f Up}|1|0|Send|||||
183|[Pause]||1|500|Sleep|||||
184|[Text]|Add Record|1|0|SendRaw|||||
185|[Pause]||1|300|Sleep|||||
186|Left Click, Stop, FoundX, FoundY|0, 0, 1920, 1080, 0xFF9632, 0, Fast RGB|1|0|PixelSearch||Window|||
187|[Pause]||1|1000|Sleep|||||
188|[Text]|%ISSNo%|1|0|SendRaw|||||
189|[Pause]||1|300|Sleep|||||
190|[MsgBox]|Confirm with the client:`n1) How many toiletries are needed to be issued`n2) Confirm Regular Transportation Allowance (RTA) eligibility`n3) Other issues|1|0|MsgBox|262192|Paused|||
*/