我正在使用WinSendKeys程序(http://ath.dcmembers.com/wb/pages/software/winsendkeys.php)嘗試自動錄製連接的攝像機的視頻。使用WinSendKeys在批處理文件中自動執行的問題
這裏是我的設置:
我使用的是Windows Vista計算機與火線連接的攝像機。我使用Sony PlayMemories的PMBTapeImporter.exe(又名「從磁帶導入」)程序將視頻直接從攝像機錄製到電腦硬盤。我需要每30分鐘記錄1分鐘的視頻。
要自動執行此任務,我使用WinSendKeys和這個批處理文件:
REM Go to directory with the WinSendKeys program
cd \Users\Seibel\Documents\WinSendKeys
REM Start the program
start WinSendKeys.exe
REM Open PMBTapeImporter.exe, then after a 20,000 msec pause tab 5 times
WinSendKeys -x "C:\Program Files\Sony\PlayMemories Home\TapeImporter\PMBTapeImporter.exe" -xd 20000 -w PMBTapeImporter.exe {TAB}{TAB}{TAB}{TAB}{TAB}
REM Click the mouse 100 pixels down the "Import from Tape" window and 10 pixels inward (this is along the menu bar to bring this window to the front)
WinSendKeys -m "Import from Tape" #%,100,10
REM Click the space bar to select the highlighted "Import" button
WinSendKeys -w PMBTapeImporter.exe {SPACE}
FOR /L %%A IN (1,1,5) DO (
REM wait 10 seconds
timeout 10 /nobreak
WinSendKeys -m "Import from Tape" #%,100,10
REM select the button again to stop recording
WinSendKeys -w PMBTapeImporter.exe {SPACE}
REM wait 20 seconds
timeout 20 /nobreak
WinSendKeys -m "Import from Tape" #%,100,10
REM select the button to begin recording again
WinSendKeys -w PMBTapeImporter.exe {SPACE}
)
就目前而言,我只是錄製10秒的視頻,每20秒,直到我解決我的問題。
我的問題是,在for循環中的第一個WinSendKeys -w PMBTapeImporter.exe {SPACE}
命令從來沒有工作,我不明白爲什麼。 20秒暫停後的第二個WinSendKeys -w PMBTapeImporter.exe {SPACE}
總是有效,但從來沒有第一個。我究竟做錯了什麼?
附件是當該批處理文件運行時指向計算機視頻的鏈接。
https://www.dropbox.com/s/6sktsljp7un3bw4/issue.tvs?dl=0
出於好奇,任何想法,爲什麼這樣做工作,爲第二個相同的線? – CephBirk
@CephBirk對於我來說,有太多未知數據:首先,'WinSendKeys -m「從磁帶導入」#,100,10'命令做什麼(如批處理,如果不使用命令行中唯一的'%'_disappears_一個特殊的上下文)。第二,這種情況下'PMBTapeImporter'做了什麼? – JosefZ