Jump to content

WinActive and other questions


Recommended Posts

Hello this is somehow a continuation of my previous thread.

Issue/Question 1#

WinActive - Is it not working or am i'm doing something wrong?

I tried the provided test code :

If WinActive("[CLASS:Notepad]") Then
    MsgBox(0, "", "Window was active")
EndIf

but i didn't receive any msgbox.

Then i tried with my own code :

If WinActive("[CLASS:Notepad]") Then
WinSetState("[CLASS:Notepad]", "", @SW_MINIMIZE)
Sleep(1000)
WinSetState("[CLASS:Notepad]", "", @SW_MAXIMIZE)
EndIf

and still same result, nothing happends - whats wrong?

Issue/Question 2#

When using WinSetState to SetState to @SW_MAXIMIZE it doesn't go into this window.

Like if i wanted a quick way to open and write into Notepad then i want it to open so i can start typing without need of clicking on it to like .. focus it.

Example : Try open up notepad and then click somewhere else than on the notepad.

or its pretty much like WinSetOnTop

Issue/Question 2#

Is it possible to check if @SW_MAXIMIZE = true then execute a command and make an else function?

For example: (not working i know, just an example)

if "WinSetState("[CLASS:Notepad]", "", @SW_MAXIMIZE)" = true then
Sleep(1000)
else
MsgBox(.....)
EndIf
Link to comment
Share on other sites

Issue #3

You opened a new thread on the same subject you already have open and current.

Sorry but it didn't seem active so i just decided to add this issue to this thread. As i already was creating the thread. Edited by nacon
Link to comment
Share on other sites

Issue #1

Is the notepad window active when the code is ran? Try this

If WinActivate("[CLASS:Notepad]") Then
WinSetState("[CLASS:Notepad]", "", @SW_MINIMIZE)
Sleep(1000)
WinSetState("[CLASS:Notepad]", "", @SW_MAXIMIZE)
EndIf

Or put a sleep in before WinActive to give you some time to make the notepad window active....

Issue #2

You need to use WinGetState. Use something like this

$value = WinGetState("[CLASS:Notepad]")
if BitAnd($value, 32) then
MsgBox(0,"WinSize","Notepad window is maximized")
else
MsgBox(0,"WinSize","Notepad window is not maximized")
EndIf
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...