 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
d41m40u Guest
|
Posted: Fri Jul 18, 2008 4:30 am Post subject: GUI + Hotkey |
|
|
I have a gui setup for a machine which will not have a mouse or keyboard (only a joystick.)
I was having no troubles up until a point where I needed to go back to a previous Gui screen from one further along. I want the option just to go from Gui 2 to Gui 1by pressing a button. However every time I put the hotkey in, depending where I put it, it will either execute without the key ever being pressed or pausing the script altogether. I'm not sure if I'm doing something wrong in my placement or whether it's my syntax with the setup of the hotkey. I believe it's the former. Can anyone shed any light on this issue? |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Fri Jul 18, 2008 5:45 am Post subject: |
|
|
only if you can post your script or an example to simulate the problem. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
d41m40u Guest
|
Posted: Fri Jul 18, 2008 6:25 am Post subject: |
|
|
Sure. It's a Gui that will be running emulators. Right now I'm using keyboard commands, and later when it's ready, I'll put in whatever joystick commands I need.
| Code: |
SetWorkingDir %A_ScriptDir%
ConsoleSelect:
Gui, 1:Font, S20 CDefault, Verdana
Gui, 1:Add, Button, x146 y137 w700 h120 , Atari
Gui, 1:Add, Button, x146 y267 w700 h120 , Sega Genesis
Gui, 1:Add, Button, x146 y397 w700 h120 , Nintendo (NES)
Gui, 1:Add, Button, x146 y527 w700 h120 , Super Nintendo (SNES)
Gui, 1:Add, Text, x16 y7 w830 h120 +Center, Select a console to load and press "Start":
Gui, 1:Add, Picture, x16 y277 w120 h90 +Border, H:\Pictures\genesis-sega.jpg
Gui, 1:Add, Picture, x16 y397 w120 h100 +Border, H:\Pictures\nes.jpg
Gui, 1:Add, Picture, x16 y527 w120 h110 +Border, H:\Pictures\snes.jpg
; Generated using SmartGUI Creator 4.0
Gui, 1:Show, x110 y128 h768 w1024, Console Select
Return
ButtonAtari:
{
Console=Atari
ROMList=ATARIRomList
Gui, 1:Submit
Goto, GameSelect
Return
}
ButtonSegaGenesis:
{
Console=Sega Genesis
ROMList=SEGARomList
Gui, 1:Submit
Goto, GameSelect
Return
}
ButtonNintendo(NES):
{
Console=Nintendo NES
ROMList=NESRomList
Gui, 1:Submit
Goto, GameSelect
Return
}
ButtonSuperNintendo(SNES):
{
Console=Super Nintendo SNES
ROMList=SNESRomList
Gui, 1:Submit
Goto, GameSelect
Return
}
GameSelect:
1GuiClose:
GameTitle=Aeros
Gui, 2:Font, S15 CDefault, Verdana
Gui, 2:Add, Text, x6 y7 w1000 h50 +Center, Please select a game by highlighting it and pressing "Start" or press "Select" to go back:
Loop, Read, %ROMList%.txt
{
ListBoxItems.=A_LoopReadLine "|"
}
Gui, 2:Add, ListBox, x16 y67 w400 h560 +VScroll Sort, %ListBoxItems%
Gui, 2:Add, Picture, x586 y117 w270 h250 , H:\Pictures\speed-link-joystick.jpg
Gui, 2:Add, Text, x426 y67 w580 h40 +Center,%GameTitle%
Gui, 2:Font, S8 CDefault Bold, Verdana
Gui, 2:Add, Text, x436 y377 w120 h20 , Game Synopsis:
Gui, 2:Font, S8 CDefault, Verdana
Gui, 2:Add, Text, x436 y397 w570 h220 , Description....
; Generated using SmartGUI Creator 4.0
Gui, 2:Show, x206 y223 h768 w1024, %Console% Game Select
Return
2GuiClose:
ExitApp
Esc:: ;Later, this will be "Select"
Console=
ROMList=
ListBoxItems=
GameTitle=
ListVars
Pause
Goto ConsoleSelect
Return
|
It just seems as though, no matter where I put in "Esc::" it will execute without my pushing the key at all. I'm not exactly sure what's happening. |
|
| Back to top |
|
 |
SpiderGames
Joined: 09 Jun 2008 Posts: 281 Location: Canada
|
Posted: Sat Jul 19, 2008 5:04 am Post subject: |
|
|
instead of making select the back button try like a Gui button instead. I think AHK might not see select as a button. _________________ http://www.spider-games77.piczo.com
Join the Elite few... |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Sat Jul 19, 2008 4:57 pm Post subject: |
|
|
try this:
| Code: |
SetTitleMatchMode, 2
SetWorkingDir %A_ScriptDir%
Gui, 1:Font, S20 CDefault, Verdana
Gui, 1:Add, Button, x146 y137 w700 h120 , Atari
Gui, 1:Add, Button, x146 y267 w700 h120 , Sega Genesis
Gui, 1:Add, Button, x146 y397 w700 h120 , Nintendo (NES)
Gui, 1:Add, Button, x146 y527 w700 h120 , Super Nintendo (SNES)
Gui, 1:Add, Text, x16 y7 w830 h120 +Center, Select a console to load and press "Start":
Gui, 1:Add, Picture, x16 y277 w120 h90 +Border, H:\Pictures\genesis-sega.jpg
Gui, 1:Add, Picture, x16 y397 w120 h100 +Border, H:\Pictures\nes.jpg
Gui, 1:Add, Picture, x16 y527 w120 h110 +Border, H:\Pictures\snes.jpg
; Generated using SmartGUI Creator 4.0
ConsoleSelect:
Gui, 1:Show, x110 y128 h768 w1024, Console Select
Return
ButtonAtari:
{
Console=Atari
ROMList=ATARIRomList
Gui, 1:Submit
Goto, GameSelect
Return
}
ButtonSegaGenesis:
{
Console=Sega Genesis
ROMList=SEGARomList
Gui, 1:Submit
Goto, GameSelect
Return
}
ButtonNintendo(NES):
{
Console=Nintendo NES
ROMList=NESRomList
Gui, 1:Submit
Goto, GameSelect
Return
}
ButtonSuperNintendo(SNES):
{
Console=Super Nintendo SNES
ROMList=SNESRomList
Gui, 1:Submit
Goto, GameSelect
Return
}
GameSelect:
1GuiClose:
GameTitle=Aeros
Gui, 2:Font, S15 CDefault, Verdana
Gui, 2:Add, Text, x6 y7 w1000 h50 +Center, Please select a game by highlighting it and pressing "Start" or press "Select" to go back:
Loop, Read, %ROMList%.txt
{
ListBoxItems.=A_LoopReadLine "|"
}
Gui, 2:Add, ListBox, x16 y67 w400 h560 +VScroll Sort, %ListBoxItems%
Gui, 2:Add, Picture, x586 y117 w270 h250 , H:\Pictures\speed-link-joystick.jpg
Gui, 2:Add, Text, x426 y67 w580 h40 +Center,%GameTitle%
Gui, 2:Font, S8 CDefault Bold, Verdana
Gui, 2:Add, Text, x436 y377 w120 h20 , Game Synopsis:
Gui, 2:Font, S8 CDefault, Verdana
Gui, 2:Add, Text, x436 y397 w570 h220 , Description....
; Generated using SmartGUI Creator 4.0
Gui, 2:Show, x206 y223 h768 w1024, %Console% Game Select
Return
2GuiClose:
ExitApp
#IfWinActive, Game Select
Esc:: ;Later, this will be "Select"
Console=
ROMList=
ListBoxItems=
GameTitle=
Gui, 2:Destroy
Goto ConsoleSelect
Return
#IfWinActive
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
d41m40u Guest
|
Posted: Sat Jul 19, 2008 5:59 pm Post subject: |
|
|
Ah, I see what you did there! Yes, it works perfectly thank you!
PS. The reason I didn't want to use a GUI button was that the joystick would be locked into a listbox on the second screen. Secondly, I could have put "Back" into the listbox, but that would require extra scrolling by the user, and I was trying to avoid that by making the usage of the joystick more natural.
Thanks again for the help. ^_^ |
|
| Back to top |
|
 |
SpiderGames
Joined: 09 Jun 2008 Posts: 281 Location: Canada
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|