Sign in to follow this  
Followers 0
Seedorf

Need help with a small thing

7 posts in this topic

Hi im new to this autoit and programming. The thing I want to do is that I want to do a function (dont know if u call it that) for a MouseClick ("left", 535, 469, 1, 10) thing, I mean I want the func to be at the top of the script, i think its called global or something like that. And my second question, is it possible to have tre mouseclick on one function or global? how would that look?

Would very much appreciate it if someone could help me :idea:

Share this post


Link to post
Share on other sites

It dosent matter where you put the function in your script, although its generally practiced to put all your functions at the bottom.

Autoit reads them all befor anything else if I remember correctly.

You can initiate the function anywhere in your script so long as its in the same .au3 file.

If it isnt then you need to include the file it is in

#Include "functions.au3" if its in the same folder.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

hmm I dont think u understood me, its probably my fault that i dont know the programming language so good...

But the thing i want to do is: write something like Global $One and everytime i write $One in my script then it will do a MouseClick ("left", 535, 469, 1, 10). I need it because i will change the postion of the mouseclick from time to time...

hope i got it right this time :idea:

Share this post


Link to post
Share on other sites

No because autoit just sees $One as a variable

If I understand you correct then you want something like this

_MyClick(2)

Func _MyClick($iVar)
    Switch $iVar
        Case 1
            MouseClick("Primary",10,10)
        Case 2
            MouseClick("Primary",20,20)
        Case 3
            MouseClick("Primary",30,30) 
        Case Else
            MouseClick("Primary",0,0)   
    EndSwitch
EndIf

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

yes that worked great, thank u very much for the help :idea:

Share this post


Link to post
Share on other sites

hi again, i just one last question and i wonder if someone could help me out? this is just an example of what i want.

Global $m11 = MouseClick ("left", 718, 327, 1, 10)

Global $m1X = MouseClick ("left", 753, 329, 1, 10)

Global $m12 = MouseClick ("left", 789, 328, 1, 10)

Sleep (5000)

$m11

$m1X

$m12

I want to write it like this but i need to write something before in line 5-7, what is that? I want line 5-7 do the mouseclick from line 1-3 but i dont want to write the mouseclick comand down there (line 5-7)... is this possible? how would it look? I reallay appreciate all the help thx :idea:

Share this post


Link to post
Share on other sites

The question is the same as your original one and the answer remains the same.

Once you run the above code, it will attempt 3 mouse clicks, assuming they are successful the global variables will each hold the value 1 .

You are going to have to call the mouseclick function one way or another to perform a mouseclick.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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