Sign in to follow this  
Followers 0
amysue

how to maximize firefox window by using AutoitX in perl

3 posts in this topic

Hi,

I'm using activex in perl, I want to maximize firefox window when run C:Program FilesMozilla Firefoxfirefox.exe.

But the firefox is NOT launched by using 

$Au3->Run($exe, "", "SW_MAXIMIZE");

the firefox is launched by 

$Au3->Run($exe);

The firefox is launched but not default maximize.

The completely code is below

use strict;
use warnings;
use Win32::OLE;
use Getopt::Long;

my ($rc, $browser, $ip, $num, $exe);
$browser = 'firefox';
$ip      = '11.11.11.200:4433';
$num     = 10;

$rc = GetOptions (
    "b=s" => \$browser,
    "i=s" => \$ip,
    "n=s" => \$num,
 );
if ($browser eq 'firefox') {
    $exe = 'C:\Program Files\Mozilla Firefox\firefox.exe';
}
print "exe is ". $exe . "\n";
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE());
my $Au3 = Win32::OLE->new("AutoItX3.Control") or die "AutoIT dll not installed\n";
$Au3->Run($exe, "", "SW_MAXIMIZE");
sleep 5;

Share this post


Link to post
Share on other sites



You aren't supposed to send a string for that parameter. It should be the value $Au3->SW_MAXIMIZE.

Share this post


Link to post
Share on other sites

You aren't supposed to send a string for that parameter. It should be the value $Au3->SW_MAXIMIZE.

Thanks, use $Au3->SW_MAXIMIZE solve my problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0