### Script trimmed down ##### GET: getstore ('http://URL.com/tast.cfm?jump=true&dropboxvalue=0&nblock=50&Sort_By=INC_Incident.IncidentNumber&Sort_Type=ASC&displayColumnList=1,2,3,4,5,6,7', 'tempincid.html')or goto GET; my $html = 'tempincid.html'; my $te = HTML::TableExtract->new( headers => [("", "Incident # ", "Dispatch Time", "Incident Type", "Address", "Apt. #", "Postal Code", "Unit Dispatched")] ); $te->parse_file($html); $config{'header'} =<<"EOF"; ESSI | Online Home EOF my $file = "tempincid.html"; my $date = POSIX::strftime( "%c", localtime( ( stat $file )[9] ) ); my $row = @{$te->rows}; print $config{'header'}; print ""; foreach my $ts ($te->tables) { foreach my $row ($ts->rows) { print "" , "\n"; } } print "
", join(' ', @$row), "\n"; #########Every now and then the cell prints a stream of errors. I'm Guessing it is that character I can identify #### print "
", "Dispatcher data last read $date", ""; my $numColumns = @{$te->rows->[0]}; my $numRows = @{$te->rows}; for my $rowIndex ( 0..$numRows-3 ) { for my $columnIndex ( 0..$numColumns-1 ) { my $cellvalue = $te->rows->[$rowIndex][7]; foreach ($cellvalue) {chomp;} { $cellvalue=uc($cellvalue); if (($cellvalue =~ /BT/) || ($cellvalue =~ /FB/)) { my $path = "C:/incidentnum/"; my $cellmatch = $te->rows->[$rowIndex][$columnIndex]; #******************************************************************************************############################## #---------------Read each cell and as they are opened trim all whitespaces from the left and right side-----------------# #------There is still some non-viewable (Null space, non-printable character to the left of the incident number.--------# ######################################################################################################################### my $cell1=$te->rows->[$rowIndex][1]; $cell1 =~ s/^\s+|\s+//g; $cell1 =~ s/^\s+|\s(?=\s)|\s+$//g; my $cell2=$te->rows->[$rowIndex][2]; $cell2 =~ s/^\s+|\s+$//g; my $cell3=$te->rows->[$rowIndex][3]; $cell3 =~ s/^\s+|\s+$//g; my $cell4=$te->rows->[$rowIndex][4]; $cell4 =~ s/^\s+|\s+$//g; my $cell5=$te->rows->[$rowIndex][5]; $cell5 =~ s/^\s+|\s+$//g; my $cell7=$te->rows->[$rowIndex][7]; $cell7 =~ s/^\s+|\s+$//g; my $row="$cell1, $cell2, $cell3, $cell4, $cell5, $cell7"; my $filename = $cell1."."."txt"; $filename =~ s/^\s+|\s+$//g; #$filename =~ s/^S+|\S+$//g; $path =~ s/^\s+|\s+$//g; $path =~ s/^\s+|\s(?=\s)|\s+$//g; my $full ="$path$filename"; open (FILE, '>', $filename) or die("Couldn't open $filename"); print FILE "$row"; close(FILE)or die $!; my $powershell = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; my $mboxScript = 'C:\inetpub\cgi-bin\EmailAlert.ps1'; my $result = `$powershell -command "$mboxScript"`; print "$powershell\n"; print "$mboxScript\n"; goto EEND; } } } } EEND: exit 0;