Jump to content
Byte11

Maximize Sometimes Doesn't Work

Recommended Posts

Byte11

WinSetState ("[CLASS:OpusApp]", "", @SW_SHOWMAXIMIZED) and WinSetState ("[CLASS:OpusApp]", "", @SW_MAXIMIZE) don't maximize the window.  Using WinSetState("[CLASS:OpusApp]","",@SW_RESTORE) allows me to maximize it about 15% of the time. I've tried using  WinMove("[active]",0,0,@Desktopwidth,@Desktopheight), but that only makes it worse. I've also tried putting in a sleep and maximizing it again. Does anyone have a solution?

Here's my code:

Quote

#include <Misc.au3>

;Startup Script
;Run("C:\hifuase\falhseiu\feashilu\fesahliu\fesaihlulfaheui\fewalihuaflheui\grdlihjnuslgr\ferswahiuhoiuafe\greyhugfral.docx")
;WinWait(".docx", "")
;WinSetState (".docx", "", @SW_HIDE)

;Keypress Script
Local $i = 0

While $i = 0
   if _IsPressed(11) then
      if _IsPressed(10) then
         if _IsPressed(22) then
            if Not StringInStr(WinGetTitle("[active]"), ".docx") = 0 then
               ;SplashTextOn("Title", "Message goes here.")
               WinSetState ("[active]", "", @SW_HIDE)
            Else
               send("#d")
               WinSetState ("[CLASS:OpusApp]", "", @SW_SHOWMAXIMIZED)
               WinSetState("[CLASS:OpusApp]","",@SW_RESTORE)
               WinSetState ("[CLASS:OpusApp]", "", @SW_SHOWMAXIMIZED)
            EndIf
         EndIf
      EndIf

   EndIf
WEnd

The startup script is intentionally commented, because I'm not testing it right now. The other comment is just for debugging when I need it. 

 

UPDATE: When I run two instances of the program, it works almost all the time, but if I copy the code inside the else statement twice it doesn't work at all (despite the fact that it's running the same code just in one program vs two). I also noticed that when I run two instances of it, about 50% of the time when it opens both the windows, it also hits the windows button and types the letter d into the search box. Neither of these actions are in my code. I'm not really sure what's going on. 

Edited by Byte11

Share this post


Link to post
Share on other sites
careca

Changed the application to test and it worked everytime, also used only one "hotkey" for simplicity.

#include <Misc.au3>

;Startup Script
;Run("C:\hifuase\falhseiu\feashilu\fesahliu\fesaihlulfaheui\fewalihuaflheui\grdlihjnuslgr\ferswahiuhoiuafe\greyhugfral.docx")
;WinWait(".docx", "")
;WinSetState (".docx", "", @SW_HIDE)

;Keypress Script
Local $i = 0

While $i = 0
   ;if _IsPressed(11) then
      ;if _IsPressed(10) then
         if _IsPressed(22) then
            if StringInStr(WinGetTitle("[active]"), "Photo Viewer") <> 0 then
                WinSetState ("[active]", "", @SW_MINIMIZE)
                WinSetState ("[CLASS:classFoxitReader]", "", @SW_MAXIMIZE)
            EndIf
         EndIf
      ;EndIf
   ;EndIf
WEnd

If the idea is to, at the press of some keys, while a certain window is active, to minimize the active window and to maximize another window, this works for me.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

  • Similar Content

    • BetaLeaf
      By BetaLeaf
      As the title says, when a script that is stored on a Google Drive File Stream drive is ran or compiled, it fails to work at all.
      Basically, Google Drive File Stream creates a G:\ drive where you can access all your files. The difference between this and Google Backup and Sync is your files are downloaded as needed rather than they always be downloaded and taking up storage. 
      How to Reproduce Bug
      1. Download and Install Google Drive File Stream
      2. Sign into Google Drive File Stream with a G Suite account. 
      3. Create a AutoIt Script and save it to Google Drive File Stream. (See attached file)
      4. Attempt to run or compile this AutoIt Script. 
       
      AutoIt appears to act like the script is (incorrectly) empty and ends immediately. (You can kind of tell based on file sizes from a successful and failed compile).
      I've also attached a Process Monitor log file. Hopefully someone can figure this out, because having to move the script out of the drive just to run or compile it is super annoying and I lose version revisioning Google Drive provides me.
      test.au3
      Logfile.PML
    • distancesprinter
      By distancesprinter
      _ArrayDisplay($aArray, "Window Title", "1:", 0, Default, "Column") ; Expected results are rows 1 to the end of the array, all columns. The result is rows 0-1, all columns. The API reference is here:
      https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayDisplay.htm
       
      Am I doing something wrong?
    • imitto
      By imitto
      Hi!
      I just playing around with _ArrayMin for my next project, but seems like it's not working. I think the code is OK, but I always get the value of $aArray[2][1], not col 2's lowest value (see attached image)

    • nss
      By nss
      Hi all.
       
      Because of me wondering if I could access the key/value pair arrays with the numbers as indexes, I have found out that the zeroth element for some reason doesn't return anything.
      Here's the example:
       
      local $r[2] $r["test1"]="hello" $r["test2"]="how are you" msgbox(64, $r[0], $r[1]) ; prints the ["test2"] but not ["test1"]. Is this even supposed to be a thing?  
       
      BTW, I haven't seen Autoit get updated since 2015; is it abandened or something?
      Any help/clarification appreciated.
    • TheDcoder
      By TheDcoder
      Hello everyone, I discovered a bug yesterday and I posted it at the bug tracker:
      I also made a simple script which can be used to reproduce the bug:
      CreateVariable() ConsoleWrite($sGlobalVariable & @CRLF) Func CreateVariable() Global $sGlobalVariable = "Foobar" EndFunc The bug was closed by @BrewManNH:
      While I partially agree with the above statement, My code was not practical enough... so @mLipok advised me to create a thread on the forums with practical code (Thanks!). That is the point of this thread, I am going to provide the code where I experience this bug/problem .
      I discovered this bug when I was working on one of my projects called "ProxAllium". When the main script finishes execution, Au3Check throws a nasty warning about "variable possibly used before declaration":

      As you can see, the variable is indeed being used after calling the function in which the variable is declared... The warning won't appear if I declare the function ABOVE the variable. As @BrewManNH said, Au3Check reads line by line... I think this should be changed, Au3Check should not throw warnings if the interpreter is able to run the code, at least most of the time anyway!
      So what do you guys think? Is this a valid bug?... and I request those who participate in the discussion not to discuss the code being "poor", that is another thing/thread in itself
      P.S I had already written this once but the forum editor decided to mess up and when I undid (Ctrl + Z) something... This is a poorly written version of that article, I was very frustrated while writing this!
×