Sign in to follow this  
Followers 0
jason404

Script to make any windows show always on top?

8 posts in this topic

Is there an Autoit script that can make any window always on top?

I particularly want browser windows to sometimes stay on top, for video windows.

Thanks.

Share this post


Link to post
Share on other sites



WinSetOnTop >_>


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Okay, with your helpful reply I found this page, which has something that is similar to what I want. I changed a couple of things and came up with this:

#Include <Constants.au3>
#NoTrayIcon

Global $Enabled = 0

Opt("TrayMenuMode",1)
$radio1 = TrayCreateItem("Enable - Always on Top", -1, -1, 1)
TrayCreateItem("")
$radio2 = TrayCreateItem("Disable - Always on Top", -1, -1, 1)
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()

While 1
$msg = TrayGetMsg()
Select
  
Case $msg = $radio1
TrayItemSetState($radio2, $TRAY_UNCHECKED)
WinSetOnTop("BBC iPlayer - The Killing Episode 15", "", 1)
$Enabled = 1

Case $msg = $radio2
TrayItemSetState($radio1, $TRAY_UNCHECKED)
WinSetOnTop("BBC iPlayer - The Killing Episode 15", "", 0)
$Enabled = 0

Case $msg = $exititem
Exit

EndSelect
WEnd

I have some way to go before I understand this script, but it works fine.

Now, instead of having the window's name (BBC iPlayer - The Killing Episode 15) hardcoded, how could I use wildcards instead?

Even better, to make this truly multipurpose, is there a way of getting the window name inserted by clicking on the window after starting the script?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Opt("WinTitleMatchMode", 1) ;1=start *default, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

To change how will script adress to titles

Or WinGetHandle to use it if it change title after original title is displayed handle can b used instead of name

WinGetTitle("[active]") to get name of active win

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

This is a slightly modified copy of code that I am using in another script. May I suggest you read up on: _IsPressed() and WinGetTitle().

Func GetTitle()
    Local $dll = DllOpen("user32.dll")
    While 1
        ToolTip("Click on the App now")
        Sleep(10)
        If _IsPressed("01", $dll) Then ExitLoop
    WEnd
    DllClose($dll)
    ToolTip("")
    MsgBox(4096, """, WinGetTitle("[active]"))
EndFunc   ;==>GetTitle

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@somdcomputerguy """ :)

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Take out the extra double quote in the MsgBox line (""", should be "",).


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@BogQ: I know, I saw that,&nbsp; (late edit: thanks geshi god!) but didn't want to edit my first post..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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