#include #include #include #include #include #include #include #include #include #include #include #include #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Multicam Manager", 943, 662, 100, -12) Global $MenuItem5 = GUICtrlCreateMenu("&MenuItem5") Global $MenuItem4 = GUICtrlCreateMenu("M&enuItem4") Global $MenuItem3 = GUICtrlCreateMenu("Me&nuItem3") Global $MenuItem2 = GUICtrlCreateMenu("Men&uItem2") Global $MenuItem1 = GUICtrlCreateMenu("Menu&Item1") GUISetBkColor(0xA6CAF0) Global $StatusBar1 = _GUICtrlStatusBar_Create($Form1) _GUICtrlStatusBar_SetMinHeight($StatusBar1, 50 ) Global $Tab1 = GUICtrlCreateTab(4, 17, 852, 590) Global $TabSheet1 = GUICtrlCreateTabItem("connection management") Global $Label1 = GUICtrlCreateLabel("Check (edit if necessary) the following directory as that in which file chdkptp.exe resides", 24, 70, 520, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $chdk_path = GUICtrlCreateEdit("C:\CHDKPTP\", 24, 96, 420, 20) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("You selected the following directory as that in which file chdkptp.exe resides", 24, 130, 440, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $start_chdkptp = GUICtrlCreateButton("PRESS TO: start chdkptp", 24, 190, 156, 26) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $initial_connection_to_all_cameras = GUICtrlCreateButton("PRESS TO: create initial connection information for all cameras ", 24, 250, 380, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $edit_id_assigned_to_cameras = GUICtrlCreateButton("PRESS TO: edit the random ID initially assigned to each camera serial number connection", 24, 310, 517, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $start_the_scripts_on_all_cameras = GUICtrlCreateButton("PRESS TO: start camera side script on all cameras", 24, 370, 297, 30) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $start_record_mode_on_all_cameras = GUICtrlCreateButton("PRESS TO: select record mode on all cameras", 24, 421, 271, 31) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $start_playback_mode_on_all_cameras = GUICtrlCreateButton("PRESS TO: select play mode on all cameras", 24, 469, 261, 31) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $stop_the_scripts_on_all_cameras = GUICtrlCreateButton("PRESS TO: stop camera side script on all cameras", 24, 530, 294, 27) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $close_chdkptp = GUICtrlCreateButton("PRESS TO: close chdkptp", 24, 570, 158, 27) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $exitbutton = GUICtrlCreateButton("Exit", 400, 570, 150, 27) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $List1 = GUICtrlCreateList("", 606, 129, 185, 435) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $TabSheet2 = GUICtrlCreateTabItem("set zoom & aperture") Global $set_zoom = GUICtrlCreateButton("Press to: set zoom", 24, 70, 193, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $set_aperture = GUICtrlCreateButton("Press to: set aperture at this zoom", 24, 130, 209, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $TabSheet3 = GUICtrlCreateTabItem("process management") Global $init_sync = GUICtrlCreateButton("Press to: init_sync", 24, 60, 161, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $pre_shoot = GUICtrlCreateButton("Press to: preshoot", 24, 120, 161, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $shoot_hook_sync = GUICtrlCreateButton("Press to: shoot", 24, 180, 161, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $download = GUICtrlCreateButton("Download Images", 24, 240, 161, 33) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $TabSheet4 = GUICtrlCreateTabItem("individual camera control") Global $TabSheet5 = GUICtrlCreateTabItem("downloaded file management") Global $TabSheet6 = GUICtrlCreateTabItem("for further development") GUICtrlSetFont(-1, 8.5, 400, 0, "MS Shell Dlg", 5) GUICtrlSetFont(-1, 8.5, 400, 0, "MS Shell Dlg", 5) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start_chdkptp $user_path_provided=GUICtrlRead($chdk_path) loadchdkptp($user_path_provided) ;_TalkOBJ('multi cam file has successfully loaded. Continue with pre shoot.') Case $initial_connection_to_all_cameras mc_require() mc_connect() Case $start_the_scripts_on_all_cameras mc_start() Case $start_record_mode_on_all_cameras mc_record() Case $start_playback_mode_on_all_cameras mc_playback() Case $stop_the_scripts_on_all_cameras mc_exit() Case $close_chdkptp closechdkptp($processid0) Case $exitbutton Exit EndSwitch WEnd Func loadchdkptp($the_path_passed_in) $path1 = '"' $path2 = $the_path_passed_in $path3 = "chdkptp.exe" $path4 = "-i" $path5 = '"' $path6 = "," $path7 = '"' $path8 = '"' $path9 = "," $path10 = "@SW_MAXIMIZE" $final_path = $path1 & $path2 & $path3 & " " & $path4 & $path5 & $path6 & " " & $path7 & $path8 & $path9 & " " & $path10 ;$path2 = "\chdkptp.exe" ;$final_path1 = $path1 & $aa + 1 & $path2; => for Run command ;$final_path2 = $path1 & $aa + 1; => for WinWaitActive & WinActivate command ;$arg1 = "-i" ;e.g Run("C:\CHDK\chdkptp\chdkptp-r438-win32\instance1\chdkptp.exe -i", "", @SW_MAXIMIZE) ;$chdkptp_processid[$aa] = Run($final_path1 & " " & $arg1) ;This works fine => Global $processid0 = Run("C:\CHDKPTP\chdkptp.exe -i", "", @SW_MAXIMIZE) Global $processid0 = Run($final_path) ;this hangs GUICtrlSetData($chdk_path, $final_path) ;what's wrong? WinWaitActive("C:\CHDKPTP\chdkptp.exe") WinActivate("C:\CHDKPTP\chdkptp.exe") EndFunc Func mc_require() WinActivate("C:\CHDKPTP\chdkptp.exe") Send("{!}mc=require('multicam'){Enter}") Sleep (500) EndFunc Func mc_connect() WinActivate("C:\CHDKPTP\chdkptp.exe") Send("{!}mc:connect(){Enter}") Sleep (5000) EndFunc Func mc_start() WinActivate("C:\CHDKPTP\chdkptp.exe") Send("{!}mc:start(){Enter}") Sleep (500) EndFunc Func mc_record() WinActivate("C:\CHDKPTP\chdkptp.exe") Send("{!}return mc:cmdwait('rec'){Enter}") EndFunc Func mc_playback() WinActivate("C:\CHDKPTP\chdkptp.exe") Send("{!}return mc:cmdwait('play'){Enter}") EndFunc Func mc_exit() WinActivate("C:\CHDKPTP\chdkptp.exe") Send("{!}mc:cmd('exit'){Enter}") EndFunc Func closechdkptp($x) ProcessClose($x) EndFunc Func _TalkOBJ($s_text) Local $o_speech = ObjCreate("SAPI.SpVoice") $o_speech.Speak($s_text) $o_speech = "" EndFunc