;Set up variables SetEnv, PicNum, 0 SetEnv, MouseX, 1 SetEnv, MouseY, 1 SetEnv, CardTime, 25 SetEnv, CardLoop, %CardTime% SetEnv, Lapse, 50 SetEnv, CurrentTime, 0 ;Close open Explorer windows that can confuse script begin: IfWinExist, Exploring, , GoSub, CloseExplorer IfWinExist, Exploring, , Goto, begin ;Check for command line parameters and set program variables appropriately. ;Parameter format: /C /L /P /S IfEqual, %0%, 0, Goto, PromptForParams SetEnv, CardTime, %2% SetEnv, Lapse, %4% SetEnv, Pictures, %6% SetEnv, SetupFlag, %8% Goto, ShowParams PromptForParams: InputBox, CardTime, Card Time, Kodak DC3400 Time Lapse Utility\nby Todd Ferrante\n\nEnter time in seconds to save picture to memory card. InputBox, Lapse, Time Lapse, Kodak DC3400 Time Lapse Utility\nby Todd Ferrante\n\nEnter time in seconds between time lapse pictures. InputBox, Pictures, Number of Pictures, Kodak DC3400 Time Lapse Utility\nby Todd Ferrante\n\nEnter number of pics to take (0 to loop until exit) InputBox, SetupFlag, Camera Setup, Kodak DC3400 Time Lapse Utility\nby Todd Ferrante\n\nEnter 1 to setup and test camera. 0 to use camera defaults. ShowParams: SplashTextOn, 300, 100, Time Lapse Parameters, Card time: %CardTime%. Time Lapse: %Lapse%. # of pics: %Pictures%. Setup flag: %SetupFlag%. Sleep, 3000 SplashTextOff ;Start camera controller and windows explorer Run, C:\\WINDOWS\\Explorer.exe, C:\\temp WinWait, Exploring - 6_0gig (C:) WinActivate, Exploring - 6_0gig (C:) WinMove, Exploring - 6_0gig (C:),, 0, 0, default, default Run, C:\\Program Files\\Kodak\\DC3400\\Controls\\DCCam.exe WinWait, KODAK DC3400 Camera Controls WinActivate, KODAK DC3400 Camera Controls WinMove, KODAK DC3400 Camera Controls,, 0, 0, default, default ;If SetupFlag set, wait for user to setup camera. IfEqual, SetupFlag, 0, Goto, MainLoop MsgBox, 0, Camera Setup, Use camera controls to set up camera. \nDo not move or close windows.\nSelect OK when finished. ;Start main program infinite loop MainLoop: Repeat, %Pictures% EnvAdd, PicNum, 1 ;Check if mouse cursor is in upper left of screen. If so, exit loop. MouseGetPos, MouseX, MouseY IfEqual, MouseX, 0, IfEqual, MouseY, 0, Goto, exit GoSub, WaitUntilTime GoSub, TakePicture GoSub, SavePicture EndRepeat exit: WinClose, Exploring - KODAK DC3400 Camera:\\DCIM\\100K3400 WinClose, KODAK DC3400 Camera Controls Exit TestTakePicture: SplashTextOn, 300, 100, Picture, Taking picture: %PicNum% Sleep, 1000 Return TestSavePicture: SplashTextOn, 300, 100, Picture, Saving picture: %PicNum% Sleep, 1000 Return TakePicture: SplashTextOn, 300, 100, Picture, Taking picture: %PicNum% WinActivate, KODAK DC3400 Camera Controls LeftClick, 211, 33 LeftClick, 321, 114 WinWaitActive, KODAK DC3400 Camera Controls SplashTextOn, 300, 100, Picture, Carding picture: %PicNum%. Seconds remaining: %CardTime%. waitloop: Sleep, 750 EnvSub, CardLoop, 1 SplashTextOn, 300, 100, Picture, Carding picture: %PicNum%. Seconds remaining: %CardLoop%. IfGreater, CardLoop, 0, Goto, waitloop SetEnv, CardLoop, %CardTime% Return SavePicture: SplashTextOn, 300, 100, Picture, Saving picture: %PicNum% WinActivate, Exploring Send, !a{UP}{ENTER}^a Send, {SHIFTDOWN}{F10}{SHIFTUP}{DOWN 2}{RIGHT}{UP}{ENTER} WinWaitActive, Busy ... WinWaitActive, Exploring - KODAK DC3400 Camera:\\DCIM\\100K3400 Send, {SHIFTDOWN}{F10}{SHIFTUP}{DOWN 3}{ENTER} WinWaitActive, Delete Selected File(s) Send, {ENTER} WinWaitActive, Exploring - KODAK DC3400 Camera:\\DCIM\\100K3400 WinActivate, KODAK DC3400 Camera Controls Return CloseExplorer: WinActivate, Exploring WinWaitActive, Exploring WinClose, Exploring Return WaitUntilTime: IfEqual, PicNum, 1, Goto, TheTimeIsNow KeepWaiting: ;Check if mouse cursor is in upper left of screen. If so, exit loop. MouseGetPos, MouseX, MouseY IfEqual, MouseX, 0, IfEqual, MouseY, 0, Goto, exit GoSub, GetCurrentTime SetEnv, TimeLeft, %NextTime% EnvSub, TimeLeft, %CurrentTime% IfLess, TimeLeft, 1, Goto, TheTimeIsNow SplashTextOn, 300, 100, Waiting, Waiting. %TimeLeft% seconds to go. Goto, KeepWaiting TheTimeIsNow: IfEqual, CurrentTime, 0, GoSub, GetCurrentTime SetEnv, NextTime, %CurrentTime% EnvAdd, NextTime, %Lapse% Return GetCurrentTime: SetEnv, CurrentTime, %A_MDAY% EnvMult, CurrentTime, 24 EnvAdd, CurrentTime, %A_HOUR% EnvMult, CurrentTime, 60 EnvAdd, CurrentTime, %A_MIN% EnvMult, CurrentTime, 60 EnvAdd, CurrentTime, %A_SEC% Return