On 13/11/2004, at 5:48 AM, Sherm Pendley wrote:
If BBEdit can be driven via AppleScript, you should also be able to use Mac::Glue to drive it. Or, you could run your AppleScript with the "osascript" tool.

That got me on the right track -- to the extent that this is already working:


#!/usr/bin/perl
use strict;
use Mac::AppleScript::Glue;
use LWP::Simple;
print "Enter URL:\n -> ";
my $URL = <STDIN> || die "$!";

getstore( $URL, "/path/to/tempfile.html" ) || die;

my $BB = new Mac::AppleScript::Glue::Application('BBEdit')
  || die "$!";

my $results =
  $BB->check_syntax(
    file => "path:to:tempfile.html" )
  || die "$!";

foreach my $item ( @{$results} ) {
    print 'Line '
      . $item->{'result_line'} . ': '
      . $item->{'message'} . "\n";
}


I don't quite understand the results data that's coming back from the Glue object, but the basics are already there. Of course if it was going to be a CGI script there's a lot of other stuff to do but the concept is proven at least.




Reply via email to