hello
i made a gui with all my hotkeys the gui is always on top
i want to add a button that sets the window that was active before i hit the knob always on top to always on top is this possible?
any help is appreciated thank you
Always on Top gui with a button in it to set windows always on top problem Topic is solved
Always on Top gui with a button in it to set windows always on top problem
Last edited by OCP on 26 Jul 2018, 22:38, edited 1 time in total.
Re: Always on Top gui with a button in it to set windows always on top problem
try this
Code: Select all
Gui, +AlwaysOnTop
Gui, Add, Button, x72 y50 w100 h30 gSwitch, Button
; Generated using SmartGUI Creator for SciTE
Gui, Show, w258 h142, My Gui Title
return
GuiClose:
ExitApp
return
Switch:
Gui, -AlwaysOnTop
WinMinimize, My Gui Title
;~ Send, !{Tab}
AlwaysOnTop_ = 0
return
#If !AlwaysOnTop_
~LButton::
KeyWait, LButton, U
IfWinActive, My Gui Title
{
Gui, +AlwaysOnTop
AlwaysOnTop_ = 1
}
return
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: Always on Top gui with a button in it to set windows always on top problem
Wow. Outstanding solving skills.YoucefHam wrote:... There is always more than one way to solve a problem.
Einfach nur ein toller Typ.
Re: Always on Top gui with a button in it to set windows always on top problem
While what you are looking to do is not imposable, I would think that it is impractical, and probably not the best approach to setting your windows to AlwaysOnTop.OCP wrote:hello
i made a gui with all my hotkeys the gui is always on top
i want to add a button that sets the window that was active before i hit the knob always on top to always on top is this possible?
any help is appreciated thank you
The simpler method would be to hit your button and then have the next window you activate set to alwaysOnTop, but I have to assume that you are aware of that and still want it the way you have described.
Before I begin, understand that there could be a more direct method of doing this, but because I don't know what that is I have to invent one to make progress.
That said, I think the way that I would approach this problem would be to use 3 variables to hold the names (or maybe better, the process Id) of your windows.
One var would be something like Old_window, another one would be Last_window and the last one would be Current_window.
I would start by checking to see if the current_window is the same as Last_window, if they are the same I would do nothing, however if they are different I would set the value of Old_window to be the value in Last_window, and then set Last_window to be the value of current_window.
That handles setting it up so that the window you will be setting as AlwaysOnTop is the window in the variable Old_window.
Ok, the next thing to work out is how are you going to actually be getting the names/Id of the different windows? I think I would look to see what "OnMessage" gets triggered when you select a window. I have not had too much need to use windows messages so I can't say the one that would fit this, but I'll have a look and see if I can find one that does what I am talking about. Perhaps in the mean time, you can try looking over the list and testing, or someone that knows a better approach or the right message to use will come along.
With the assumption that it would be a message that is looking to see when a window is activated, or any other message for that matter. In it, you would use wingettitle, or wingetId, or w/e to get the value to put into your Current_window variable. Then you do the check as described above.
So, now you have a var with the last window set into the var Old_window, when you hit your button you will use your winset, AlwayOnTop on that window.
Well, without knowing any better, that is the approach I would take.
Alternative, I would just use a timer set for every 300 ms or so that does all that stuff. It would be simpler for me to get to my goal and make progress, so if I didn't find a message to do this within a few mins of testing I am pretty sure I would go that route, but that's just me, and I don't give two $%!&$ if it is the "BEST WAY". Progress is progress, and I can pick up new things tomorrow
Re: Always on Top gui with a button in it to set windows always on top problem
have to say that code is pretty clever and its giving me some cool other ideas like perhaps a way to make my next left click the location to execute a series of events that way i could make buttons to add plugins in my audio projects on desired slotsTry This
i think what you posted will work in some form it would cause my gui to disappear for a bit i suspect (perhaps a nice visual clue to that it happened dunno have to see what i like and also i probably need to tab backwards) i got some testing to do tomorrow first some sleep thnx for that code its a keeper
very true but the situation i use this in involves 2 screens filled with stuff i need to see, the moment i open something extra to see and i click somewhere it moves to backgroundThe simpler method would be to hit your button and then have the next window you activate set to alwaysOnTop, but I have to assume that you are aware of that and still want it the way you have described.
what you suggest for the next window could work if i can also select stuff that is currently active in the taskbar so i can just click there on the active icon to make it always on top
the rest you said, i have to get some sleep first
I agreeAnd I don't give two $%!&$ if it is the "BEST WAY". Progress is progress
thnx once again
Last edited by OCP on 26 Jul 2018, 22:39, edited 1 time in total.
Re: Always on Top gui with a button in it to set windows always on top problem Topic is solved
Code: Select all
#SingleInstance,Force
Gui,+AlwaysOnTop -Caption +Border
Gui,Color,Black
Gui,1:Font,s10 Q4, Segoe UI Black
Gui,Add,Progress,x0 y0 w240 h2 BackgroundYellow
Gui,Add,Progress,x0 y123 w240 h2 BackgroundYellow
Gui,Add,Progress,x0 y0 w2 h125 BackgroundYellow
Gui,Add,Progress,x238 y0 w2 h125 BackgroundYellow
Gui,Add,Text,cAqua x5 y2 w30 h20 Border Center gTag,HB
Gui,1:Font,s10 Underline Q4, Segoe UI Black
Gui,Add,Text,cYellow x60 y2 w120 h20 Border Center gMove_window,Move Window
Gui,1:Font,
Gui,1:Font,s10 Q4, Segoe UI Black
Gui,Add,Text,cRed x+16 y2 w20 h20 Border Center gMin_window,-
Gui,Add,Text,cRed x+0 y2 w20 h20 Border Center gGuiClose,x
Gui,Add,Checkbox,cLime x10 y+7 Checked vAlways gAOT,AlwaysOnTop
Gui,Add,Button,x10 y+7 w220 gSet_Next_On_Top -Theme,Set Next Win On Top
Gui,Add,Button,x10 y+7 w220 gSet_Last_On_Top -Theme,Set Last Win On Top
Gui,Show,w240 h125,Random Gui
Gui,Submit,NoHide
SetTimer,Update_Window,100
return
GuiClose:
ExitApp
Min_Window:
Gui,Minimize
return
Move_Window:
PostMessage,0xA1,2
return
Tag:
TrayTip,,Hellbent Was Here!,3
return
AOT:
if(Always:=!Always)
Gui,+AlwaysOnTop
else
Gui,-AlwaysOnTop
return
Set_Next_On_Top:
While(!GetKeyState("ctrl"))
Tooltip, Activate the window to set on top and then press "ctrl"
Tooltip,
Winset,AlwaysOnTop,Toggle,A
return
Set_Last_On_Top:
WinSet,AlwaysOnTop,Toggle,ahk_id %Old_Window%
return
Update_Window:
;~ DetectHiddenWindows, On ; https://autohotkey.com/docs/commands/DetectHiddenWindows.htm
;~ SetTitleMatchMode, ; https://autohotkey.com/docs/commands/SetTitleMatchMode.htm
WinGet, Current_Window,ID,A ; https://autohotkey.com/docs/commands/WinGet.htm
;~ WinGet, Current_Window,ProcessName,A ; https://autohotkey.com/docs/commands/WinGet.htm
;~ WinGet, Current_Window,PID,A ; https://autohotkey.com/docs/commands/WinGet.htm
;~ WinGetClass,Current_Window,A ; https://autohotkey.com/docs/commands/WinGetClass.htm
;~ WinGetText,Current_Window,A ; https://autohotkey.com/docs/commands/WinGetText.htm
;~ WinGetTitle,Current_Window,A ; https://autohotkey.com/docs/commands/WinGetTitle.htm
;~ ToolTip,% Current_Window "`n" Last_Window "`n" Old_Window
if(Current_Window!=Last_Window)
Old_Window:=Last_Window,Last_Window:=Current_Window
return
*^ESC::ExitApp
It also has a example of making your gui toggle between the states.
Just pick the method that suits your needs and bam, Bob's your uncle
Re: Always on Top gui with a button in it to set windows always on top problem
thnx Hellbent that is just what i wanted i like bolt options but i am gonna use set last window on top for my situation
bob likes it he will have to buy you some coffee on his next payday
bob likes it he will have to buy you some coffee on his next payday
Who is online
Users browsing this forum: Ineedhelplz and 324 guests