Connecting Tech Pros Worldwide Forums | Help | Site Map

automatically running third-party tool for all files in folder

Newbie
 
Join Date: Jul 2009
Posts: 22
#1: Aug 10 '09
i am trying to make a script that recognizes all unparsed stream files from folder and runs an external tool in windows system to parse them. so far i am able to call that tool for all unparsed files. but after that we need to clcik "analyse" button in that tool. and after it analyse whole file for about 1 minute we need to click on "save " button i want to automate this .. means make a script that does click buttons on an external software automatically..

is this possible?

KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Aug 10 '09

re: automatically running third-party tool for all files in folder


The Expect module is probably what you want. If you are on Windows it only works when run in cygwin environment. I never use Expect so can't offer help with its actual usage.
nithinpes's Avatar
Expert
 
Join Date: Dec 2007
Posts: 400
#3: Aug 11 '09

re: automatically running third-party tool for all files in folder


If you are on Windows , you can make use of Win32::GuiTest to automate GUI related tasks (eg. clicking buttons).
Newbie
 
Join Date: Jul 2009
Posts: 22
#4: Aug 11 '09

re: automatically running third-party tool for all files in folder


Thanks all,

Well the problem is sorted out. i just omiited the gui version of running tool. it had a command line version too. i used that and it works and does well.
but it dint recognize some streams. i think probably some mistake in my if code

Expand|Select|Wrap|Line Numbers
  1.  
  2. my $dir="F:";
  3.  
  4. my ($stream_name,$stream_loc,$htmlstream,$stream,$txtstream,$docstream);
  5. my $count_present=0;
  6. my $count_absent=0;
  7. my $count_total=0;
  8.  
  9. find(\&edits,$dir);
  10.  
  11. sub edits
  12. {
  13.     #Finds files with following extensions
  14.     if(/\w+\...(dts|ts|trp|mpg)/i)    <=it doesnt recognize some streams with same extension....................
  15.     {
  16. $count_total++;                 #count the number of files found
  17. $stream_name=$_;             #name of stream
  18. $stream_loc=$File::Find::name;  #path of stream
  19.  
  20. my($stream_name, $stream_loc) = fileparse($stream_loc);
  21.  
  22. $stream_name=~ s/\..*//; #stripping off the stream extension
  23.     $htmlstream=$stream_loc.$stream_name.".html";                          $txtstream=$stream_loc.$stream_name.".txt";
  24.         $docstream=$stream_loc.$stream_name.".doc";
  25.         if((-e $htmlstream)||(-e $txtstream)|| (-e $docstream))
  26.         {
  27.         $count_present++;         #streams are present
  28.         }
  29.         else
  30.         {
  31.         $stream=$File::Find::name;
  32.         $count_absent++;          #streams are absent
  33.         push(@unparsed_files,$stream);    
  34.         }
  35.     }
  36. }
  37.  
  38.  
  39.  
nithinpes's Avatar
Expert
 
Join Date: Dec 2007
Posts: 400
#5: Aug 13 '09

re: automatically running third-party tool for all files in folder


The two extra dots(periods) that u put after '\.' will try match any two characters after dot and before the required extensions.

To check for those extensions, the following pattern should suffice:
Expand|Select|Wrap|Line Numbers
  1. if(/\.(dts|ts|trp|mpg)$/i)
  2.  
Reply