Jump to content
Sign in to follow this  

how to maximize firefox window by using AutoitX in perl

Recommended Posts


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 


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      = '';
$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";
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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...