Jump to content

Script to make any windows show always on top?


Recommended Posts

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.

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

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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

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