-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10-AS4.ahk
More file actions
374 lines (372 loc) · 10.7 KB
/
10-AS4.ahk
File metadata and controls
374 lines (372 loc) · 10.7 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
#Requires AutoHotkey v2.0
;
;This Script will open a set of FireCaputre recordings in AutoStakkert3 and stack with defaults
; 20240807 v2 includes MQTT and lots of cleanup
; 20230826 v1.7
; moving variables to ini file
; 20220222 - ver 1.1
; Added Logging and file moves
;
Logging := 1
;
; Variables
;
q := chr(34) ; https://www.autohotkey.com/board/topic/33688-storing-quotation-marks-in-a-variable/#:~:text=Use%20the%20accent%20symbol%20before%20each%20quote%20mark.,a%20variable%20to%20another%20variable%20and%20need%20quotes.
FCRoot := IniRead("00-setup.ini", "Autostakkert", "FCRoot")
VideoFileType := IniRead("00-setup.ini", "Autostakkert", "VideoFileType")
ASOutputFileType := IniRead("00-setup.ini", "Autostakkert", "ASOutputFileType")
PreferredStackDepth := IniRead("00-setup.ini", "Autostakkert", "PreferredStackDepth")
AS4 := IniRead("00-setup.ini", "Programs", "Autostakkert")
VideoFileType := IniRead("00-setup.ini", "Autostakkert", "VideoFileType")
Enabled := IniRead("00-setup.ini", "MQTT", "Enabled")
Target := IniRead("00-setup.ini", "MQTT", "Target")
STATUS := IniRead("00-setup.ini", "MQTT", "STATUS")
FILTER := IniRead("00-setup.ini", "MQTT", "FILTER")
MQTTERROR := IniRead("00-setup.ini", "MQTT", "MQTTERROR")
;
;
; ================================================================================
; Starting Logging
; ================================================================================
;
;
FileAppend "`n`n" FormatTime(A_Now, "dddd MMMM d, yyyy hh:mm:ss tt") " Starting AS4 Stacking Setup.`n", "Log.txt"
;
;
;
if Enabled = 1
{
Run MQTTERROR '"Starting setup..."' ; clears previous errors to avoid confusion
Run STATUS '"Starting AS4 setup..."'
}
;
; ================================================================================
; INTRO!
; ================================================================================
;
result := MsgBox("Ready for FullPlanetAutomatedProcessing? `n Pick your folder to process from the open FC root `n This MsgBox will time out in 10 seconds. Continue?",, "Y/N T10")
if (result = "Timeout")
{
TrayTip "You didn't press YES or NO within the 10-second period."
Exit ; Terminate this function as well as the calling function.
}
else if (result = "No")
{
MsgBox "You pressed NO?!?!"
Exit ; Terminate this function as well as the calling function.
MsgBox "This MsgBox will never happen because of the Exit."
}
else (result = "Yes")
{
TrayTip "You Said YES :) `n Do NOT touch, I got this...."
}
;
; ================================================================================
; This secion runs Autostakkert
; ================================================================================
;
; minimize all windows
TrayTip "HANDS OFF, I GOT THIS FOR NOW!!!"
Send "#m"
try
{
Run AS4
if Enabled = 1
{
Run STATUS '"Opening AS4"'
}
WinWait "AutoStakkert"
WinActivate "AutoStakkert"
if Enabled = 1
{
Run STATUS '"AS4 Confirmed open"'
}
}
catch
{
MsgBox "File does not exist."
if Enabled = 1
{
Run MQTTERROR '"AS4 needs input"'
}
}
;
;
; ================================================================================
; This secion sets up input video files via prompt or arg passing
; ================================================================================
;
;
try
Run FCRoot
catch
if Enabled = 1
{
Run MQTTERROR '"You are missing the FC ROOT files!"'
}
else
{
MsgBox "You are missing the FC ROOT files!"
}
;
;
TrayTip "Pick your folder and close windows, else this script will minimize everything for you."
if A_Args.Length < 1
{
if Enabled = 1
{
Run MQTTERROR '"Needs input"'
}
PATH := InputBox("This script requires at least 1 parameters but it only received " A_Args.Length ". Please paste the path to your FireCaputre raw AVIs.").value
if Enabled = 1
{
Run MQTTERROR '"Running"'
}
}
else
{
PATH := A_Args[1]
}
;
;
; ================================================================================
; Copy of 41-FC-Settings-Parser for ease of use
; ================================================================================
;
;
;
try
{
Loop Files, PATH "\*R.txt"
{
RedFile := A_LoopFilePath
}
Loop Files, PATH "\*G.txt"
{
GreenFile := A_LoopFilePath
}
Loop Files, PATH "\*B.txt"
{
BlueFile := A_LoopFilePath
}
;
Loop read, RedFile
;
{
if InStr(A_LoopReadLine, "Shutter")
RedShutter := A_LoopReadLine
if InStr(A_LoopReadLine, "Gain")
RedGain := A_LoopReadLine
}
RedShutter := SubStr(RedShutter, 9 , 4)
RedShutter := Round(RedShutter,0)
RedGain := SubStr(RedGain, 6 , 4)
RedGain := RedGain
;
;Loop read, "C:\Personal\B-Sorted\Astronomy\20-Stacked\SolarSystem\Jupiter\Jupiter_2023_09_04\2023-09-04-0819_1-G.txt"
;Loop read, "P:\Personal\E-Delete\FC-Expiring--20240309\Saturn\Saturn_2023_09_01\2023-09-01-0342_9-G.txt"
;
Loop read, GreenFile
{
if InStr(A_LoopReadLine, "Shutter")
GreenShutter := A_LoopReadLine
if InStr(A_LoopReadLine, "Gain")
GreenGain := A_LoopReadLine
}
GreenShutter := SubStr(GreenShutter, 9 , 4)
GreenShutter := Round(GreenShutter,0)
GreenGain := SubStr(GreenGain, 6 , 4)
GreenGain := GreenGain
;
;Loop read, "C:\Personal\B-Sorted\Astronomy\20-Stacked\SolarSystem\Jupiter\Jupiter_2023_09_04\2023-09-04-0818_6-B.txt"
;Loop read, "P:\Personal\E-Delete\FC-Expiring--20240309\Saturn\Saturn_2023_09_01\2023-09-01-0340_9-B.txt"
Loop read, BlueFile
{
if InStr(A_LoopReadLine, "Shutter")
BlueShutter := A_LoopReadLine
if InStr(A_LoopReadLine, "Gain")
BlueGain := A_LoopReadLine
}
BlueShutter := SubStr(BlueShutter, 9 , 4)
BlueShutter := Round(BlueShutter,0)
BlueGain := SubStr(BlueGain, 6 , 4)
BlueGain := BlueGain
;
;
TrayTip "RBG: " RedShutter ", " BlueShutter ", " GreenShutter " ms`nGain: " RedGain ", " BlueGain ", " GreenGain
A_Clipboard := "RBG: " RedShutter ", " BlueShutter ", " GreenShutter " ms`nGain: " RedGain ", " BlueGain ", " GreenGain
;
FileAppend "`n`n" FormatTime(A_Now, "dddd MMMM d, yyyy hh:mm:ss tt") "`nRedFile= " RedFile "`nBlueFile= " BlueFile "`nGreenFile= " GreenFile, "FCSettings.txt"
FileAppend "`n" FormatTime(A_Now, "dddd MMMM d, yyyy hh:mm:ss tt") " Logging Firecapture Exposure Settings`n`n" A_Clipboard, "FCSettings.txt"
}
;
;
; ================================================================================
; END of 41-FC-Settings-Parser for ease of use
; ================================================================================
;
;
;
;
;
; ================================================================================
; Count files, and log start times
; ================================================================================
;
;
;MouseMove 100, 100
;
nDIR := PATH "\" VideoFileType
Counter := 0
;
Loop Files, nDIR
Counter++
;
TrayTip VideoFileType " count is: " Counter
if Enabled = 1
{
Run Filter Counter
}
;
COUTTXT := nDIR ": Input File count is: " Counter
FileAppend FormatTime(A_Now, "dddd MMMM d, yyyy hh:mm:ss tt") " " nDIR ": Input File count is: " Counter "`n", "Log.txt"
;
; Log attempted start time of AS3
;
FileAppend FormatTime(A_Now, "dddd MMMM d, yyyy hh:mm:ss tt") " Starting AS4 setup.`n", "Log.txt"
sleep 10000 ; 10seconds
if Enabled = 1
{
try
{
Run TARGET '"Autostakkert4"'
Run FILTER q COUTTXT q
Run STATUS '"Starting AS4 setup"'
}
catch as e ; Handles the first error thrown by the block above.
{
MsgBox "An error was thrown!`nSpecifically: " e.Message
Exit
}
}
else
{
TrayTip "MQTT NOT Enabled"
}
;
; ================================================================================
; This secion opens your inputed files
; ================================================================================
;
;
; Sends file / open
try
{
WinActivate "AutoStakkert"
MenuSelect "AutoStakkert",, "File", "Open AVI/SER"
if Enabled = 1
{
Run STATUS '"AS4 file menu OK"'
sleep 2000 ; 2seconds ; long waits due to bg win popups and traytips
WinWait "ahk_class #32770"
ControlClick "Edit1", "ahk_class #32770" ; clicks into edit path to find all files later
}
}
catch
{
if Enabled = 1
{
Run STATUS '"AS4 file menu failed"'
Run MQTTERROR '"Starting setup..."' ; clears previous errors to avoid confusion
Exit
}
}
try
{
WinWait "ahk_class #32770"
sleep 5000 ; MQTT Pub opens window and AHK needs time to refoucs active window
WinActivate "ahk_class #32770"
sleep 5000 ; MQTT Pub opens window and AHK needs time to refoucs active window
WinActivate "ahk_class #32770" ; clicks into edit path to refocus window
ControlClick "Edit1", "ahk_class #32770" ; clicks into edit path to refocus window
Send "!a" ; unneded alt+a
sleep 200
Send "!n" ; ensures it's inside path
Send PATH "`n" ; pastes path
sleep 200
ControlClick "Edit1", "ahk_class #32770" ; clicks into edit path to find all files later
sleep 5000 ; MQTT Pub opens window and AHK needs time to refoucs active window
sleep 200
Send "{Shift down}" ; Shift+TAB into files area
Send "{Tab}" ; Shift+TAB into files area
Send "{Shift up}" ; Shift+TAB into files area
sleep 200
Send "{Home}" ; change file selection
Send "Right" ; change file selection
sleep 200
Send "^a" ; SELECT ALL
sleep 200
Send "^a" ; SELECT ALL
sleep 200
Send "!o" ; Loads all files
WinWaitClose "ahk_class #32770" , , 30000 ; validate this section by making sure file dialgoue closes
if Enabled = 1
{
Run STATUS '"AS4 files opened OK"'
}
}
catch
{
if Enabled = 1
{
Run STATUS '"AS4 opening files failed"'
}
}
;
;
; This section sets various AP size parameters
;
;
WinActivate "ahk_class TFormImage"
sleep 2000
SetControlDelay -1
;ControlClick "TRadioButton3","ahk_class TFormImage" ; AP Size 48
sleep 2000
ControlClick "TButton3","ahk_class TFormImage" ; Places AP Grid
sleep 100
WinActivate "ahk_class TFormMain"
ControlClick "TRadioButton2","ahk_class TFormMain" ; Ref frame autosize?
;
; This section sets Mike's favorite Mars stacking parameters
;
WinActivate "ahk_class TFormImage"
sleep 2000
SetControlDelay -1
ControlClick "TRadioButton1","ahk_class TFormImage" ; AP Size 104
sleep 2000
ControlClick "TButton3","ahk_class TFormImage" ; Places AP Grid
sleep 100
WinActivate "ahk_class TFormMain"
ControlClick "TRadioButton2","ahk_class TFormMain" ; Ref frame autosize
ControlClick "TRadioButton4","ahk_class TFormMain" ; 1.5x Drizzle
;
TrayTip "Override any stack settings within 20sec"
ToolTip "Override any stack settings within 20sec"
if Enabled = 1
{
Run STATUS '"AS4: Override any stack settings within 20sec"'
}
sleep 20000
ControlClick "TButton3","ahk_class TFormMain" ; presses STACK button
if Enabled = 1
{
Run STATUS '"AS4 pressed STACK button"'
}
;
; The main body is complete the following line starts the wait until done script
; End Logging
;
FileAppend FormatTime(A_Now, "dddd MMMM d, yyyy hh:mm:ss tt") " AS4 Stacking started.`n", "Log.txt"
;
;
Run "15-AS3-wait-loop-v2.ahk" " " PATH