Friday, August 18, 2017

On the trip to the eclipse

Arriving in Klamath Falls, OR, at 8 pm, we saw some smoky haze in the sky from forest fires north west of the area.  Checking the internet, I saw a picture from Bend where the sun was dim and the sky was brown.  Hoping that this will be controlled quickly and we'll have clear skies for night time viewing and the eclipse itself!

I copied the AHK script for the K10D to use the Pentax Image Transmitter 2 software for tethering the K-1 camera.  After updating the mouse clicks and directions to trigger the menus, I found that the main difference was that the IT2 software is slow.  There is a noticeable delay to display the dropdown menus before they can be used.  Had to build in 100-250 microsecond delays to allow the software to respond, for the camera to update settings, and be ready for new commands.

Yet to be made: audio announcements to work with the filters.  I may just set a timer on my phone.

Here's how this update looks:


#SingleInstance force
CoordMode, mouse, screen



; Get target time in a format we can:
;  - compare (with "<")
; < comparison should be safe as long as both are in the *exact* same format.
; time is 2305 format
; ====================================
; the values listed below are for the eclipse BE SURE TO UNCOMMENT
;filter1timeS = %A_YYYY%%A_MM%%A_DD%090643 ; 9:06:43 am
;filter1timeE = %A_YYYY%%A_MM%%A_DD%101830 ; 10:18:30 am 50 seconds to remove filters
;beads1timeS  = %A_YYYY%%A_MM%%A_DD%101920 ; 10:19:20 am 13 seconds to spam for beads
;beads1timeE  = %A_YYYY%%A_MM%%A_DD%101933 ; 10:19:33 am
;brackettimeS = %A_YYYY%%A_MM%%A_DD%101934 ; 10:19:34 am
;brackettimeE = %A_YYYY%%A_MM%%A_DD%102125 ; 10:21:25 am
;beads2timeS  = %A_YYYY%%A_MM%%A_DD%102135 ; 10:21:35 am 10 seconds to spam for beads
;beads2timeE  = %A_YYYY%%A_MM%%A_DD%102145 ; 10:21:45 am
;filter2timeS = %A_YYYY%%A_MM%%A_DD%102200 ; 10:22:15 am 30 seconds to apply filters
;filter2timeE = %A_YYYY%%A_MM%%A_DD%114102 ; 11:41:02 am

; ====================================
; the values listed below are for testing
filter1timeS = %A_YYYY%%A_MM%%A_DD%224500 ; 
filter1timeE = %A_YYYY%%A_MM%%A_DD%224500 ; 
beads1timeS  = %A_YYYY%%A_MM%%A_DD%224520 ; 
beads1timeE  = %A_YYYY%%A_MM%%A_DD%224535 ; 
brackettimeS = %A_YYYY%%A_MM%%A_DD%224536 ; 
brackettimeE = %A_YYYY%%A_MM%%A_DD%224739; 
beads2timeS  = %A_YYYY%%A_MM%%A_DD%224741 ; 
beads2timeE  = %A_YYYY%%A_MM%%A_DD%224755 ; 
filter2timeS = %A_YYYY%%A_MM%%A_DD%224810 ; 
filter2timeE = %A_YYYY%%A_MM%%A_DD%225000 ; 

; ====================================

; send filtersettings ; set single frame shooting with appropriate fstop and shutter speed

; K1 Aperture is F8 set on the lens
; K1 ISO is 200 
; K1 beads shutter speed is 8000
; K1 central bracket is 1/30
; K1 filter setting is 1/1000
Click 1397, 195 ; set bracket mode off
 sleep 150
 SendInput {PgUp 2}
 SendInput {Enter}
 sleep 150
;click 1397, 195 ; set single shot
; sleep 100
; SendInput {Enter}
; sleep 100
click 1578, 299 ; set shutter speed to 8000 then up to 1000 
 sleep 150
 send {PgDn 8}
 sleep 250
 send {Up 9}
 sleep 150
 send {Enter}
 sleep 150
MouseMove 1552, 504 ; position mouse over shutter button

gosub, filter1

; remove filters audio warning
; SoundPlay K1filter.wma


; send beadsettings ; set continuous shooting speed to Low with appropriate fstop and shutter speedset beads
Click 1397, 195 ; set bracket mode off
 sleep 100
 Send {PgUp 2}
 Send {Enter}
 sleep 100
click 1397, 195 ; set continuous medium
 sleep 100
 Send {Down 2}
 Send {Enter}
 sleep 100
click 1578, 299 ; set shutter speed to 8000
 sleep 100
 send {PgDn 7}
 sleep 100
 send {Enter}
 sleep 50
MouseMove 1552, 504 ; position mouse over shutter button

gosub, beads1

; send bracketsettings
Click 1397, 195 ; set bracket mode off
 sleep 100
 Send {PgUp 2}
 Send {Enter}
 sleep 50
click 1397, 195 ; set single shot
 sleep 100
 Send {Enter}
 sleep 100
click 1578, 299 ; set shutter speed to 1/30 from 8000
 sleep 100
 send {PgDn 8}
 sleep 250
 send 1/30
 sleep 150
 sendInput {Enter}
 sleep 100
click 1397, 195 ; set bracket mode
 sleep 100
 Send {Down 9}
 Send {Enter}
 sleep 150

MouseMove 1552, 504 ; position mouse over shutter button


gosub, totality

; beads2
; send beadsettings ; set continuous shooting speed to Low with appropriate fstop and shutter speedset beads
Click 1397, 195 ; set bracket mode off
 sleep 100
 Send {PgUp 3}
 sleep 50
 Send {Enter}
 sleep 150

click 1578, 299 ; set shutter speed to 8000
 sleep 100
 sendInput {PgDn 8}
 sleep 150
 SendInput {Enter}
 sleep 150
 
click 1397, 195 ; set continuous medium
 sleep 100
 SendInput {Down 2}
 sleep 50
 SendInput {Enter}
 sleep 150

MouseMove 1552, 504 ; position mouse over shutter button

gosub, beads2

; apply filters audio warning
; SoundPlay K1filter.wma


;set final filter settings
Click 1397, 195 ; set bracket mode off
 Send {PgUp 2}
 sleep 200
 Send {Enter}
click 1397, 195 ; set single shot
 Send {Enter}
 sleep 200
click 1578, 299 ; set shutter speed to 8000 then up to 1000 
 sleep 200
 send {PgDn 7}
 sleep 200
 send {Up 9}
 sleep 200
 send {Enter}
MouseMove 1552, 504 ; position mouse over shutter button
gosub, filter2

goto, terminate

; ====================================

; subroutines

; ====================================

filter1:
; this is first to second contact
; send a picture click once a minute


if (A_Now >= filter1timeS)  
 { 
 Loop
  { 
   MouseClick, left, 1550, 495, 1, 10  ; click slowly to ensure shutter register
   sleep 60000 ; wait a minute
   if (A_Now >= filter1timeE)
    break 
   if (A_Now < filter1timeE)
    continue
  }}
 else
  { 
   Sleep 60000 ; wait a minute
   goto filter1 ; go back to the start of the subroutine
  }
 
return

; ====================================

beads1:
; this is the beads1 subroutine

; press and hold shutter button while beads active
if (A_Now > beads1timeS)
 {
 Loop
  {
   MouseClick, left, 1550, 495, 1, 10, D ; Press and hold shutter button
   if (A_Now >= beads1timeE)
    {
    MouseClick, left, 1550, 495, 1, 10, U ; release shutter button
    Break 
    }
   if (A_Now < beads1timeE)
    sleep 1000 ; wait a second
    continue
  }}
 else
  { 
   Sleep 1000 ; wait a second
   goto beads1 ; go back to the start of the subroutine
  }
 
return
 
; ====================================

totality:
; this is the subroutine for totality with bracketing

 
if (A_Now > brackettimeS)
 {
 Loop
  {
   MouseClick, left, 1550, 495, 1, 10
   Sleep 4000  ; click every 4 seconds
   if (A_Now >= brackettimeE)
    Break 
   If (A_Now < brackettimeE)
    continue
  }}
 else
    { 
   Sleep 1000 ; wait a second
   goto totality ; go back to the start of the subroutine
  }
 
return

; ==================================== 
 
beads2:
; this is the second beads routine


if (A_Now > beads2timeS)
 {
 Loop
  {
   MouseClick, left, 1550, 495, 1, 10, D ; Press and hold shutter button
   if (A_Now >= beads2timeE)
    {
    MouseClick, left, 1550, 495, 1, 10, U ; release shutter button
    Break 
    }
   if (A_Now < beads2timeE)
    sleep 1000 ; wait a second
    continue
  }}
 else
  { 
   Sleep 1000 ; wait a second
   goto beads2 ; go back to the start of the subroutine
  }
 
return

; ====================================
   
filter2:
; this is from 3rd to 4th contact


if (A_Now >= filter2timeS)  
 { 
 Loop
  { 
   MouseClick, left, 1550, 495, 1, 10  ; click slowly to ensure shutter register
   sleep 60000 ; wait a minute
   if (A_Now >= filter2timeE)
    break 
   if (A_Now < filter2timeE)
    continue
  }}
 else
  { 
   Sleep 1000 ; wait a second
   goto filter2 ; go back to the start of the subroutine
  }
 
return

; ====================================




terminate:
 exit
 
Esc::ExitApp 

Thursday, August 17, 2017

Properly working AHK Script

Last night, I got the AutoHotKey script to work with the Pentax K10D.

Very slick and I can see how I might be able to script things like Maxim.

Here is the properly working code for reference.


#SingleInstance force
CoordMode, mouse, screen



; Get target time in a format we can:
;  - compare (with "<")
; < comparison should be safe as long as both are in the *exact* same format.
; time is 2305 format
; ====================================
; the values listed below are for the eclipse BE SURE TO UNCOMMENT
;filter1timeS = %A_YYYY%%A_MM%%A_DD%090643 ; 9:06:43 am
;filter1timeE = %A_YYYY%%A_MM%%A_DD%101830 ; 10:18:30 am 50 seconds to remove filters
;beads1timeS  = %A_YYYY%%A_MM%%A_DD%101920 ; 10:19:20 am 13 seconds to spam for beads
;beads1timeE  = %A_YYYY%%A_MM%%A_DD%101933 ; 10:19:33 am
;brackettimeS = %A_YYYY%%A_MM%%A_DD%101934 ; 10:19:34 am
;brackettimeE = %A_YYYY%%A_MM%%A_DD%102125 ; 10:21:25 am
;beads2timeS  = %A_YYYY%%A_MM%%A_DD%102135 ; 10:21:35 am 10 seconds to spam for beads
;beads2timeE  = %A_YYYY%%A_MM%%A_DD%102145 ; 10:21:45 am
;filter2timeS = %A_YYYY%%A_MM%%A_DD%102200 ; 10:22:15 am 30 seconds to apply filters
;filter2timeE = %A_YYYY%%A_MM%%A_DD%114102 ; 11:41:02 am

; ====================================
; the values listed below are for testing
filter1timeS = %A_YYYY%%A_MM%%A_DD%222000 ; 
filter1timeE = %A_YYYY%%A_MM%%A_DD%223000 ; 
beads1timeS  = %A_YYYY%%A_MM%%A_DD%223100 ; 
beads1timeE  = %A_YYYY%%A_MM%%A_DD%223115 ; 
brackettimeS = %A_YYYY%%A_MM%%A_DD%223120 ; 
brackettimeE = %A_YYYY%%A_MM%%A_DD%223420 ; 
beads2timeS  = %A_YYYY%%A_MM%%A_DD%223425 ; 
beads2timeE  = %A_YYYY%%A_MM%%A_DD%223435 ; 
filter2timeS = %A_YYYY%%A_MM%%A_DD%223510 ; 
filter2timeE = %A_YYYY%%A_MM%%A_DD%224000 ; 

; ====================================

; send filtersettings ; set single frame shooting with appropriate fstop and shutter speed 
Click 1452, 491 ; set bracket mode off
	SendInput {PgUp}
	SendInput {Enter}
click 1472, 452 ; set single shot
	SendInput {Down}
	SendInput {Enter}
click 1222, 485 ; set shutter speed to 4000 then down to 500 
	sendInput {PgUp}
	sendInput {Down 9}
	sendInput {Enter}
click 1222, 518 ; set f stop to max then to F5.6
	sendInput {PgUp}
	sendInput {Down 12}
	sendInput {Enter}
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button

gosub, filter1

; remove filters audio warning


; send beadsettings ; set continuous shooting speed to Low with appropriate fstop and shutter speedset beads
Click 1452, 491 ; set bracket mode off
	SendInput {PgUp}
	SendInput {Enter}
click 1472, 452 ; set continuous
	SendInput {Down 2}
	SendInput {Enter}
click 1222, 485 ; set shutter speed to 4000
	sendInput {PgUp}
	sendInput {Enter}
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button

gosub, beads1

; send bracketsettings
click 1472, 452 ; set single shot
	SendInput {Down}
	SendInput {Enter}
click 1222, 485 ; set shutter speed to 1/8 from 4000
	sendInput {Down 27}
	sendInput {Enter}
Click 1452, 491 ; set bracket mode on with 5 shots
	SendInput {Down 2}
	SendInput {Enter}
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button

gosub, totality

; beads2
; set beads ; set continuous shooting speed to Low with appropriate fstop and shutter speed
Click 1452, 491 ; set bracket mode off
	SendInput {Up 2}
	SendInput {Enter}
click 1472, 452 ; set continuous
	SendInput {Down 2}
	SendInput {Enter}
click 1222, 485 ; reset shutter speed to 4000 max
	sendInput {PgUp}
	sendInput {Enter}
click 1222, 518 ; set f stop to max then to F5.6
	sendInput {PgUp}
	sendInput {Down 12}
	sendInput {Enter}
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button

gosub, beads2

; apply filters audio warning

;set final filter settings
Click 1452, 491 ; set bracket mode off
	SendInput {PgUp}
	SendInput {Enter}
click 1472, 452 ; set single shot
	SendInput {Down}
	SendInput {Enter}
click 1222, 485 ; set shutter speed to 500 from earlier 4000
	sendInput {down 9}
	sendInput {Enter}
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button
gosub, filter2

goto, terminate

; ====================================

; subroutines

; ====================================

filter1:
; this is first to second contact
; send a picture click once a minute


if (A_Now >= filter1timeS)  
	{ 
	Loop
		{ 
			MouseClick, left, 1565, 363, 1, 10  ; click slowly to ensure shutter register
			sleep 60000 ; wait a minute
			if (A_Now >= filter1timeE)
				break 
			if (A_Now < filter1timeE)
				continue
		}}
	else
		{ 
			Sleep 60000 ; wait a minute
			goto filter1 ; go back to the start of the subroutine
		}
	
return

; ====================================

beads1:
; this is the beads1 subroutine

; press and hold shutter button while beads active
if (A_Now > beads1timeS)
	{
	Loop
		{
			MouseClick, left, 1565, 363, 1, 10, D ; Press and hold shutter button
			if (A_Now >= beads1timeE)
				{
				MouseClick, left, 1563, 363, 1, 10, U ; release shutter button
				Break 
				}
			if (A_Now < beads1timeE)
				sleep 1000 ; wait a second
				continue
		}}
	else
		{ 
			Sleep 1000 ; wait a second
			goto beads1 ; go back to the start of the subroutine
		}
	
return
	
; ====================================

totality:
; this is the subroutine for totality with bracketing

	
if (A_Now > brackettimeS)
	{
	Loop
		{
			MouseClick, left, 1565, 363, 1, 10
			Sleep 3000  ; click every 3 seconds
			if (A_Now >= brackettimeE)
				Break 
			If (A_Now < brackettimeE)
				continue
		}}
	else
				{ 
			Sleep 1000 ; wait a second
			goto totality ; go back to the start of the subroutine
		}
	
return

; ====================================	
	
beads2:
; this is the second beads routine


if (A_Now > beads2timeS)
	{
	Loop
		{
			MouseClick, left, 1565, 363, 1, 10, D ; Press and hold shutter button
			if (A_Now >= beads2timeE)
				{
				MouseClick, left, 1563, 363, 1, 10, U ; release shutter button
				Break 
				}
			if (A_Now < beads2timeE)
				sleep 1000 ; wait a second
				continue
		}}
	else
		{ 
			Sleep 1000 ; wait a second
			goto beads2 ; go back to the start of the subroutine
		}
	
return

; ====================================
			
filter2:
; this is from 3rd to 4th contact


if (A_Now >= filter2timeS)  
	{ 
	Loop
		{ 
			MouseClick, left, 1565, 363, 1, 10  ; click slowly to ensure shutter register
			sleep 60000 ; wait a minute
			if (A_Now >= filter2timeE)
				break 
			if (A_Now < filter2timeE)
				continue
		}}
	else
		{ 
			Sleep 1000 ; wait a second
			goto filter2 ; go back to the start of the subroutine
		}
	
return

; ====================================




terminate:
	exit
	
Esc::ExitApp	

Wednesday, August 16, 2017

Auto Hot Key and Time Controls

I've been languishing with my AHK script.

The earlier example that was posted assumed that I understood how time controls worked. I tested these ideas last night and found my knowledge lacking.

While I was able to get the coordinates and button clicks working with the Pentax K10D camera, I found that my "while" flow control was poorly managed.

Here's what I wrote:

#SingleInstance force
CoordMode, mouse, screen

; Get target time in a format we can:
;  - compare (with "<")
; < comparison should be safe as long as both are in the *exact* same format.
; target_time is 2305 format
filter1timeS = %A_YYYY%%A_MM%%A_DD%%212500 ; 21:05 pm
filter1timeE = %A_YYYY%%A_MM%%A_DD%%213000 ; 21:10 pm
beads1timeS = %A_YYYY%%A_MM%%A_DD%%213100 ; 21:11 pm
beads1timeE = %A_YYYY%%A_MM%%A_DD%%213130 ; 21:1130 pm
brackettimeS = %A_YYYY%%A_MM%%A_DD%%213020 ; 21:1140 pm
brackettimeE = %A_YYYY%%A_MM%%A_DD%%213320 ; 21:1320 pm
beads2timeS = %A_YYYY%%A_MM%%A_DD%%213325 ; 21:1320 pm
beads2timeE = %A_YYYY%%A_MM%%A_DD%%213400 ; 21:14 pm
filter2timeS = %A_YYYY%%A_MM%%A_DD%%213410 ; 21:1410 pm
filter2timeE = %A_YYYY%%A_MM%%A_DD%%214000 ; 21:20 pm

; send filtersettings ; set single frame shooting with appropriate fstop and shutter speed 
click 1472, 452 ; set single shot
SendInput {Down}
SendInput {Enter}
click 1222, 485 ; set shutter speed to 500 from default 125
sendInput {Up 6}
sendInput {Enter}
click 1222, 518 ; set f stop 5.6 from default 8
sendInput {Up 3}
sendInput {Enter}

MouseMove 1565, 363
Click 1501, 14

while ((A_Now >= filter1timeS) and (A_Now <= filter1timeE)) ; this is first to second contact
{ ; send a picture click once a minute
MouseClick, left, 1565, 363, 1, 10
SendInput {Space}
sleep 60000
}


; remove filters audio warning
; beads1
; send beadsettings ; set continuous shooting speed to Low with appropriate fstop and shutter speedset beads
click 1472, 452 ; set continuous
SendInput {Down 2}
SendInput {Enter}
click 1222, 485 ; set shutter speed to 4000 from 500
sendInput {Up 9}
sendInput {Enter}

MouseMove 1565, 363
Click 1501, 14
while ((A_Now >= beads1timeS) and (A_Now <= beads1timeE)) ; this is when first beads goes
{ ; spam beads
MouseClick, left, 1565, 363, 1, 100, D
SendInput {Space}
; at the start 
 ; hold button until the end of beads time
}
MouseClick, left, 1563, 363, 1, 100, U
; click ; at the end, click again to stop the continuous shooting mode

; send bracketsettings
click 1472, 452 ; set single shot
SendInput {Down}
SendInput {Enter}
click 1222, 485 ; set shutter speed to 1/8 from 4000
sendInput {Down 27}
sendInput {Enter}
Click 1452, 491 ; set bracket mode on
SendInput {Down 2}

Click 1501, 14
MouseMove 1565, 363
while ((A_Now >= brackettimeS) and (A_Now <= brackettimeE)) ; this is totality
{ ; spam brackets
MouseClick, left, 1565, 363, 1, 100
Sleep 3000
; click every 3 seconds
}



; beads2
; set beads ; set continuous shooting speed to Low with appropriate fstop and shutter speed
Click 1452, 491 ; set bracket mode off
SendInput {Up 2}
click 1472, 452 ; set continuous
SendInput {Down 2}
SendInput {Enter}
click 1222, 485 ; reset shutter speed to 4000 max
sendInput {PgUp}
sendInput {Enter}
click 1222, 518 ; set f stop to max then to F5.6
sendInput {PgUp}
sendInput {Down 12}
sendInput {Enter}

Click 1501, 14
MouseMove 1565, 357
while ((A_Now >= beads2timeS) and (A_Now <= beads2timeE)) ; this is when second beads goes
{ ; spam beads
MouseClick, left, 1565, 363, 1, 100, D ; at the start 
}
MouseClick, left, 1565, 363, 1, 100, U ; at the end, click again to stop the continuous shooting mode

 ; apply filters audio warning

;set final filter settings
click 1472, 452 ; set single shot
SendInput {Down}
SendInput {Enter}
click 1222, 485 ; set shutter speed to 500 from default 125
sendInput {down 9}
sendInput {Enter}

Click 1501, 14
MouseMove 1565, 357

while ((A_Now >= filter2timeS) and (A_Now <= filter2timeE)) ; this is 3rd to 4th contact
{ ; send a picture click once a minute
MouseClick, left, 1565, 363, 1, 100
sleep 60000
}

return





As far as I can tell, none of the time controls worked.  I will need to go back to the original target_time AHK examples and see where I went wrong. 

The way the script runs now is that the mouse darts around, clicking buttons, changing settings, but the shutter is never fired because the "while" values are never true.  What I'd like to see would be that the script waits until the "while" values are true, executes, then moves to the next step.

I see a few possibilities to solve this problem:
  • Build nested "if...then" flow to catch all variations and wrap it all in a loop that waits a minute to try again.
  • Build a collection of separate AHK files and call them from the Windows Task Scheduler at the right times.

I think that the latter solution might be the easiest since I can test each step independently.




On review, I realize that the Task Scheduler won't stop a script at a certain time. 

So I'm back to the flow control within AHK.  I think that working with loops may be a better solution.

I'm going to try replacing the "while" with logic like this:

if (A_Now > filter1timeS)
 { 
 Loop
  { 
   MouseClick, left, 1565, 363, 1, 10
   sleep 60000
   if (A_Now >= filter1timeE)
    break
   if (A_Now < filter1timeE)
    continue
  }
 }



After playing with the loops, I see where the time controls failed - it was because of an extra "%" as this prevented the time values to be seen as a number.  Still, I rewrote the flow control using if and else and put the bits into subroutines.

Here's how it looks now and I'll try it out tonight:

#SingleInstance force
CoordMode, mouse, screen

; Get target time in a format we can:
;  - compare (with "<")
; < comparison should be safe as long as both are in the *exact* same format.
; time is 2305 format
; ====================================
; the values listed below are for the eclipse BE SURE TO UNCOMMENT
;filter1timeS = %A_YYYY%%A_MM%%A_DD%090643 ; 9:06:43 am
;filter1timeE = %A_YYYY%%A_MM%%A_DD%101830 ; 10:18:30 am 50 seconds to remove filters
;beads1timeS  = %A_YYYY%%A_MM%%A_DD%101920 ; 10:19:20 am 13 seconds to spam for beads
;beads1timeE  = %A_YYYY%%A_MM%%A_DD%101933 ; 10:19:33 am
;brackettimeS = %A_YYYY%%A_MM%%A_DD%101934 ; 10:19:34 am
;brackettimeE = %A_YYYY%%A_MM%%A_DD%102125 ; 10:21:25 am
;beads2timeS  = %A_YYYY%%A_MM%%A_DD%102135 ; 10:21:35 am 10 seconds to spam for beads
;beads2timeE  = %A_YYYY%%A_MM%%A_DD%102145 ; 10:21:45 am
;filter2timeS = %A_YYYY%%A_MM%%A_DD%102200 ; 10:22:15 am 30 seconds to apply filters
;filter2timeE = %A_YYYY%%A_MM%%A_DD%114102 ; 11:41:02 am

; ====================================
; the values listed below are for testing
filter1timeS = %A_YYYY%%A_MM%%A_DD%212000 ; 
filter1timeE = %A_YYYY%%A_MM%%A_DD%213000 ; 
beads1timeS  = %A_YYYY%%A_MM%%A_DD%213100 ; 
beads1timeE  = %A_YYYY%%A_MM%%A_DD%213115 ; 
brackettimeS = %A_YYYY%%A_MM%%A_DD%213120 ; 
brackettimeE = %A_YYYY%%A_MM%%A_DD%213420 ; 
beads2timeS  = %A_YYYY%%A_MM%%A_DD%213425 ; 
beads2timeE  = %A_YYYY%%A_MM%%A_DD%213435 ; 
filter2timeS = %A_YYYY%%A_MM%%A_DD%213510 ; 
filter2timeE = %A_YYYY%%A_MM%%A_DD%214000 ; 

; ====================================

; send filtersettings ; set single frame shooting with appropriate fstop and shutter speed 
click 1472, 452 ; set single shot
 SendInput {Down}
 SendInput {Enter}
click 1222, 485 ; set shutter speed to 4000 then down to 500 
 sendInput {PgUp}
 sendInput {Down 9}
 sendInput {Enter}
click 1222, 518 ; set f stop to max then to F5.6
 sendInput {PgUp}
 sendInput {Down 12}
 sendInput {Enter}


gosub, filter1

; remove filters audio warning


; send beadsettings ; set continuous shooting speed to Low with appropriate fstop and shutter speedset beads
click 1472, 452 ; set continuous
 SendInput {Down 2}
 SendInput {Enter}
click 1222, 485 ; set shutter speed to 4000
 sendInput {PgUp}
 sendInput {Enter}

gosub, beads1

; send bracketsettings
click 1472, 452 ; set single shot
 SendInput {Down}
 SendInput {Enter}
click 1222, 485 ; set shutter speed to 1/8 from 4000
 sendInput {Down 27}
 sendInput {Enter}
Click 1452, 491 ; set bracket mode on with 5 shots
 SendInput {Down 2}

gosub, totality

; beads2
; set beads ; set continuous shooting speed to Low with appropriate fstop and shutter speed
Click 1452, 491 ; set bracket mode off
 SendInput {Up 2}
click 1472, 452 ; set continuous
 SendInput {Down 2}
 SendInput {Enter}
click 1222, 485 ; reset shutter speed to 4000 max
 sendInput {PgUp}
 sendInput {Enter}
click 1222, 518 ; set f stop to max then to F5.6
 sendInput {PgUp}
 sendInput {Down 12}
 sendInput {Enter}

gosub, beads2

; apply filters audio warning

;set final filter settings
click 1472, 452 ; set single shot
 SendInput {Down}
 SendInput {Enter}
click 1222, 485 ; set shutter speed to 500 from earlier 4000
 sendInput {down 9}
 sendInput {Enter}

gosub, filter2


; ====================================

; subroutines

; ====================================

filter1:
; this is first to second contact
; send a picture click once a minute
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button

if (A_Now >= filter1timeS)  
 { 
 Loop
  { 
   MouseClick, left, 1565, 363, 1, 10  ; click slowly to ensure shutter register
   sleep 60000 ; wait a minute
   if (A_Now >= filter1timeE)
    break
   if (A_Now < filter1timeE)
    continue
  }
 else
  { 
   Sleep 60000 ; wait a minute
   gosub, filter1 ; go back to the start of the subroutine
  }
 }
return

; ====================================

beads1:
; this is the beads1 subroutine
Click 1501, 14 ; click on shutter control window bar to make active
MouseMove 1565, 363 ; position mouse over shutter button
; press and hold shutter button while beads active
if (A_Now > beads1timeS)
 {
 Loop
  {
   MouseClick, left, 1565, 363, 1, 10, D ; Press and hold shutter button
   if (A_Now >= beads1timeE)
    {
    MouseClick, left, 1563, 363, 1, 10, U ; release shutter button
    Break
    }
   if (A_Now < beads1timeE)
    continue
  }
  else
  { 
   Sleep 1000 ; wait a second
   gosub, beads1 ; go back to the start of the subroutine
  }
 }
return
 
; ====================================

totality:
; this is the subroutine for totality with bracketing
Click 1501, 14
MouseMove 1565, 363
 
if (A_Now > brackettimeS)
 {
 Loop
  {
   MouseClick, left, 1565, 363, 1, 10
   Sleep 3000  ; click every 3 seconds
   if (A_Now >= brackettimeE)
    Break
   If (A_Now < brackettimeE)
    continue
  }
  else
    { 
   Sleep 1000 ; wait a second
   gosub, totality ; go back to the start of the subroutine
  }
 }
return

; ==================================== 
 
beads2:
; this is the second beads routine

Click 1501, 14
MouseMove 1565, 357

if (A_Now > beads2timeS)
 {
 Loop
  {
   MouseClick, left, 1565, 363, 1, 10, D ; Press and hold shutter button
   if (A_Now >= beads2timeE)
    {
    MouseClick, left, 1563, 363, 1, 10, U ; release shutter button
    Break
    }
   if (A_Now < beads2timeE)
    continue
  }
  else
  { 
   Sleep 1000 ; wait a second
   gosub, beads2 ; go back to the start of the subroutine
  }
 }
return

; ====================================
   
filter2:
; this is from 3rd to 4th contact
Click 1501, 14
MouseMove 1565, 357

if (A_Now >= filter2timeS)  
 { 
 Loop
  { 
   MouseClick, left, 1565, 363, 1, 10  ; click slowly to ensure shutter register
   sleep 60000 ; wait a minute
   if (A_Now >= filter2timeE)
    break
   if (A_Now < filter2timeE)
    continue
  }
 else
  { 
   Sleep 1000 ; wait a second
   gosub, filter2 ; go back to the start of the subroutine
  }
 }
return

; ====================================


exit