;****************************************************************** ;* Single-button tool to shoot consecutive screenshots * ;* of a Zoom session that is distributed over several screenshots * ;****************************************************************** ;* Version 1.0.1 * (c) 2021, 2022 by Jochen Hilkert * ;****************************************************************** #include #include #include #include #include #include Opt("GUIOnEventMode", 1) ;_DebugSetup () ; defaults Const $TotalShotCountDefault = 2 Const $PageDelayDefault = 300; milliseconds between clicking page button repeatedly Const $PathDefault = _WinAPI_ShellGetSpecialFolderPath($CSIDL_PERSONAL) & "\ZoomShot\" Const $FilePrefixDefault = "ZoomShot" Const $AutoResetDefault = False ; registry names Const $RegKey = "HKEY_CURRENT_USER\SOFTWARE\HIT\ZoomShot" Const $RegValTotalShotCount = "TotalShotCount" Const $RegValPageDelay = "PageDelay" Const $RegValPath = "Path" Const $RegValFilePrefix = "FilePrefix" Const $RegValAutoReset = "AutoReset" ; general settings AutoItSetOption ( "WinTitleMatchMode" , 2 ) ; match any substring Const $GUIName = "ZoomScreenShot" Const $SettingsGUIName = "ZoomScreenShotSetting" Const $ZoomWindowName = "Zoom " ; Space at the end distiguishes between Zoom windows to get the meeting window Const $ZoomPageRightControlName = "VideoPaginationBarWndCls1" Const $ZoomPageLeftControlName = "VideoPaginationBarWndCls2" Const $PicViewerWindowName = "IrfanView" Const $SaveDialogName = "Save Picture As ..." Const $ClearPicKeys = "!ed"; Alt-E D Const $PasteKeys = "^v" ; Ctrl-V Const $SaveDialogKeys = "!fs" ; Alt-F (File Menu) S (Save As) ;Const $SaveButtonKeys = "!s" ; Alt-S ;Const $SaveButtonKeys = "{TAB}!s" ; Alt-S Const $SaveButtonKeys = "{ENTER}" ;Const $SaveButtonKeys = "{TAB}{ENTER}" Const $Timestamp = "" ; declare public var, since it will get modified from within a Func Const $SaveFileNameConrolName = "Edit1" Const $ProgramsPath = _WinAPI_ShellGetSpecialFolderPath($CSIDL_PROGRAM_FILES) Const $ProgramsPathX86 = _WinAPI_ShellGetSpecialFolderPath($CSIDL_PROGRAM_FILESX86) Const $PicViewerProg1 = $ProgramsPath & "\IrfanView\i_view64.exe" Const $PicViewerProg2 = $ProgramsPathX86 & "\IrfanView\i_view32.exe" Const $PicViewerProg3 = $ProgramsPath & "\IrfanView\i_view32.exe" Global $ShotCount ;i18n Const $i18nRegSubKey = "locale" Const $i18nRegVal_BtnReset = "BtnReset" Const $i18nRegVal_BtnNext = "BtnNext" Const $i18nRegVal_BtnSetup = "BtnSetup" Const $i18nRegVal_LblStepPageHome = "LblStepPageHome" Const $i18nRegVal_LblStepPageRight = "LblStepPageRight" Const $i18nRegVal_LblStepShoot = "LblStepShoot" Const $i18nRegVal_LblClearPic = "LblClearPic" Const $i18nRegVal_LblStepPasteShot = "LblStepPasteShot" Const $i18nRegVal_LblStepOpenSaveDialog = "LblStepOpenSaveDialog" Const $i18nRegVal_LblStepSetFileName4Save = "LblStepSetFileName4Save" Const $i18nRegVal_LblStepDoSave = "LblStepDoSave" Const $i18nRegVal_LblStepShotSetCompleted = "LblStepCompleted" Const $i18nRegVal_LblTotalShotCountPre = "LblTotalShotCountPre" Const $i18nRegVal_LblTotalShotCountPost = "LblTotalShotCountPost" Const $i18nRegVal_LblPageDelayPre = "LblPageDelayPre" Const $i18nRegVal_LblPageDelayPost = "LblPageDelayPPost" Const $i18nRegVal_LblPath = "LblPath" Const $i18nRegVal_LblFilePrefix = "LblFilePrefix" Const $i18nRegVal_LblAutoReset = "LblAutoReset" Const $i18n_BtnResetDefault = "Reset" Const $i18n_BtnNextDefault = "Next" Const $i18n_BtnSetupDefault = "Setup" Const $i18n_LblStepPageHomeDefault = "page home" Const $i18n_LblStepPageRightDefault = "page right" Const $i18n_LblStepShootDefault = "shoot screen" Const $i18n_LblStepPasteShotDefault = "paste to IrfanView" Const $i18n_LblClearPicDefault = "clear picture" Const $i18n_LblStepOpenSaveDialogDefault = "open Save dialog" Const $i18n_LblStepSetFileName4SaveDefault = "set File name for Save" Const $i18n_LblStepShotSetCompletedDefault = "*** Completed ***" Const $i18n_LblStepDoSaveDefault = "Save the file" Const $i18n_LblTotalShotCountPreDefault = "total" Const $i18n_LblTotalShotCountPostDefault = "shots per set" Const $i18n_LblPageDelayPreDefault = "wait" Const $i18n_LblPageDelayPostDefault = "ms between page" Const $i18n_LblPathDefault = "path" Const $i18n_LblFilePrefixDefault = "prefix for file name" Const $i18n_LblAutoResetDefault = "automatic reset after completion" ReadLocaleFromRegistry () ReadSettingsFromRegistry () BuildActions () BuildSettingsGUI () BuildGUI () ResetShooter () While True Sleep (10) WEnd Func ReadLocaleFromRegistry () Local $i18nRegKey = $RegKey & "\" & $i18nRegSubKey Global $i18n_BtnReset = RegRead ($i18nRegKey, $i18nRegVal_BtnReset) If @error <> 0 Then $i18n_BtnReset = $i18n_BtnResetDefault RegWrite ($i18nRegKey, $i18nRegVal_BtnReset, "REG_SZ", $i18n_BtnReset) EndIf Global $i18n_BtnNext = RegRead ($i18nRegKey, $i18nRegVal_BtnNext) If @error <> 0 Then $i18n_BtnNext = $i18n_BtnNextDefault RegWrite ($i18nRegKey, $i18nRegVal_BtnNext, "REG_SZ", $i18n_BtnNext) EndIf Global $i18n_BtnSetup = RegRead ($i18nRegKey, $i18nRegVal_BtnSetup) If @error <> 0 Then $i18n_BtnSetup = $i18n_BtnSetupDefault RegWrite ($i18nRegKey, $i18nRegVal_BtnSetup, "REG_SZ", $i18n_BtnSetup) EndIf Global $i18n_LblStepPageHome = RegRead ($i18nRegKey, $i18nRegVal_LblStepPageHome) If @error <> 0 Then $i18n_LblStepPageHome = $i18n_LblStepPageHomeDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepPageHome, "REG_SZ", $i18n_LblStepPageHome) EndIf Global $i18n_LblStepPageRight = RegRead ($i18nRegKey, $i18nRegVal_LblStepPageRight) If @error <> 0 Then $i18n_LblStepPageRight = $i18n_LblStepPageRightDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepPageRight, "REG_SZ", $i18n_LblStepPageRight) EndIf Global $i18n_LblStepShoot = RegRead ($i18nRegKey, $i18nRegVal_LblStepShoot) If @error <> 0 Then $i18n_LblStepShoot = $i18n_LblStepShootDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepShoot, "REG_SZ", $i18n_LblStepShoot) EndIf Global $i18n_LblClearPic = RegRead ($i18nRegKey, $i18nRegVal_LblClearPic) If @error <> 0 Then $i18n_LblClearPic = $i18n_LblClearPicDefault RegWrite ($i18nRegKey, $i18nRegVal_LblClearPic, "REG_SZ", $i18n_LblClearPic) EndIf Global $i18n_LblStepPasteShot = RegRead ($i18nRegKey, $i18nRegVal_LblStepPasteShot) If @error <> 0 Then $i18n_LblStepPasteShot = $i18n_LblStepPasteShotDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepPasteShot, "REG_SZ", $i18n_LblStepPasteShot) EndIf Global $i18n_LblStepOpenSaveDialog = RegRead ($i18nRegKey, $i18nRegVal_LblStepOpenSaveDialog) If @error <> 0 Then $i18n_LblStepOpenSaveDialog = $i18n_LblStepOpenSaveDialogDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepOpenSaveDialog, "REG_SZ", $i18n_LblStepOpenSaveDialog) EndIf Global $i18n_LblStepSetFileName4Save = RegRead ($i18nRegKey, $i18nRegVal_LblStepSetFileName4Save) If @error <> 0 Then $i18n_LblStepSetFileName4Save = $i18n_LblStepSetFileName4SaveDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepSetFileName4Save, "REG_SZ", $i18n_LblStepSetFileName4Save) EndIf Global $i18n_LblStepDoSave = RegRead ($i18nRegKey, $i18nRegVal_LblStepDoSave) If @error <> 0 Then $i18n_LblStepDoSave = $i18n_LblStepDoSaveDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepDoSave, "REG_SZ", $i18n_LblStepDoSave) EndIf Global $i18n_LblStepShotSetCompleted = RegRead ($i18nRegKey, $i18nRegVal_LblStepShotSetCompleted) If @error <> 0 Then $i18n_LblStepShotSetCompleted = $i18n_LblStepShotSetCompletedDefault RegWrite ($i18nRegKey, $i18nRegVal_LblStepShotSetCompleted, "REG_SZ", $i18n_LblStepShotSetCompleted) EndIf Global $i18n_LblTotalShotCountPre = RegRead ($i18nRegKey, $i18nRegVal_LblTotalShotCountPre) If @error <> 0 Then $i18n_LblTotalShotCountPre = $i18n_LblTotalShotCountPreDefault RegWrite ($i18nRegKey, $i18nRegVal_LblTotalShotCountPre, "REG_SZ", $i18n_LblTotalShotCountPre) EndIf Global $i18n_LblTotalShotCountPost = RegRead ($i18nRegKey, $i18nRegVal_LblTotalShotCountPost) If @error <> 0 Then $i18n_LblTotalShotCountPost = $i18n_LblTotalShotCountPostDefault RegWrite ($i18nRegKey, $i18nRegVal_LblTotalShotCountPost, "REG_SZ", $i18n_LblTotalShotCountPost) EndIf Global $i18n_LblPageDelayPre = RegRead ($i18nRegKey, $i18nRegVal_LblPageDelayPre) If @error <> 0 Then $i18n_LblPageDelayPre = $i18n_LblPageDelayPreDefault RegWrite ($i18nRegKey, $i18nRegVal_LblPageDelayPre, "REG_SZ", $i18n_LblPageDelayPre) EndIf Global $i18n_LblPageDelayPost = RegRead ($i18nRegKey, $i18nRegVal_LblPageDelayPost) If @error <> 0 Then $i18n_LblPageDelayPost = $i18n_LblPageDelayPostDefault RegWrite ($i18nRegKey, $i18nRegVal_LblPageDelayPost, "REG_SZ", $i18n_LblPageDelayPost) EndIf Global $i18n_LblPath = RegRead ($i18nRegKey, $i18nRegVal_LblPath) If @error <> 0 Then $i18n_LblPath = $i18n_LblPathDefault RegWrite ($i18nRegKey, $i18nRegVal_LblPath, "REG_SZ", $i18n_LblPath) EndIf Global $i18n_LblFilePrefix = RegRead ($i18nRegKey, $i18nRegVal_LblFilePrefix) If @error <> 0 Then $i18n_LblFilePrefix = $i18n_LblFilePrefixDefault RegWrite ($i18nRegKey, $i18nRegVal_LblFilePrefix, "REG_SZ", $i18n_LblFilePrefix) EndIf Global $i18n_LblAutoReset = RegRead ($i18nRegKey, $i18nRegVal_LblAutoReset) If @error <> 0 Then $i18n_LblAutoReset = $i18n_LblAutoResetDefault RegWrite ($i18nRegKey, $i18nRegVal_LblAutoReset, "REG_SZ", $i18n_LblAutoReset) EndIf EndFunc Func ReadSettingsFromRegistry () ; from previous run Global $TotalShotCount = RegRead ($RegKey, $RegValTotalShotCount) If @error <> 0 Then $TotalShotCount = $TotalShotCountDefault RegWrite ($RegKey, $RegValTotalShotCount, "REG_SZ", $TotalShotCount) EndIf Global $PageDelay = RegRead ($RegKey, $RegValPageDelay) If @error <> 0 Then $PageDelay = $PageDelayDefault RegWrite ($RegKey, $RegValPageDelay, "REG_SZ", $PageDelayDelay) EndIf Global $Path = RegRead ($RegKey, $RegValPath) If @error <> 0 Then $Path = $PathDefault RegWrite ($RegKey, $RegValPath, "REG_SZ", $Path) EndIf AssertPath () Global $FilePrefix = RegRead ($RegKey, $RegValFilePrefix) If @error <> 0 Then $FilePrefix = $FilePrefixDefault RegWrite ($RegKey, $RegValFilePrefix, "REG_SZ", $FilePrefix) EndIf Global $AutoReset = ( RegRead ($RegKey, $RegValAutoReset) = 1 ) If @error <> 0 Then $AutoReset = $AutoResetDefault RegWrite ($RegKey, $RegValAutoReset, "REG_SZ", $AutoReset?1:0) EndIf EndFunc Func BuildActions() _DebugOut ("BuildActions") Global $NextAction = 0 Global $Actions [1][4] ;Structure: ;Interactive, ActionLabel, FunctionName, Parameters ;----------- ------------ ----------- ---------- ;| | | | ;| | | +- for function call ;| | +- Name of Func to be performed ;| +- Text for label in GUI to be displayed ;| while waiting for button ;+- wait for Button before execution Local $Params = [] AddAction (True, $i18n_LblStepPageHome, "PageHome", $Params) Local $Params = [] AddAction (False, "", "ResetShotCount", $Params) For $ShotCount = 1 To $TotalShotCount Local $Params = [] AddAction (False, "increment ShotCount", "incShotCount", $Params) If $ShotCount <> 1 Then Local $Params = [] AddAction (True, $i18n_LblStepPageRight, "PageRight", $Params) EndIf ; Local $Params = [True]; get TimeStamp during first shot Local $Params = [False]; do not get TimeStamp during first shot AddAction (True, $i18n_LblStepShoot, "ShootScreen", $Params) If $ShotCount = 1 Then Local $Params = [] AddAction (False, "", "TimeStamp2FileNameFix", $Params) Local $Params = [] AddAction (False, "", "AssertPath", $Params) EndIf Local $Params = [] AddAction (False, "", "AssertPicViewerRunning", $Params) Local $Params = [] AddAction (False, "", "AssertSaveDialogClosed", $Params) Local $Params = [] AddAction (False, $i18n_LblClearPic, "ClearPic", $Params) Local $Params = [] AddAction (True, $i18n_LblStepPasteShot, "PasteShot", $Params) Local $Params = [] AddAction (True, $i18n_LblStepOpenSaveDialog, "OpenSaveDialog", $Params) Local $Params = [] AddAction (True, $i18n_LblStepSetFileName4Save, "SetFileName4Save", $Params) Local $Params = [] AddAction (True, $i18n_LblStepDoSave, "DoSave", $Params) Next Local $Params = [] AddAction (True, $i18n_LblStepShotSetCompleted, "ShotSetCompleted", $Params) EndFunc Func AddAction ($Interactive, $ActionLabel, $FunctionName, ByRef $Params) Redim $Actions [$NextAction+1] [4] $Actions [$NextAction] [0] = $Interactive $Actions [$NextAction] [1] = $ActionLabel $Actions [$NextAction] [2] = $FunctionName $Actions [$NextAction] [3] = $Params $NextAction += 1 EndFunc Func BuildGUI () Global $hGUI = GUICreate ($GUIName, 300, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "DoClose") Global $ButtonReset = GUICtrlCreateButton ($i18n_BtnReset, 10, 10) GUICtrlSetOnEvent (-1, "ResetShooter") Global $ButtonNext = GUICtrlCreateButton ($i18n_BtnNext, 80, 10, 120, 50) GUICtrlSetOnEvent (-1, "DoNextAction") Global $ButtonSetup = GUICtrlCreateButton ($i18n_BtnSetup, 240, 20) GUICtrlSetOnEvent (-1 , "ShowSettingsGUI") GUICtrlCreateLabel ("#", 12, 42) Global $LabelShotCount = GUICtrlCreateLabel ("0", 30, 42) Global $LabelNext = GUICtrlCreateLabel ( " ", 10, 70, 280) GUISetState (@SW_SHOW, $hGUI) EndFunc Func PrepareOrDoNextAction () _DebugOut ("ShotCount=" & $ShotCount & ", NextAction=" & $NextAction) GUICtrlSetData ($LabelShotCount, $ShotCount) GUICtrlSetData ($LabelNext, $Actions [$NextAction] [1]) If $Actions [$NextAction] [0] Then ;Interactive WinActivate ($GUIName) ControlFocus ($GUIName, "", $ButtonNext) Else ;Batch DoNextAction () EndIf EndFunc Func DoNextAction () _DebugOut ("DoNextAction") if UBound ($Actions [$NextAction] [3]) > 0 Then ;parameters exist Call ($Actions [$NextAction] [2], $Actions [$NextAction] [3]) Else ; no parameters Call ($Actions [$NextAction] [2]) EndIf $NextAction += 1 If $NextAction >= UBound ($Actions) Then _DebugOut ("last Action over") If $AutoReset Then $NextAction = 0 PrepareOrDoNextAction () Else GUICtrlSetState ($ButtonNext, $GUI_DISABLE) EndIf Else PrepareOrDoNextAction () EndIf EndFunc Func DoClose() _DebugOut ("close") Exit EndFunc Func BuildSettingsGUI () _DebugOut ("build SettingsGUI") Global $hSettingsGUI = GUICreate ($SettingsGUIName, 300, 165) GUISetOnEvent($GUI_EVENT_CLOSE, "DoCloseSettings") GUICtrlCreateLabel ($i18n_LblTotalShotCountPre, 10, 13, 40) Global $TotalShotCountInput = GUICtrlCreateInput ($TotalShotCount, 50, 10, 30) GUICtrlSetOnEvent (-1, "UpdateTotalShotCount") GUICtrlCreateLabel ($i18n_LblTotalShotCountPost, 90, 13) GUICtrlCreateLabel ($i18n_LblPageDelayPre, 10, 43, 40) Global $PageDelayInput = GUICtrlCreateInput ($PageDelay, 50, 40, 30) GUICtrlSetOnEvent (-1, "UpdatePageDelay") GUICtrlCreateLabel ($i18n_LblPageDelayPost, 90, 43) GUICtrlCreateLabel ($i18n_LblPath, 10, 73, 40) Global $PathInput = GUICtrlCreateInput ($Path, 50, 70, 210) GUICtrlSetOnEvent (-1, "UpdatePath") GUICtrlCreateLabel ($i18n_LblFilePrefix, 10, 103, 120) Global $FilePrefixInput = GUICtrlCreateInput ($FilePrefix, 120, 100, 140) GUICtrlSetOnEvent (-1, "UpdateFilePrefix") Global $AutoResetCheckbox = GUICtrlCreateCheckbox ($i18n_LblAutoReset, 10, 130) GUICtrlSetOnEvent (-1, "UpdateAutoReset") GUICtrlSetState ($AutoResetCheckbox, $AutoReset:$GUI_CHECKED:$GUI_UNCHECKED) EndFunc Func ShowSettingsGUI () GUISetState (@SW_SHOW, $hSettingsGUI) WinActivate ($hSettingsGUI) EndFunc Func UpdateTotalShotCount () $TotalShotCount = GUICtrlRead ($TotalShotCountInput) _DebugOut ("TotalShotCount=" & $TotalShotCount) RegWrite ($RegKey, $RegValTotalShotCount, "REG_SZ", $TotalShotCount) BuildActions () ResetShooter () EndFunc Func UpdatePageDelay () $PageDelay = GUICtrlRead ($PageDelayInput) _DebugOut ("PageDelay=" & $PageDelay) RegWrite ($RegKey, $RegValPageDelay, "REG_SZ", $PageDelay) EndFunc Func UpdatePath () $Path = GUICtrlRead ($PathInput) _DebugOut ("Path=" & $Path) if StringRight ($Path, 1) <> "\" Then $Path = $Path & "\" GUICtrlSetData ($PathInput, $Path) EndIf RegWrite ($RegKey, $RegValPath, "REG_SZ", $Path) AssertPath () EndFunc Func UpdateFilePrefix () $FilePrefix = GUICtrlRead ($FilePrefixInput) _DebugOut ("FilePrefix=" & $FilePrefix) RegWrite ($RegKey, $RegValFilePrefix, "REG_SZ", $FilePrefix) EndFunc Func UpdateAutoReset () $AutoReset = ( GUICtrlRead ($AutoResetCheckbox) = $GUI_CHECKED ) _DebugOut ("AutoReset=" & $AutoReset) RegWrite ($RegKey, $RegValAutoReset, "REG_SZ", $AutoReset?1:0) EndFunc Func DoCloseSettings () GUISetState (@SW_HIDE, $hSettingsGUI) WinActivate ($GUIName) EndFunc Func ResetShotCount () $ShotCount = 0 EndFunc Func IncShotCount () $ShotCount += 1 EndFunc Func ShootScreen (ByRef $Params) ; Params: [DoCreateFileNameInfix] Local $CreateFileNameInfix = $Params[0] If $CreateFileNameInfix Then TimeStamp2FileNameFix() If WinActivate ( $ZoomWindowName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $ZoomWindowName) Else Send ( "!{PRINTSCREEN}" ) EndIf EndFunc Func AssertPath () If FileExists ($Path) Then Local $FileAttrib = FileGetAttrib ($Path) If StringRegExp ($FileAttrib, ".*D.*") = 0 Then MsgBox ($MB_ICONERROR, "This is NOT a Directory", $Path) EndIf Else If DirCreate ($Path) = 0 Then MsgBox ($MB_ICONERROR, "Directory cannot be created", $Path) EndIf EndIf EndFunc Func AssertSaveDialogClosed () While WinWaitClose ($SaveDialogName, "", 3) = 0 ; make sure previous save file action completed MsgBox ($MB_ICONERROR, "Save dialog still open", "Make sure save dialog is closed before continuing!") WEnd EndFunc Func AssertPicViewerRunning () While WinExists ($PicViewerWindowName) = 0 ;$PicViewerPID = ShellExecute ($PicViewerProg1) $PicViewerPID = Run ($PicViewerProg1) If $PicViewerPID <= 0 Then $PicViewerPID = Run ($PicViewerProg2) If $PicViewerPID <= 0 Then $PicViewerPID = Run ($PicViewerProg3) If $PicViewerPID <= 0 Then MsgBox ($MB_ICONERROR, "Picture viewer not available", "Please start IrfanView before continuing!") Else If WinWait ($PicViewerWindowName, "", 15) = 0 Then MsgBox ($MB_ICONERROR, $PicViewerWindowName & " did not open", "open it manually before continuing") $PicViewerPID = 0 EndIf EndIf WEnd EndFunc Func ClearPic () If WinActivate ( $PicViewerWindowName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $PicViewerWindowName) Else Send ( $ClearPicKeys ) EndIf EndFunc Func PasteShot () If WinActivate ( $PicViewerWindowName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $PicViewerWindowName) Else Send ( $PasteKeys ) EndIf EndFunc Func OpenSaveDialog () If WinActivate ( $PicViewerWindowName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $PicViewerWindowName) Else Send ( $SaveDialogKeys ) EndIf EndFunc Func SetFileName4Save () Local $FileName = $FileNameFix & $ShotCount If WinActivate ( $SaveDialogName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $SaveDialogName) Else ControlFocus ( $SaveDialogName, "", $SaveFileNameConrolName ) ; Sleep ($Delay) If ControlSetText ( $SaveDialogName, "", $SaveFileNameConrolName, $FileName ) = 0 Then MsgBox ($MB_ICONERROR, "filename has not been set - please set manually", $FileName) EndIf ; ControlCommand ( $SaveDialogName, "", $SaveFileNameConrolName, "EditPaste", $FileName ) EndIf EndFunc Func DoSave () If WinActivate ( $SaveDialogName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $SaveDialogName) Else Send ( $SaveButtonKeys ) EndIf EndFunc Func PageRight () If WinActivate ( $ZoomWindowName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $ZoomWindowName) Else ControlClick ( $ZoomWindowName, "", $ZoomPageRightControlName ) EndIf EndFunc Func PageHome () If WinActivate ( $ZoomWindowName ) = 0 Then MsgBox ($MB_ICONERROR, "Window could not be activated", $ZoomWindowName) Else For $i = 2 to $TotalShotCount ; go to the very left screen ControlClick ( $ZoomWindowName, "", $ZoomPageLeftControlName ) Sleep ($PageDelay) Next EndIf EndFunc Func ShotSetCompleted () ; GUICtrlSetState ($ButtonNext, $GUI_DISABLE) EndFunc Func TimeStamp2FileNameFix() Global $FileNameFix = $Path & $FilePrefix & "_" _ & @YEAR & "-" & @MON & "-" & @MDAY & "_" _ & @HOUR & "-" & @MIN & "-" & @SEC & "_" & @MSEC & "_" EndFunc Func ResetShooter () _DebugOut ("call reset shot count") ResetShotCount() _DebugOut ("call page home") PageHome() _DebugOut ("call preDoNext ") $NextAction = 0 PrepareOrDoNextAction() _DebugOut ("enable Next button") GUICtrlSetState ($ButtonNext, $GUI_ENABLE) EndFunc