Sparrowlord Posted January 24, 2010 Share Posted January 24, 2010 (edited) Hi, I'm trying to use "WinSetState($title, "", @SW_MAXIMIZE)" in my script to make IE8 maximize, however this just creates a blank IE shell window.. and doesn't actually make the window I want bigger. Edit: After some more failed attempts I finally realized the problem. Using WinSetState only works on the 64 bit version of Windows Internet Explorer (Default _IECreate), however I have to use the 32-bit version of Windows Internet Explorer because I have to work with a flash application. Here's the code I'm trying to use on the 32-bit browser: #include <IE.au3> Opt("WinTitleMatchMode", 2) Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe") WinWait("- Windows Internet Explorer") WinSetState("Windows Internet Explorer", "", @SW_MAXIMIZE) Attached is a screenshot of what happens to the browser window. Edited January 25, 2010 by Sparrowlord Link to comment Share on other sites More sharing options...
Sparrowlord Posted January 24, 2010 Author Share Posted January 24, 2010 Also I'm using windows 7 thanks Link to comment Share on other sites More sharing options...
Sparrowlord Posted January 24, 2010 Author Share Posted January 24, 2010 please help Link to comment Share on other sites More sharing options...
natthehe Posted January 25, 2010 Share Posted January 25, 2010 an alternative solution could be: WinMove($title,'',0,0,@desktopwidth,@desktopheight,0) Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 25, 2010 Share Posted January 25, 2010 I just ran this code and it works. Maybe there is an issue with $title. Try changing the TitleMatchMode in your script. Also, I am running this under Vista, so the problem might be with Win7. Opt("WinTitleMatchMode", 2) WinSetState("Windows Internet Explorer", "", @SW_MAXIMIZE) - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Sparrowlord Posted January 25, 2010 Author Share Posted January 25, 2010 After some more failed attempts I finally realized the problem. Using WinSetState only works on the 64 bit version of Windows Internet Explorer (Default _IECreate), however I have to use the 32-bit version of Windows Internet Explorer because I have to work with a flash application. Here's the code I'm trying to use on the 32-bit browser: #include <IE.au3> Opt("WinTitleMatchMode", 2) Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe") WinWait("- Windows Internet Explorer") WinSetState("Windows Internet Explorer", "", @SW_MAXIMIZE) Attached is a screenshot of what happens to the browser window. Link to comment Share on other sites More sharing options...
Sparrowlord Posted January 25, 2010 Author Share Posted January 25, 2010 updated first post so everybody don't have to read the whole thread to figure out the problem Link to comment Share on other sites More sharing options...
Sparrowlord Posted January 25, 2010 Author Share Posted January 25, 2010 anyone? Link to comment Share on other sites More sharing options...
KaFu Posted January 25, 2010 Share Posted January 25, 2010 (edited) If you open IE via run() you don't have to include IE.au3. Additionally you can set @SW_MAXIMIZE in the run() command. $sPathIE = StringReplace(StringReplace(RegRead("HKEY_CLASSES_ROOT\Applications\iexplore.exe\shell\open\command", ""), " %1", ""), """", "") If Not FileExists($sPathIE) Then $sPathIE = @ProgramFilesDir & "\Internet Explorer\iexplore.exe" If Not FileExists($sPathIE) Then MsgBox(16, "Error", "Location of iexplore.exe not found") Exit EndIf $iPID = Run($sPathIE, "", @SW_MAXIMIZE) Edited January 25, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
JerryD Posted January 25, 2010 Share Posted January 25, 2010 How strange. I haven't written a script in well over a year, and haven't been on the forums for longer, and just yesterday I sat down and wrote a script that does just this! Little did I know I was doing something that couldn't be done. The thing is, the title of the window I was dealing with changed, so what I ended up doing was using the Windows handle like this: $obj_IE = _IECreate ( 'about:blank', $IECreate_NoAttach, $IECreate_NoVisible, $IECreate_Wait, $IECreate_TakeFocus ) _IENavigate ( $obj_IE, $VPNURL ) _IEAction ( $obj_IE, 'visible' ) _IEAction ( $obj_IE, 'focus' ) $hwnd_IE = _IEPropertyGet ( $obj_IE, 'hwnd' ) WinWait ( 'vpn', '', 1 ) WinActivate ( 'vpn' ) Do ; Wait for the title of the window to have the word Home in it $Ret = WinGetTitle ( $hwnd_IE ) If $Ret = '' Then Exit If StringInStr ( $Ret, 'Home' ) Then ExitLoop EndIf Sleep ( 100 ) Until 1=2 Do ; Now wait for the window to be minimized by another process $Ret = WinGetState ( $hwnd_IE ) If @error Then Exit If $Ret >= 16 Then ExitLoop EndIf Sleep ( 100 ) Until 1=2 WinSetState ( $hwnd_IE, '', @SW_HIDE ) Do ; Now hide the window and wait for the word Home to NOT be in the title! $Ret = WinGetTitle ( $hwnd_IE ) If $Ret = '' Then Exit If NOT StringInStr ( $Ret, 'Home' ) Then WinSetState ( $hwnd_IE, '', @SW_SHOW ) WinSetState ( $hwnd_IE, '', @SW_RESTORE ) ExitLoop EndIf Sleep ( 500 ) Until 1=2 This script works exactly as I wanted it to under XP/IE6, Vista/IE7, and Windows 7/IE8 (all 32 bit). Was I just lucky? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now