automatically running third-party tool for all files in folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kanishka1213
    New Member
    • Jul 2009
    • 22

    automatically running third-party tool for all files in folder

    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
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    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.

    Comment

    • nithinpes
      Recognized Expert Contributor
      • Dec 2007
      • 410

      #3
      If you are on Windows , you can make use of Win32::GuiTest to automate GUI related tasks (eg. clicking buttons).

      Comment

      • kanishka1213
        New Member
        • Jul 2009
        • 22

        #4
        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

        Code:
        my $dir="F:";
        
        my ($stream_name,$stream_loc,$htmlstream,$stream,$txtstream,$docstream);
        my $count_present=0;
        my $count_absent=0;
        my $count_total=0;
        
        find(\&edits,$dir);
        
        sub edits
        {
        	#Finds files with following extensions
        	[B]if(/\w+\...(dts|ts|trp|mpg)/i)  [/B]  <=it doesnt recognize some streams with same extension....................
        	{
        $count_total++;	     		#count the number of files found
        $stream_name=$_;     		#name of stream
        $stream_loc=$File::Find::name;  #path of stream
        	
        my($stream_name, $stream_loc) = fileparse($stream_loc);
        		
        $stream_name=~ s/\..*//; #stripping off the stream extension
        	$htmlstream=$stream_loc.$stream_name.".html";  		                $txtstream=$stream_loc.$stream_name.".txt";
        		$docstream=$stream_loc.$stream_name.".doc";
        		if((-e $htmlstream)||(-e $txtstream)|| (-e $docstream))
        		{
        		$count_present++; 		#streams are present
        		}
        		else
        		{
        		$stream=$File::Find::name;
        		$count_absent++;  		#streams are absent
        		push(@unparsed_files,$stream);	
        		}
        	}
        }

        Comment

        • nithinpes
          Recognized Expert Contributor
          • Dec 2007
          • 410

          #5
          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:
          Code:
          if(/\.(dts|ts|trp|mpg)$/i)

          Comment

          Working...