Sign in to follow this  
Followers 0
Cyote101

KEEP on TOP

16 posts in this topic

Hello,

I have a Window "Book Helper" I would like this window to always be on top of another window "TPS REPORT" any Ideas

Thanks

Share this post


Link to post
Share on other sites



This was answered an hour ago...

$WS_TOPMOST

Use that style on your GUI

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This was answered an hour ago...

$WS_TOPMOST

Use that style on your GUI

I'm Sorry, I don't know if this would work or how as i'm looking for a way to apply this to a 3rd party application not one i created in Auto-it. I do not wish to have the window ontop of everything just that one window.

Perhaps you could give me an example for this command, I could not find it in the Help files.

Thanks

Edited by Cyote101

Share this post


Link to post
Share on other sites

I see, if your not using a AutoIt created GUI, then you might need to use:

WinSetOnTop() check that out, that will put the window you choose on top of all others.

Share this post


Link to post
Share on other sites

Thanks, That was pritty much it, I could use a little help on one last thing, I would like it so if the end user makes another window besides "TPS REPORT" active the Window "Book Helper" will no longer be set as "on top." but if the end user activates "TPS Report" or "Book Helper" then the "Book Helper" will be set up as OnTop again.

Thanks

Share this post


Link to post
Share on other sites

Try this:

If WinActive("") Then WinSetOnTop("window", "",...)

If any other window is active, it will reactive/top the window!

Share this post


Link to post
Share on other sites

cool, Thanks, Now how can i make is so this one line of code is running all the time in the backround, untill the "TPS REPORT" application is Closed!

Thanks

Share this post


Link to post
Share on other sites

This is what I have so far, but it does not work. I'm sorry but these statements are not my strong point

Thanks for all your help!!!!!!!!

While <WinExists ( "TPS REPORT" , "" )>

If WinActive("TPS REPORT") Then WinSetOnTop("Book Helper", "",1) Else Then WinSetOnTop("Book Helper", "",)

WEnd

Share this post


Link to post
Share on other sites

Please use code boxs for code, it makes them easier to read...

While <WinExists ( "TPS REPORT" , "" )>
If WinActive("TPS REPORT") Then
WinSetOnTop("Book Helper", "",1)
Else
WinSetOnTop("Book Helper", "",)
EndIf
WEnd

Whats its process name? If you know it, you could do this:

Do
Sleep(500)
Until Not ProcessExist("processname.exe")

Share this post


Link to post
Share on other sites

Would it not be better to combine the script R6V2?

Dim $isTop = False

While ProcessExists("name-of-process.exe")
    If (WinActive("TPS REPORT") Or WinActive("Book Helper")) And Not $isTop Then
        WinSetOnTop("Book Helper", "", 1)
        $isTop = True
    ElseIf Not WinActive("TPS REPORT") And Not WinActive("Book Helper") And $isTop Then
        WinSetOnTop("Book Helper", "", 0)
        $isTop = False
    EndIf   
WEnd

MsgBox(0 "Exit", "Host program closed, exiting...")

Untested. Should work, you'll have to edit the name-of-process part.

Share this post


Link to post
Share on other sites

THANKS

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

well, it works sometimes and then it does not.

I do not get any errors or prompts. I would like to Than everyone for their help on this, it has been amazing!!!!

I would ask you just for one more favor.

Basically what I'm trying to do is:

I have a window "TPS REPORT" and another window, a menu, created with a third party application, the menu is called "book Helper" The menu is a border less window with buttons, all of the buttons are powered by Auto-it. I had to make the Menu to make the "TPS Report" user friendly for younger users. All of the buttons on the menu just replicate input device gestures such as keyboard and mouse movements that interact with the "TPS REPORT" What I was trying to do in make the menu, "Book Helper" appeare to be part of the "TPS REPORT" window, and that is why i need the behaviors between the two windows to work together. If the user selects the "TPS REPORT" window I would like the "Book Helper" set to top, and if the user selects "Book Helper"window then the "TPS REPORT" window should come up too, while maintaining the "Book Helper" on top. Ideally this behavior would carry over to even when the user minimizes or maximizes the "TPS REPORT" window the "Book Helper" window would follow suit and of course if "TPS Report" is closed then "book Helper" would also be closed. to me the solution to this is to have another process running "Behavior" that will be launched after both programs "TPS REPORT" and "Book Helper" are running and would continue unitll "TPS REPORT" is closed at which point the "BEHAVIOR" Process would close "book helper" and launch another Proccess "Done" and terminate itself.

Thanks again for all your Help!!!!!

Edited by Cyote101

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I think you'll have to be a little more precise, what exactly doesn't work?

In my example(provided that you have edited the name-of-process part to the correct process name), it should run until you quit the program, then it exits.

If that's not what you want, then you might want to check if the window is visible:

Dim $isTop = False
Dim $isVisible = False

While ProcessExists("name-of-process.exe")
    If (WinActive("TPS REPORT") Or WinActive("Book Helper")) And Not $isTop And $isVisible Then
        WinSetOnTop("Book Helper", "", 1)
        $isTop = True
    ElseIf Not WinActive("TPS REPORT") And Not WinActive("Book Helper") And $isTop And $isVisible Then
        WinSetOnTop("Book Helper", "", 0)
        $isTop = False
    ElseIf (Not BitAND(WinGetState("TPS REPORT"), 2) Or Not WinExists("TPS REPORT")) And $isVisible Then
        WinSetState("Book Helper", "", @SW_HIDE)
        $isVisible = False
    ElseIf BitAND(WinGetState("TPS REPORT"), 2) And WinExists("TPS REPORT") And Not $isVisible Then
        WinSetState("Book Helper", "", @SW_SHOW)
        $isVisible = True       
    EndIf
    Sleep(250)
WEnd

MsgBox(0, "Exit", "Host program closed, exiting...")

Edit:

Added a Sleep in there, so it won't fry your cpu. :)

Edit2: whups typo. :)

Edited by FreeFry

Share this post


Link to post
Share on other sites

Thanks,

well I checked it out and it did not do it, perhaps wingetstate would work better, eny ideas.

If we were to use wingetstate and make it so "book helper" = the state of "TPS REPORT" s state. there would only be one additional point and that is when either "TPS REPORT" or "book helper" is selected both become active and "book helper" is set to ontop

well thanks, again!!!

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

My last example uses WinGetState.., and the script works as intended for me.

And only one window can be active at once.

Edit:

One last try:

Dim $isTop = False
Dim $isVisible = False
Dim $isVisible2 = False

While 1
    If (WinActive("TPS REPORT") Or WinActive("Book Helper")) And Not $isTop And $isVisible Then
        WinSetOnTop("Book Helper", "", 1)
        $isTop = True
        If WinActive("Book Helper") And Not $isVisible2 Then
            WinActivate("TPS REPORT")
            WinActivate("Book Helper")
            $isVisible2 = True
        EndIf
    ElseIf Not WinActive("TPS REPORT") And Not WinActive("Book Helper") And $isTop And $isVisible Then
        WinSetOnTop("Book Helper", "", 0)
        $isTop = False
        $isVisible2 = False
    ElseIf (Not BitAND(WinGetState("TPS REPORT"), 2) Or Not WinExists("TPS REPORT")) And $isVisible Then
        WinSetState("Book Helper", "", @SW_HIDE)
        $isVisible = False
    ElseIf BitAND(WinGetState("TPS REPORT"), 2) And WinExists("TPS REPORT") And Not $isVisible Then
        WinSetState("Book Helper", "", @SW_SHOW)
        $isVisible = True
    EndIf
    Sleep(250)
WEnd

MsgBox(0, "Exit", "Host program closed, exiting...")
Exit

This will activate ("show") the window if the other window is activated, and vice versa.

Edited by FreeFry

Share this post


Link to post
Share on other sites

Thanks for all your Help, but it still does not work. I'm going to double check all the window names and will post any changes here. Thanks again!!!!

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  
Followers 0