Jump to content

KEEP on TOP


Recommended Posts

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

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

Link to comment
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")
Link to comment
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.

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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
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...