Jump to content

Maximize Sometimes Doesn't Work


 Share

Recommended Posts

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
Link to comment
Share on other sites

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

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.

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

Link to comment
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
 Share

×
×
  • Create New...