 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
michu
Joined: 13 Sep 2005 Posts: 5 Location: Switzerland
|
Posted: Tue Sep 13, 2005 11:58 am Post subject: GUI script will not restart |
|
|
I searched a while but found no similar, but over 18000 posts....
My problem:
Start the following script, runs one time by pressing ^Win, all fine
second by pressing ^Win time nothing happens, no trayaccess to Autohokey, it must be killed.
I now its my fault but what did I miss???
;Script
^LWin::
Gui, Add, Button,gButtons, B1
Gui, Add, Button,gButtons, B2
Gui, Add, Button,gButtons, B3
Gui, Add, Button,gButtons, B4
Gui, Add, Button,gButtons, B5
Gui, Add, Button,gButtons, B6
Gui, Add, Button,gButtons, B7
Gui, Show, Blabla
Return
Buttons:
Gui, Cancel
Gui, Destroy
MsgBox, %A_GuiControl% was clicked
return |
|
| Back to top |
|
 |
neyon
Joined: 29 May 2005 Posts: 34 Location: The Netherlands
|
Posted: Tue Sep 13, 2005 12:14 pm Post subject: |
|
|
The next code works fine for me:
| Code: |
^LWin::
Gui, Add, Button,gButtons, B1
Gui, Add, Button,gButtons, B2
Gui, Add, Button,gButtons, B3
Gui, Add, Button,gButtons, B4
Gui, Add, Button,gButtons, B5
Gui, Add, Button,gButtons, B6
Gui, Add, Button,gButtons, B7
Gui, Add, Button,gStop,Exit
Gui, Show, Blabla
Return
Buttons:
MsgBox, %A_GuiControl% was clicked
return
Stop:
Exitapp
|
1. It runs every time I press ^Win,
2. It shows the right message in the messagebox,
3. It shows the right title in the titlebar,
4. It ends when pressing the 'Exit' button. _________________ Greetz,
Neyon |
|
| Back to top |
|
 |
michu
Joined: 13 Sep 2005 Posts: 5 Location: Switzerland
|
Posted: Tue Sep 13, 2005 12:21 pm Post subject: |
|
|
Tried, but helps nothing
My idea is the gui should go away after pressing a button, and reapear after pressing ^win
Michu |
|
| Back to top |
|
 |
neyon
Joined: 29 May 2005 Posts: 34 Location: The Netherlands
|
Posted: Tue Sep 13, 2005 1:22 pm Post subject: |
|
|
Well, simply add
Gui, hide after the messagebox:
| Code: | Buttons:
MsgBox, %A_GuiControl% was clicked
Gui,hide
return |
This is what you mean? _________________ Greetz,
Neyon |
|
| Back to top |
|
 |
michu
Joined: 13 Sep 2005 Posts: 5 Location: Switzerland
|
Posted: Tue Sep 13, 2005 3:07 pm Post subject: |
|
|
Hi Neyon
Thanks for help,
but I think we missunderstand us.
The messagebox is only a debug output
I would like to close the gui after each press of a button.
and reopen if I press ^Win
Assume, I have no keyboard (TabletPC) only one programmable key and
I would like to have special operations from a application to run.
Show gui, press button and close gui running only first time.
But then Autokey seems to hang and wait for something.
I am not able to open the contextmenu and a restart of autohotkey
gives: "another instance of...."
I have to kill the process.
michu |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3841 Location: Bremen, Germany
|
Posted: Tue Sep 13, 2005 3:16 pm Post subject: |
|
|
Try this | Code: | Gui, Add, Button,gButtons, B1
Gui, Add, Button,gButtons, B2
Gui, Add, Button,gButtons, B3
Gui, Add, Button,gButtons, B4
Gui, Add, Button,gButtons, B5
Gui, Add, Button,gButtons, B6
Gui, Add, Button,gButtons, B7
return
^LWin::
Gui, Show, Blabla
Return
Buttons:
Gui, Submit
MsgBox, %A_GuiControl% was clicked
return | You have to put the building of the GUI into the autoexec section. so that it is only build once. Then you can show and submit it as often as you want. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
michu
Joined: 13 Sep 2005 Posts: 5 Location: Switzerland
|
Posted: Tue Sep 13, 2005 4:25 pm Post subject: |
|
|
Thanks toralf
this helps a lot,
But, i can not exit the script (Trayicon Rightmouse)
michu |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3841 Location: Bremen, Germany
|
Posted: Tue Sep 13, 2005 5:26 pm Post subject: |
|
|
What do you mean?
1) Can't you exit the script, when you right click on the tray icon?
2) Or can't you right click on the tray icon?
3) Or can't you exit the script without clicking on the tray icon?
Solution
to 1) There is something fishy. should work
to 2) Use "menu, tray, default" to specify exit as the default action when the tray icon is double clicked.
to 3) Add this to your code | Code: | GuiClose:
Esc::
#x::
Exitapp |
_________________ Ciao
toralf  |
|
| Back to top |
|
 |
michu
Joined: 13 Sep 2005 Posts: 5 Location: Switzerland
|
Posted: Tue Sep 13, 2005 8:37 pm Post subject: |
|
|
With your solution 1 and 3
with all other tries 1,2,3
It is possible that "Gui, Destroy" is not working properly?
Michu |
|
| Back to top |
|
 |
toralf as guest Guest
|
Posted: Tue Sep 13, 2005 8:51 pm Post subject: |
|
|
Please post your code.
I have problems to understand your short hand, sorry. |
|
| 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
|