 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Fri Aug 13, 2004 5:04 pm Post subject: Making a Jump/Drop-down Menu? |
|
|
Hello, I am an ammature programmer. I have read most of the AHK Help file but I couldn't find one thing...
How do I make a InputBox/MsgBox with a Jump/Drop-down menu with differnt options that when chosen do something different.
For example, how would I make a message box which comes up and asks how many times to click in different places with a drop-down menu with numbers from 1-10. And when somebody chooses a number the script will use that command to click so many times in different places. Thanks to anybody in advance who can help. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri Aug 13, 2004 5:46 pm Post subject: |
|
|
There are no built-in drop-down boxes yet. So your choices are:
1) Use InputBox and have the user type a number, then have the script validate that the number is between 1 and 10.
2) Use a popup menu (or attach a submenu to the tray menu) to offer a list of choices. This is done via the Menu command.
3) Use a tooltip menu, which is described at http://www.autohotkey.com/forum/viewtopic.php?t=233
4) Use an external GUI utility to create a window with a drop-down control. This kind of thing has been mentioned in other past topics, accessible via searching the forum. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Fri Aug 13, 2004 9:15 pm Post subject: I'll use option 1... |
|
|
| Quote: | | 1) Use InputBox and have the user type a number, then have the script validate that the number is between 1 and 10. |
I think option 1 is best for me because I'm an amature. Could you give me a basic code for this and explain to me what exactly is involved (variables or anything else...) thanks. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Fri Aug 13, 2004 10:21 pm Post subject: |
|
|
| Code: | InputBox, X, Title, How often d'ya wanna click (1-10)
If X = 1, Y = 10
If X = 2, Y = 20
If X = 3, Y = 30
If X = 4, Y = 40
If X = 5, Y = 50
If X = 6, Y = 60
If X = 7, Y = 70
If X = 8, Y = 80
If X = 9, Y = 90
If X = 10, Y = 100
ClickCount = %X%
MouseClick, L, %X%, %Y%, %ClickCount% |
Something like this ? |
|
| Back to top |
|
 |
Bob Guest
|
Posted: Sat Aug 14, 2004 12:30 am Post subject: |
|
|
Got this error ?
| Quote: | ---------------------------
numbers.ahk
---------------------------
Error: The X & Y coordinates must be either both absent or both present. The current thread will exit.
Specifically: 3
Line#
007: IF X = 5, Y = 50
008: IF X = 6, Y = 60
009: IF X = 7, Y = 70
010: IF X = 8, Y = 80
011: IF X = 9, Y = 90
012: IF X = 10, Y = 100
013: ClickCount = %X%
---> 015: MouseClick,L,%X%,%Y%,%ClickCount%
016: Exit
017: Exit
---------------------------
OK
---------------------------
|
|
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sat Aug 14, 2004 1:12 am Post subject: |
|
|
| Yea, I tried to edit that but I get error messages. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Sat Aug 14, 2004 1:32 am Post subject: |
|
|
You can't have an if's action on the same line unless you use the old style of command, such as: IfEqual, x, 1, SetEnv, y, 10. The new style is probably better since it's easier to add blocks (multi-line sections) later. Example:
| Code: | if x = 1
{
y = 10
}
|
As for the InputBox, here is a basic example:
| Code: | Loop
{
InputBox, ClickCount, My Title, How often d'ya wanna click. Please enter a number between 1 and 10.
if ClickCount >= 1
if ClickCount <= 10
break
; Otherwise, continue looping until a proper answer is given.
}
MouseClick, left, 200, 200, %ClickCount%
|
|
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Sat Aug 14, 2004 9:00 am Post subject: |
|
|
Ooops
The code I wrote (new phantasy style ) was different from the one I've tested (old style). Sorry for the confusion. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sat Aug 14, 2004 10:11 pm Post subject: Sorted, thanks. |
|
|
Thankyou very much Bobo and Chris for helping.
I am going to use your code Chris and edit it a bit so thanks. |
|
| 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
|