AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Making a Jump/Drop-down Menu?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Titan



Joined: 11 Aug 2004
Posts: 5009
Location: imaginationland

PostPosted: Fri Aug 13, 2004 5:04 pm    Post subject: Making a Jump/Drop-down Menu? Reply with quote

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
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Fri Aug 13, 2004 5:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Titan



Joined: 11 Aug 2004
Posts: 5009
Location: imaginationland

PostPosted: Fri Aug 13, 2004 9:15 pm    Post subject: I'll use option 1... Reply with quote

Arrow
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
View user's profile Send private message Visit poster's website
BoBo
Guest





PostPosted: Fri Aug 13, 2004 10:21 pm    Post subject: Reply with quote

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





PostPosted: Sat Aug 14, 2004 12:30 am    Post subject: Reply with quote

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

PostPosted: Sat Aug 14, 2004 1:12 am    Post subject: Reply with quote

Yea, I tried to edit that but I get error messages.
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Sat Aug 14, 2004 1:32 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
BoBo
Guest





PostPosted: Sat Aug 14, 2004 9:00 am    Post subject: Reply with quote

Ooops Embarassed
The code I wrote (new phantasy style Rolling Eyes ) 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

PostPosted: Sat Aug 14, 2004 10:11 pm    Post subject: Sorted, thanks. Reply with quote

Thankyou very much Bobo and Chris for helping. Very Happy

I am going to use your code Chris and edit it a bit so thanks.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group