GuiControlGet not working with hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Bunny1
Posts: 66
Joined: 18 Nov 2014, 17:01

GuiControlGet not working with hotkey

28 Oct 2015, 21:34

I've got a hotkey

Code: Select all

A::Gosub,Down
I want it to trigger a subroutine, but it doesn't.

The subroutine in question is this. it should move the controls up giving them a scrolling down look.

Code: Select all

Down:
bottom := Add(ButtonsH,20)
Down := Subtract(A_Screenheight,bottom)
GuiControlGet,FirstControl,Pos,Control%Games%
IfGreater,FirstControlY,%Down%
    MoveControls(0,-Coverheight)
Return
What I've tried.
Copying the contents of the subroutine into the body of the hotkey including the return.
Putting the hotkey right above the label, so it runs until until hits the label's return.
Putting the Gosub between the hotkey and Return.

I've tracked it down to the GuiControlGet being the problem.

I've read over the label, hotkey, and GUiControlGet documentation several times. have I missed something here?
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: GuiControlGet not working with hotkey

28 Oct 2015, 21:43

How do you know the subroutine isn't triggered? I notice a lot of variables that are undefined in just the code you've given us - they may be defined elsewhere in the script - such as FirstControlY (edit: Oh, the pos parameter in guicontrolget outputs an x, y, width, and height in separate variables?) and Coverheight (edit: this one is undefined though right?), as well as the functions being undefined.

Have you tried putting a Msgbox inside of your Down subroutine to verify it's executing? And have you checked the contents of each variable to make sure they all have appropriate values?
Last edited by Exaskryz on 28 Oct 2015, 22:41, edited 1 time in total.
Bunny1
Posts: 66
Joined: 18 Nov 2014, 17:01

Re: GuiControlGet not working with hotkey

28 Oct 2015, 21:49

Yes. I went line by line with a message box until it came up blank at the GuiControlGet.
I've used other labels that don't have GuiControlGet and they worked.

The label works the way it should when I trigger it with a button.

Full code.
Spoiler
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: GuiControlGet not working with hotkey

28 Oct 2015, 22:54

I'll be able to play with your code tomorrow. I wasn't able to make your code do anything (except "Build a Wall" disables the DOWN button). Is the ePSXe Frontend.ini required? I noticed you had the default value parameters included in your commands so I was hoping I wouldn't need it. If you can, can you confirm the ini's necessity (testing by renaming it on your system real quick) and if it is necessary to share that ini?

Oh, what if there are other files required like your images? I just noticed that bit of code lower in the script.

At a glance I see no reason that a hotkey shouldn't be able to do what your buttons do. However, the GUI doesn't seem to be behaving right for me, so it's hard to say. (I get no response from the UP or DOWN buttons.)
Bunny1
Posts: 66
Joined: 18 Nov 2014, 17:01

Re: GuiControlGet not working with hotkey

29 Oct 2015, 02:12

Q: I wasn't able to make your code do anything (except "Build a Wall" disables the DOWN button).
A: The down button is disabled while the wall is being built otherwise clicking it can mess up the layout of the controls. once the wall is built the control is enabled.

Q: Is the ePSXe Frontend.ini required?
A: Only for restarting the gui and having the wall built automatically. The ini contains the paths to the disc images, cover art, emulator, button size and button position. it is created the first time the wall is built and used every time after that to rebuild the wall when it is started.

Q: I noticed you had the default value parameters included in your commands, so I was hoping I wouldn't need it.
A: I had to set a default starting value or it wouldn't work right.

Q: Oh, what if there are other files required like your images? I just noticed that bit of code lower in the script.
A: the cover art is used for the picture on each control. it's able to work without the cover art. it just puts the name from the disc image on the control without a picture.
A: Any disc image in one of these formats will work. img,bin,iso,ccd,cue,mds,pbp,ecm

At a glance I see no reason that a hotkey shouldn't be able to do what your buttons do. However, the GUI doesn't seem to be behaving right for me, so it's hard to say. (I get no response from the UP or DOWN buttons.)
The up and down controls only work if the picture controls extend off screen and give the gui a scroll like effect.
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: GuiControlGet not working with hotkey

29 Oct 2015, 04:15

You might want to check the result of WinGet,ListOfControls,ControlList in MoveControls(). It is using the The "Last Found" Window since all win-criteria are omitted.
Bunny1
Posts: 66
Joined: 18 Nov 2014, 17:01

Re: GuiControlGet not working with hotkey

29 Oct 2015, 08:15

That was the cause. added the window title and it worked.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Rohwedder, Sniperman and 390 guests