Jump to content

Howto bind a script to Mousebutton ?

Recommended Posts

1st of all sry 4 my english im german so im not that good in english .....

sry 4 this noobquestion .. maybe im totally blind or just stupid (i searched the docs and forum 4 this but didnt really find an awnswer/ a point to start)... however im new to this and i wonder how i can bind a script to my left mousebutton (i can execute it through winexplorer .. lol but i guess this isnt what its meant to be used ?!)

Might be a bit confusin - I AM confused hehe...

This is what i want to do:

This is for clicking through large tables of switches to set up some stuff (its for a serversettingcontrol program we wrote in shool and i wanna stresstest it)

(i wanna use left mousebutton to execute a script >HOW?<)

-it should be executed as long as i hold down the button,

-it should click the left mousebutton "X times" (each click for a specif amount of time) with specified "waits",

and at the same time move the Mouse a specific amount of pixel in a specific speed DOWN

-as long as this above is performed it should count the amount of pixels it moves DOWN and gives out a variable (lets say ´var_pix´)

-when mousebutton is released it should move ´var_pix´ back UP INSTANTLY

-all other mousefunctions should be still available (clickin other buttons, movin RIGHT/LEFT/UP/DOWN -> at the moment i release the left mousebutton it should get current position und add the ´var_pix´ to it an move the mouse INSTANTLYUP


Now here my questions in a row:

1. Please gimme a hint where to start to get something like i mentionend above.


2. Where can i get German Docs for ver. 3.x ?


3. i wanna use left mousebutton to execute a script >HOW?< (should be executed AS LONG AS Mousebutton is pushed)


4. what would be the best way to do what i wanna do? (u r the pros and know some tricks im not aware of :ph34r: )


5. THX 4 this cool software and THX in Advance for ur great help !!

Edited by Merlin
Link to post
Share on other sites

That was discussed some weeks ago already i think.

It's not possible to execute a script while a key is pressed, AFAIK.

You could use Hotkeys instead. Will say Press Alt-A to start the test, Alt-S to stop.

German docs for v3 are not out yet.

For your stress test: its difficult to tell whats the best method, when you dont know the program. Maybe you could post a screenshot of it?

And for your english: Mines not better i think :ph34r:



Link to post
Share on other sites

Some time ago Larry or Valik made a small script that executes a function when a floppy disk is inserted.

It's a marvelous idea.

Let me see if I can find the topic...


No. Sorry, can't find the topic.

And I think it was Larry who made the script.

Edited by SlimShady
Link to post
Share on other sites

@larry - i think i found a way .. just set the script to ´ALT´ and then mod the mousedriver to have ´ALT´ on left mousebutton

@zeDMin - hmm not possible , is this the way we should think HERE ? discussin Software? THINK BIG !!! ;-) there must be a way - maybe wirh some external help (another script or whatever ill think about that)

-is it possible to "toggle" it ? mean push ALT it starts push alt again - it stops?

shouldnt be that hard...

Thx for the Flowers ! (ur comment about my english)

no German Docs... what has changed since 2.6 (i can get german 2.6 docs) maybe i can use them for learning basic stuff easier?

i will post a screenshot after we have had next IT-lesson (Thursday)

(imagine a excel sheet 12x8 with drop down boxes with settings in it - if the cursor starts on top it moves to settingbox1 and clicks to open it (on the right arrow of the box) then it moves cursor down to the setting it should make - click! - then move to the next box (this box contains more settings then to display so it has a scrollbar if u click the right Arrow) so i have to click&drag/click&hold down the mousebutton/cursor then release - click .... and so on ...

ALL has to work relative - not y x based (i mean the startpoints and so on:

NOT: mousebutton "left" 500,0 !

it should be like:

move cursor DOWN=(500)

(i used this just to express what i mean [i know this inst correct syntax - it isnt even syntax lol] = should mean : just go FROM WHEREEVER U R 500 pixel DOWN)

this should contain also info about HOW FAST the cursor should move this 500 pixel

.... wow i hope u understand what i mean

@ Slimshady - thx for ur try 2 help !

Link to post
Share on other sites

ok i will try it... remember this my first try in AutoIT ! (after i read the manual i love it hehe) if everything worx as decripted and expected then u can do great stuff with it!

i understand - this :


would work with this:

Func test()
;do stuff here

no questions so far...

i guess this is for "loop (looptime 1ms) a milisecond until return from func test() is true/1 ?!

or how exactly does this work together ? i wanna understand it please !!

While 1

i dont fully understand the english docu about this:


expression - If the expression is true the following statements up to the WEnd statement are executed. This loop continues until the expression is false.


While...WEnd statements may be nested.

The expression is tested before the loop is executed so the loop will be executed zero or more times.

To create an infinite loop, you can use a non-zero number as the expression.

While <exp[b][/b]ression>
also i found something i dont understand:

When you set a hotkey, AutoIt captures the keypress and does not pass it on to the active application--with one exception: The Lock keys (NumLock, CapsLock, and ScrollLock) still toggle their respective state! If you wish to send the captured hotkey to the active application you must unregister the hotkey before invoking Send or must use ControlSend:

; capture and pass along a keypress
HotKeySet("{Esc}", "captureEsc")
Func captureEsc()
; ... can do stuff here
    HotKeySet("{Esc}", "captureEsc")

Please can u help explain cuz i wanna use it in "another application" in another project...

all help is welcome :ph34r:

Edited by Merlin
Link to post
Share on other sites

I have competely "re-edited" the post above ... please help me ... my noobish questions were resolved by reading all those docs etc. but i have still those questions above

and one further question: if i push (and hold it) the key does this mean for AutoIT "Key is down and stays down" or does it mean "key is pushed and released ?" i mean does it recognize something similar like "onkeydown and onkeydown" ?? or is it just "key has been pushed" ?

I just want to fully understand to get the "full power" out of the Software ;ö)) !!

Some Words:

Thx in Advance 4 ur replay and thx again 4 this great peace of Software !

Its awesome !! after i have learned enough about that i will open my AcG (AutoIT coding Group) forum (just a part of www.ALLyaNEED.de ) for the public. It will be a German support Forum 4 this great Software! We currently are 4 German members in that forumpart in the "AcG" hehe its nice tweakin around together on scripts... lots fun and usefull together !

Also would be glad to make the German Docus and make the German support for u! just visit us! All from the Usergroup Mods-Allround are interested in this project!

Also u can contact me there if u like...

Remember : Yes we are totally noobs in AutoIT codin but we are willed to learn and able to translate ur Stuff ... Also we are currently workin to build up a big Forum/comunity (at least we started 1month ago and we have now 31 registered members and over 550 posts ok not thaaaaat big but it´ll grow! we´re workin hard on it ... We have all kinds of intersting stuff : Help 4 Hard´n´Software / Electronic [2 IT servicetechnician]/ Cars;Motobikes [we have 3 mechanics there] / Funstuff / Buy&Sell of privat stuff / Grafix;Photoshop / Html/PhP etc. ALLyaNEED it will grow !!! ;-) maybe u can help with ur nice prog!

contact:lo0k @ sig.

Link to post
Share on other sites

OK got it ! thank you!

mousegetPOS returns everytime the same value cuz its a 3d window...hmmm

i also tried Opt("MouseCoordMode", 0) but same result it returns everytime same result... any solution idea ?!


some ideas...

if there is a solution for the above mentionend problem:

MouseClickDrag ( "button", x1, y1, x2, y2 [,speed] )

possible to work here with empty values for one axis (x1 + x2)?

how to interact with y but not with x ? i mean what is the best solution to clickdrag and relatively move the mouse up/down without have to set a value for left/right ??

there must be another way to do htis:

go from whereever you are 5 pixel down with a specified speed (best would be WITH clicked mousebutton)

- please i need ur ideas... im also workin on it .... i have some ideas but it takes time to test em...

Edited by Merlin
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...