AlwaysOnTop not working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Milenko
Posts: 11
Joined: 18 Sep 2019, 15:20

AlwaysOnTop not working

30 Sep 2019, 18:37

yes I'm back with another stupid question :problem: lol
After creating my first basic script with alot of help from AHK forums and many youtube tutorials, I've seem to have broken something once again.

my AlwaysOnTop doesn't work anymore, I just dealt with it for the time being. But now that I'm working on a custom GUI it's starting to aggravate me.
I'm not asking for the code to be fixed for me, just point me in the right direction.... Or call me stupid then gimme the answer :lol:

apologizes if it seems messy.

Code: Select all

Gui, -Caption +Border +AlwaysOnTop
Gui, color, 000000, 000000
Gui, Font, cWhite


Gui, Add, Text, x12 y9 w100 h20 , Message
Gui, Add, Text, x142 y9 w100 h20 , Seconds

Gui, Add, Edit, x12 y29 w100 h30 vLine1, pls 
Gui, Add, Edit, x12 y69 w100 h30 vLine2, pls 
Gui, Add, Edit, x12 y109 w100 h30 vLine3, pls 
Gui, Add, Edit, x12 y149 w100 h30 vLine4, pls 
Gui, Add, Edit, x12 y189 w100 h30 vLine5, pls 
Gui, Add, Edit, x12 y229 w100 h30 vLine6, pls
Gui, Add, Edit, x12 y269 w100 h30 vLine7, pls


Gui, Add, Edit, x142 y29 w100 h30 vTime1, 5
Gui, Add, Edit, x142 y69 w100 h30 vTime2, 5
Gui, Add, Edit, x142 y149 w100 h30 vTime3, 5
Gui, Add, Edit, x142 y109 w100 h30 vTime4, 5
Gui, Add, Edit, x142 y189 w100 h30 vTime5, 5
Gui, Add, Edit, x142 y229 w100 h30 vTime6, 10
Gui, Add, Edit, x142 y269 w100 h30 vTime7, 10


Gui, Add, Button, x12 y329 w100 h30 , Tabs Loops
Gui, Add, Button, x12 y369 w100 h30 , Singal Loop
Gui, Add, Button, x12 y409 w100 h30 , Pet

Gui, Add, Button, x142 y329 w100 h30 , Stop
Gui, Add, Button, x142 y369 w100 h30 , Help
Gui, Add, Button, x142 y409 w100 h30 , Bump





Gui, Show, x500 y100 h450 w258, AutoSend




return

ButtonTabsLoop:
Gui, Submit

Loop
{
;------------------------------------------------------------------Loop Tabs
send ^{Tab}
Sleep, 3000
Send,  %Line1%{ENTER}
Sleep, %Time1%000

Send,  %Line2%{ENTER}
Sleep, %Time2%000

Send,  %Line3%{ENTER}
Sleep, %Time3%000

Send,  %Line4%{ENTER}
Sleep, %Time4%000

Send,  %Line5%{ENTER}
Sleep, %Time5%000

Send,  %Line6%{ENTER}
Sleep, %Time6%000

Send,  %Line7%{ENTER}
Sleep, %Time7%000

;Send,  %Line6%{ENTER}
;Sleep, %Time6%000
}
return


ButtonStop:
ExitApp
return



;-----------------------------------Normal loop
ButtonSingalLoop:
Gui, Submit

Loop
{
Sleep, 3000
Send,  %Line1%{ENTER}
Sleep, %Time1%000

Send,  %Line2%{ENTER}
Sleep, %Time2%000

Send,  %Line3%{ENTER}
Sleep, %Time3%000

Send,  %Line4%{ENTER}
Sleep, %Time4%000

Send,  %Line5%{ENTER}
Sleep, %Time5%000

Send,  %Line6%{ENTER}
Sleep, %Time6%000

Send,  %Line7%{ENTER}
Sleep, %Time7%000

;Send,  %Line6%{ENTER}
;Sleep, %Time6%000
}
return

ButtonBump:
Gui, Submit
Sleep, 3000

Send,  {ShiftDown}1{ShiftUp}d{Space}bump{ENTER}
return


ButtonPet:
Gui, Submit
Sleep, 3000

Send,  pls{Space}withdraw{space}400{ENTER}
Sleep, 5000


Send,  pls{Space}pet{space}feed{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}feed{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}feed{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}feed{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}play{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}play{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}play{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}play{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}wash{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}wash{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}wash{ENTER}
Sleep, 5000

Send,  pls{Space}pet{space}wash{ENTER}
Sleep, 5000

Send,  pls{Space}deposit{space}all{ENTER}
Sleep, 5000
;Send,  %Line6%{ENTER}
;Sleep, %Time6%000

return


ButtonHelp:
Gui +OwnDialogs
SoundPlay, C:\Users\DuStiN\Desktop\x71-v3\clubbed.mp3
OnMessage(0x44, "OnMsgBox")
MsgBox 0x40000, Help, help message will go here
OnMessage(0x44, "")

OnMsgBox() {
    DetectHiddenWindows, On
    Process, Exist
    If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
        ControlSetText Button1, Close
        WinMove 900, 175
    }
}
return

Esc::Exitapp
return

F7::
Pause, Toggle
return

GuiClose:
exitapp
return
Thanks in advance for any help! :D
User avatar
flyingDman
Posts: 2823
Joined: 29 Sep 2013, 19:01

Re: AlwaysOnTop not working

30 Sep 2019, 19:36

Your AlwaysOnTop works but each of your buttons destroys the gui. Use Gui, Submit, nohide to keep the gui.
14.3 & 1.3.7
User avatar
boiler
Posts: 17095
Joined: 21 Dec 2014, 02:44

Re: AlwaysOnTop not working

30 Sep 2019, 20:56

Gui, Submit doesn't destroy the Gui. And it doesn't seem to affect the AlwaysOnTop property as this script shows:

Code: Select all

Gui, -Caption +Border +AlwaysOnTop
Gui, Add, Button, w150 gMyButton, Click to submit
Gui, Add, Text, w150 Center, Press F1 to restore
Gui, Show
return

MyButton:
	Gui, Submit
return

F1::Gui, Restore
Edit: If by the OP saying that AlwaysOnTop doesn't work anymore means that the Gui disappears when one of his buttons is clicked, then yes, Gui, Submit, NoHide will keep it from disappearing, but then the issue isn't related to AlwaysOnTop.
Last edited by boiler on 30 Sep 2019, 21:07, edited 1 time in total.
User avatar
flyingDman
Posts: 2823
Joined: 29 Sep 2013, 19:01

Re: AlwaysOnTop not working

30 Sep 2019, 21:06

Ok, gui, submit hides the window rather than destroys it (though the effect might appear the same ...)
14.3 & 1.3.7
User avatar
boiler
Posts: 17095
Joined: 21 Dec 2014, 02:44

Re: AlwaysOnTop not working

30 Sep 2019, 21:08

Yeah, just realized that OP might have been incorrectly thinking it was an AlwaysOnTop issue, and I understand why you posted what you did. I edited my post above.
User avatar
Milenko
Posts: 11
Joined: 18 Sep 2019, 15:20

Re: AlwaysOnTop not working

02 Oct 2019, 10:34

Ok, maybe i was wrong and its not a AlwaysOnTop issue.

NoHide keeps the app on top but when a button is pressed the text doesn't go anywhere.
I guess the question i should of asked is, How do i make the button send text without hiding or minimizing the app?

My intentions is to simply press a button and send the text to whatever window is active behind the script and still keep the script always on top so more buttons can be pressed
User avatar
boiler
Posts: 17095
Joined: 21 Dec 2014, 02:44

Re: AlwaysOnTop not working

02 Oct 2019, 10:54

Change the top line to this:

Code: Select all

Gui, -Caption +Border +AlwaysOnTop +E0x08000000
(and of course, change the Gui, Submit lines to Gui, Submit, NoHide.

It worked for most of the buttons for me when I tested with a Notepad window active. I don't know why the Tabs Loops button didn't work for me, but maybe it will with your application.
User avatar
Milenko
Posts: 11
Joined: 18 Sep 2019, 15:20

Re: AlwaysOnTop not working

02 Oct 2019, 11:40

That's exactly what i was looking for! Thanks so much.

Tabs Loop didn't work with notepad because it uses Tab+Ctrl to loop thru Chrome tabs.
Also now the Edit controls can't be changed once the script has started but not a problem, does what i need it to do.

Thanks again :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], haomingchen1998, mikeyww, ntepa and 171 guests