Play Legend of the Green Dragon Play BNT Play Promisance Play Alien Assault Traders Play Quantum Star Play Some Chess  
   D3jsp RPGRPG   ArcadeArcade   Multiplayer PokerD3Jsp Poker   FAQ/RulesFAQ/Rules  SearchSearch  MemberlistMemberlist   UsergroupsUsergroups   ChatroomLive Chat   Log inLog in   RegisterRegister 

Autoit Basic Tutorial

 
Post new topic  Reply to topic  d3jsp Forum Index -> General Chat
View previous topic :: View next topic ::  


Author Message
the_pillo
The Magnificent

Group: Verified Member
Joined: 09 Jul 2009
Donor:
Posts: 1105
Gold: 0.00
Clan: Honor


us.gif

Status:
Warn:
Reputation: 32    



Post#1 Posted: 07 Oct 2009 02:02 am    Post subject: Autoit Basic Tutorial Reply with quote

Autoit Quick Tutorial

Ok, so I am feeling very bored and decided it would be fun to make a tutorial.
So i decided to do it with autoit, this will be brief and teach you some basics.
there are much better tutorials out there but this will get you started.


Basic Format:
Command(----,----,----,)
run("notepad.exe")





Common simple functions:

Run

WinWaitactive

winactivate

mouseclick

mousemove

sleep

$


Common Simple Commands

Func...Endfunc


Code:


hotkeyset("{end}", "fun")

func fun()
   Exit
EndFunc



This is an example of the func command.. we declared the command "fun"
To be attached to the END button on your keyboard.
Therefore when we press the END button on the keyboard it will run this
function and EXIT the entire Program.


While...Wend

Code:
 

Run("notepad.exe")
While 1
Send("This is an example of the While...Wend Command")
Wend



This is an example of the while Wend command. it will repeat the code between
While and Wend until it becomes true, or forever.
In this script there is no true... so it will type
This is an example of the While...Wend Command
until you end it


If..Then..Endif


Code:


$a=10

If $a <> 5 then Exit
Endif



This is an example of if then endif, in this it will
find the variable of $a and if it does not equal 5 then it will exit the script.


Select...Case...Endselect

Code:

$msg = GuiGetmsg()
Select
Case $msg = $GUI_EVENT_CLOSE
      Exitloop
      Exit

Case $msg = $button_1
      run("notepad.exe")
      Send("test,test,test")

EndSelect




This is an example of select..case..endselect. This command is used
if you have multiple choices, Depending on which case is true will depend what happens.
This was part of a GUI(Graphic User Interface) script,
but when you hit X at the top right of window it would exit the script.
Or if you hit one of the buttons (button 1 for example) it would run notepad and type test.
You must put endselect after you or done to close the command.



VARIABLES:

How to declare variables?
A: Put a $(dollar) sign in front of anything you like... such as $a ,$b, etc.
Then Put and = sign and type what you want your variable to be.
Such as:
Code:

$a=5
$b=7
$c=12

If $a+$b <> $c then exit
endif




Here is a simple gui script for organizing computer maintenance items.
of course under the run functions on lines: 54,58,and 49 to your own specs.

Code:

#include <GUIConstantsEx>

hotkeyset("{end}", "fun")

func fun()
   Exit
EndFunc

HotKeySet("{PAUSE}", "TogglePause")

Global $Paused


Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("Script is running")
Sleep(2000)
EndFunc



;=====================================================GUI=================================================
Example()

Func Example()
    Local $Button_1, $Button_2, $Button_3, $msg
    GUICreate("Pillo Productions Presents: Computer Maintenence Center") ; will create a dialog box that when displayed is centered
    GUICtrlCreateLabel("What would you like to do?",100,30,200)
    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("CCleaner", -200, 60, 200)
    $Button_2 = GUICtrlCreateButton("Panda Scan", -200, 90)
   $Button_3 = GUICtrlCreateButton("Defrag",-200,120)
    GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            exit
         
         Case $msg = $Button_1
            Msgbox(0,"Pillo Productions", "you have started CCleaner")
         Run("C:\Program Files\CCleaner\CCleaner.exe")
            WinWaitActive("Piriform CCleaner")
         Send("{r}")
      Case $msg = $Button_2
         Msgbox(0,"Pillo Productions", "you have started Panda")
         run("C:\Program Files\Panda Security\Panda Antivirus Pro 2009\Pavw.exe")
         Winwaitactive("Panda Antivirus Pro 2009 (8.00.00)")
      Case $msg = $Button_3
         Msgbox(0,"Pillo Productions", "you have started Defrag")
         Run ( "C:\WINDOWS\system32\mmc.exe C:\WINDOWS\system32\dfrg.msc" )
         Winwaitactive("Disk Defragmenter")
EndSelect
Wend
EndFunc


This is confusing but it gives you a small taste of everything ...



Ok i am sorry if this is a crappy tutorial, its my first pure text one. and my first ever on autoit.

tell me what you think and if you think something needs added just ask

_____________________


Happiness is a disease, and smiling is the cough that spreads it - pillo-

"When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Schoolhacker


Group: Senior Moderator
Joined: 20 Feb 2007
Posts: 9365
Gold: 935.14


ca.gif

Status:
Warn:
Reputation: 55    


<b><font color=Blue>Senior Moderator</font></b>

Post#2 Posted: 17 Oct 2009 12:32 am    Post subject: Reply with quote

interesting... good for nob programmers lol
_____________________
Back to top
View user's profile Send private message


njaguars_multi


Group: Members
Joined: 27 Oct 2009
Posts: 50
Gold: 14.20
Clan: D3JSP


Status:
Warn:
Reputation: 0    



Post#3 Posted: 31 Oct 2009 12:00 pm    Post subject: Reply with quote

or you could just get iMacros for firefox. unless you want to do extensive autoit functions, this works very well.
_____________________

We'll make great pets.
Let's give 'em something to talk about..
Hi.
Back to top
View user's profile Send private message
cagiva


Group: Members
Joined: 31 Oct 2009
Posts: 613
Gold: 4.00
Clan: D3JSP


Status:
Warn:
Reputation: 1    



Post#4 Posted: 31 Oct 2009 03:59 pm    Post subject: Reply with quote

autoit is the easiest programming language and its very useful great thing!
but your tutorial is crappy.

_____________________
Back to top
View user's profile Send private message
KnightMaire


Group: Members
Joined: 11 Nov 2008
Posts: 304
Gold: 0.80


us.gif

Status:
Warn:
Reputation: 3    



Post#5 Posted: 11 Nov 2009 06:26 pm    Post subject: Reply with quote

agreed.
_____________________
Maps Made:
Trust bound
Skittles Bound
Yoshi Egg Bound
Top Bound¹
Preferred Bounds
Maps in Progress:
True Scope Sniping
Bound Cannon Defense
Chain Reaction Bound
Ravamped DodgeBall [1.0]

And yes, I'm a Bounder... 8/10.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
1 Members: Guest
Post new topic  Reply to topic  d3jsp Forum Index -> General Chat All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum



D3jsp is proudly powered by phpBB © 2.0
Theme and Forum by tramway