x' v3.3.14.2 ©1999-2015 jonathan bennett & autoit team autoit … · autoit via an...

633
'X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt v3 Homepage

Upload: others

Post on 31-Aug-2020

23 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

'X'

v3.3.14.2

©1999-2015JonathanBennett&AutoItTeam

AutoItv3Homepage

Page 2: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

IntroductionAutoItv3isafreewareBASIC-likescriptinglanguagedesignedforautomatingtheWindowsGUI.Itusesacombinationofsimulatedkeystrokes,mousemovementandwindow/controlmanipulationinordertoautomatetasksinawaynotpossibleorreliablewithotherlanguages(e.g.VBScriptandSendKeys).

AutoItXisaDLLversionofAutoItv3thatprovidesasubsetofthefeaturesofAutoItviaanActiveX/COMandDLLinterface.ThismeansthatyoucanaddAutoIt-likefeaturestoyourfavouritescriptingandprogramminglanguages,e.g.VB,VBScript,Delphi,C,C++,Kixtart,andmostotherlanguagesthatsupporttheuseofDLLs.

AsAutoItXprovidesasubsetofthefeaturesofAutoItv3youshouldreadthehelpfileforAutoItv3andbecomefamilarwiththebasicconcepts,including:

TheAutoItWindowInfoToolWindowsControls

Helppagesontheabovetopicsareduplicatedinthishelpfileforreference.

TheoriginalversionofAutoItcamewithtwocontrols:AutoItX(aCOM/ActiveXcontrol)andAutoItDLL(aDLLcontrol).InthisnewversionboththeCOMandDLLversionshavebeencombinedintothesingleAutoItXcontrolwhichprovidesbothmethodsofaccess.

HowyouuseAutoItXdependsonthehostlanguageyouwanttouse.IfyouareusingsomethingthatsupportsCOMobjectaccess(likeVBScript)thenusingAutoItXasaCOMcontrolisrecommended.IfyouwanttouseAutoItXfromalanguagesuchasCthenusingitasaDLLissimplest.

ThroughoutthishelpfileexamplesforCOM/ActiveXusagearegivenusingVBScript,andstandardDLLusageusingC/C++.TheseareexpectedtobethemostcommonwaysofusingAutoItX(andthetwothatIammostfamiliarwith).UsersofotherlanguagesshouldcheckouttheAutoItXsectionontheAutoItForumforhelpandadviceshouldyouneedit.

Page 3: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

SoftwareLicenseAutoIt

Author:JonathanBennettandtheAutoItTeamWWW:https://www.autoitscript.com/site/autoit/Email:supportatautoitscriptdotcom________________________________________________________

END-USERLICENSEAGREEMENTFORTHISSOFTWARE

ThisEnd-UserLicenseAgreement("EULA")isalegalagreementbetweenyou(eitheranindividualorasingleentity)andthementionedauthorofthisSoftwareforthesoftwareproductidentifiedabove,whichincludescomputersoftwareandmayincludeassociatedmedia,printedmaterials,and"online"orelectronicdocumentation("SOFTWAREPRODUCT").Byinstalling,copying,orotherwiseusingtheSOFTWAREPRODUCT,youagreetobeboundbythetermsofthisEULA.IfyoudonotagreetothetermsofthisEULA,donotinstallorusetheSOFTWAREPRODUCT.

SOFTWAREPRODUCTLICENSE

TheSOFTWAREPRODUCTisprotectedbycopyrightlawsandinternationalcopyrighttreaties,aswellasotherintellectualpropertylawsandtreaties.TheSOFTWAREPRODUCTislicensed,notsold.

ThedefinitionofSOFTWAREPRODUCTdoesnotincludesanyfilesgeneratedbytheSOFTWAREPRODUCT,suchascompiledscriptfilesintheformofstandaloneexecutables.

1.GRANTOFLICENSE

ThisEULAgrantsyouthefollowingrights:

InstallationandUse.YoumayinstallanduseanunlimitednumberofcopiesoftheSOFTWAREPRODUCT.

ReproductionandDistribution.YoumayreproduceanddistributeanunlimitednumberofcopiesoftheSOFTWAREPRODUCTeitherinwholeorinpart;eachcopyshouldincludeallcopyrightandtrademarknotices,andshallbe

Page 4: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

accompaniedbyacopyofthisEULA.CopiesoftheSOFTWAREPRODUCTmaybedistributedasastandaloneproductorincludedwithyourownproduct.

CommercialUse.YoumayusetheSOFTWAREPRODUCTforcommercialpurposes.Youmaysellforprofitandfreelydistributescriptsand/orcompiledscriptsthatwerecreatedwiththeSOFTWAREPRODUCT.

Reverseengineering.YoumaynotreverseengineerordisassembletheSOFTWAREPRODUCT.

2.COPYRIGHT

AlltitleandcopyrightsinandtotheSOFTWAREPRODUCT(includingbutnotlimitedtoanyimages,photographs,animations,video,audio,music,text,and"applets"incorporatedintotheSOFTWAREPRODUCT),theaccompanyingprintedmaterials,andanycopiesoftheSOFTWAREPRODUCTareownedbytheAuthorofthisSoftware.TheSOFTWAREPRODUCTisprotectedbycopyrightlawsandinternationaltreatyprovisions.Therefore,youmusttreattheSOFTWAREPRODUCTlikeanyothercopyrightedmaterial.

MISCELLANEOUS

IfyouacquiredthisproductintheUnitedKingdom,thisEULAisgovernedbythelawsoftheUnitedKingdom.IfthisproductwasacquiredoutsidetheUnitedKingdom,thenlocallawmayapply.

ShouldyouhaveanyquestionsconcerningthisEULA,orifyoudesiretocontacttheauthorofthisSoftwareforanyreason,pleasecontacthim/herattheemailaddressmentionedatthetopofthisEULA.

LIMITEDWARRANTY

1.NOWARRANTIES

TheAuthorofthisSoftwareexpresslydisclaimsanywarrantyfortheSOFTWAREPRODUCT.TheSOFTWAREPRODUCTandanyrelateddocumentationisprovided"asis"withoutwarrantyofanykind,eitherexpressorimplied,including,withoutlimitation,theimpliedwarrantiesormerchantability,fitnessforaparticularpurpose,ornon-infringement.TheentireriskarisingoutofuseorperformanceoftheSOFTWAREPRODUCTremainswithyou.

Page 5: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

2.NOLIABILITYFORDAMAGES

InnoeventshalltheauthorofthisSoftwarebeliableforanydamageswhatsoever(including,withoutlimitation,damagesforlossofbusinessprofits,businessinterruption,lossofbusinessinformation,oranyotherpecuniaryloss)arisingoutoftheuseoforinabilitytousethisproduct,eveniftheAuthorofthisSoftwarehasbeenadvisedofthepossibilityofsuchdamages.Becausesomestates/jurisdictionsdonotallowtheexclusionorlimitationofliabilityforconsequentialorincidentaldamages,theabovelimitationmaynotapplytoyou.

[ENDOFLICENSE]

Page 6: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

AutoItWindowInformationToolAutoItv3comeswithastandalonetoolcalledtheAutoItWindowInfoTool(ProgramFiles\AutoIt3\Au3Info.exe).Au3Infoallowsyoutogetinformationfromaspecifiedwindowthatcanbeusedtoeffectivelyautomateit.Informationthatcanbeobtainedincludes:

WindowtitlesTextonthewindow(visibleandhidden)WindowsizeandpositionContentsofthestatusbarPositionofthemousepointerColorofthepixelsunderneaththemousepointerDetailsoftheControlunderneaththemousepointer

TouseAu3Infojustrunit(fromthecommandlineorStartmenu).Au3Infowillremainthetopmostwindowatalltimessothatyoucanreadit.Onceactivemovetothewindowyouareinterestedinandactivateit-thecontentsofAu3Infowillchangetoshowtheinformationthatisavailable.WiththehelpofAu3Infoyoushouldbeautomatinginnotime!

WhenAu3InfoisrunningyoumaywanttocopytextdirectlyfromitusingCTRL-Candthenpasteitintoyourscripttoavoidspelling/caseerrors.Forthetabsthathaveinformationinalistview(likethecontrolinformationshownbelow)justdouble-clickonanentrytocopyittotheclipboard.Thiscanbedifficultwhenyouwanttocapturepixel/mouseinformationasitkeepschanging!Tohelpwiththisyoucan"freeze"theoutputofAu3InfobypressingCTRL-ALT-F.Pressthekeysagainto"unfreeze".

HereisanexampleofAu3InfoinusewiththeWindows"WordPad"editor:

Page 7: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite
Page 8: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WindowTitlesandText(Basic)Whenautomating,mostwindowscanbeuniquelyidentifiedbytheirtitleoracombinationoftheirtitle&text.AndbyusingAutoItWindowInfoTool(orevenbysight)thisinformationiseasytoobtain.Thetitlesofmostwindowsarefairlyobvious,forexampleUntitled-Notepadisthetitleofthenotepad.exeeditorandinmanycasesthisisenoughtoautomate.

Note:Ifablankstring""isgivenforbothtitleandtextthenthecurrentlyActivewindowwillbeused(thisisnottrueinsomeofthemoreadvancedWinTitleMatchModes)!

Windowtitlesandtextarecasesensitive.Youmustmatchthecaseandpunctuationexactly.Toavoidproblemsselectthetitle/textintheWindowInfoToolandusectrl-ctocopyitandthenpasteitdirectlyintoyourscript.

MostofAutoIt'swindowfunctionshavespaceforatitleandtextentry,hereistheWinWaitActivefunction.Thisfunctionpausesexecutionofthescriptuntilthespecifiedwindowappearsandisactive.

WinWaitActive"title",["text"],[timeout]

titleistheonlyrequiredparameterforthisfunction,boththetextandtimeoutareoptional.Insomefunctionsthetextparameterisnotoptional,ifyoudonotwishtospecifyanytextthenjustuse""(ablankstring).Ablankstring,ornothingatall,inthetexttellsAutoItthatanytextisvalid.

Tousetheabovefunctionwithanynotepadwindowboththesemethodswillwork:

oAutoIt.WinWaitActive"Untitled-Notepad"

Page 9: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

and

oAutoIt.WinWaitActive"Untitled-Notepad",""

Ifthesamenotepadwindowhad"Thisisalineoftext"typedintothewindow,theWindowInfoToolwouldshow:

NotethattheWindowInfoToolhasseenthetitleandtextofthenotepadwindow.WhatevertheWindowInfoToolcanseeiswhatAutoItcansee.Nowwehaveenoughinformationtoidentifythisexactwindoweveniftherearelotsofothernotepadwindowsopen.Inthiscaseweuse:

Page 10: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

oAutoIt.WinWaitActive"Untitled-Notepad","Thisissometext!"

Page 11: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WindowTextThewindowtextconsistsofallthetextthatAutoItcan"see".Thiswillusuallybethingslikethecontentsofeditcontrols(asabovewith"Thisisalineoftext")butwillalsoincludeothertextlike:

Buttontextlike&Yes,&No,&Next(the&indicatesanunderlinedletter)Dialogtextlike"Areyousureyouwishtocontinue?"ControltextMisctext-sometimesyoudon'tknowwhatitis:)

Theimportantthingisthatyoucanusethetextalongwiththetitletouniquelyidentifyawindowtoworkwith.

Whenyouspecifythetextparameterinawindowfunctionitistreatedasasubstring.Sofortheexampleaboveifyouusedthetext"issome"youwouldgetamatch.

WhathasbeendescribedisthedefaultmodethatAutoItoperatesin,thereareanumberofmoreadvancedmodestousewhenthingsarenotassimpleasthis.

Note:Hiddenwindowcanbematchedby"title"onlyif"text"isempty("").

Page 12: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WindowTitlesandText(Advanced)AutoItoperatesinoneofthree"Windowmatching"modes.ThemodesaresetwiththeAutoItSetOptionfunctionusingtheWinTitleMatchModeoption.

Mode1(default)

Matchespartialtitlesfromthestart.

InthismodetheawindowtitledUntitled-Notepadwouldbematchedby"Untitled-Notepad","Untitled","Un",etc.

eg.

oAutoIt.WinWait"Untitled"

Mode2

Matchesanysubstringinthetitle.

InthismodeawindowtitledUntitled-Notepadwouldbematchedby"Untitled-Notepad","Untitled","Notepad","pad",etc.

eg.

oAutoIt.WinWait"Notepad"

Mode3

Exacttitlematch.

InthismodeawindowtitledUntitled-Notepadwouldonlybematchedby"Untitled-Notepad"

Mode4(Keptforbackwardcompatibility)

Advancedmode

Page 13: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MustbereplacedwithAdvancedWindowDescriptionswhichdoesnotneedanymodetobeset.

Mode-1to-4

Forcelowercasematchaccordingtoothertypeofmatch.

Page 14: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

AdvancedWindowDescriptionsAspecialdescriptioncanbeusedasthewindowtitleparameter.Thisdescriptioncanbeusedtoidentifyawindowbythefollowingproperties:

TITLE-WindowtitleCLASS-TheinternalwindowclassnameREGEXPTITLE-WindowtitleusingaregularexpressionREGEXPCLASS-WindowclassnameusingaregularexpressionLAST-LastwindowusedinapreviousAutoItcommandACTIVE-CurrentlyactivewindowX\Y\W\H-ThepositionandsizeofawindowINSTANCE-The1-basedinstancewhenallgivenpropertiesmatchHANDLE-ThehandleaddressasreturnedbyamethodlikeWinGetHandle

Oneormorepropertiesareusedinthetitleparameterofawindowcommandintheformat:

[PROPERTY1:Value1;PROPERTY2:Value2]

Note:ifaValuemustcontaina";"itmustbedoubled.

e.g.Waitawindowofclassname"Notepad"

oAutoIt.WinWaitActive"[CLASS:Notepad]",""

e.g.Closethecurrentlyactivewindow

oAutoIt.WinClose"[ACTIVE]",""

e.g.Waitforthe2ndinstanceofawindowwithtitle"MyWindow"andclassname"MyClass"

Page 15: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

oAutoIt.WinWaitActive"[TITLE:MyWindow;CLASS:MyClass;INSTANCE:2]",""

Note:ifaValuemustcontaina";"itmustbedoubled.

Page 16: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlsOneofthebestnewfeatureswithAutoItv3istheabilitytoworkdirectlywithcertaintypesofWindowControls.Almosteverythingyouseeonawindowisacontrolofsomekind:buttons,listboxes,editfields,statictextareallcontrols.InfactNotepadisjustonebig"Edit"control!BecauseAutoItworksdirectlywithacontroltheyprovideamorereliablewaytoautomatethanjustsendingkeystrokes.

Note:AutoItonlyworkswithstandardMicrosoftcontrols-someapplicationswritetheirowncustomcontrolswhichmaylooklikeastandardMScontrolbutmayresistautomation.Experiment!

UsingtheAutoItWindowInfoToolyoucanmoveyourmousearoundthewindowyouareinterestedinandyouwillbegiveninformationofthecontrolthatiscurrentlyunderyourmouse.Informationoncontrolsisgiveninanumberofways,theseare:

ControlIDClassNameNNText

WheneveryouseeaControl...()commandexpectingacontrolIDparameter(mostofthem)youcanuseanyoneofthesemethods.ThemethodyouchoosewillvarybypersonalpreferenceandtheinformationyouareabletoretrievefromtheAutoItWindowInfoTool.Ingeneral,thebestmethodtouseistheControlID,withtheothermethodsbeingusedwhenaControlIDisnotavailableorisnotunique(usuallywithstatictexteachpieceoftextactuallyhasthesameControlIDsoyouwillneedtouseoneoftheothermethodstoworkwiththosecontrols).

Page 17: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlIDTheControlIDistheinternalnumericidentifierthatwindowsgivestoeachcontrol.Itisgenerallythebestmethodofindentifyingcontrols.InadditiontotheAutoItWindowInfoTool,otherapplicationssuchasscreenreadersfortheblindandMicrosofttools/APIsmayallowyoutogetthisControlID.

Page 18: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ClassNameNNEachMicrosoftstandardcontrolhasa"classname"suchas"button"or"edit".InAutoItthisiscombinedwiththe"instance"ofthatcontroltogivethe"ClassNameNN"method.Ifyouhaveasimpledialogwithafewbuttonsonittheywillgenerallybereferredtoas"Button1","Button2","Button3",etc.

ThismethodisusefulwhentheControlIDisnotapplicable(forstatictextorcustomcontrols).

Page 19: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

TextYouwillnoticethatAu3Infogivesyouthetextitcanseeonacontrol,forexampleonaNextbuttonyoumightseethetext&Next-the&indicatesthatthenextletterisunderlinedandiscommonwhenworkingwithmenusandcontrols.Youcanusethistexttoidentifyacontrolinplaceofthe"ClassNameNN"ifyoulike-howeverifmanycontrolshavethesametextyouwillrunintoproblems.

LookunderthecontentsforMethodReference\WindowManagement\Controlsforalistofthefunctionsthatworkwithcontrols.

Page 20: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

UsingtheCOMInterfaceBeforeyoucanusetheCOMinterfacetoAutoItXitneedstobe"registered"(ThisisdoneautomaticallywhenyouinstallthefullversionofAutoItbutyoumayneedtodoitmanuallyifyouareusingAutoItXseparately).

ToregistertheCOMinterface:

1.Openacommandprompt

2.Changedirectory(usingCD)tothedirectorythatcontainsAutoItX3.dll

3.Typeregsvr32.exeAutoItX3.dllandpressenter

ThenameoftheAutoItXcontrolisAutoItX3.Control

HereisanexampleofcallingatheRunmethodofthecontrolfromVBScript:

SetoAutoIt=WScript.CreateObject("AutoItX3.Control")

oAutoIt.Run("notepad.exe")

Page 21: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method Description

AutoItSetOption ChangestheoperationofvariousAutoItfunctions/parameters

ClipGet RetrievestextfromtheclipboardClipPut WritestexttotheclipboardControlClick SendsamouseclickcommandtoagivencontrolControlCommand SendsacommandtoacontrolControlDisable Disablesor"grays-out"acontrolControlEnable Enablesa"grayed-out"controlControlFocus Setsinputfocustoagivencontrolonawindow

ControlGetFocus ReturnstheControlRef#ofthecontrolthathaskeyboardfocuswithinaspecifiedwindow

ControlGetHandle Retrievestheinternalhandleofacontrol

ControlGetPosHeight Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosWidth Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosX Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosY Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetText RetrievestextfromacontrolControlHide HidesacontrolControlListView SendsacommandtoaListView32control

Page 22: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlMove MovesacontrolwithinawindowControlSend SendsastringofcharacterstoacontrolControlSetText SetstextofacontrolControlShow ShowsacontrolthatwashiddenControlTreeView SendsacommandtoaTreeView32controlDriveMapAdd MapsanetworkdriveDriveMapDel DisconnectsanetworkdriveDriveMapGet Retreivesthedetailsofamappeddrive

IsAdmin Checksifthecurrentuserhasadministratorprivileges

MouseClick PerformamouseclickoperationMouseClickDrag Performamouseclickanddragoperation

MouseDown Performamousedowneventatthecurrentmouseposition

MouseGetCursor ReturnsacursorIDNumberofthecurrentMouseCursor

MouseGetPosX RetrievesthecurrentXpositionofthemousecursorMouseGetPosY RetrievesthecurrentYpositionofthemousecursorMouseMove Movesthemousepointer

MouseUp Performamouseupeventatthecurrentmouseposition

MouseWheel Movesthemousewheelupordown.XPONLYPixelChecksum Generatesachecksumforaregionofpixels

PixelGetColor Returnsapixelcoloraccordingtox,ypixelcoordinates

PixelSearch Searchesarectangleofpixelsforthepixelcolorprovided

ProcessClose TerminatesanamedprocessProcessExists Checkstoseeifaspecifiedprocessexists

Page 23: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessSetPriority ChangesthepriorityofaprocessProcessWait Pausesscriptexecutionuntilagivenprocessexists

ProcessWaitClose Pausesscriptexecutionuntilagivenprocessdoesnotexist

Run RunsanexternalprogramRunAs RunsanexternalprogramRunAsWait Runsanexternalprogram

RunWait Runsanexternalprogramandpausesscriptexecutionuntiltheprogramfinishes

Send SendssimulatedkeystrokestotheactivewindowShutdown ShutsdownthesystemSleep PausescriptexecutionStatusbarGetText RetrievesthetextfromastandardstatusbarcontrolToolTip CreatesatooltipanywhereonthescreenWinActivate Activates(givesfocusto)awindow

WinActive Checkstoseeifaspecifiedwindowexistsandiscurrentlyactive

WinClose ClosesawindowWinExists Checkstoseeifaspecifiedwindowexists

WinGetCaretPosX Returnsthecoordinatesofthecaretintheforegroundwindow

WinGetCaretPosY Returnsthecoordinatesofthecaretintheforegroundwindow

WinGetClassList RetrievestheclassesfromawindowWinGetClientSizeHeight Retrievesthesizeofagivenwindow'sclientareaWinGetClientSizeWidth Retrievesthesizeofagivenwindow'sclientareaWinGetHandle RetrievestheinternalhandleofawindowWinGetPosHeight RetrievesthepositionandsizeofagivenwindowWinGetPosWidth Retrievesthepositionandsizeofagivenwindow

Page 24: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetPosX RetrievesthepositionandsizeofagivenwindowWinGetPosY Retrievesthepositionandsizeofagivenwindow

WinGetProcess RetrievestheProcessID(PID)associatedwithawindow

WinGetState RetrievesthestateofagivenwindowWinGetText RetrievesthetextfromawindowWinGetTitle RetrievesthefulltitlefromawindowWinKill ForcesawindowtocloseWinList RetrievesalistofwindowsWinMenuSelectItem InvokesamenuitemofawindowWinMinimizeAll MinimizesallwindowsWinMinimizeAllUndo UndoesapreviousWinMinimizeAllfunctionWinMove Movesand/orresizesawindowWinSetOnTop Changeawindow's"AlwaysOnTop"attribute

WinSetState Shows,hides,minimizes,maximizes,orrestoresawindow

WinSetTitle ChangesthetitleofawindowWinSetTrans Setsthetransparencyofawindow

WinWait Pausesexecutionofthescriptuntiltherequestedwindowexists

WinWaitActive Pausesexecutionofthescriptuntiltherequestedwindowisactive

WinWaitClose Pausesexecutionofthescriptuntiltherequestedwindowdoesnotexist

WinWaitNotActive Pausesexecutionofthescriptuntiltherequestedwindowisnotactive

Page 25: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

EnvironmentmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionClipGet RetrievestextfromtheclipboardClipPut Writestexttotheclipboard

Page 26: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 27: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ClipGetRetrievestextfromtheclipboard

ClipGet

Page 28: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsastringcontainingthetextontheclipboard.

Failure: SetsoAutoIt.errorto1ifclipboardisemptyorcontainsanon-textentry.

Page 30: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

text=oAutoIt.ClipGet()

WScript.Echo"Clipboardcontains:"&text

Page 31: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 32: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ClipPutWritestexttotheclipboard

ClipPut"value"

Page 33: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersvalue Thetexttowritetotheclipboard.

Page 34: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0.

Page 35: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAnyexistingclipboardcontentsareoverwritten.

Page 37: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ClipPut"Iamcopiedtotheclipboard"

Page 38: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

File,DirectoryandDiskmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionDriveMapAdd MapsanetworkdriveDriveMapDel DisconnectsanetworkdriveDriveMapGet Retreivesthedetailsofamappeddrive

Page 39: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 40: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

DriveMapAddMapsanetworkdrive

DriveMapAdd"device","remoteshare"[,flags[,

"user"[,"password"]]]

Page 41: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameters

device

Thedevicetomap,forexample"O:"or"LPT1:".Ifyoupassablankstringforthisparameteraconnectionismadebutnotmappedtoaspecificdrive.Ifyouspecify"*"anunuseddriveletterwillbeautomaticallyselected.

remoteshare Theremotesharetoconnecttointheform"\\server\share".

flags

Optional:Acombinationofthefollowing:0=default1=Persistantmapping8=Showauthenticationdialogifrequired

user Optional:Theusernametousetoconnect.Intheform"username"or"domain\username".

password Optional:Thepasswordtousetoconnect.

Page 42: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.(SeeRemarks)

Failure: Returns0ifanewmappingcouldnotbecreatedandsetsoAutoIt.error(seebelow).(SeeRemarks)

Page 43: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenthefunctionfails(returns0)oAutoIt.errorcontainsextendedinformation:1=Undefined/Othererror2=Accesstotheremotesharewasdenied3=Thedeviceisalreadyassigned4=Invaliddevicename5=Invalidremoteshare6=Invalidpassword

Note:Whenusing"*"forthedeviceparameterthedriveletterselectedwillbereturnedinsteadof1or0,e.g."U:".Iftherewasanerrorusing"*"thenablankstring""willbereturned.

Page 45: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'MapXdriveto\\myserver\stuffusingcurrentuse

r

oAutoIt.DriveMapAdd"X:","\\myserver\stuff"

'MapXdriveto\\myserver2\stuff2usingtheuser

"jon"from"domainx"withpassword"tickle"

oAutoIt.Drivemap"X:","\\myserver2\stuff2",0,"do

mainx\jon","tickle"

Page 46: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 47: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

DriveMapDelDisconnectsanetworkdrive

DriveMapDel"device"

Page 48: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersdrive Thedevicetodisconnect,e.g."O:"or"LPT1:".

Page 49: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifthedisconnectionwasunsuccessful.

Page 50: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfaconnectionhasnodrivelettermappedyoumayusetheconnectionnametodisconnect,e.g.\\server\share

Page 52: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'MapXdriveto\\myserver\stuffusingcurrentuse

r

oAutoIt.DriveMapAdd"X:","\\myserver\stuff"

'Disconnect

oAutoIt.DriveMapDel"X:"

Page 53: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 54: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

DriveMapGetRetreivesthedetailsofamappeddrive

DriveMapGet"device"

Page 55: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersdevice Thedevice(driveorprinter)lettertoquery.Eg."O:"or"LPT1:"

Page 56: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsdetailsofthemapping,e.g.\\server\shareFailure: Returnsablankstring""andsetsoAutoIt.errorto1.

Page 58: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'MapXdriveto\\myserver\stuffusingcurrentuse

r

oAutoIt.DriveMapAdd"X:","\\myserver\stuff"

'Getdetailsofthemapping

WScript.Echo"DriveX:ismappedto"&DriveMapGet

("X:")

Page 59: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

GraphicmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionPixelChecksum GeneratesachecksumforaregionofpixelsPixelGetColor Returnsapixelcoloraccordingtox,ypixelcoordinatesPixelSearch Searchesarectangleofpixelsforthepixelcolorprovided

Page 60: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 61: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

PixelChecksumGeneratesachecksumforaregionofpixels

PixelChecksumleft,top,right,bottom[,step]

Page 62: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersleft leftcoordinateofrectangle.top topcoordinateofrectangle.right rightcoordinateofrectangle.bottom bottomcoordinateofrectangle.

stepOptional:Insteadofchecksummingeachpixeluseavaluelargerthan1toskippixels(forspeed).E.g.Avalueof2willonlycheckeveryotherpixel.Defaultis1.

Page 63: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsthechecksumvalueoftheregion.

Page 64: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksPerformingachecksumofaregionisverytimeconsuming,sousethesmallestregionyouareabletoreduceCPUload.Onsomemachinesachecksumofthewholescreencouldtakemanyseconds!

Achecksumonlyallowsyoutoseeif"something"haschangedinaregion-itdoesnottellyouexactlywhathaschanged.

Whenusingastepvaluegreaterthan1youmustbearinmindthatthechecksummingbecomeslessreliableforsmallchangesasnoteverypixelischecked.

Page 66: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Getinitialchecksum

checksum=oAutoIt.PixelChecksum(0,0,50,50)

Page 67: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 68: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

PixelGetColorReturnsapixelcoloraccordingtox,ypixelcoordinates

PixelGetColorx,y

Page 69: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersx xcoordinateofpixel.y ycoordinateofpixel.

Page 70: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsdecimalvalueofpixel'scolor.Failure: Returns-1ifinvalidcoordinates.

Page 71: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedMouseGetPosX,MouseGetPosY,PixelCoordMode(Option),PixelSearch

Page 72: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

var=oAutoIt.PixelGetColor(10,100)

WScript.Echo"Thecoloris"&var

Page 73: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 74: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

PixelSearchSearchesarectangleofpixelsforthepixelcolorprovided

PixelSearchleft,top,right,bottom,color[,

shade-variation][,step]]

Page 75: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersleft leftcoordinateofrectangle.top topcoordinateofrectangle.right rightcoordinateofrectangle.bottom bottomcoordinateofrectangle.color colorvalueofpixeltofind(indecimalorhex).

shade-variation

Optional:Anumberbetween0and255toindicatetheallowednumberofshadesofvariationofthered,green,andbluecomponentsofthecolor.Defaultis0(exactmatch).

stepOptional:Insteadofsearchingeachpixeluseavaluelargerthan1toskippixels(forspeed).E.g.Avalueof2willonlycheckeveryotherpixel.Defaultis1.

Page 76: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsa2elementarraycontainingthepixel'scoordinatesFailure: SetsoAutoIt.errorto1ifcolorisnotfound.

Page 77: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThesearchisperformedtop-to-bottom,left-to-right,andthefirstmatchisreturned.

Performingasearchofaregioncanbetimeconsuming,sousethesmallestregionyouareabletoreduceCPUload.

Page 79: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

value=oAutoIt.PixelSearch(0,0,100,100,0)

IfoAutoIt.error=1Then

WScript.Echo"Colornotfound"

Else

WScript.Echo"Colorfoundat:"&value(0)&","

&value(1)

EndIf

Page 80: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

KeyboardControlmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionSend Sendssimulatedkeystrokestotheactivewindow

Page 81: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 82: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

SendSendssimulatedkeystrokestotheactivewindow

Send"keys"[,flag]

Page 83: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterskeys Thesequenceofkeystosend.

flag

Optional:Changeshow"keys"isprocessed:flag=0(default),Textcontainsspecialcharacterslike+and!toindicateSHIFTandALTkeypresses.flag=1,keysaresentraw.

Page 84: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 85: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksSeetheAppendixforsometips.

The"Send"commandsyntaxissimilartothatofScriptItandtheVisualBasic"SendKeys"command.Charactersaresentaswrittenwiththeexceptionofthefollowingcharacters:

'!'ThistellsAutoIttosendanALTkeystroke,thereforeSend("Thisistext!a")wouldsendthekeys"Thisistext"andthenpress"ALT+a".

N.B.SomeprogramsareverychoosyaboutcapitallettersandALTkeys,i.e."!A"isdifferentto"!a".ThefirstsaysALT+SHIFT+A,thesecondisALT+a.Ifindoubt,uselowercase!

'+'ThistellsAutoIttosendaSHIFTkeystroke,thereforeSend("Hell+o")wouldsendthetext"HellO".Send("!+a")wouldsend"ALT+SHIFT+a".

'^'ThistellsAutoIttosendaCONTROLkeystroke,thereforeSend("^!a")wouldsend"CTRL+ALT+a".

N.B.SomeprogramsareverychoosyaboutcapitallettersandCTRLkeys,i.e."^A"isdifferentto"^a".ThefirstsaysCTRL+SHIFT+A,thesecondisCTRL+a.Ifindoubt,uselowercase!

'#'ThehashnowsendsaWindowskeystroke;therefore,Send("#r")wouldsendWin+rwhichlaunchestheRundialogbox.

YoucansetSendCapslockModetomakeCAPSLOCKdisabledatthestartofaSendoperationandrestoreduponcompletion.However,ifauserisholdingdowntheShiftkeywhenaSendfunctionbegins,

Page 86: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

textmaybesentinuppercase.OneworkaroundistoSend("{SHIFTDOWN}{SHIFTUP}")beforetheotherSendoperations.

Certainspecialkeyscanbesentandshouldbeenclosedinbraces:

N.B.Windowsdoesnotallowthesimulationofthe"CTRL-ALT-DEL"combination!

SendCommand(ifzeroflag) ResultingKeypress

{!} !{#} #{+} +{^} ^{{} {{}} }{SPACE} SPACE{ENTER} ENTERkeyonthemainkeyboard{ALT} ALT{BACKSPACE}or{BS} BACKSPACE{DELETE}or{DEL} DELETE{UP} Cursorup{DOWN} Cursordown{LEFT} Cursorleft{RIGHT} Cursorright{HOME} HOME{END} END{ESCAPE}or{ESC} ESCAPE{INSERT}or{INS} INS

Page 87: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

{PGUP} PageUp{PGDN} PageDown{F1}-{F12} Functionkeys{TAB} TAB{PRINTSCREEN} PrintScreenkey{LWIN} LeftWindowskey{RWIN} RightWindowskey{NUMLOCKon} NUMLOCK(on/off/toggle){CAPSLOCKoff} CAPSLOCK(on/off/toggle){SCROLLLOCKtoggle} SCROLLLOCK(on/off/toggle){BREAK} forCtrl+Breakprocessing{PAUSE} PAUSE{NUMPAD0}-{NUMPAD9} Numpaddigits

{NUMPADMULT} NumpadMultiply{NUMPADADD} NumpadAdd{NUMPADSUB} NumpadSubtract{NUMPADDIV} NumpadDivide{NUMPADDOT} Numpadperiod{NUMPADENTER} Enterkeyonthenumpad{APPSKEY} WindowsAppkey{LALT} LeftALTkey{RALT} RightALTkey{LCTRL} LeftCTRLkey{RCTRL} RightCTRLkey{LSHIFT} LeftShiftkey{RSHIFT} RightShiftkey{SLEEP} ComputerSLEEPkey

Page 88: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

{ALTDOWN} HoldstheALTkeydownuntil{ALTUP}issent

{SHIFTDOWN} HoldstheSHIFTkeydownuntil{SHIFTUP}issent

{CTRLDOWN} HoldstheCTRLkeydownuntil{CTRLUP}issent

{LWINDOWN} HoldstheleftWindowskeydownuntil{LWINUP}issent

{RWINDOWN} HoldstherightWindowskeydownuntil{RWINUP}issent

{ASCnnnn} SendtheALT+nnnnkeycombination{BROWSER_BACK} XPOnly:Selectthebrowser"back"button{BROWSER_FORWARD} XPOnly:Selectthebrowser"forward"button{BROWSER_REFRESH} XPOnly:Selectthebrowser"refresh"button{BROWSER_STOP} XPOnly:Selectthebrowser"stop"button{BROWSER_SEARCH} XPOnly:Selectthebrowser"search"button{BROWSER_FAVORITES} XPOnly:Selectthebrowser"favorites"button

{BROWSER_HOME} XPOnly:Launchthebrowserandgotothehomepage

{VOLUME_MUTE} XPOnly:Mutethevolume{VOLUME_DOWN} XPOnly:Reducethevolume{VOLUME_UP} XPOnly:Increasethevolume{MEDIA_NEXT} XPOnly:Selectnexttrackinmediaplayer{MEDIA_PREV} XPOnly:Selectprevioustrackinmediaplayer{MEDIA_STOP} XPOnly:Stopmediaplayer{MEDIA_PLAY_PAUSE} XPOnly:Play/pausemediaplayer{LAUNCH_MAIL} XPOnly:Launchtheemailapplication{LAUNCH_MEDIA} XPOnly:Launchmediaplayer{LAUNCH_APP1} XPOnly:Launchuserapp1{LAUNCH_APP2} XPOnly:Launchuserapp2

Page 89: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

TosendtheASCIIvalueA(sameaspressingALT+065onthenumerickeypad)Send("{ASC65}")

Singlekeyscanalsoberepeated,e.g.Send("{DEL4}");PressestheDELkey4timesSend("{S30}");Sends30'S'charactersSend("+{TAB4});PressesSHIFT+TAB4times

Toholdakeydown(generallyonlyusefulforgames)Send("{adown}");HoldstheAkeydownSend("{aup}");ReleasestheAkey

Tosetthestateofthecapslock,numlockandscrolllockkeysSend("{NumLockon}");TurnstheNumLockkeyonSend("{CapsLockoff}");TurnstheCapsLockkeyoffSend("{ScrollLocktoggle}");TogglesthestateofScrollLock

Ifyouwithtouseavariableforthecount,try$n=4Send("+{TAB"&$n&"}")

IfyouwishtosendtheASCIIvalueAfourtimes,thentry$x=Chr(65)Send("{"&$x&"4}")

MostlaptopcomputerkeyboardshaveaspecialFnkey.Thiskeycannotbesimulated.

Note,bysettingtheflagparameterto1theabove"special"processingwillbedisabled.Thisisusefulwhenyouwanttosendsometextcopiedfromavariableandyouwantthetextsentexactlyaswritten.

Forexample,openFolderOptions(inthecontrolpanel)andtrythefollowing:

Send("{TAB}") Navigatetonextcontrol(button,checkbox,etc)

Page 90: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Send("+{TAB}") Navigatetopreviouscontrol.

Send("^{TAB}") NavigatetonextWindowTab(onaTabbeddialogwindow)

Send("^+{TAB}") NavigatetopreviousWindowTab.Send("{SPACE}") Canbeusedtotoggleacheckboxorclickabutton.Send("{+}") Usuallychecksacheckbox(ifit'sa"real"checkbox.)Send("{-}") Usuallyunchecksacheckbox.Send("{NumPadMult}") RecursivelyexpandsfoldersinaSysTreeView32.

UseAlt-keycombostoaccessmenuitems.Also,openNotepadandtrythefollowing:Send("!f")SendAlt+f,theaccesskeyforNotepad'sfilemenu.Tryotherletters!

Send("{DOWN}") Movedownamenu.Send("{UP}") Moveupamenu.Send("{LEFT}") Moveleftwardtonewmenuorexpandasubmenu.Send("{RIGHT}") Moverightwardtonewmenuorcollapseasubmenu.

Page 91: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedControlSend,SendAttachmode(Option),SendKeyDelay(Option),SendKeyDownDelay(Option)

Page 92: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Send"#r"

oAutoIt.WinWaitActive"Run"

oAutoIt.Send"notepad.exe{Enter}"

oAutoIt.WinWaitActive"Untitled-"

oAutoIt.Send"Today'stime/dateis{F5}"

Page 93: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MessageBoxesandDialogsmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionToolTip Createsatooltipanywhereonthescreen

Page 94: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 95: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ToolTipCreatesatooltipanywhereonthescreen

ToolTip"text"[,x,y]

Page 96: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstext Thetextofthetooltip.(Anemptystringclearsadisplayingtooltip)x,y Thex,ypositionofthetooltip.

Page 97: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 98: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthexandycoordinatesareomittedthe,tipisplacednearthemousecursor.Ifthecoordswouldcausethetooltiptorunoffscreen,itisrepositionedtovisible.Tooltipappearsuntilitiscleared,untilscriptterminates,orsometimesuntilitisclickedupon.Youmayusealinefeedcharactertocreatemulti-linetooltips.

Page 99: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Thiswillcreateatooltipintheupperleftoft

hescreen

oAutoIt.ToolTip"Thisisatooltip",0,0

oAutoIt.Sleep2000'Sleeptogivetooltiptimeto

display

Page 100: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MiscelaneousmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method Description

AutoItSetOption ChangestheoperationofvariousAutoItfunctions/parameters

IsAdmin Checksifthecurrentuserhasadministratorprivileges

Page 101: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 102: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

AutoItSetOptionChangestheoperationofvariousAutoItfunctions/parameters

AutoItSetOption"option",param

Page 103: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersoption Theoptiontochange.SeeRemarks.param Theparameter(variesbyoption).SeeRemarks.

Page 104: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsthevalueoftheprevioussetting.

Page 105: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksYoumayuseOptasanalternativetoAutoItSetOption.

AutoItwillhaltwithanerrormessageiftherequestedoptionisunknown.Optionsareasfollows:

Option Param

CaretCoordMode

Setsthewaycoordsareusedinthecaretfunctions,eitherabsolutecoordsorcoordsrelativetothecurrentactivewindow:0=relativecoordstotheactivewindow1=absolutescreencoordinates(default)2=relativecoordstotheclientareaoftheactivewindow

MouseClickDelayAltersthelengthofthebriefpauseinbetweenmouseclicks.Timeinmillisecondstopause(default=10).

MouseClickDownDelay Altersthelengthaclickishelddownbeforerelease.Timeinmillisecondstopause(default=10).

MouseClickDragDelayAltersthelengthofthebriefpauseatthestartandendofamousedragoperation.Timeinmillisecondstopause(default=250).

MouseCoordMode

Setsthewaycoordsareusedinthemousefunctions,eitherabsolutecoordsorcoordsrelativetothecurrentactivewindow:0=relativecoordstotheactivewindow1=absolutescreencoordinates(default)2=relativecoordstotheclientareaoftheactivewindow

PixelCoordMode

Setsthewaycoordsareusedinthepixelfunctions,eitherabsolutecoordsorcoordsrelativetothecurrentactivewindow:0=relativecoordstotheactivewindow1=absolutescreencoordinates(default)2=relativecoordstotheclientareaoftheactive

Page 106: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

window

SendAttachMode

SpecifiesifAutoItattachesinputthreadswhenusingthenSend()function.Whennotattaching(defaultmode=0)detectingthestateofcapslock/scrolllockandnumlockcanbeunreliableunderNT4.However,whenyouspecifyattachmode=1theSend("{...down/up}")syntaxwillnotworkandtheremaybeproblemswithsendingkeysto"hung"windows.ControlSend()ALWAYSattachesandisnotaffectedbythismode.0=don'tattach(default)1=attach

SendCapslockMode

SpecifiesifAutoItshouldstorethestateofcapslockbeforeaSendfunctionandrestoreitafterwards.0=don'tstore/restore1=storeandrestore(default)

SendKeyDelay

Altersthethelengthofthebriefpauseinbetweensentkeystrokes.Timeinmillisecondstopause(default=5).Sometimesavalueof0doesnotwork;use1instead.

SendKeyDownDelay

Altersthelengthoftimeakeyishelddownbeforereleasedduringakeystroke.Forapplicationsthattakeawhiletoregisterkeypresses(andmanygames)youmayneedtoraisethisvaluefromthedefault.Timeinmillisecondstopause(default=1).

WinDetectHiddenText

Specifiesifhiddenwindowtextcanbe"seen"bythewindowmatchingfunctions.0=Donotdetecthiddentext(default)1=Detecthiddentext

WinSearchChildren

Allowsthewindowsearchroutinestosearchchildwindowsaswellastop-levelwindows.0=Onlysearchtop-levelwindows(default)1=Searchtop-levelandchildwindowsAltersthemethodthatisusedtomatchwindowtextduringsearchoperations.1=Complete/Slowmode(default)

Page 107: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinTextMatchMode

2=QuickmodeInquickmodeAutoItcanusuallyonly"see"dialogtext,buttontextandthecaptionsofsomecontrols.Inthedefaultmodemuchmoretextcanbeseen(forinstancethecontentsoftheNotepadwindow).Ifyouarehavingperformanceproblemswhenperformingmanywindowsearchesthenchangingtothe"quick"modemayhelp.

WinTitleMatchMode

Altersthemethodthatisusedtomatchwindowtitlesduringsearchoperations.1=Matchthetitlefromthestart(default)2=Matchanysubstringinthetitle3=Exacttitlematch4=Advancedmode,seeWindowTitles&Text(Advanced)

WinWaitDelayAltershowlongascriptshouldbrieflypauseafterasuccessfulwindow-relatedoperation.Timeinmillisecondstopause(default=250).

Page 108: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oldvalue=oAutoIt.Opt("SendAttachMode",0)

Page 109: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 110: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

IsAdminChecksifthecurrentuserhasadministratorprivileges

IsAdmin

Page 111: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1ifthecurrentuserhasadministratorprivileges.Failure: Returns0ifuserlacksadminprivileges.

Page 112: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThisfunctionwillalwaysreturn1underWindow95/98/Me.

Page 114: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

IfoAutoIt.IsAdminThenWScript.Echo"Adminrights

detected"

Page 115: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseControlmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionMouseClick PerformamouseclickoperationMouseClickDrag PerformamouseclickanddragoperationMouseDown PerformamousedowneventatthecurrentmousepositionMouseGetCursor ReturnsacursorIDNumberofthecurrentMouseCursorMouseGetPosX RetrievesthecurrentXpositionofthemousecursorMouseGetPosY RetrievesthecurrentYpositionofthemousecursorMouseMove MovesthemousepointerMouseUp PerformamouseupeventatthecurrentmousepositionMouseWheel Movesthemousewheelupordown.XPONLY

Page 116: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 117: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseClickPerformamouseclickoperation

MouseClick"button"[,x,y[,clicks[,speed]]]

Page 118: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameters

button Thebuttontoclick:"left","right","middle","main","menu","primary","secondary".

x,y Optional:Thex/ycoordinatestomovethemouseto.Ifnoxandycoordsaregiven,thecurrentpositionisused.

clicks Optional:Thenumberoftimestoclickthemouse.Defaultis1.

speedOptional:thespeedtomovethemouseintherange1(fastest)to100(slowest).Aspeedof0willmovethemouseinstantly.Defaultspeedis10.

Page 119: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 120: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthebuttonisanemptystring,theleftbuttonwillbeclicked.

Ifthebuttonisnotinthelist,thenoAutoIt.errorwillbesetto1.

Iftheuserhasswappedtheleftandrightmousebuttonsinthecontrolpanel,thenthebehaviourofthebuttonsisdifferent."Left"and"right"alwaysclickthosebuttons,whetherthebuttonsareswappedornot.The"primary"or"main"buttonwillbethemainclick,whetherornotthebuttonsareswapped.The"secondary"or"menu"buttonswillusuallybringupthecontextmenu,whetherthebuttonsareswappedornot.

Button Normal Swapped"" Left Left"left" Left Left"middle" Middle Middle"right" Right Right"primary" Left Right"main" Left Right"secondary" Right Left"menu" Right Left

Page 122: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Doubleclickatthecurrentmousepos

oAutoIt.MouseClick"left"

oAutoIt.MouseClick"left"

'Doubleclickat0,500

oAutoIt.MouseClick"left",0,500,2

Page 123: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 124: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseClickDragPerformamouseclickanddragoperation

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

Page 125: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameters

button Thebuttontoclick:"left","right","middle","main","menu","primary","secondary".

x1,y1 Thex/ycoordstostartthedragoperationfrom.x2,y2 Thex/ycoordstostartthedragoperationto.

speedOptional:thespeedtomovethemouseintherange1(fastest)to100(slowest).Aspeedof0willmovethemouseinstantly.Defaultspeedis10.

Page 126: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 127: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthebuttonisanemptystring,theleftbuttonwillbeclicked.

Ifthebuttonisnotinthelist,thenoAutoIt.errorwillbesetto1.

Iftheuserhasswappedtheleftandrightmousebuttonsinthecontrolpanel,thenthebehaviourofthebuttonsisdifferent."Left"and"right"alwaysclickthosebuttons,whetherthebuttonsareswappedornot.The"primary"or"main"buttonwillbethemainclick,whetherornotthebuttonsareswapped.The"secondary"or"menu"buttonswillusuallybringupthecontextmenu,whetherthebuttonsareswappedornot.SeethetableinMouseClickformoreexplaination

Page 129: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Leftclickdragfrom0,200to600,700

oAutoIt.MouseClickDrag"left",0,200,600,700

Page 130: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 131: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseDownPerformamousedowneventatthecurrentmouseposition

MouseDown"button"

Page 132: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameters

button Thebuttontoclick:"left","right","middle","main","menu","primary","secondary".

Page 133: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 134: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksMouseClick.Useresponsibly:ForeveryMouseDownthereshouldeventuallybeacorrespondingMouseUpevent.

Page 136: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.MouseDown"left"

oAutoIt.Sleep100

oAutoIt.MouseUp"left"

Page 137: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 138: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseGetCursorReturnsacursorIDNumberofthecurrentMouseCursor

MouseGetCursor

Page 139: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsacursorIDNumber:0=UNKNOWN(thisincludespointingandgrabbinghandicons)1=APPSTARTING2=ARROW3=CROSS4=HELP5=IBEAM6=ICON7=NO8=SIZE9=SIZEALL10=SIZENESW11=SIZENS12=SIZENWSE13=SIZEWE14=UPARROW15=WAIT

Page 140: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedMouseGetPosX,MouseGetPosY

Page 141: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Sleep2000'allowtimetomovemousebefor

ereportingID

cursor=oAutoIt.MouseGetCursor()

WScript.Echo"ID="&cursor

Page 142: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 143: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseGetPosXRetrievesthecurrentXpositionofthemousecursor

MouseGetPosX

Page 144: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsthecurrentXpositionofthemousecursor.

Page 145: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksSeeMouseCoordModeforrelative/absolutepositionsettings.Ifrelativepositioning,numbersmaybenegative.

Page 147: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

posx=oAutoIt.MouseGetPosX()

posy=oAutoIt.MouseGetPosX()

WScript.Echo"Mousex,y:"&posx&","&posy

Page 148: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 149: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseGetPosYRetrievesthecurrentYpositionofthemousecursor

MouseGetPosY

Page 150: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsthecurrentYpositionofthemousecursor.

Page 151: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksSeeMouseCoordModeforrelative/absolutepositionsettings.Ifrelativepositioning,numbersmaybenegative.

Page 153: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

posx=oAutoIt.MouseGetPosX()

posy=oAutoIt.MouseGetPosX()

WScript.Echo"Mousex,y:"&posx&","&posy

Page 154: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 155: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseMoveMovesthemousepointer

MouseMovex,y[,speed]

Page 156: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersx Thescreenxcoordinatetomovethemouseto.y Thescreenycoordinatetomovethemouseto.

speedOptional:thespeedtomovethemouseintherange1(fastest)to100(slowest).Aspeedof0willmovethemouseinstantly.Defaultspeedis10.

Page 157: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueUsermousemovementishinderedduringanon-instantaneousMouseMoveoperation.IfMouseCoordModeisrelativepositioning,numbersmaybenegative.

Page 159: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.MouseMove10,100

oAutoIt.MouseMove700,700,0

Page 160: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 161: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseUpPerformamouseupeventatthecurrentmouseposition

MouseUp"button"

Page 162: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameters

button Thebuttontoclick:"left","right","middle","main","menu","primary","secondary".

Page 163: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 164: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksMouseClick.Useresponsibly:ForeveryMouseDownthereshouldeventuallybeacorrespondingMouseUpevent.

Page 166: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.MouseDown"left"

oAutoIt.Sleep100

oAutoIt.MouseUp"left"

Page 167: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 168: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MouseWheelMovesthemousewheelupordown.XPONLY

MouseWheel"direction"[,clicks]

Page 169: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersdirection "up"or"down"clicks Optional:Thenumberoftimestomovethewheel.Defaultis1.

Page 170: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 171: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthedirectionisnotrecognized,oAutoIt.errorissetto1.

Page 173: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Movethewheelup10times

oAutoIt.MouseWheel"up",10

Page 174: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionProcessClose TerminatesanamedprocessProcessExists CheckstoseeifaspecifiedprocessexistsProcessSetPriority ChangesthepriorityofaprocessProcessWait PausesscriptexecutionuntilagivenprocessexistsProcessWaitClose PausesscriptexecutionuntilagivenprocessdoesnotexistRun RunsanexternalprogramRunAs RunsanexternalprogramRunAsWait Runsanexternalprogram

RunWait Runsanexternalprogramandpausesscriptexecutionuntiltheprogramfinishes

Shutdown Shutsdownthesystem

Page 175: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 176: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessCloseTerminatesanamedprocess

ProcessClose"process"

Page 177: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersprocess ThetitleorPIDoftheprocesstoterminate.

Page 178: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.(Returns1regardlessofsuccess/failure.)

Page 179: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksProcessnamesareexecutableswithoutthefullpath,e.g.,"notepad.exe"or"winword.exe"Ifmultipleprocesseshavethesamename,theonewiththehighestPIDisterminated--regardlessofhowrecentlytheprocesswasspawned.PIDistheuniquenumberwhichidentifiesaProcess.APIDcanbeobtainedthroughtheProcessExistsorRuncommands.InordertoworkunderWindowsNT4.0,ProcessCloserequiresthefilePSAPI.DLL(includedintheAutoItinstallationdirectory).Theprocessispolledapproximatelyevery250milliseconds.

Page 181: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ProcessClose"notepad.exe"

PID=oAutoIt.ProcessExists("notepad.exe")

oAutoIt.ProcessClose(PID)

Page 182: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 183: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessExistsCheckstoseeifaspecifiedprocessexists

ProcessExists"process"

Page 184: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersprocess ThenameorPIDoftheprocesstocheck.

Page 185: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:ReturnsthePIDoftheprocess.Failure:Returns0ifprocessdoesnotexist.

Page 186: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksProcessnamesareexecutableswithoutthefullpath,e.g.,"notepad.exe"or"winword.exe"PIDistheuniquenumberwhichidentifiesaProcess.InordertoworkunderWindowsNT4.0,ProcessExistsrequiresthefilePSAPI.DLL(includedintheAutoItinstallationdirectory).Theprocessispolledapproximatelyevery250milliseconds.

Page 188: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

IfProcessExists("notepad.exe")Then

WScript.Echo"Notepadisrunning."

EndIf

Page 189: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 190: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessSetPriorityChangesthepriorityofaprocess

ProcessSetPriority"process",priority

Page 191: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersprocess ThenameorPIDoftheprocesstocheck.

priority

Aflagwhichdetermineswhatprioritytoset0-Idle/Low1-BelowNormal(NotsupportedonWindows95/98/ME)2-Normal3-AboveNormal(NotsupportedonWindows95/98/ME)4-High5-Realtime(Usewithcaution,maymakethesystemunstable)

Page 192: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:Returns1.Failure:Returns0andsetsoAutoIt.errorto1.MaysetoAutoIt.errorto2ifattemptingtouseanunsupportedpriorityclass.

Page 193: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAboveNormalandBelowNormalpriorityclassesarenotsupportedonWindows95/98/ME.Ifyoutrytousethemonthoseplatforms,thefunctionwillfailandoAutoIt.errorwillbesetto2.

Page 194: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Run"Notepad.exe"

oAutoIt.ProcessSetPriority"notepad.exe",0

'NotepadshouldnowhaveIdle/Lowpriority

Page 195: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 196: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessWaitPausesscriptexecutionuntilagivenprocessexists

ProcessWait"process"[,timeout]

Page 197: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersprocess Thenameoftheprocesstocheck.

timeout Optional:Specifieshowlongtowait(defaultistowaitindefinitely).

Page 198: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:Returns1.Failure:Returns0ifthewaittimedout.

Page 199: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksProcessnamesareexecutableswithoutthefullpath,e.g.,"notepad.exe"or"winword.exe"InordertoworkunderWindowsNT4.0,ProcessWaitrequiresthefilePSAPI.DLL(includedintheAutoItinstallationdirectory).Theprocessispolledapproximatelyevery250milliseconds.

ThisfunctionistheonlyprocessfunctionnottoacceptaPID.BecausePIDsareallocatedrandomly,waitingforaparticularPIDtoexistdoesn'tmakesense.

Page 201: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ProcessWait"notepad.exe"

Page 202: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 203: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ProcessWaitClosePausesscriptexecutionuntilagivenprocessdoesnotexist

ProcessWaitClose"process"[,timeout]

Page 204: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersprocess ThenameorPIDoftheprocesstocheck.

timeout Optional:Specifieshowlongtowait(defaultistowaitindefinitely).

Page 205: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:Returns1.Failure:Returns0ifwaittimedout.

Page 206: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksProcessnamesareexecutableswithoutthefullpath,e.g.,"notepad.exe"or"winword.exe"PIDistheuniquenumberwhichidentifiesaProcess.APIDcanbeobtainedthroughtheProcessExistsorRuncommands.InordertoworkunderWindowsNT4.0,ProcessWaitCloserequiresthefilePSAPI.DLL(includedintheAutoItinstallationdirectory).Theprocessispolledapproximatelyevery250milliseconds.

Page 208: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'waitsuntilnoinstanceofnotepad.exeexists

oAutoIt.ProcessWaitClose"notepad.exe"

'Thiswillwaituntilthisparticularinstanceof

notepadhasexited

PID=oAutoIt.Run("notepad.exe")

oAutoIt.ProcessWaitClose(PID)

Page 209: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 210: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RunRunsanexternalprogram

Run"filename"[,"workingdir"[,show_flag]]

Page 211: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersfilename Thenameoftheexecutable(EXE,BAT,COM,orPIF)torun.workingdir Optional:Theworkingdirectory.

show_flag

Optional:The"show"flagoftheexecutedprogram:SW_HIDE=HiddenwindowSW_MINIMIZE=MinimizedwindowSW_MAXIMIZE=Maximizedwindow

Page 212: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:ThePIDoftheprocessthatwaslaunched.Failure:seeRemarks.

Page 213: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAfterrunningtherequestedprogramthescriptcontinues.TopauseexecutionofthescriptuntilthespawnedprogramhasfinishedusetheRunWaitfunctioninstead.

Theerrorpropertyissetto1asanindicationoffailure.

Page 215: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Run"Notepad.exe","",oAutoIt.SW_MAXIMIZE

Page 216: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 217: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RunAsRunsanexternalprogram

RunAs"user","domain","password",logon_flag,

"filename"[,"workingdir"[,show_flag]]

Page 218: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersusername Theusernametouse.domain Thedomainnametouse.password Thepasswordtouse.

logon_flag 0=donotloadtheuserprofile,1=(default)loadtheuserprofile,2=usefornetcredentialsonly

filename Thenameoftheexecutable(EXE,BAT,COM,orPIF)torun.workingdir Optional:Theworkingdirectory.

show_flag

Optional:The"show"flagoftheexecutedprogram:SW_HIDE=HiddenwindowSW_MINIMIZE=MinimizedwindowSW_MAXIMIZE=Maximizedwindow

Page 219: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:ThePIDoftheprocessthatwaslaunched.Failure:seeRemarks.

Page 220: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAfterrunningtherequestedprogramthescriptcontinues.TopauseexecutionofthescriptuntilthespawnedprogramhasfinishedusetheRunWaitfunctioninstead.

Theerrorpropertyissetto1asanindicationoffailure.

Page 222: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Run"Notepad.exe","",oAutoIt.SW_MAXIMIZE

Page 223: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 224: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RunAsWaitRunsanexternalprogram

RunAsWait"user","domain","password",logon_flag,

"filename"[,"workingdir"[,show_flag]]

Page 225: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersusername Theusernametouse.domain Thedomainnametouse.password Thepasswordtouse.

logon_flag 0=donotloadtheuserprofile,1=(default)loadtheuserprofile,2=usefornetcredentialsonly

filename Thenameoftheexecutable(EXE,BAT,COM,orPIF)torun.workingdir Optional:Theworkingdirectory.

show_flag

Optional:The"show"flagoftheexecutedprogram:SW_HIDE=HiddenwindowSW_MINIMIZE=MinimizedwindowSW_MAXIMIZE=Maximizedwindow

Page 226: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess:ThePIDoftheprocessthatwaslaunched.Failure:seeRemarks.

Page 227: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAfterrunningtherequestedprogramthescriptpausesuntiltheprogramterminates.TorunaprogramandthenimmediatelycontinuescriptexecutionusetheRunfunctioninstead.

Someprogramswillappeartoreturnimmediatelyeventhoughtheyarestillrunning;theseprogramsspawnanotherprocess-youmaybeabletousetheProcessWaitClosefunctiontohandlethesecases.

Theerrorpropertyissetto1asanindicationoffailure.

Page 229: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Run"Notepad.exe","",oAutoIt.SW_MAXIMIZE

Page 230: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 231: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RunWaitRunsanexternalprogramandpausesscriptexecutionuntiltheprogramfinishes

RunWait"filename"[,"workingdir"[,flag]]

Page 232: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersfilename Thenameoftheexecutable(EXE,BAT,COM,PIF)torun.workingdir Optional:Theworkingdirectory.

flag

Optional:The"show"flagoftheexecutedprogram:SW_HIDE=HiddenwindowSW_MINIMIZE=MinimizedwindowSW_MAXIMIZE=Maximizedwindow

Page 233: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnstheexitcodeoftheprogramthatwasrun.Failure: seeRemarks.

Page 234: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAfterrunningtherequestedprogramthescriptpausesuntiltheprogramterminates.TorunaprogramandthenimmediatelycontinuescriptexecutionusetheRunfunctioninstead.

Someprogramswillappeartoreturnimmediatelyeventhoughtheyarestillrunning;theseprogramsspawnanotherprocess-youmaybeabletousetheProcessWaitClosefunctiontohandlethesecases.

Theerrorpropertyissetto1asanindicationoffailure.

Page 236: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

val=oAutoIt.RunWait("Notepad.exe","C:\WINDOWS",

oAutoIt.SW_MAXIMIZE)

'scriptwaitsuntilNotepadcloses

WScript.Echo"Programreturnedwithexitcode:"&v

al

Page 237: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 238: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ShutdownShutsdownthesystem

Shutdown(code)

Page 239: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterscode Acombinationofshutdowncodes.See"remarks".

Page 240: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0.

Page 241: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksTheshutdowncodeisacombinationofthefollowingvalues:0=Logoff1=Shutdown2=Reboot4=Force8=Powerdown

Addtherequiredvaluestogether.Toshutdownandpowerdown,forexample,thecodewouldbe9(shutdown+powerdown=1+8=9).

Standbyorhibernatecanbeachievedwiththird-partysoftwaresuchashttp://grc.com/wizmo/wizmo.htm

Page 243: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

'Forceareboot

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Shutdown6

Page 244: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

TimerandDelaymethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionSleep Pausescriptexecution

Page 245: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 246: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

SleepPausescriptexecution

Sleepdelay

Page 247: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parametersdelay Amountoftimetopause(inmilliseconds).

Page 248: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 249: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksMaximumsleeptimeis2147483647milliseconds(24days).

Page 250: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Sleep5000'fiveseconds

Page 251: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WindowmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionWinActivate Activates(givesfocusto)awindow

WinActive Checkstoseeifaspecifiedwindowexistsandiscurrentlyactive

WinClose ClosesawindowWinExists Checkstoseeifaspecifiedwindowexists

WinGetCaretPosX Returnsthecoordinatesofthecaretintheforegroundwindow

WinGetCaretPosY Returnsthecoordinatesofthecaretintheforegroundwindow

WinGetClassList RetrievestheclassesfromawindowWinGetClientSizeHeight Retrievesthesizeofagivenwindow'sclientareaWinGetClientSizeWidth Retrievesthesizeofagivenwindow'sclientareaWinGetHandle RetrievestheinternalhandleofawindowWinGetPosHeight RetrievesthepositionandsizeofagivenwindowWinGetPosWidth RetrievesthepositionandsizeofagivenwindowWinGetPosX RetrievesthepositionandsizeofagivenwindowWinGetPosY Retrievesthepositionandsizeofagivenwindow

WinGetProcess RetrievestheProcessID(PID)associatedwithawindow

WinGetState RetrievesthestateofagivenwindowWinGetText RetrievesthetextfromawindowWinGetTitle Retrievesthefulltitlefromawindow

Page 252: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinKill ForcesawindowtocloseWinList RetrievesalistofwindowsWinMenuSelectItem InvokesamenuitemofawindowWinMinimizeAll MinimizesallwindowsWinMinimizeAllUndo UndoesapreviousWinMinimizeAllfunctionWinMove Movesand/orresizesawindowWinSetOnTop Changeawindow's"AlwaysOnTop"attribute

WinSetState Shows,hides,minimizes,maximizes,orrestoresawindow

WinSetTitle ChangesthetitleofawindowWinSetTrans Setsthetransparencyofawindow

WinWait Pausesexecutionofthescriptuntiltherequestedwindowexists

WinWaitActive Pausesexecutionofthescriptuntiltherequestedwindowisactive

WinWaitClose Pausesexecutionofthescriptuntiltherequestedwindowdoesnotexist

WinWaitNotActive Pausesexecutionofthescriptuntiltherequestedwindowisnotactive

Page 253: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlsmethodsReferenceBelowisacompletelistofthemethodsavailableinAutoItX.Clickonamethodnameforadetaileddescription.

Method DescriptionControlClick SendsamouseclickcommandtoagivencontrolControlCommand SendsacommandtoacontrolControlDisable Disablesor"grays-out"acontrolControlEnable Enablesa"grayed-out"controlControlFocus Setsinputfocustoagivencontrolonawindow

ControlGetFocus ReturnstheControlRef#ofthecontrolthathaskeyboardfocuswithinaspecifiedwindow

ControlGetHandle Retrievestheinternalhandleofacontrol

ControlGetPosHeight Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosWidth Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosX Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosY Retrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetText RetrievestextfromacontrolControlHide HidesacontrolControlListView SendsacommandtoaListView32controlControlMove MovesacontrolwithinawindowControlSend SendsastringofcharacterstoacontrolControlSetText SetstextofacontrolControlShow Showsacontrolthatwashidden

Page 254: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlTreeView SendsacommandtoaTreeView32controlStatusbarGetText Retrievesthetextfromastandardstatusbarcontrol

Page 255: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 256: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlClickSendsamouseclickcommandtoagivencontrol

ControlClick"title","text","controlID"[,button

[,clicks[,x[,y]]]]

Page 257: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

button Optional:Thebuttontoclick,"left","right"or"middle".Defaultistheleftbutton.

clicks Optional:Thenumberoftimestoclickthemouse.Defaultis1.

x Optional:Thexpositiontoclickwithinthecontrol.Defaultiscenter.

y Optional:Theypositiontoclickwithinthecontrol.Defaultiscenter.

Page 258: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0.

Page 259: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksSomecontrolswillresistclickingunlesstheyaretheactivewindow.UsetheWinActive()functiontoforcethecontrol'swindowtothetopbeforeusingControlClick().Using2forthenumberofclickswillsendadouble-clickmessagetothecontrol-thiscanevenbeusedtolaunchprogramsfromanexplorercontrol!

Page 261: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlClick"Untitled-","","MDIClient1"

Page 262: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 263: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlCommandSendsacommandtoacontrol

ControlCommand"title","text","controlID",

"command","option"

Page 264: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.command Thecommandtosendtothecontrol.

option Additionalparameterrequiredbysomecommands;use""ifparameterisnotrequired.

Page 265: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueDependsoncommandastablebelowshows.Incaseofanerror(suchasaninvalidcommandorwindow/control),oAutoIt.error=1.

Command,Option ReturnValue"IsVisible","" Returns1ifControlisvisible,0otherwise"IsEnabled","" Returns1ifControlisenabled,0otherwise"ShowDropDown","" DropsaComboBox"HideDropDown","" UNdropsaComboBox"AddString",'string' AddsastringtotheendinaListBoxorComboBox"DelString",occurrence

DeletesastringaccordingtooccurrenceinaListBoxorComboBox

"FindString",'string' ReturnsoccurrencerefoftheexactstringinaListBoxorComboBox

"SetCurrentSelection",occurrence

SetsselectiontooccurrencerefinaListBoxorComboBox

"SelectString",'string' SetsselectionaccordingtostringinaListBoxorComboBox

"IsChecked","" Returns1ifButtonischecked,0otherwise"Check","" ChecksradioorcheckButton"UnCheck","" UnchecksradioorcheckButton"GetCurrentLine","" Returnstheline#wherethecaretisinanEdit"GetCurrentCol","" Returnsthecolumn#wherethecaretisinanEdit"GetCurrentSelection",""

ReturnsnameofthecurrentlyselectediteminaListBoxorComboBox

"GetLineCount","" Returns#oflinesinanEdit"GetLine",line# Returnstextatline#passedofanEdit"GetSelected","" ReturnsselectedtextofanEdit"EditPaste",'string' Pastesthe'string'attheEdit'scaretposition

Page 266: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

"CurrentTab","" ReturnsthecurrentTabshownofaSysTabControl32

"TabRight","" MovestothenexttabtotherightofaSysTabControl32

"TabLeft","" MovestothenexttabtotheleftofaSysTabControl32

Page 267: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksCertaincommandsthatworkonnormalComboandListBoxesdonotworkon"ComboLBox"controls.WhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".UseAU3_Spy.exetoobtainacontrol'snumber.

WhenusingtextinsteadofClassName#in"Control"commands,besuretousetheentiretextofthecontrol.Partialtextwillfail.

Page 269: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlCommand"Untitled-Notepad","","E

dit1","GetLineCount",""

Page 270: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 271: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlDisableDisablesor"grays-out"acontrol

ControlDisable"title","text","controlID"

Page 272: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 273: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0.

Page 274: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 276: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlDisable"Untitled-","","MDIClient

1"

Page 277: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 278: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlEnableEnablesa"grayed-out"control

ControlEnable"title","text","controlID"

Page 279: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 280: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0.

Page 281: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksUsewithcaution.WhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 283: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlEnable"Untitled-","","MDIClient1

"

Page 284: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 285: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlFocusSetsinputfocustoagivencontrolonawindow

ControlFocus"title","text","controlID"

Page 286: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 287: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0.

Page 288: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 290: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlFocus"Untitled-Notepad","","Edi

t1"

Page 291: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 292: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetFocusReturnstheControlRef#ofthecontrolthathaskeyboardfocuswithinaspecifiedwindow

ControlGetFocus"title"[,"text"]

Page 293: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Titleofwindowtocheck.text Optional:Textfromwindowtocheck.

Page 294: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValue

Success: ReturnsControlRef#ofthecontrolthathaskeyboardfocuswithinaspecifiedwindow.

Failure: ReturnsablankstringandsetsoAutoIt.errorto1ifwindowisnotfound.

Page 296: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

a=oAutoIt.ControlGetFocus("Untitled-Notepad")

Page 297: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 298: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetHandleRetrievestheinternalhandleofacontrol

ControlGetHandle"title","text","controlID"

Page 299: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Thetextofthewindowtoread.controlID Thecontroltointeractwith.SeeControls.

Page 300: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsastringcontainingthecontrolhandlevalue.

Failure: Returns""(blankstring)andsetsoAutoIt.errorto1ifnowindowmatchesthecriteria.

Page 301: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinTitleMatchMode(Option)

Page 302: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

handle=oAutoIt.ControlGetHandle("Untitled-Notep

ad","","Edit1")

Page 303: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 304: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetPosXRetrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosX"title","text","controlID"

Page 305: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 306: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnstheXcoordinateofthecontrol.Failure: SetsoAutoIt.errorto1.

Page 307: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 309: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

posx=ControlGetPosX("Untitled-Notepad","","Ed

it1")

posy=ControlGetPosY("Untitled-Notepad","","Ed

it1")

poswidth=ControlGetPosWidth("Untitled-Notepad",

"","Edit1")

posheight=ControlGetPosHeight("Untitled-Notepad

","","Edit1")

Page 310: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 311: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetPosYRetrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosY"title","text","controlID"

Page 312: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 313: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnstheYcoordinateofthecontrol.Failure: SetsoAutoIt.errorto1.

Page 314: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 316: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

posx=ControlGetPosX("Untitled-Notepad","","Ed

it1")

posy=ControlGetPosY("Untitled-Notepad","","Ed

it1")

poswidth=ControlGetPosWidth("Untitled-Notepad",

"","Edit1")

posheight=ControlGetPosHeight("Untitled-Notepad

","","Edit1")

Page 317: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 318: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetPosWidthRetrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosWidth"title","text","controlID"

Page 319: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 320: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsthewidthofthecontrol.Failure: SetsoAutoIt.errorto1.

Page 321: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 323: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

posx=ControlGetPosX("Untitled-Notepad","","Ed

it1")

posy=ControlGetPosY("Untitled-Notepad","","Ed

it1")

poswidth=ControlGetPosWidth("Untitled-Notepad",

"","Edit1")

posheight=ControlGetPosHeight("Untitled-Notepad

","","Edit1")

Page 324: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 325: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetPosHeightRetrievesthepositionandsizeofacontrolrelativetoit'swindow

ControlGetPosHeight"title","text","controlID"

Page 326: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 327: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnstheheightofthecontrol.Failure: SetsoAutoIt.errorto1.

Page 328: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 330: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

posx=ControlGetPosX("Untitled-Notepad","","Ed

it1")

posy=ControlGetPosY("Untitled-Notepad","","Ed

it1")

poswidth=ControlGetPosWidth("Untitled-Notepad",

"","Edit1")

posheight=ControlGetPosHeight("Untitled-Notepad

","","Edit1")

Page 331: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 332: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlGetTextRetrievestextfromacontrol

ControlGetText"title","text","controlID"

Page 333: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 334: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnstextfromacontrol.Failure: SetsoAutoIt.errorto1andreturnsablankstringof"".

Page 335: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 337: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

var=oAutoIt.ControlGetText("Untitled-Notepad",

"","Edit1")

Page 338: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 339: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlHideHidesacontrol

ControlHide"title","text","controlID"

Page 340: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 341: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifwindow/controlisnotfound.

Page 342: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 344: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlHide"Untitled-","","MDIClient1"

Page 345: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 346: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlListViewSendsacommandtoaListView32control

ControlListView"title","text","controlID",

"command","option1","option2"

Page 347: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.command Thecommandtosendtothecontrol(seebelow).

option1 Additionalparameterrequiredbysomecommands;use""ifparameterisnotrequired.

option2 Additionalparameterrequiredbysomecommands;use""ifparameterisnotrequired.

Page 348: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueDependsoncommandastablebelowshows.Incaseofanerror(suchasaninvalidcommandorwindow/controlcouldnotbefound)then@errorissetto1.

Allitems/subitemsare0based.Thismeansthatthefirstitem/subiteminalistis0,thesecondis1,andsoon.

Ina"Details"viewofaListView32control,the"item"canbethoughtofasthe"row"andthe"subitem"asthe"column".

Command,Option1,Option2 Operation"DeSelect",From[,To] Deselectsoneormoreitems."FindItem","stringtofind"[,SubItem]

Returnstheitemindexofthestring.Returns-1ifthestringisnotfound.

"GetItemCount" Returnsthenumberoflistitems.

"GetSelected"[,option]

Returnsastringcontainingtheitemindexofselecteditems.Ifoption=0(default)onlythefirstselecteditemisreturned.Ifoption=1thenalltheselecteditemsarereturneddelimitedby|,e.g:"0|3|4|10".Ifnoitemsareselectedablank""stringisreturned.

"GetSelectedCount" Returnsthenumberofitemsthatareselected."GetSubItemCount" Returnsthenumberofsubitems."GetText",Item,SubItem Returnsthetextofagivenitem/subitem.

"IsSelected",Item Returns1iftheitemisselected,otherwisereturns0.

"Select",From[,To] Selectsoneormoreitems."SelectAll" Selectsallitems."SelectClear" Clearstheselectionofallitems."SelectInvert" Invertsthecurrentselection.

Page 349: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

"ViewChange","view" Changesthecurrentview.Validviewsare"list","details","smallicons","largeicons".

Page 350: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedControlClick,ControlCommand,ControlDisable,ControlEnable,ControlFocus,ControlGetPosX,ControlGetPosY,ControlGetText,ControlHide,ControlMove,ControlSetText,ControlShow,ControlTreeView,StatusbarGetText,WinGetClassList,WinMenuSelectItem

Page 351: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlListView"C:\ProgramFiles\NSIS",""

,"SysListView321","SelectAll","",""

oAutoIt.ControlListView"C:\ProgramFiles\NSIS",""

,"SysListView321","Deselect","2","5"

Page 352: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 353: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlMoveMovesacontrolwithinawindow

ControlMove"title","text","controlID",x,y[,

width[,height]]

Page 354: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtomove.text Thetextofthewindowtomove.controlID Thecontroltointeractwith.SeeControls.x Xcoordinatetomoveto.y Ycoordinatetomoveto.width Optional:Newwidthofthewindow.height Optional:Newheightofthewindow.

Page 355: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifwindow/controlisnotfound.

Page 356: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 358: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlMove"Untitled-","","MDIClient1",

0,0,200,200

Page 359: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 360: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlSendSendsastringofcharacterstoacontrol

ControlSend"title","text","controlID","string"

[,flag]

Page 361: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.string Stringofcharacterstosendtothecontrol.

flag

Optional:Changeshow"keys"isprocessed:flag=0(default),Textcontainsspecialcharacterslike+toindicateSHIFTand{LEFT}toindicateleftarrow.flag=1,keysaresentraw.

Page 362: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifwindow/controlisnotfound.

Page 363: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksControlSendcanbequiteusefultosendcapitalletterswithoutmessingupthestateof"Shift."

WhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".Note,thisfunctioncannotsendallthecharactersthattheusualSendfunctioncan(notablyALTkeys)butitcansendmostofthem--eventonon-activeorhiddenwindows!

Page 365: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlSend"Untitled","","Edit1","This

isalineoftextinthenotepadwindow"

Page 366: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 367: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlSetTextSetstextofacontrol

ControlSetText"title","text","controlID","new

text"

Page 368: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.newtext Thenewtexttobesetintothecontrol.

Page 369: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifwindow/controlisnotfound.

Page 370: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 372: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Run"notepad.exe"

oAutoIt.WinWait"Untitled-"

oAutoIt.ControlSetText"Untitled-","","Edit1","

NewTextHere"

Page 373: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 374: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlShowShowsacontrolthatwashidden

ControlShow"title","text","controlID"

Page 375: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.

Page 376: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifwindow/controlisnotfound.

Page 377: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWhenusingacontrolnameintheControlfunctions,youneedtoaddanumbertotheendofthenametoindicatewhichcontrol.Forexample,iftheretwocontrolslistedcalled"MDIClient",youwouldrefertotheseas"MDIClient1"and"MDIClient2".

Page 379: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlShow"Untitled-","","MDIClient1"

Page 380: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 381: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ControlTreeViewSendsacommandtoaTreeView32control

ControlTreeView"title","text","controlID",

"command","option1","option2"

Page 382: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaccess.text Thetextofthewindowtoaccess.controlID Thecontroltointeractwith.SeeControls.command Thecommandtosendtothecontrol(seebelow).

option1 Additionalparameterrequiredbysomecommands;use""ifparameterisnotrequired.

option2 Additionalparameterrequiredbysomecommands;use""ifparameterisnotrequired.

Page 383: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueDependsoncommandastablebelowshows.Incaseofanerror(suchasaninvalidcommandorwindow/controlcouldnotbefound)then@errorissetto1.

Command,Option1,Option2 Operation"Check","item" Checksanitem(iftheitemsupportsit)."Collapse","item" Collapsesanitemtohideitschildren."Exists","item" Returns1ifanitemexists,otherwise0."Expand","item" Expandsanitemtoshowitschildren.

"GetItemCount","item" Returnsthenumberofchildrenforaselecteditem.

"GetSelected"[,UseIndex]Returnstheitemreferenceofthecurrentselectionusingthetextreferenceoftheitem(orindexreferenceifUseIndexissetto1).

"GetText","item" Returnsthetextofanitem.

"IsChecked" Returnsthestateofanitem.1:checked,0:unchecked,-1:notacheckbox.

"Select","item" Selectsanitem."Uncheck","item" Unchecksanitem(iftheitemsupportsit).

Page 384: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedControlClick,ControlCommand,ControlDisable,ControlEnable,ControlFocus,ControlGetPosX,ControlGetPosY,ControlGetText,ControlHide,ControlListView,ControlMove,ControlSetText,ControlShow,StatusbarGetText,WinGetClassList,WinMenuSelectItem

Page 385: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.ControlListView"C:\","","SysTreeView321"

,"SelectAll","",""

oAutoIt.ControlListView"C:\","","SysTreeView321"

,"Deselect","2","5"

Page 386: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 387: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

StatusbarGetTextRetrievesthetextfromastandardstatusbarcontrol

StatusbarGetText"title"[,"text"[,part]]

Page 388: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtocheck.text Optional:Thetextofthewindowtocheck.

partOptional:The"part"numberofthestatusbartoread-thedefaultis1.1isthefirstpossiblepartandusuallytheonethatcontainstheusefulmessageslike"Ready""Loading...",etc.

Page 389: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsthetextread.

Failure: ReturnsemptystringandsetsoAutoIt.errorto1ifnotextcouldberead.

Page 390: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThisfunctionsattemptstoreadthefirststandardstatusbaronawindow(Microsoftcommoncontrol:msctls_statusbar32).SomeprogramsusetheirownstatusbarsorspecialversionsoftheMScommoncontrolwhichStatusbarGetTextcannotread.Forexample,StatusbarTextdoesnotworkontheprogramTextPad;however,thefirstregionofTextPad'sstatusbarcanbereadusingControlGetText("TextPad","","HSStatusBar1")StatusbarGetTextcanworkonwindowsthatareminimizedorevenhidden.

Page 392: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.AutoItSetOption("WinTitleMatchMode",2)

text=oAutoIt.StatusbarGetText"InternetExplorer"

WScript.Echo"InternetExplorer'sstatusbarsays:

"&text

Page 393: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 394: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinActivateActivates(givesfocusto)awindow

WinActivate"title"[,"text"]

Page 395: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoactivate.text Optional:Thetextofthewindowtoactivate.

Page 396: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 397: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksYoucanusetheWinActivefunctiontocheckifWinActivatesucceeded.Ifmultiplewindowsmatchthecriteria,thewindowthatwasmostrecentlyactiveistheoneactivated.WinActivateworksonminimizedwindows.However,awindowthatis"AlwaysOnTop"couldstillcoverupawindowyouActivated.

Page 399: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinActivate"Untitled-Notepad",""

Page 400: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 401: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinActiveCheckstoseeifaspecifiedwindowexistsandiscurrentlyactive

WinActive"title"[,"text"]

Page 402: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoactivate.text Optional:Thetextofthewindowtoactivate.

Page 403: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifwindowisnotactive.

Page 405: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

IfoAutoIt.WinActive("Untitled-")Then

WScript.Echo"Windowwasactive"

EndIf

Page 406: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 407: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinCloseClosesawindow

WinClose"title"[,"text"]

Page 408: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoclose.text Optional:Thetextofthewindowtoclose.

Page 409: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 410: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThisfunctionsendsaclosemessagetoawindow,theresultdependsonthewindow(itmayasktosavedata,etc.).Toforceawindowtoclose,usetheWinKillfunction.Ifmultiplewindowsmatchthecriteria,thewindowthatwasmostrecentlyactiveisclosed.

Page 412: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinClose"Untitled-Notepad",""

Page 413: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 414: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinExistsCheckstoseeifaspecifiedwindowexists

WinExists"title"[,"text"]

Page 415: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtocheck.text Optional:Thetextofthewindowtocheck.

Page 416: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturns1ifthewindowexists,otherwisereturns0.

Page 417: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinExistwillreturn1evenifawindowishidden.

Page 419: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

IfoAutoIt.WinExists("Untitled-")Then

WScript.Echo"Windowexists"

EndIf

Page 420: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 421: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetCaretPosXReturnsthecoordinatesofthecaretintheforegroundwindow

WinGetCaretPosX

Page 422: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnstheXcoordinateofthecaret.Failure: SetsoAutoIt.errorto1.

Page 423: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetCaretPosmightnotreturnaccuratevaluesforMultipleDocumentInterface(MDI)applicationsifabsoluteCaretCoordModeisused.Seeexampleforaworkaround.Note:Someapplicationsreportstaticcoordinatesregardlessofcaretposition!

Page 424: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedCaretCoordMode(Option)

Page 425: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

x=oAutoIt.WinGetCaretPosX()

y=oAutoIt.WinGetCaretPosY()

Page 426: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 427: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetCaretPosYReturnsthecoordinatesofthecaretintheforegroundwindow

WinGetCaretPosY

Page 428: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnstheYcoordinateofthecaret.Failure: SetsoAutoIt.errorto1.

Page 429: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetCaretPosmightnotreturnaccuratevaluesforMultipleDocumentInterface(MDI)applicationsifabsoluteCaretCoordModeisused.Seeexampleforaworkaround.Note:Someapplicationsreportstaticcoordinatesregardlessofcaretposition!

Page 430: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedCaretCoordMode(Option)

Page 431: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

x=oAutoIt.WinGetCaretPosX()

y=oAutoIt.WinGetCaretPosY()

Page 432: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 433: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetClassListRetrievestheclassesfromawindow

WinGetClassList"title"[,"text"]

Page 434: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 435: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsastringcontainingthewindowclassesread.

Failure: Returnsnumeric1andsetsoAutoIt.errorto1ifnowindowmatchesthecriteria.

Page 436: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksClassnamesarelinefeedseparated.WinGetClassListworksonbothminimizedandhiddenwindows.Upto64KBoftextcanberetrieved.Ifmultiplewindowsmatchthecriteria,theclassesarereadfromthemostrecentlyactivewindow.

Page 438: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

text=oAutoIt.WinGetClassList("Untitled-","")

WScript.Echo"Textreadwas:"&text

Page 439: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 440: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetClientSizeWidthRetrievesthesizeofagivenwindow'sclientarea

WinGetClientSizeWidth"title"[,"text"]

Page 441: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 442: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsthewidthofthewindow'sclientareaFailure: Returnsnumeric1andsetsoAutoIt.errorto1ifwindowsisnotfound.

Page 443: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthewindowisminimized,thereturnedwidthandheightvaluesarebothzero.However,WinGetClientSizeworkscorrectlyon(non-minimized)hiddenwindows.Ifthewindowtitle"ProgramManager"isused,thefunctionwillreturnthesizeofthedesktop.WinGetClientSize("")matchestheactivewindow.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 445: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

$width=oAutoIt.WinGetClientSizeWidth("")

$height=oAutoIt.WinGetClientSizeHeight("")

Page 446: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 447: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetClientSizeHeightRetrievesthesizeofagivenwindow'sclientarea

WinGetClientSizeHeight"title"[,"text"]

Page 448: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 449: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnstheheightofthewindow'sclientareaFailure: Returnsnumeric1andsetsoAutoIt.errorto1ifwindowsisnotfound.

Page 450: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthewindowisminimized,thereturnedwidthandheightvaluesarebothzero.However,WinGetClientSizeworkscorrectlyon(non-minimized)hiddenwindows.Ifthewindowtitle"ProgramManager"isused,thefunctionwillreturnthesizeofthedesktop.WinGetClientSize("")matchestheactivewindow.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 452: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

$width=oAutoIt.WinGetClientSizeWidth("")

$height=oAutoIt.WinGetClientSizeHeight("")

Page 453: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 454: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetHandleRetrievestheinternalhandleofawindow

WinGetHandle"title"[,"text"]

Page 455: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 456: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsastringcontainingthewindowhandlevalue.

Failure: Returns""(blankstring)andsetsoAutoIt.errorto1ifnowindowmatchesthecriteria.

Page 457: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThisfunctionisforusewiththeadvancedWinTitleMatchModeoptionsthatallowyoutouseclassnamesandhandlestospecifywindowsratherthan"title"and"text".Onceyouhaveobtainedthehandleyoucanaccesstherequiredwindowevenifitstitlechanges.

Page 458: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinTitleMatchMode(Option)

Page 459: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

handle=oAutoIt.WinGetHandle("[CLASS:Notepad]",""

)

Page 460: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 461: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetPosXRetrievesthepositionandsizeofagivenwindow

WinGetPosX"title"[,"text"]

Page 462: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 463: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnstheXcoordinateofthewindow.Failure: Returnsnumeric1andsetsoAutoIt.errorto1ifwindowsisnotfound.

Page 464: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetPosXreturnsnegativenumberssuchas-32000forminimizedwindows,butworksfinewith(non-minimized)hiddenwindows.Ifthewindowtitle"ProgramManager"isused,thefunctionwillreturnthesizeofthedesktop.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 465: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinGetClientSizeHeight,WinGetClientSizeWidth,WinMove

Page 466: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

x=oAutoIt.WinGetPosX("")

y=oAutoIt.WinGetPosY("")

width=oAutoIt.WinGetPosWidth("")

height=oAutoIt.WinGetPosHeight("")

Page 467: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 468: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetPosYRetrievesthepositionandsizeofagivenwindow

WinGetPosY"title"[,"text"]

Page 469: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 470: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnstheYcoordinateofthewindow.Failure: Returnsnumeric1andsetsoAutoIt.errorto1ifwindowsisnotfound.

Page 471: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetPosYreturnsnegativenumberssuchas-32000forminimizedwindows,butworksfinewith(non-minimized)hiddenwindows.Ifthewindowtitle"ProgramManager"isused,thefunctionwillreturnthesizeofthedesktop.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 472: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinGetClientSizeHeight,WinGetClientSizeWidth,WinMove

Page 473: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

x=oAutoIt.WinGetPosX("")

y=oAutoIt.WinGetPosY("")

width=oAutoIt.WinGetPosWidth("")

height=oAutoIt.WinGetPosHeight("")

Page 474: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 475: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetPosWidthRetrievesthepositionandsizeofagivenwindow

WinGetPosWidth"title"[,"text"]

Page 476: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 477: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnsthewidthofthewindow.Failure: Returnsnumeric1andsetsoAutoIt.errorto1ifwindowsisnotfound.

Page 478: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetPosreturnsnegativenumberssuchas-32000forminimizedwindows,butworksfinewith(non-minimized)hiddenwindows.Ifthewindowtitle"ProgramManager"isused,thefunctionwillreturnthesizeofthedesktop.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 479: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinGetClientSizeHeight,WinGetClientSizeWidth,WinMove

Page 480: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

x=oAutoIt.WinGetPosX("")

y=oAutoIt.WinGetPosY("")

width=oAutoIt.WinGetPosWidth("")

height=oAutoIt.WinGetPosHeight("")

Page 481: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 482: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetPosHeightRetrievesthepositionandsizeofagivenwindow

WinGetPosHeight"title"[,"text"]

Page 483: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 484: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returnstheheightofthewindow.Failure: Returnsnumeric1andsetsoAutoIt.errorto1ifwindowsisnotfound.

Page 485: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetPosreturnsnegativenumberssuchas-32000forminimizedwindows,butworksfinewith(non-minimized)hiddenwindows.Ifthewindowtitle"ProgramManager"isused,thefunctionwillreturnthesizeofthedesktop.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 486: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinGetClientSizeHeight,WinGetClientSizeWidth,WinMove

Page 487: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

x=oAutoIt.WinGetPosX("")

y=oAutoIt.WinGetPosY("")

width=oAutoIt.WinGetPosWidth("")

height=oAutoIt.WinGetPosHeight("")

Page 488: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 489: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetProcessRetrievestheProcessID(PID)associatedwithawindow

WinGetProcess"title"[,"text"]

Page 490: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 491: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: ReturnsastringcontainingthenumericProcessID(PID).Failure: Returns"".

Page 493: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

WScript.EchooAutoIt.WinGetProcess("Untitled-Note

pad")

Page 494: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 495: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetStateRetrievesthestateofagivenwindow

WinGetState"title"[,"text"]

Page 496: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 497: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValue

Success:

Returnsavalueindicatingthestateofthewindow.MultiplevaluesareaddedtogethersouseBitAND()toexaminethepartyouareinterestedin:1=Windowexists2=Windowisvisible4=Windowsisenabled8=Windowisactive16=Windowisminimized32=Windowsismaximized

Failure: Returns0andsetsoAutoIt.errorto1ifthewindowisnotfound.

Page 498: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RelatedWinGetPosX,WinGetPosY

Page 499: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

state=oAutoIt.WinGetState"Untitled",""

Page 500: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 501: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetTextRetrievesthetextfromawindow

WinGetText"title"[,"text"]

Page 502: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 503: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsastringcontainingthewindowtextread.

Page 504: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksUpto64KBofwindowtextcanberetrieved.WinGetTextworksonminimizedwindows,butonlyworksonhiddenwindowsifyou'vesetAutoItSetOption("WinDetectHiddenText",1)IfmultiplewindowsmatchthecriteriaforWinGetText,theinformationforthemostrecentlyactivematchisreturned.UseWinGetText("")togettheactivewindow'stext.

Page 506: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

text=oAutoIt.WinGetText("Untitled-","")

WScript.Echo"Textreadwas:"&text

Page 507: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 508: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinGetTitleRetrievesthefulltitlefromawindow

WinGetTitle"title"[,"text"]

Page 509: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Optional:Thetextofthewindowtoread.

Page 510: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturnsastringcontainingthecompletewindowtitle.Returnsnumeric0ifnotitlematch.

Page 511: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinGetTitle("")returnstheactivewindow'stitle.WinGetTitleworksonbothminimizedandhiddenwindows.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 513: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

title=oAutoIt.WinGetTitle"Untitled-",""

WScript.Echo"Fulltitlereadwas:"&title

Page 514: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 515: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinKillForcesawindowtoclose

WinKill"title"[,"text"]

Page 516: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoclose.text Optional:Thetextofthewindowtoclose.

Page 517: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.(Alwaysreturns1regardlessofsuccess.)

Page 518: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThedifferencebetweenthisfunctionandWinCloseisthatWinKillwillforciblyterminatethewindowifitdoesn'tclosequicklyenough.Consequently,ausermightnothavetimetorespondtodialogspromptingtheusertosavedata.AlthoughWinKillcanworkonbothminimizedandhiddenwindows,somewindows(notablyexplorerwindows)canonlybeterminatedusingWinClose.

Page 520: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinKill"Untitled-",""

Page 521: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 522: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinListRetrievesalistofwindows

WinList"title"[,"text"]

Page 523: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtofind.text Optional:Thetextofthewindowtofind.

Page 524: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValue

Success:Returnsa2dimensionalarraycontainingthewindowtitlesandcorrespondinghandles.Thenumberofentriesisinelement0,0(seeexample).

Page 525: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Findallinstancesofthenotepadwindow

val=oAutoIt.WinList("[CLASS:Notepad]")

Fori=1toval(0,0)

WScript.Echo"Title:"&val(0,i)&"-Handle:"&

val(1,i)

Next

'Findallwindows(maybehundreds!)

val=oAutoIt.WinList("[ALL]")

Fori=1toval(0,0)

WScript.Echo"Title:"&val(0,i)&"-Handle:"&

val(1,i)

Next

Page 526: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 527: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinMenuSelectItemInvokesamenuitemofawindow

WinMenuSelectItem"title","text","item"[,"item"

[,"item"[,"item"[,"item"[,"item"[,

"item"]]]]]]

Page 528: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoread.text Thetextofthewindowtoread.item TextofMenuItemitem Optional:TextofSubMenuitemitem Optional:TextofSubMenuitemitem Optional:TextofSubMenuitemitem Optional:TextofSubMenuitemitem Optional:TextofSubMenuitemitem Optional:TextofSubMenuitem

Page 529: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0ifthemenucouldnotbefound.

Page 530: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksYoushouldnotethatunderlinedmenuitemsactuallycontaina&charactertoindicatetheunderlining.Thus,themenuitemFilewouldactuallyrequirethetext"&File;",andConvertwouldrequire"Con|"Youcanaccessmenuitemsuptosixlevelsdeep;andthewindowcanbeinactive,minimized,and/orevenhidden.

WinMenuSelectItemwillonlyworkonstandardmenus.Unfortunately,manymenusinusetodayareactuallycustomwrittenortoolbars"pretending"tobemenus.ThisistrueformostMicrosoftapplications.

Page 532: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'ThiswillselectFile,PageSetupinnotepad

oAutoIt.WinMenuSelectItem"Untitled-","","&File

","PageSet&up..."

Page 533: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 534: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinMinimizeAllMinimizesallwindows

WinMinimizeAll

Page 535: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 536: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksSend("#m")isapossiblealternative.

Page 538: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinMinimizeAll

Page 539: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 540: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinMinimizeAllUndoUndoesapreviousWinMinimizeAllfunction

WinMinimizeAllUndo

Page 541: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 542: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksSend("#+m")isapossiblealternative.

Page 544: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinMinimizeAllUndo

Page 545: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 546: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinMoveMovesand/orresizesawindow

WinMove"title","text",x,y[,width[,height]]

Page 547: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtomove/resize.text Thetextofthewindowtomove/resize.x Xcoordinatetomoveto.y Ycoordinatetomoveto.width Optional:Newwidthofthewindow.height Optional:Newheightofthewindow.

Page 548: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 549: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinMovehasnoeffectonminimizedwindows,butWinMoveworksonhiddenwindows.Ifverywidthandheightaresmall(ornegative),thewindowwillgonosmallerthan112x27pixels.Ifwidthandheightarelarge,thewindowwillgonolargerthanapproximately[12+@DesktopWidth]x[12+@DesktopHeight]pixels.Negativevaluesareallowedforthexandycoordinates.Infact,youcanmoveawindowoffscreen;andifthewindow'sprogramisonethatremembersitslastwindowposition,thewindowwillappearinthecorner(butfullyon-screen)thenexttimeyoulaunchtheprogram.Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.

Page 551: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinMove"Untitled-","",0,0,200,200

Page 552: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 553: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinSetOnTopChangeawindow's"AlwaysOnTop"attribute

WinSetOnTop"title","text",flag

Page 554: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoaffect.text Thetextofthewindowtoaffect.

flagDetermineswhetherthewindowshouldhavethe"TOPMOST"flagset.1=setontopflag,0=removeontopflag

Page 555: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 556: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThird-partyprogramswhichaddan"AlwaysOnTop"contextmenuentrymightnotupdatetheirmenuentrytoreflecttheAutoIt-inducedchangeinTOPMOSTstatus.

Page 558: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinSetOnTop"Untitled-","",1

Page 559: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 560: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinSetStateShows,hides,minimizes,maximizes,orrestoresawindow

WinSetState"title","text",flag

Page 561: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtoshow.text Thetextofthewindowtoshow.

flag

The"show"flagoftheexecutedprogram:SW_HIDE=HidewindowSW_SHOW=ShowsapreviouslyhiddenwindowSW_MINIMIZE=MinimizewindowSW_MAXIMIZE=MaximizewindowSW_RESTORE=Undoesawindowminimizationormaximization

Page 562: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 563: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksWinSetStateisareplacementforthebadlynamedWinShowfunction.WinShowisacceptedasanaliasbutthismaybewithdrawninthefuture.

Ifmultiplewindowsmatchthecriteria,themostrecentlyactivewindowisused.SW_MINIMIZEandSW_MAXIMIZEevenworkonmodaldialogwindows.

Page 565: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinSetState"Untitled-","",oAutoIt.SW_HI

DE

oAutoIt.Sleep3000

oAutoIt.WinSetState"Untitled-","",oAutoIt.SW_SH

OW

Page 566: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 567: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinSetTitleChangesthetitleofawindow

WinSetTitle"title","text","newtitle"

Page 568: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtochange.text Thetextofthewindowtochange.newtitle Thenewtitletogivetothewindow.

Page 569: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNone.

Page 570: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfmultiplewindowsmatchthecriteriathetitleofmostrecentlyactivewindowischanged.

Page 572: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.WinSetTitle"Untitled-","","MyNewNote

pad"

Page 573: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 574: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinSetTransSetsthetransparencyofawindow

WinSetTrans"title","text",transparency

Page 575: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtochange.text Thetextofthewindowtochange.

transparency Anumberintherange0-255.Thelargerthenumber,themoretransparentthewindowwillbecome.

Page 576: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueNon-zeroonsuccess,zeroonfailure.oAutoIt.errorwillbesetto1ifthefunctionisn'tsupportedonanOS.

Page 577: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

oAutoIt.Run("notepad.exe","",oAutoIt.SW_MINIMIZE)

oAutoIt.WinWaitActive("Untitled-Notepad")

oAutoIt.WinSetTrans"Untitled-Notepad","",50

Page 578: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 579: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinWaitPausesexecutionofthescriptuntiltherequestedwindowexists

WinWait"title"[,"text"[,timeout]]

Page 580: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtocheck.text Optional:Thetextofthewindowtocheck.timeout Optional:Timeoutinseconds

Page 581: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0iftimeoutoccurred.

Page 582: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThescriptpollsforwindowmatchevery250millisecondsorso.

Page 584: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Waitforthewindow"Untitled"toexist

oAutoIt.Run"notepad.exe"

oAutoIt.WinWait"Untitled"

'Waitamaximumof5secondsfor"Untitled"toexis

t

oAutoIt.WinWait"Untitled","",5

Page 585: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 586: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinWaitActivePausesexecutionofthescriptuntiltherequestedwindowisactive

WinWaitActive"title",["text"],[timeout]

Page 587: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtocheck.text Optional:Thetextofthewindowtocheck.timeout Optional:Timeoutinseconds

Page 588: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0iftimeoutoccurred.

Page 589: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksAutoItpollsforawindowmatchevery250millisecondsorso.

Page 591: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Waitforthewindow"Untitled"toexistandbeact

ive

oAutoIt.WinWaitActive"Untitled"

'Waitamaximumof5secondsfor"Untitled"toexis

tandbeactive

oAutoIt.WinWaitActive"Untitled","",5

Page 592: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 593: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinWaitClosePausesexecutionofthescriptuntiltherequestedwindowdoesnotexist

WinWaitClose"title"[,"text"[,timeout]]

Page 594: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtocheck.text Optional:Thetextofthewindowtocheck.timeout Optional:Timeoutinseconds

Page 595: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueSuccess: Returns1.Failure: Returns0iftimeoutoccurred.

Page 596: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksIfthewindowalreadydoesn'texistwhenthisfunctioniscalleditwillreturn0immediately.Thewindowispolledevery250millisecondsorso.

Page 598: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Waitforthewindow"Untitled"tonotexist

oAutoIt.WinWaitClose"Untitled"

'Waitamaximumof5secondsfor"Untitled"tonot

exist

oAutoIt.WinWaitClose"Untitled","",5

Page 599: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

MethodReference

Page 600: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

WinWaitNotActivePausesexecutionofthescriptuntiltherequestedwindowisnotactive

WinWaitNotActive"title"[,"text"[,timeout]]

Page 601: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Parameterstitle Thetitleofthewindowtocheck.text Optional:Thetextofthewindowtocheck.timeout Optional:Timeoutinseconds

Page 602: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ReturnValueReturns0ifthetimeoutoccurred,otherwisereturns1.

Page 603: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

RemarksThescriptpollsforawindowmatchevery250millisecondsorso.

Page 605: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Example

SetoAutoIt=WScript.CreateObject("AutoItX3.Contro

l")

'Waitforthewindow"Untitled"tonotbeactive

oAutoIt.WinWaitNotActive"Untitled"

'Waitamaximumof5secondsfor"Untitled"tonot

beactive

oAutoIt.WinWaitNotActive"Untitled","",5

Page 606: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

PropertiesReferenceBelowisanlistofallthepropertiesavailableinAutoItX.

e.g.

SetoAutoIt=WScript.CreateObject("AutoItX3.Control")

error=oAutoIt.error()

Macro Description

error Statusoftheerrorflag(equivalenttothe@errormacroinAutoItv3)

version autoitXdllversion(equivalentto@AutoItVersionmacroinAutoItv3)

SW_HIDE Hidesthewindowandactivatesanotherwindow.

SW_MAXIMIZE Maximizesthespecifiedwindow.

SW_MINIMIZE Minimizesthespecifiedwindowandactivatesthenexttop-levelwindowintheZorder.

SW_RESTORE

Activatesanddisplaysthewindow.Ifthewindowisminimizedormaximized,thesystemrestoresittoitsoriginalsizeandposition.Anapplicationshouldspecifythisflagwhenrestoringaminimizedwindow.

SW_SHOW Activatesthewindowanddisplaysitinitscurrentsizeandposition.

SW_SHOWDEFAULTSetstheshowstatebasedontheSW_valuespecifiedbytheprogramthatstartedtheapplication.

SW_SHOWMAXIMIZED Activatesthewindowanddisplaysitasamaximizedwindow.

Page 607: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

SW_SHOWMINIMIZED Activatesthewindowanddisplaysitasaminimizedwindow.

SW_SHOWMINNOACTIVE

Displaysthewindowasaminimizedwindow.ThisvalueissimilartoSW_SHOWMINIMIZED,exceptthewindowisnotactivated.

SW_SHOWNADisplaysthewindowinitscurrentsizeandposition.ThisvalueissimilartoSW_SHOW,exceptthewindowisnotactivated.

SW_SHOWNOACTIVATE

Displaysawindowinitsmostrecentsizeandposition.ThisvalueissimilartoSW_SHOWNORMAL,exceptthewindowisnotactived.

SW_SHOWNORMAL

Activatesanddisplaysawindow.Ifthewindowisminimizedormaximized,thesystemrestoresittoitsoriginalsizeandposition.Anapplicationshouldspecifythisflagwhendisplayingthewindowforthefirsttime.

Page 608: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

UsingtheDLLInterfaceAutoItXcanbeusedasastandardDLLfromanylanguagecapableofcallingfunctionsinexternalDLLs.

ThefollowingfilesareprovidedtoallowyoutousetheDLLinC++:

AutoItX3_DLL.h-Clanguageheaderfileshowingtheexportedfunctionsandparameters

AutoItX3_DLL.lib-Microsoftformatimportlibrary(x86)

AutoItX3_x64_DLL.lib-Microsoftformatimportlibrary(x64)

AutoItX3.dll-ThemainAutoItXDLL(x86)

AutoItX3_x64.dll-ThemainAutoItXDLL(x64)

DocumentationforeachfunctionisnotprovidedasthefunctioncallsaresimilartotheCOMversionanditshouldbeeasytoworkoutwhatisrequiredwiththeCOMdocumentationandtheheaderfile.ThemaindifferencetotheCOMversionisthatthefunctionsthatreceivetext-suchasAU3_WinGetTitlehaveanadditionalparametercallednBufSize-thisshouldbesettotheavailablesizeoftheoutputtextbuffer.

e.g.TheprototypeforAU3_WinGetTextis:voidAU3_WinGetTitle(LPCWSTRszTitle,LPCWSTRszText,LPWSTRszRetText,intnBufSize);

ThereturnbufferisszRetText,andanexample(C++language)usagewouldbe:WCHARszMyTitle[200];

AU3_WinGetTitle("Untitled-Notepad","",szMyTitle,200);

MessageBox(NULL,szMyTitle,"Returnedwindowtitlewas:",MB_OK);

nBufSizeissimplyusedtoavoidbufferoverrunsinanytextthatispassedback.

Page 609: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Usingthe.NETInterfaceA.NETAssemblyinterfaceisprovidedtoallowtheuseofAutoItXDLLfunctionswithoutthetroubleofworkingwithDllImport.Theassemblyuses.NET2.0/CLR2.0andisstronglysignedformaximumcompatibilitywithyourprojects.

Thefollowingfilesareprovidedtoallow.NETuse:

AutoItX3.Assembly.dll-The.NETAssemblyforusingAutoItX.

AutoItX3.Assembly.xml-TheVisualStudioIntellisensehelpfileforthe.NETAssembly.

AutoItX3.dll-ThemainAutoItXDLL(x86)

AutoItX3_x64.dll-ThemainAutoItXDLL(x64)

UsingtheAssemblyfromVB/C#withininVisualStudioisveryeasy:

-AddareferencetoAutoItX3.Assembly.dlltoyourproject

-AddausingAutoIt;statementinthefilesyouwanttouseAutoItfunctions

-WritecodelikethisC#example:

usingAutoIt;

...

//Wow,thisisC#!

AutoItX.Run("notepad.exe");

AutoItX.WinWaitActive("Untitled");

AutoItX.Send("I'minnotepad");

IntPtrwinHandle=AutoItX.WinGetHandle("Untitled");

AutoItX.WinKill(winHandle);

-DistributeyourfinalexecutablewiththefilesAutoItX3.Assembly.dll,AutoItX3.dll,AutoItX3_x64.dll.

Page 610: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

UsingthePowerShellCmdLetsAutoItXcanbeusedtoprovidePowerShellCmdLets.

ThefollowingfilesareprovidedtoallowPowerShelluse:

AutoItX.psd1-ThesignedPowerShellimportmanifest,thisisthefileyouwillimportintoyourscript.

AutoItX3.PowerShell.dll-ThePowerShellmodulecode

AutoItX3.Assembly.dll-The.NETAssemblyforusingAutoItX.ThisisusedbythePowerShellmodule.

AutoItX3.dll-ThemainAutoItXDLL(x86)

AutoItX3_x64.dll-ThemainAutoItXDLL(x64)

UsageofthecmdletswihinPowerShellisasfollows:

#Importthemodulemanfiest.

#IfAutoItisinstalledonthismachinethisstepwon'tberequired-itshouldbeauto-imported.

Import-Module.\AutoItX.psd1

#GetthelistofAutoItXcmdlets

Get-Command*AU3*

#Getdetailedhelpforaparticularcmdlet

Get-HelpGet-AU3WinText

Page 611: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

AppendixReference

ASCIICharacters

SendKeyList

Page 612: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ASCIICharacterCodesThislistishelpfulwiththeAscandChrfunctions.TakenfromASCIICharacterSet

ControlCharacters(mostlynon-printing;mostusefulofthesearehighlightedinyellow.)

Char... Dec Hex Oct DescriptionNUL 0 00 000 NullcharacterSOH 1 01 001 Startofheading,=consoleinterruptSTX 2 02 002 Startoftext,maintenancemodeonHPconsoleETX 3 03 003 EndoftextEOT 4 04 004 Endoftransmission,notthesameasETBENQ 5 05 005 Enquiry,goeswithACK;oldHPflowcontrolACK 6 06 006 Acknowledge,clearsENQlogonhandBEL 7 07 007 Bell,ringsthebell...(PlaysWindows'defaultbeep)BS 8 08 010 Backspace,worksonHPterminals/computersHT 9 09 011 Horizontaltab,movetonexttabstopLF 10 0a 012 LineFeedVT 11 0b 013 VerticaltabFF 12 0c 014 FormFeed,pageejectCR 13 0d 015 CarriageReturnSO 14 0e 016 ShiftOut,alternatecharactersetSI 15 0f 017 ShiftIn,resumedefaultcharactersetDLE 16 10 020 DatalinkescapeDC1 17 11 021 XON,withXOFFtopauselistings;":okaytosend".DC2 18 12 022 Devicecontrol2,block-modeflowcontrolDC3 19 13 023 XOFF,withXONisTERM=18flowcontrol

Page 613: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

DC4 20 14 024 Devicecontrol4NAK 21 15 025 NegativeacknowledgeSYN 22 16 026 SynchronousidleETB 23 17 027 Endtransmissionblock,notthesameasEOTCAN 24 18 030 Cancelline,MPEechoes!!!EM 25 19 031 Endofmedium,Control-YinterruptSUB 26 1a 032 SubstituteESC 27 1b 033 Escape,nextcharacterisnotechoedFS 28 1c 034 FileseparatorGS 29 1d 035 GroupseparatorRS 30 1e 036 Recordseparator,block-modeterminatorUS 31 1f 037 UnitseparatorDEL 127 7f 177 Delete(rubout),cross-hatchbox

PrintingCharacters(standardcharacters)

Char Dec Hex Oct Description 32 20 040 Space! 33 21 041 Exclamationmark" 34 22 042 Quotationmark("inHTML)# 35 23 043 Crosshatch(numbersign)$ 36 24 044 Dollarsign% 37 25 045 Percentsign& 38 26 046 Ampersand` 39 27 047 Closingsinglequote(apostrophe)( 40 28 050 Openingparentheses) 41 29 051 Closingparentheses

Page 614: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

* 42 2a 052 Asterisk(star,multiply)+ 43 2b 053 Plus, 44 2c 054 Comma- 45 2d 055 Hyphen,dash,minus. 46 2e 056 Period/ 47 2f 057 Slant(forwardslash,divide)0 48 30 060 Zero1 49 31 061 One2 50 32 062 Two3 51 33 063 Three4 52 34 064 Four5 53 35 065 Five6 54 36 066 Six7 55 37 067 Seven8 56 38 070 Eight9 57 39 071 Nine: 58 3a 072 Colon; 59 3b 073 Semicolon< 60 3c 074 Lessthansign= 61 3d 075 Equalssign> 62 3e 076 Greaterthansign? 63 3f 077 Questionmark@ 64 40 100 At-signA 65 41 101 UppercaseAB 66 42 102 UppercaseBC 67 43 103 UppercaseCD 68 44 104 UppercaseDE 69 45 105 UppercaseE

Page 615: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

F 70 46 106 UppercaseFG 71 47 107 UppercaseGH 72 48 110 UppercaseHI 73 49 111 UppercaseIJ 74 4a 112 UppercaseJK 75 4b 113 UppercaseKL 76 4c 114 UppercaseLM 77 4d 115 UppercaseMN 78 4e 116 UppercaseNO 79 4f 117 UppercaseOP 80 50 120 UppercasePQ 81 51 121 UppercaseQR 82 52 122 UppercaseRS 83 53 123 UppercaseST 84 54 124 UppercaseTU 85 55 125 UppercaseUV 86 56 126 UppercaseVW 87 57 127 UppercaseWX 88 58 130 UppercaseXY 89 59 131 UppercaseYZ 90 5a 132 UppercaseZ[ 91 5b 133 Openingsquarebracket\ 92 5c 134 Reverseslant(Backslash)] 93 5d 135 Closingsquarebracket^ 94 5e 136 Caret(Circumflex)_ 95 5f 137 Underscore` 96 60 140 Openingsinglequotea 97 61 141 Lowercasea

Page 616: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

b 98 62 142 Lowercasebc 99 63 143 Lowercasecd 100 64 144 Lowercasede 101 65 145 Lowercaseef 102 66 146 Lowercasefg 103 67 147 Lowercasegh 104 68 150 Lowercasehi 105 69 151 Lowercaseij 106 6a 152 Lowercasejk 107 6b 153 Lowercasekl 108 6c 154 Lowercaselm 109 6d 155 Lowercasemn 110 6e 156 Lowercaseno 111 6f 157 Lowercaseop 112 70 160 Lowercasepq 113 71 161 Lowercaseqr 114 72 162 Lowercasers 115 73 163 Lowercasest 116 74 164 Lowercasetu 117 75 165 Lowercaseuv 118 76 166 Lowercasevw 119 77 167 Lowercasewx 120 78 170 Lowercasexy 121 79 171 Lowercaseyz 122 7a 172 Lowercasez{ 123 7b 173 Openingcurlybrace| 124 7c 174 Verticalline} 125 7d 175 Closingcurlybrace

Page 617: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

~ 126 7e 176 Tilde(approximate)

ExtendedCharacterSet(ANSI)

Char Dec Hex Oct Description€ 128 80 200

129 81 201 Note:doesnotdisplayinthiscompiledhtmlhelpfile' 130 82 202ƒ 131 83 203" 132 84 204… 133 85 205† 134 86 206‡ 135 87 207ˆ 136 88 210‰ 137 89 211Š 138 8A 212‹ 139 8B 213Œ 140 8C 214

141 8D 215 Note:doesnotdisplayinthiscompiledhtmlhelpfileŽ 142 8E 216

143 8F 217 Note:doesnotdisplayinthiscompiledhtmlhelpfile� 144 90 220 Note:doesnotdisplayinthiscompiledhtmlhelpfile' 145 91 221' 146 92 222" 147 93 223" 148 94 224• 149 95 225

Page 618: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

- 150 96 226- 151 97 227˜ 152 98 230™ 153 99 231š 154 9A 232› 155 9B 233œ 156 9C 234

157 9D 235 Note:doesnotdisplayinthiscompiledhtmlhelpfilež 158 9E 236Ÿ 159 9F 237 160 A0 240¡ 161 A1 241¢ 162 A2 242£ 163 A3 243¤ 164 A4 244¥ 165 A5 245¦ 166 A6 246§ 167 A7 247¨ 168 A8 250© 169 A9 251ª 170 AA 252« 171 AB 253¬ 172 AC 254

173 AD 255 Note:maynotdisplayinthiscompiledhtmlhelpfile® 174 AE 256¯ 175 AF 257° 176 B0 260± 177 B1 261

Page 619: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

² 178 B2 262

³ 179 B3 263´ 180 B4 264µ 181 B5 265¶ 182 B6 266· 183 B7 267¸ 184 B8 270¹ 185 B9 271º 186 BA 272» 187 BB 273¼ 188 BC 274½ 189 BD 275¾ 190 BE 276¿ 191 BF 277À 192 C0 300Á 193 C1 301Â 194 C2 302Ã 195 C3 303Ä 196 C4 304Å 197 C5 305Æ 198 C6 306Ç 199 C7 307È 200 C8 310É 201 C9 311Ê 202 CA 312Ë 203 CB 313Ì 204 CC 314Í 205 CD 315

Page 620: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Î 206 CE 316

Ï 207 CF 317Ð 208 D0 320Ñ 209 D1 321Ò 210 D2 322Ó 211 D3 323Ô 212 D4 324Õ 213 D5 325Ö 214 D6 326× 215 D7 327Ø 216 D8 330Ù 217 D9 331Ú 218 DA 332Û 219 DB 333Ü 220 DC 334Ý 221 DD 335Þ 222 DE 336ß 223 DF 337à 224 E0 340á 225 E1 341â 226 E2 342ã 227 E3 343ä 228 E4 344å 229 E5 345æ 230 E6 346ç 231 E7 347è 232 E8 350

Page 621: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

é 233 E9 351ê 234 EA 352

ë 235 EB 353ì 236 EC 354í 237 ED 355î 238 EE 356ï 239 EF 357ð 240 F0 360ñ 241 F1 361ò 242 F2 362ó 243 F3 363ô 244 F4 364õ 245 F5 365ö 246 F6 366÷ 247 F7 367ø 248 F8 370ù 249 F9 371ú 250 FA 372û 251 FB 373ü 252 FC 374ý 253 FD 375þ 254 FE 376ÿ 255 FF 377

Page 622: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

SendKeylistQuickreferencefortheSend("keys"[,flag])Command.^Ctrl!Alt+Shift#Win

AutoItcansendallASCIIandExtendedASCIIcharacters(0-255),tosendUNICODEcharactersyoumustusethe"ASC"optionandthecodeofthecharacteryouwishtoSend(see{ASC}below).

TosendtheASCIIvalueA(sameaspressingALT+065onthenumerickeypad)

Send("{ASC065}")

(Whenusing2digitASCIIcodesyoumustusealeading0,otherwiseanobsolete437codepageisused).

TosendUNICODEcharactersenterthecharactercode,forexamplethissendsaChinesecharacter

Send("{ASC2709}")

Singlekeyscanalsoberepeated,e.g.

Send("{DEL4}");PressestheDELkey4times

Send("{S30}");Sends30'S'characters

Send("+{TAB4}");PressesShift+Tab4times

Toholdakeydown

Send("{adown}");HoldstheAkeydown

Send("{aup}");ReleasestheAkey

Page 623: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Ifyouwithtouseavariableforthecount,try

Local$iCount=4

Send("+{TAB"&$iCount&"}")

IfyouwishtosendtheASCIIvalueAfourtimes,thentry

Local$iChr=Chr(65)

Send("{"&$iChr&"4}")

MostlaptopcomputerkeyboardshaveaspecialFnkey.Thiskeycannotbesimulated.

Note,bysettingtheflagparameterto1the"keys"parameterissentRAW.Thisisusefulwhenyouwanttosendsometextcopiedfromavariableandyouwantthetextsentexactlyaswritten.

Sendisquiteusefulbecausewindowscanbenavigatedwithoutneedingamouse.

Forexample,openFolderOptions(inthecontrolpanel)andtrythefollowing:

Send("{TAB}") Navigatetonextcontrol(button,checkbox,etc)Send("+{TAB}") Navigatetopreviouscontrol.Send("^{TAB}") NavigatetonextWindowTab(onaTabbeddialogwindow)Send("^+{TAB}") NavigatetopreviousWindowTab.

Send("{SPACE}") Canbeusedtotoggleacheckboxorclickabutton.

Send("{+}") Usuallychecksacheckbox(ifit'sa"real"checkbox.)Send("{-}") Usuallyunchecksacheckbox.

Page 624: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

Send("{NumPadMult}") RecursivelyexpandsfoldersinaSysTreeView32.

UseAlt-keycombostoaccessmenuitems.Also,openNotepadandtrythefollowing:

Send("!f") SendAlt+f,theaccesskeyforNotepad'sfilemenu.Tryotherletters!

Send("{DOWN}") Movedownamenu.

Send("{UP}") Moveupamenu.Send("{LEFT}") Moveleftwardtonewmenuorexpandasubmenu.

Send("{RIGHT}") Moverightwardtonewmenuorcollapseasubmenu.

SeeWindows'Help--pressWin+F1--foracompletelistofkeyboardshortcutsifyoudon'tknowtheimportanceofAlt+F4,PrintScreen,Ctrl+C,andsoon.

SendCommand(ifzeroflag) ResultingKeypress

{!} !{#} #{+} +{^} ^{{} {{}} }

{SPACE} SPACE{ENTER} ENTERkeyonthemainkeyboard

Page 625: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

{ALT} ALT{BACKSPACE}or{BS} BACKSPACE{DELETE}or{DEL} DELETE

{UP} Uparrow{DOWN} Downarrow{LEFT} Leftarrow{RIGHT} Rightarrow{HOME} HOME{END} END

{ESCAPE}or{ESC} ESCAPE{INSERT}or{INS} INS

{PGUP} PGUP{PGDN} PGDN

{F1}-{F12} Functionkeys{TAB} TAB

{PRINTSCREEN} PRINTSCR{LWIN} LeftWindowskey{RWIN} RightWindowskey

{NUMLOCK} NUMLOCK{CAPSLOCK} CAPSLOCK

{SCROLLLOCK} SCROLLLOCK{BREAK} forCtrl+Breakprocessing{PAUSE} PAUSE

{NUMPAD0}-{NUMPAD9} Numpaddigits

{NUMPADMULT} NumpadMultiply{NUMPADADD} NumpadAdd{NUMPADSUB} NumpadSubtract

Page 626: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

{NUMPADDIV} NumpadDivide{NUMPADDOT} Numpadperiod

{NUMPADENTER} Enterkeyonthenumpad{APPSKEY} WindowsAppkey{LALT} LeftALTkey{RALT} RightALTkey{LCTRL} LeftCTRLkey{RCTRL} RightCTRLkey{LSHIFT} LeftShiftkey{RSHIFT} RightShiftkey{SLEEP} ComputerSLEEPkey

{ALTDOWN} HoldstheALTkeydownuntil{ALTUP}issent

{SHIFTDOWN} HoldstheSHIFTkeydownuntil{SHIFTUP}issent

{CTRLDOWN} HoldstheCTRLkeydownuntil{CTRLUP}issent

{LWINDOWN} HoldstheleftWindowskeydownuntil{LWINUP}issent

{RWINDOWN} HoldstherightWindowskeydownuntil{RWINUP}issent

{ASCnnnn} SendtheALT+nnnnkeycombination

{BROWSER_BACK} Selectthebrowser"back"button{BROWSER_FORWARD} Selectthebrowser"forward"button{BROWSER_REFRESH} Selectthebrowser"refresh"button{BROWSER_STOP} Selectthebrowser"stop"button

{BROWSER_SEARCH} Selectthebrowser"search"button{BROWSER_FAVORITES} Selectthebrowser"favorites"button

{BROWSER_HOME} Launchthebrowserandgotothehomepage

Page 627: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

{VOLUME_MUTE} Mutethevolume{VOLUME_DOWN} Reducethevolume{VOLUME_UP} Increasethevolume{MEDIA_NEXT} Selectnexttrackinmediaplayer{MEDIA_PREV} Selectprevioustrackinmediaplayer{MEDIA_STOP} Stopmediaplayer

{MEDIA_PLAY_PAUSE} Play/pausemediaplayer{LAUNCH_MAIL} Launchtheemailapplication{LAUNCH_MEDIA} Launchmediaplayer{LAUNCH_APP1} Launchuserapp1{LAUNCH_APP2} Launchuserapp2

Page 628: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

CreditsAutoItXwasadaptedfromthemainAutoItsourcecodebyJonathanBennett.PleaseseethemainAutoIthelpfileforfullcredits.

Page 629: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

HistoryIMPORTANT:Seehereforrecentscript-breakingchanges.

PleaseseethemainAutoIthelpfilewhichdetailsthehistoryofallcomponentsincludingAutoItX.

Page 630: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

ScriptBreakingChangesinRecentVersionsThispagecontainsalistofallchangesmadeinrecentupdatesthatwillalmostcertainlybreakexistingscripts/sources.Pleasereadthislistcarefullywhenupgradingifyouhavenotbeenkeepingupwithdevelopmentsinthebetaversions.Ifanyoftheseissuesaffectyouthenyouwillneedtomodifyyourscripts/sources.

Page 631: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

23rdDecember,2013-v3.3.10.0AutoItX:

Removed:RemovedDevCfilesandVisualStudio6files.Removed:ANSIversionsofSend/WinWaitfunctionsfromthenativeDLL.Removed:DLLImports:AU3_WinGetPosX,AU3_WinGetPosY,AU3_WinGetPosWidth,AU3_WinGetPosHeight.Removed:DLLImports:AU3_ControlGetPosX,AU3_ControlGetPosY,AU3_ControlGetPosWidth,AU3_ControlGetPosHeight.Removed:DLLImports:AU3_MousePosX,AU3_MouseGetPosY.Removed:DLLImports:AU3_WinGetClientSizeWidth,AU3_WinGetClientSizeHeight.Removed:DLLImports:AU3_WinGetCaretPosX,AU3_WinGetCaretPosY.Removed:DLLImports:AU3_CDTray,AU3_BlockInput.Removed:DLLImports:AU3_RunAsSet.Removed:COMMethods:CDTray,BlockInput.Removed:COMMethods:RunAsSet.Removed:Allregistryfunctions.Thesupportwaslimitedandthehostlanguagewillcertainlyhaveregistryfunctions.Removed:AllInifilefunctions.Asperregistryfunctions.Changed:RenamedAutoIt3.htoAutoItX3_DLL.h.

Page 632: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

18thDecember,2009-v3.3.2.0AutoItX:

Removed:"ColorMode"optionremovedfromAutoItSetOption().

Page 633: X' v3.3.14.2 ©1999-2015 Jonathan Bennett & AutoIt Team AutoIt … · AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite

24thDecember,2008-v3.3.0.0AutoItX:

ThenativeversionoftheDLLnowexclusivelyusesUnicodestrings(LPWSTRandLPCWTSR).IfyoureallyneedANSIstringsthencontinuetousev3.2.12.1.Theeasiestworkaroundthoughistousea"wrapper"functiontosimplyconvertbetweenUnicodeandANSI.Alimitedselectionoffunctions(WinWait...andSend)haveanANSIversionbutitisnotintendedtoaddANSIversionsforanyothersunlessthereisalargedemand.