Sign in to follow this  
Followers 0
cowsmanaut

getting more from your mouse?

8 posts in this topic

I was again looking around and pondering.. I found a bunch of options to press the mouse buttons and move the mouse wheel all remotley etc.. I also found how I can get the position of the mouse and it's cursor as input. However... Can I find out when it's clicked and what button has been pressed so I can use that information for IF THEN statements? or something like?

for example I have a splash screen come up and have it say hit the left mouse button to continue. Now I know I can bring up a message box with an OK button and the question "Continue?".. however it's not as elegant.

moo :D

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

AutoIt's mouse support is passive; AutoIt does not install mouse hooks which would allow functionality you desire. (One reason AutoIt avoids mouse hoooks is to avoid being classified as a virus/worm/trojan.)

Here's one workaround for the specific situation you describe. it requires an "unstable" beta version of AutoIt with GUI support

Note: If you want a titlebar on the "splash screen", then remove the 0x80000000 part from GuiCreate.

#cs - ### Generated by AutoBuilder 0.4 -- do not modify ###
394 278
0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
button  $button_1   Button 1    -20 -20 430 320 0   0   
#ce - ### End of Dump ###

;Script generated by AutoBuilder 0.4 -- but modified

$title = "Sample Splash Screen"

Opt("GUITaskbarEntry", 0);no button on taskbar
Opt("GUINotifyMode", 1)
GuiCreate($title, 392,273,(@DesktopWidth-392)/2, (@DesktopHeight-273)/2, 0x80000000)

$button_1 = GUISetControl("button", "Click the left mouse button to continue", -20, -20, 430, 320)
; We make the button is bigger than the window itself so that the user
;  does not see the border of the button

GuiShow()
WinSetOnTop($title, "", 1)
While GuiMsg() < 0
    sleep(100)
WEnd

GuiDelete()
MsgBox(4096,"Next", "Rest of script could go here")
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

so really all I'm doing is making a large button.. this means it would only work with left button anyway.

I understand the point of it being mistaken for a virus as I tried to send a compiled script via email to a friend and it didn't ever show up.. deleted in transit it seems. So already it's at that point

However, is it not much the same by it doing all the controll of the mouse? moving it in location.. click left right middle .. wheel mouse.. clickdrag.. etc etc.. You can send the mouse information but not get information back.. seems a little odd to me.

Share this post


Link to post
Share on other sites

so really all I'm doing is making a large button.. this means it would only work with left button anyway.

I understand the point of it being mistaken for a virus as I tried to send a compiled script via email to a friend and it didn't ever show up.. deleted in transit it seems. So already it's at that point

However, is it not much the same by it doing all the controll of the mouse? moving it in location.. click left right middle .. wheel mouse.. clickdrag.. etc etc.. You can send the mouse information but not get information back.. seems a little odd to me.

moo

Share this post


Link to post
Share on other sites

sorry.. if the mod could delete the extra post (And this one) I didn't even know I wasn's still logged in.. sheesh..

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You can send the mouse information but not get information back.. seems a little odd to me.

Sending these keystrokes and mouse commands does not require a hook to be installed on the computer that runs the scripts. However, to detect when the user clicks the mouse requires a hook to be installed, which many people would not like. In addition, it would open up the door for more serious blackhat hackers to take advantage of this language. Also, if AutoIt used hooks, more programs than already do would declare it a virus just because of the hook it installs.

Edited to add in the last statement

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

perhaps I'm just braindead but I though this was running essentially a program.. I mean does this mean these "hooks" are installed for Maya, or photoshop or many other apps that use 3 button command structures?

And if so then how is it they are not exploited as well?

And what about this get mouse coordinates? is that sans hook?

I really want to understand how this works.. explain as you would a child :D

no seriously.. just tell me a bit more about what this hook is.. I gather it sits and waits for input to pass to the the main program..

moo

Share this post


Link to post
Share on other sites

A hook is a program that alters the way an operating system does something. In the case of a "left button" hook, it would replace what windows normally does with a left click and put in the hook's own code instead. Then, when the user clicks the mouse, it would run the hook's code instead of what the OS "should" do with it. The problem with having AutoIt do this is that a lot of virus scanners will see the hook in the exe, and consider the code a virus for it.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0