dolly2011 has asked for the wisdom of the Perl Monks concerning the following question:
I have a script to automatically open the IE browser and capture 200 html files. For some reason, after it run 70 html file, it stopped bringing up IE. I could not figure out what went wrong.
The following is my perl script(Active perl, run on the window7):
$file=""; $name=""; $string=""; opendir(CURR,"C:/script") or die "Can't open directory: $!\n"; while(defined($file = readdir(CURR))) { if($file =~ m/(.*)\.html/) { $name = $1; print "name is $name;\n"; print "$file\n"; $capture_cmd = "C:/nircmd/nircmd.exe savescreenshot c:/script/ +$name.png"; $kill_cmd = "C:/nircmd/pskill.exe iexplore.exe"; print "string is $capture_cmd\n"; system (1, "C://iexplore.exe", "-k", "file:///C:/script/$file" +); #for IE sleep 2; if (system ($capture_cmd) != 0) { print "system command failed"; } if (system ($kill_cmd) != 0) { print "kill command failed"; } sleep 10; } } closedir(CURR);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl on window7
by bart (Canon) on May 03, 2011 at 05:23 UTC | |
|
Re: Perl on window7
by CountZero (Bishop) on May 03, 2011 at 06:09 UTC | |
|
Re: Perl on window7
by cdarke (Prior) on May 03, 2011 at 11:15 UTC |