By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,834 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,834 IT Pros & Developers. It's quick & easy.

automatically running third-party tool for all files in folder

P: 22
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?
Aug 10 '09 #1
Share this Question
Share on Google+
4 Replies


KevinADC
Expert 2.5K+
P: 4,059
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.
Aug 10 '09 #2

nithinpes
Expert 100+
P: 410
If you are on Windows , you can make use of Win32::GuiTest to automate GUI related tasks (eg. clicking buttons).
Aug 11 '09 #3

P: 22
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.  
Aug 11 '09 #4

nithinpes
Expert 100+
P: 410
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.  
Aug 13 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.