#!/usr/bin/perl use strict; use warnings; use Win32::GuiTest qw[SendKeys WaitWindow FindWindowLike SetForegroundWindow]; my ($src_file, $tgt_file, $title) = @ARGV; ## Start QT system(1, 'C:\Program Files\QuickTime\QuickTimePlayer.exe', qq["$src_file"]); ## Delete any existing file by that name!!! unlink $tgt_file; ## Locate the window my $wid = WaitWindow("^$title", 2); die "Couldn't find QT" unless $wid; ## Make sure it is on top SetForegroundWindow($wid); sleep 1; ## Open the export dialog SendKeys "%FE"; sleep 1; ## Fill in the name and Save ## Assumes the dialog has remembered ## the appropriate settings for output format etc. SendKeys $tgt_file . "%S", 50; sleep 1; ## Sleep whilst the Export progress window is displayed sleep 1 while FindWindowLike(0, "^Progress"); ## Make sure it is still the active window SetForegroundWindow($wid); sleep 1; ## And exit SendKeys "%Fx";