Register for your free account! | Forgot your password?

You last visited: Today at 23:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Guide] Using AutoIT

Discussion on [Guide] Using AutoIT within the Mabinogi Hacks, Bots, Cheats & Exploits forum part of the Mabinogi category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
[Guide] Using AutoIT

Sup,
I translated , so people wont have any lame excuses for not releasing something themselves.

I learned it using this Tutorial, and hey, if I can do it, you cant do it.

Note that I'll translate one Chapter each day, since I got other stuff to do, too. Also, I edited it a bit to make it easier to understand in english, and I also deleted some unnecessary stuff.

(Yes, I know I should post this in the Tutorial-Section, and I will once I'm done translating it all, but GODDAMN I want the lazy people in this section to get off their lazy butts. :P)


__________________________________________________ ______


This Tutorial was written by MaZze from cpg and in my opinion the best TuT to learn AutoIT.
__________________________________________________ ____________

[AutoIt] BASICS I

Vorwort :

A few weeks ago I started learning AutoIT. Sadly, most Tutorials were written in "NerdLanguage", so normal people had no chance of understanding anything.
So in order to make it easier for people to start with AutoIT, I'm writing this Tutorial.

__________________________________________________ ____________

FIRST STEPS :

- Download AutoIT (Newest Version)

That would be :

(Note by Dark Raccoon: I recommend downloading the newest SciTE, too. Link: .)

- Take a look at the program
(Just start it and try out a few functions.)

__________________________________________________ ____________

Writing our first Program :

First I'll show you the whole Code, then I'll explain it step-by-step.

Quote:
Run ("notepad.exe")
Send ("Now we are writing the text...")
Send ("{enter}")
Send ("Of course we could do it ourselves...")
Send ("{enter}")
Send ("But thats what AutoIT is for!")
Sleep (5000)
Send ("!{F4}")
Sleep (1000)
Send ("{right}")
Sleep (1000)
Send ("{enter}")
Exit
Start the AutoIT SciTE Script Editor.
(If its your first time coding, there should be a blank project.)

__________________________________________________ ____________

Now lets take a look at the Commands :

I started with
("notepad.exe").
Run ("Filename")


It is important to write the Filename as "filename.fileformat".
In AutoIt, most Filenames, Messages, ... are written within the " signs.
Otherwise they are just meaningless Letters and Numbers.
(Thats not always the case, but for our example the " signs are very important.)

In our example its "notepad.exe".
Since Notepad is a common program, we dont need to put write an specific directory.
Of course, there are exceptions.
For example, if the File is in the same Folder as your script/program, then you dont have to write their directory.
However, for any other programs/files it is recommended to write their directory.


__________________________________________________ ____________


Now for the Command we used the most : Send
Send ("text")
or
Send ("{key}")


With this command, you simply send text or keys.

The following is very important :

When you want to send Text, write :
Send ("text")

If you want to send Keys (strg/alt/esc/enter/etc) write :
Send ("{key}")

It is important for both that you always have to make your that your text is within the "-signs.
Otherwise it wont work.

Of course, we can combine both. For example, it wouldnt be a problem to write :
Send ("blah blah{Enter}blah blah{Left}{Delete}{Right}{Enter}blah blah")

At the end I will also give you a list of some Keys.

__________________________________________________ ____________

The next Command is Sleep :

Sleep (1000)
Sleep (time to wait)

With Sleep, you can easily pause programs or let them rest for some time.

Its really important that you write the time to wait in milliseconds.


So basically :

1000 = 1 second

I used that command so you can watch the program write.
(Otherwise it would be finished before you even know whats happening.)

__________________________________________________ ____________

Now lets take another look at Send

Send ("text/{key}")

It is also possible to use Key-Combinations.

In the example I used the combination ALT+F4, so the opened window closes.

In AutoIT, the keys CTRL and ALT got "special signs".

Alt = !
CTRL = ^


So I wrote :
Send ("!{F4}")
__________________________________________________ ____________

Now finally, the end of our Script.

We symbolize the end with:

Exit

With this command, you simply close your script/program.

It doesnt have to stand at the end of a script.
You could, for example, combine it with other commands.
(If/Else - HotkeySet - etc.)

__________________________________________________ ____________

Now its time for the list I told you about.
(I'll just write down the ones that are used the most.)

Quote:
! = alt

^ = ctrl

{Enter} = Enter

{Delete} = delete

{left}{right}{up}{down} = arrow keys

{F1}/..../{F12} = F1 - F12
For now, you wont need anything else than this.

__________________________________________________ ____________

IMPORTANT :

AutoIt-Projects (source-files) are always saved as *.au3 Files!
NEVER save it directly as a *.exe!
Thats what the Compiler is for.

__________________________________________________ ____________

[AutoIt] Basics II


What are we gonna do today?

I think its time for variables.
__________________________________________________ ____________

What are "Variables"?

A Variable is nothing but a "Spaceholder".
In some Scripts, certain values are used over 1000 times.
So why write like hell on the SourceCode, if you could just take a "shortcut"?

In AutoIT, Variables are marked by the $(dollar)-sign.
That way, AutoIT knows that your talking about a Variable, and not abou ta command etc.
__________________________________________________ ____________

How is a Variable build?

A Variable is build really simple:

$variable = value/"value"

The following is really important when using variables:
AutoIT notices Capitalization in variables!

So...

$Variable = 10
$VaRiabLe = 10
$vAriabLe = 10

arent the same!

Try to always write variables small, so there wont be any trouble
.
__________________________________________________ ____________

What can I name a Variable?

As long as theres a $-Sign in front of it, almost everything should be okay.
However, there still are some exceptions.

Signs like !"§$%&/()=? etc cant be used to name a Variable.
Same thing with äöü and ÄÖÜ

__________________________________________________ ____________

Of course you can also combine text and/or other variables.

That way, you dont have to always write another Send() command.
To combine a variable with a string (Thats the text between the "-Signs), you need this sign:

&

A correctly combined Text would look like this:

Quote:
$variable = "number 1"

Send ("Text " & $variable)
Result => Text number 1
(correct)

As you can see, I only wrote the Text within the "-Signs.
Thats because AutoIT recognizes everything that is written in "-Signs as a String, and not as a Variable.

So if you write this:

Quote:
$variable = "nummer 1"

Send ("Text & $variable")
The Result would be

Quote:
Text & $variable
Can you see what would have happened?
AutoIT would just have written the just within the "-Signs as Text, and not how we would have wanted it.

__________________________________________________ ____________

Heres an Example how you could use Variables.

Example (Without Variables):

Image you would want to send a Mass-Email.

Quote:
Send ("Hello Kevin,")
Send ("{Enter}")
Send ("I will make a party at xx.xx on Friday.")
Send ("{Enter}")
Send ("I would appreciate it if you would come.")
Send ("{Enter}")
Send ("Oh, and Kevin, it could get pretty late, so tell your parents..")
Send ("Greetz, Eddy")
However, you want to send that Message to 3 different people.
Wanna type it all again?
No way! Lets just use variables...

Example (With Variables):

Quote:
$friend1 = "Kevin"
$friend2 = "Tom"
$friend3 = "Jesus"
$friend4 = "Anne"

Send ("Hello & $friend1,")
Send ("{Enter}")
Send ("I will make a party at xx.xx on Friday.")
Send ("{Enter}")
Send ("I would appreciate it if you would come.")
Send ("{Enter}")
Send ("Oh, and Kevin, it could get pretty late, so tell your parents..")
Send ("Greetz, Eddy")

In this case, you would just have to exchange the name of the variable and our Mass-Email would be finished.


Now you know about Variables.
Its very important that you know about them, because without Variables coding would be hell.

___________________________________

(I completely rewrote this part since that was faster and easier than translating all the stuff he wrote.)

Mouse Commands -

Code:
MouseMove - Move the Mouse to certain Coordinates on your Screen.
MouseClick - Make the Mouse click a certain Point.
MouseClickDrag - Make the Mouse click and drag something.
The Mouse Commands work by using x and y coordinates.
Note: You can find out the x and y coordinates of certain points by using the AutoIT Window Info, which comes with the default installation. Do not forget that the Coordinates may vary depending on your Resolution.
AutoIT Window Info

Lets say we want to move our Mouse from the left to the right.
- Start the AutoIT Window Info.
- Switch to the "Mouse"-Section.
- Click and Drag the Finder Tool to the very right of your Screen.
- Write down the x and y Coordinates on a sheet of paper.
Now comes the Coding:

We want to move our Mouse, so we take the command "MouseMove".

Code:
MouseMove (xcoordinate, ycoordinate, speed)
In my case, this would be:

Code:
MouseMove (1437, 453)
I didnt put in a Speed-Value so it moves by default Speed.

Thats how you make your Mouse move.
You can also combine the MouseMove-Command with other Functions such as PixelSearch, Imagesearch, and so on.

____________________________________________


Now we want the Program to - for example click the Start-Button in our Taskbar.

For this, we use the commad "MouseClick".

Code:
MouseClick ("button", xcoordinate, ycoordinate, clicks, speed)
Button: Right or left Mousebutton.
Clicks: How often is it supposed to click that point?
Speed: How fast do you want it to click?

So, you start the AutoIT Window Info and get the Coordinates of your Start-Button.

In my case, the Code would look like this:

Code:
MouseClick ("left", 30, 886)
This time, I didnt put in any Click- or Speed-Value.

That way, it will only click once and by default Speed.

Just as with "MouseMove", you can combine this command with other functions.

_________________________________________

Now we are almost almost done.

Lets say we want our program to click&drag a File onto our Desktop.

We will use this Command:

Code:
MouseClickDrag ("Button", xcoordinate one, ycoordinate one, xcoordinate two, ycoordinate two, speed)
Since we want the Mouse to click and drag something, we need TWO points: the one it starts holding down the mouse, and the one it moves to and releases the mouse.

Open up the AutoIT Window Info and get the coordinates of your files.

Write them down and get the coordinates of where you want to drop them, and write those down, too.

In my case, the code looks like this:

Code:
MouseClickDrag ("left", 321, 296, 1208, 501)
Again, I didnt put in a Speed-Value.

And just like with the other Mouse-Commands, you can combine this one with other functions.

So thats it for Mouse-Commands.

Tomorrow I'll tell you about some Pixel-Functions as well as Message-Boxes.

- Tutorial will be continued tomorrow at this point.
Dark Raccoon is offline  
Old 10/20/2009, 23:12   #2
 
elite*gold: 0
Join Date: Jan 2009
Posts: 180
Received Thanks: 102
How do we hold a key while doing something else?
Ex:
Hold Alt
Click
Alt Up

I tried {ALT DOWN} but it doesn't work.
Trismic is offline  
Old 10/20/2009, 23:25   #3
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
Quote:
Originally Posted by Trismic View Post
How do we hold a key while doing something else?
Ex:
Hold Alt
Click
Alt Up

I tried {ALT DOWN} but it doesn't work.
Send ("{ALTdown}")

You can replace ALT with whatever Key you want to hold down.
Dark Raccoon is offline  
Old 10/21/2009, 01:58   #4
 
Cloudsdabomb's Avatar
 
elite*gold: 0
Join Date: Nov 2007
Posts: 142
Received Thanks: 23
haha wish you had posted this earlier. then you wouldn't have had to stay up and help me over the internet on one on one tutorials where we couldn't figure out what was wrong thanks though
Cloudsdabomb is offline  
Old 10/21/2009, 03:34   #5
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
Quote:
Originally Posted by Cloudsdabomb View Post
haha wish you had posted this earlier. then you wouldn't have had to stay up and help me over the internet on one on one tutorials where we couldn't figure out what was wrong thanks though
The funny thing is, an hour after I got off, I figured what our problem was. :P
Dark Raccoon is offline  
Old 10/21/2009, 04:04   #6
 
Cloudsdabomb's Avatar
 
elite*gold: 0
Join Date: Nov 2007
Posts: 142
Received Thanks: 23
haha just my luck
Cloudsdabomb is offline  
Old 10/23/2009, 03:10   #7
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
#Updated.
Dark Raccoon is offline  
Old 10/23/2009, 03:14   #8
 
elite*gold: 0
Join Date: Sep 2009
Posts: 359
Received Thanks: 124
Also, if you choose to use autohotkey, their website has an AWESOME documentation section. There's almost nothing you can't find there.
lostmage333 is offline  
Old 10/23/2009, 12:41   #9
 
cloudkiller2006's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 855
Received Thanks: 149
don't forget autohotkey's help file, that thing has about the same stuff in it XD
cloudkiller2006 is offline  
Old 10/23/2009, 21:22   #10
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
Quote:
Originally Posted by cloudkiller2006 View Post
don't forget autohotkey's help file, that thing has about the same stuff in it XD
So does AutoITs HelpFile. :P

I still prefer AutoIT, because AHK is based on AutoIT, so its nothing but a cheap copy. ;D
Dark Raccoon is offline  
Old 10/23/2009, 21:28   #11
 
Eddie2200's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 37
Received Thanks: 8
KOOL

koool dude i just dont wanna learn auto it cuz im learnin lua
koool any way
Eddie2200 is offline  
Old 10/30/2009, 15:10   #12
 
cloudkiller2006's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 855
Received Thanks: 149
-bump-

this is still helpful (and most likely forgotten already) so ima push it up on the list xD
cloudkiller2006 is offline  
Old 10/30/2009, 17:44   #13
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
Oh, right, totally forgot this. ._.

Ill go and translate 2 Chapters now. D:
Dark Raccoon is offline  
Old 10/30/2009, 18:14   #14
 
elite*gold: 0
Join Date: Oct 2007
Posts: 10
Received Thanks: 2
lol yeah, but another good ways to learn it's to read the code that people put on the forum
arkilion is offline  
Old 10/30/2009, 20:48   #15
 
elite*gold: 0
Join Date: Nov 2008
Posts: 3,695
Received Thanks: 891
#Updated.

Meh, Raccoons lazy today.
Dark Raccoon is offline  
Reply


Similar Threads Similar Threads
[GUIDE] AutoIt ImageSearch
10/18/2009 - Metin2 Guides & Templates - 14 Replies
Ein sehr praktischer Befehl in AutoHotkey: ImageSearch. (http://www.autohotkey.com/docs/commands/ImageSear ch.htm) Was macht der Befehl?- er sucht den ganzen Bildschrim nach einem Vorgegebenen Bild ab. Vielleicht auch Nützlich für den Angelbot, weil die Leute nicht mehr Pixel suchen müsen, sondern nuch noch Screens machen müssen! Diesen Befehl gibt es auch für AutoIt! _________________________________________________ ___________________________ . Kopiere die ImageSearchDLL.dll in...
Suche Guide fuer AutoIt
07/25/2007 - World of Warcraft - 4 Replies
Hallo, ich habe mir jetzt mal den Guide zu AutoIt durchgelesen, aber nicht wirklich viel gelernt was ich bei WOW anwenden koennte. Kann sich vllt jemand mal die Muehe machen und einen Guide schreiben wie man die Elemente von AutoIt gut fuer WoW einsetzen kann? mfg glyx



All times are GMT +2. The time now is 23:37.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.