 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
franky Guest
|
Posted: Sat Sep 08, 2007 7:20 am Post subject: logical problem with a menu |
|
|
Hello everybody.
I would like to make a menu with a listbox.
But when i choose a choice of my menu, the script always take the first choice, why ?
This is my script here :
| Code: |
begin:
Gui, Destroy
Gui, add, listbox, vChoice, 1. first choice|2. second choice|3. third choice
Gui, Add, Button, Default, OK
Gui, show,, menu with a listbox
Return
ButtonOK:
Gui, Submit
Gui, Destroy
If Choice := 1
Gui, Add, Text,, the first choice is selected
If Choice := 2
Gui, Add, Text, the second choice is selected
If Choice := 3
Gui, Add, Text, the third choice is selected
Gui, Add, Text,, do you want to redo from start, yes or no,
Gui, Add, Text,, you have to click on the Yes Button or No button or by pressing the Y key for yes or N key for no
Gui, Add, Button, yes, &yes
Gui, Add, Button, no, &no
Gui, Show,, last choice selected
Return
Buttonyes:
Goto begin
Return
Buttonno:
ExitApp
Return
|
[Moderator's note - added code tags] |
|
| Back to top |
|
 |
Freighter
Joined: 07 Sep 2006 Posts: 64
|
Posted: Sat Sep 08, 2007 8:17 am Post subject: |
|
|
lets see
you need AltSubmit in the listbox options so the variable will be the row # instead of the text | Code: | | Gui, add, listbox, vChoice AltSubmit, 1. first choice|2. second choice|3. third choice |
the if statements dont work with the := they need normal =
you forgot a comma in the 2nd and 3rd gui, add 's
Gui, Add, Text, , the second choice is selected |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 846 Location: London, UK
|
Posted: Sat Sep 08, 2007 8:20 am Post subject: |
|
|
Please place all code in code boxes
| Code: | Gui, Destroy
Gui, add, listbox, vChoice altsubmit , 1. first choice|2. second choice|3. third choice
Gui, Add, Button, Default, OK
Gui, show,, menu with a listbox
Return
ButtonOK:
Gui, Submit
Gui, Destroy
If Choice = 1
Gui, Add, Text,, the first choice is selected
If Choice = 2
Gui, Add, Text, the second choice is selected
If Choice = 3
Gui, Add, Text, the third choice is selected
Gui, Add, Text,, do you want to redo from start, yes or no,
Gui, Add, Text,, you have to click on the Yes Button or No button or by pressing the Y key for yes or N key for no
Gui, Add, Button, yes, &yes
Gui, Add, Button, no, &no
Gui, Show,, last choice selected
Return
Buttonyes:
Goto begin
Return
Buttonno:
ExitApp
Return |
try that I removed the : from the if statements. Also added the altsubmit property to the listbox. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
franky Guest
|
Posted: Sat Sep 08, 2007 5:55 pm Post subject: script to make a menu with a listbox who works |
|
|
Thank you.
Because of you i have a script who works !
I didn't know the AltSubmit parameter.
Sorry but i don't know the HTML CODE to make a link to copy to the
clipboard
So i write here the correct script and i appended something :
begin:
| Code: | Gui, Destroy
Gui, add, listbox, vChoice AltSubmit, 1. first choice|2. second
choice|3. third choice
Gui, Add, Text,, you can press a number on the keyboard
Gui, Add, Button, Default, OK
Gui, show,, menu with a listbox
Return
ButtonOK:
Gui, Submit
Gui, Destroy
If Choice = 1
Gui, Add, Text,, the first choice is selected
If Choice = 2
Gui, Add, Text,, the second choice is selected
If Choice = 3
Gui, Add, Text,, the third choice is selected
if (Choice <1) or (Choice > 3)
Gui, Add, Text,, you press a wrong number on the keyboard
Gui, Add, Text,, do you want to redo from start, yes or no,
Gui, Add, Text,, you have to click on the Yes Button or No button or by
pressing the Y key for yes or N key for no
Gui, Add, Button, yes, &yes
Gui, Add, Button, no, &no
Gui, Show,, last choice selected
Return
Buttonyes:
Goto begin
Return
Buttonno:
ExitApp
Return |
|
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5880
|
Posted: Sat Sep 08, 2007 6:03 pm Post subject: |
|
|
franky, please use code tags in future.  |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Sun Sep 09, 2007 5:18 am Post subject: |
|
|
franky, they are BBCode code tags, not HTML.
they are made like this
| Code: |
[code]
;put your code here
[/code]
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| 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
|