Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window...

1712

Transcript of Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window...

Page 1: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 2: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Version1.1.26.01https://autohotkey.com|AutoHotkey||AHK8

©2003-2014ChrisMallett,© AutoItAHK

: GNUGeneralPublicLicense

Page 3: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

AutoHotkey

:

(,)

,

:

DllCall

-AutoHotkey1.0

Page 4: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

JonathanBennett,1999AutoItv2,.,AutoHotkey

AutoItv2WindowSpyAutoItv3.JonAutoIt.

,AutoHotkey .

~ChrisMallett

Page 5: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey

1.

1. AutoHotkey

2.

3.

4.

2.

1.

2. Win()

3. /

4.

3.

1.

4. ()

5.

1.

6.

1.

2.

3.

7.

1.

Page 6: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

2.

8.

1. []

2. AHK

3.

4.

5.

6.

Page 7: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1-

,. ,.

.

,.

a.AutoHotkey

AutoHotkey(AHK),. ,. .

:

1. AutoHotkey. https://autohotkey.com/

2. . https://autohotkey.com/download/ahk-install.exe

3. Autohotkey,UNICODEANSI. UNICODE,

,UNICODE. ,(Install).

4. ?!.

:

Frankie"InstallandHelloWorld"

http://www.autohotkey.com/forum/viewtopic.php?t=77674

b.

Autohotkey,. AutoHotkey,. .

:

Page 8: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1..

2."".

3."AutoHotkeyScript".

4..:.ahk,MyScript.ahk

5..

6."EditScript".

7.,.!

, . ,,

Send,,.

^j::

Send,MyFirstScript

Return

. ,.

-. ^j:: . ^ CTRLCTRL ,j jj . :: .

-. Send,MyFirstScript . Send ,(,).

-. Return .Return..,Return.

8..

9., CtrlCtrl + JJ .

10.!.,.

:

Frankie"InstallandHelloWorld"

Page 9: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

http://www.autohotkey.com/forum/viewtopic.php?t=77674

c.

,, ,.

d.

:

,AutoHotkey.

1:

1. ,.

2. .

3. AutoHotkey.

4. AutoHotkeyHelpFile..

5. !

2:

1. .

2. ..

3. AutoHotkey. C:\.

4. ProgramFiles AutoHotkey.

5. AutoHotkey.chmAutohotkey.

6. !

Page 11: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

2-&

?,..

?().,.

:

^j::

Send,MyFirstScript

Return

:

::ftw::Freethewhales

CTRL&JCTRL&J "ftw""Freethewhales".

",?" .::. :: ., Return

:,,.

esc::

MsgBoxEscape!!!!

Return

::.:: .

,.,!

Page 12: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

::btw::

MsgBoxYoutyped"btw".

Return

: ,, .

^j::

MsgBoxWow!

MsgBoxthisis

Run,Notepad.exe

winactivate,Untitled-Notepad

WinWaitActive,Untitled-Notepad

send,7lines{!}{enter}

sendinput,insidethectrl{+}jhotkey

Return

a.

"^CTRL?" .!^,:

# Win(Windows)

! Alt

^ Control

+ Shift

& () .

(, )

,:

Page 13: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

() &. , Numpad0Numpad0

Numpad0&Numpad1::

MsgBoxYoupressedNumpad1whileholding

downNumpad0.

Return

Numpad0&Numpad2::

RunNotepad

Return

,!

::,:

:*:ftw::Freethewhales

,:

b./

().#.

#IfWinActive

#IfWinExist

Page 14: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

("")..,,,.,:

#IfWinActiveUntitled-Notepad

#space::

MsgBoxYoupressedWin+SpacebarinNotepad.

Return

#IfWinActive

,#ifwin.:

;Notepad

#IfWinActiveuntitled-Notepad

!q::

MsgBox,YoupressedAltandQinNotepad.

Return

#IfWinActive

;Anywindowthatisn'tUntitled-Notepad

!q::

MsgBox,YoupressedAltandQinanywindow.

Return

#ifwin(), .

#ifwin:#ifwin.

;Notepad

#IfWinActiveahk_classNotepad

#space::

MsgBox,YoupressedWin+SpacebarinNotepad.

Return

Page 15: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

::msg::YoutypedmsginNotepad

#IfWinActive

;MSPaint

#IfWinActiveuntitled-Paint

#space::

MsgBox,YoupressedWin+SpacebarinMSPaint!

Return

::msg::YoutypedmsginMSPaint!

#IfWinActive

, :

#IfWinActive

c./

, :AutoHotkey

#i::

run,http://www.google.com/

Return

^p::

run,notepad.exe

Return

~j::

send,ack

Return

:*:acheiv::achiev

::achievment::achievement

::acquaintence::acquaintance

Page 16: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:*:adquir::acquir

::aquisition::acquisition

:*:agravat::aggravat

:*:allign::align

::ameria::America

.,,.

d.

::btw::Bytheway;

"btw""Bytheway", .

:*:btw::Bytheway;

"btw""Bytheway".

^n::;

Ctrl&n.

run,notepad.exe;

Ctrl&n,.

Return;

,.

^b::;

Ctrl&b

send,{ctrldown}c{ctrlup};

.^c,.

SendInput,[b]{ctrldown}v{ctrlup}[/b];

,.

Return;

,.

Page 17: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

3-

. Send.Send,.

Send, :

,Send. Send.

4:

!:ALT., SendThisistext!a"Thisistext"ALT+a. :!A

!a.!AALT+SHIFT+A!aALT+a.,.

+:SHIFT., Send+abC"AbC", Send!+aALT+SHIFT+a.

^:CONTROL(Ctrl)., Send^!aCTRL+ALT+a, Send

^{Home}CONTROL+HOME. :^A^a.^A

CONTROL+SHIFT+A^aCONTROL+a.,.

#:WIN, Send#eWindows"e".

, send .

:

., CTRLCTRL ENTERENTER (),{}.

:

;...

Page 18: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;

{LCtrl}::

send,AutoHotkey

Return

;

LCtrl::

send,AutoHotkey

Return

AHK.: {enter} {space} .

. .AutoHotkey {!} "","

.

;{}!?,{},AHK

;ALT.

send,Thistexthasbeentyped{!}

;.AHK"enter"...

;...enter{}.

send,Multipleenterlineshaveenterbeen

sent.;

send,Multiple{enter}lineshave{enter}been

sent.;

,send, .. ,.

,Send, ,, Send.

;.

send,{a};

send,{b};

send,{c};

Page 19: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

send,{a}{b}{c};

send,{abc};

send,abc;

,,UPDOWN.

;().

;,.

send,^s;CTRL+s

send,{ctrldown}s{ctrlup};CTRL+s

Send,{ctrldown}c{ctrlup}

Send,{bdown}{bup}

Send,{TABdown}{TABup}

Send,{Updown};.

Sleep,1000;1.

Send,{Upup};.

"?" ..: send,,.

.

send,

(

Line1

Line2

Applesareafruit.

)

:Send..send,."send""sendPlay".

:

Send

SendRaw

SendInput

Page 20: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendPlay

SendEvent

, .

a.

!

,,, GameGuard,Hackshield,PunkBuster.

, . ,

DirectX.DirectXAutoHotkey,

pixelimage,DirectX. (0x000000),.

AutoHotkey. ,AutoHotkey.

:

DirectInput..,():

3 SendPlay:1)SendPlay;2) SendModePlay;

/3) SP(Sendplay).

SetKeyDelay.:

SetKeyDelay,0,50

SetKeyDelay,150,150,Play

ControlSend,Send,.

Page 21: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

4-

,,.ahk , Run., https://autohotkey.com/.,

,:

;.:.

Run,%A_ProgramFiles%\Some_Program\Program.exe

;

Run,https://autohotkey.com

,CLSID(Windows).

Run, Run.

Run:

;,Windows.

Run,Notepad.exe

Run,MsPaint.exe

; AHK ""

Run,%A_MyDocuments%

;

Run,https://autohotkey.com

Run,http://www.google.com

,:

Run.

Page 22: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

5-

AutoHotkey:

:

: commands/index.htm

: Functions.htm#BuiltIn

.,.:

Command,1,2,3

,( ifEqual).

.

Msgbox,HelloRun,Notepad.exe;

Msgbox,Hello,Run,Notepad.exe;

Msgbox,Hello;

Run,Notepad.exe

,"".: ,%, %variable% .. Thisissome

text .,,.

:, % ,.

Page 23: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.:

Function(1,2,3)

,:

1. .

--SubStr(37*12,1,2)

--SubStr(A_Hour-12,2)

2. .

--SubStr(A_Now,7,2)

3. .

--SubStr(A_AHKPath,inStr(A_AHKPath,"AutoHotkey"))

4. .

--SubStr("I'mscripting,awesome!",16)

,. OutputVar,.,:

MyVariable:=Function(Parameters)

MyVariable:=SubStr("I'mscripting,awesome!",

16)

,.( SubStr(...) ):=, MyVariable .

Page 24: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

;

Msgbox,Thisissometext.

StringReplace,Output,Input,AutoHotKey,

AutoHotkey,ALL

SendInput,Thisisawesome{!}{!}{!}

;

SubStr("I'mscripting,awesome!",16)

FileExist(VariableContainingPath)

Output:=SubStr("I'mscripting,awesome!",16)

a.

( { }),AutoHotkey. If Loop.,.

,var5,.

if(var=5)

{

MsgBox,varequals%var%!!

Exitapp

}

,var5,.var5,.

if(var=5)

MsgBox,varequals%var%!!

Exitapp

Page 25: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

If,.,,If.

if(var=5)

MsgBox,varequals%var%!!

MsgBox,Wearenow'outside'theif.Wedidnot

need{}'ssincetherewasonly1linebelowit.

Page 26: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

6-

.,,,,.,.

,.(=).

1. variable=text

,..

2. variable=%variable2%

,.

3. variable:="text"

, = :..

4. variable:=variable2

,%.

5. variable:=6+8/3*2-sqrt(9)

.

12,: var=%var2%sometext%var3%.

3,4,5,: var:="Thevalueof5+"Variable"is:"

5+Variable

( =),. := += -= .= .

a.

Page 27: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

( %)..

:

1. (),.

--.

2. (),.

:

1. ,,: StringLen,OutputVar,InputVar

2. ,,: Var=123abc

3. If,(),: IfVar1<%Var2%

4. ,:

If(Var1!=Var2)

Var1:=Var2+100

b.

., Inputbox

InputBox,OutputVar,Question1,Whatisyour

firstname?

if(OutputVar="Bill")

MsgBox,That'sanawesomename,%OutputVar%.

InputBox,OutputVar2,Question2,Doyoulike

AutoHotkey?

if(OutputVar2="yes")

MsgBox,Thankyouforanswering

Page 28: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%OutputVar2%`,%OutputVar%!Wewillbecome

greatfriends.

else

MsgBox,%OutputVar%`,Thatmakesmesad.

c.

MsgBox,4,,Wouldyouliketocontinue?

IfMsgBox,No

Return;No,.

MsgBoxYoupressedYES.;YES.

;,.

Variable=text;"".

VariableNumber:=6;"".

Variable2=%Variable%;"".

Variable3:=Variable;"".

Variable4.=Variable;"".

Variable5+=VariableNumber;"",

,.

Variable5-=VariableNumber;"",

,.

Variable6:=SubStr(Variable,2,2);..

Variable7=%Variable%Text;"",

.

Variable8:=Variable"Text";"",

.

MsgBox,%Variable%;.

StringSplit,Variable,Variable,x;,.

if(VariableNumber=6);IF,,

.

If(Variable!=VariableNumber);IF,,

.

ifVariableNumber=6;IF,

Page 29: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IF.,"".

IfVar1<%Var2%;IF,

IF.,"".

Page 30: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

7-

,.,.,.

. "","".

,1.

,(),.

,!

, ,.

,:

1. ,()

2. ,()

3. ,()

a.

,:

1. MyObject:=["one","two","three",17]

. "". ,1.

2. Banana:={"Shape":"Elongated","Color":

"Yellow","Taste":"Delicious","Price":3}

. "". ,.

Page 31: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"Price" .

3. MyObject:=Array("one","two","three",17)

"".,.

4. Banana:=Object("Shape","Elongated","Color",

"Yellow","Taste","Delicious","Price",3)

.,.

,(),.

b.

,,,.

:

.

() := .

:

Banana.Consistency:="Mushy"

Banana["Pickled"]:=True;....

:

1. Value:=Banana["Color"]

.. ,

Page 32: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"Yellow"( ) Color .

2. Value:=Banana.Color

...

:

1.

,. :

MyObject.NewKey:="Shiny"

MyObject["NewerKey"]:=3.1415

2.

.

MyObject.InsertAt(Index,Value1,Value2,

Value3...)

Index.,(,1100,50,100101).

MyObject.Push(Value1,Value2,Value3...)

"" MyObject.,.

:

1. .

.""(),

Page 33: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

HasKey , for .(for)

2.

,:

1. RemovedValue:=MyObject.Delete(AnyKey)

MyObject[AnyKey] RemovedValue.

2. NumberOfRemovedKeys:=

MyObject.Delete(FirstKey,LastKey)

,,FirstKey,LastKey.

NumberOfRemovedKeys.,,.(,,14,2,

3,NumberOfRemovedKeys3)

3. MyObject.Pop()

,..

4. RemovedValue:=MyObject.RemoveAt(Index)

NumberOfRemovedKeys:=MyObject.RemoveAt(Index,

Length)

Index Index+Length-1(). Length1.,

,, Index+Length Index

Page 34: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

8-

,,.. ,.!

a.[]

,( [ ]). .,.,, [].

, ControlGetText,():

ControlGetText,OutputVar[,Control,WinTitle,

WinText,ExcludeTitle,ExcludeText]

:

ControlGetText,OutputVar

:

ControlGetText,OutputVar,Control,WinTitle

ExcludeTitleWinTextWinTitle,?!

ControlGetText,OutputVar,Control,,,ExcludeTitle

,,.

"WinTitle,WinText",:

ControlGetText,OutputVar,Control,ExcludeTitle

.

Page 35: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlGetText,OutputVar,Control,,,ExcludeTitle

b.AHK

AHK:

MsgBox,%A_AHKVersion%

.

c.

.,().

,,.,.,,.

, !

.,(). ,.

",,."-Hickson,WilliamE.

d.

!,.(25),,.,.

,.

"? "?,.3,41tab,.

:

Page 36: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

if(car="old")

{

msgbox,thecarisreallyold

if(wheels="flat")

{

msgbox,thiscarisnotsafetodrive.

Return

}

else

{

msgbox,Becareful!Thisoldcarwillbe

dangeroustodrive.

}

}

else

{

msgbox,My`,whatashinynewvehicleyouhave

there.

}

:

if(car="old")

{

msgbox,thecarisreallyold

if(wheels="flat")

{

msgbox,thiscarisnotsafetodrive.

Return

}

else

{

msgbox,Becareful!Thisoldcarwillbe

dangeroustodrive.

}

}

Page 37: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

else

{

msgbox,My`,whatashinynewvehicleyou

havethere.

}

,..

http://en.wikipedia.org/wiki/Indent_style

e.

,.,.

,.

,.

.

...

.

.

.

.

.

,.,.,,.

,..

f.

(FAQ)

Page 38: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(FAQ)

?

?

?

AutoHotkey?

?

Windows xxx?

(UAC)?

,.?

?

Run?

,SendMouseClick?

CPU?

AHK.?

?

USBAHK?

?

Page 39: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,?

?

AutoHotkey?

?

?

?

?

Winamp,?

MsgBox?

,?

GUI?

AHK?

,()?

,

PC?

.?

tab?

?

?

?,.

,?

Windows,Win+U()Win+R()?

?

?

Page 40: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

000.?

Page 41: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

?

(") .,.,,,: Run,Notepad.exe"C:\My

Documents\AddressList.txt" .

?

,:

1): StringLen,OutputVar,InputVar

2): Var=123abc

3) ()if : IfVar1<%Var2%

4) .:

If(Var1<>Var2)

Var1:=Var2+100

?

/ .: MsgBoxThecurrentpercentageis25`%. ( `, ),

MsgBox().

,.: Var:="15%" .

Page 42: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey,?

7-zip: 7-zipEXE,setup.exeInstaller.ahk(Installer.ahk

AutoHotkeyU32.exe).

AutoHotkey(exe)7-zip,.."7-zip"..

: ,:

,CtrlShift.UAC,CtrlShift“"..

.(Exe), setup.exe/S AutoHotkeyU32.exe

Installer.ahk/S .

: .,.

?

, , Return. .

, .:

#space::;Win+

RunNotepad

WinWaitActiveUntitled-Notepad

WinMaximize

return

Page 43: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Windows xxx?

,.,,.AutoHotkey, .

,.

,.

(Send).

,.,,.AutoHotkey, .

SoundGet,SoundSet,SoundGetWaveVolumeandSoundSetWaveVolume

VistaWindows.,.,XP.

:

(UAC)?

(UAC) ,WindowsXP/Vista/7Vista/7/8/10.UACWindows

Vista,,Windows8.

,UAC""(),.,,.

UAC SendPlay BlockInput.

:

'RunwithUIAccess'(UIAccess) .,AutoHotkey.

, RunwithUIAccess(UIAccess) ,

"AutoHotkeyU32_UIA.exe"".ahk" ().

Page 44: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

..

(),Windows8"(RunalladministratorsinAdminApproval

Mode)"().

UAC.,Windows8,Edge.

,.?

AHK..

AutoHotkey.ahk:

Documents( MyDocuments).

AutoHotkey,C:\ProgramFiles\AutoHotkey.,

AutoHotkey.exe.

AutoHotkey,AutoHotkey(AutoHotkey.exe).,

AutoHotkeyU32.exe,AutoHotkeyU32.ahk.,".ahk",

EditScriptAHK.,.

AutoHotkeyAutoHotkey.exe(),.,AHK

(something.ahk),AHKAutoHotkey.

"ScriptFilename" AutoHotkey.exe.

?

, ., MsgBox ToolTip., .

Page 45: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Run?

(,).:

Run,%A_ProgramFiles%\SomeApplication\App.exe,

%A_ProgramFiles%\SomeApplication

%A_WinDir%\System32 6432AutoHotkey, FileSystem

Redirector., %A_WinDir%\SysNative ;6432.

,Send Click?

AHK.

,.,AHK.,GameGuardHackshield.,

AutoHotkey.

SendPlay, SendModePlay SP SendPlay.

SendPlay,abc

SendMode,Play

Send,abc

:SP:btw::bytheway

;or

#HotstringSP

::btw::bytheway

Page 46: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:SendPlayWindowsVista,.

SetKeyDelay.:

SetKeyDelay,0,50

SetKeyDelay,0,50,Play

ControlSend,Send:

ControlSend,,abc,game_title

:

Send{KEYdown}{KEYup}

Sleep:

Send{KEYdown}

Sleep10;

Send{KEYUp}

CPU?

,, SendsCPU,.,:

Process,Priority,,High

AutoHotkey.?

Page 47: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, ,. virustotal Jotti.,.AutoHotkey,

AutoHotkey.

,,UPX(AutoHotkey1.0,AutoHotkey1.1)MPRESS(

AutoHotkey1.1).AutoHotkey,.

Page 48: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

?

AutoHotkey.

USBAHK?

AutoHotkey.exe.,,AutoHotkey.exeLibAhk2Exe.exe

(\AutoHotkey.exe\Compiler\Ahk2Exe.exe).Ahk2Exe:

HKEY_CURRENT_USER\Software\AutoHotkey\Ahk2Exe .

?

,,,.,,.:

RunWait%comspec%/cdir>C:\MyTempFile.txt

FileRead,VarToContainContents,C:\MyTemp

File.txt

FileDelete,C:\MyTempFile.txt

(), Run Shell.Exec().

,?

,:

DetectHiddenWindowsOn;Allowsascript's

hiddenmainwindowtobedetected.

Page 49: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetTitleMatchMode2;Avoidstheneedto

specifythefullpathofthefilebelow.

WinCloseScript'sFileName.ahk-AutoHotkey;

Updatethistoreflectthescript'sname(case

sensitive).

suspend() pause() ,:

PostMessage,0x111,65305,,,Script'sFile

Name.ahk-AutoHotkey;Suspend.

PostMessage,0x111,65306,,,Script'sFile

Name.ahk-AutoHotkey;Pause.

?

, Pause,:

^!p::Pause;PressCtrl+Alt+Ptopause.Press

itagaintoresume.

Loop() ,,.,..

#MaxThreadsPerHotkey3

#z::;Win+Z().

#MaxThreadsPerHotkey1

ifKeepWinZRunning; .

{

KeepWinZRunning:=false;.

return;,.

}

;:

KeepWinZRunning:=true

Page 50: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop

{

;():

ToolTip,PressWin-Zagaintostopthis

fromflashing.

Sleep1000

ToolTip

Sleep1000

;.

ifnotKeepWinZRunning;Win-Z.

break;.

}

KeepWinZRunning:=false;,.

return

AutoHotkey?

Rajat .

?

InternetExplorer,DllCallCOM

www.autohotkey.com/forum/topic19256.html.,

www.autohotkey.com/forum/topic19255.html.

:COM_L,(AutoHotkey)

,: IE.:

Run,www.yahoo.com

MouseMove,0,0;Preventsthestatusbarfrom

showingamouse-hoverlinkinsteadof"Done".

Page 51: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinWait,Yahoo!-

WinActivate

StatusBarWait,Done,30

ifErrorLevel

MsgBoxThewaittimedoutorthewindowwas

closed.

else

MsgBoxThepageisdoneloading.

?

EnvAdd YYYYMMDDHH24MISS.7: EnvAdd,

VarContainingTimestamp,-7,days .

, EnvSub,., A_Now., date/time,

FormatTime.

/?

FormatTime .

?

ControlSend.

Winamp,?

Winamp .

MsgBox?

Page 52: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

,?

Edit.

GUI?

GuiSubmit.:

Gui,Add,Text,,EntersomeTextandpress

Submit:

Gui,Add,Edit,vAssociatedVar

Gui,Add,Button,,Submit

Gui,Show

Return

ButtonSubmit:

Gui,Submit,NoHide

MsgBox,Contentoftheeditcontrol:

%AssociatedVar%

Return

AHK?

tic GDI+standardlibrary.Gui.

,()?

WinWait,WinWaitClose WinWait[Not]Active.

Page 54: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,

PC?

Startup"".,.:

1. ,Control-C.

2. ()"".

3. Programs()Startup().

4. -> ..

.?

(, #LButton:: Win+LeftButton)., ,.

(XButton1)(XButton2),

Control+F1, ^F1:: .

, ,OS..

Tab?

(TabSpace)., #Space Win+Space ^!Tab

Control+Alt+Tab.

?

.

Page 55: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

?

:

~Ctrl::

if(A_ThisHotkey=A_PriorHotkey&&

A_TimeSincePriorHotkey<200)

MsgBoxdouble-press

return

?,.

#IfWinActive.:

#IfWinActive,ahk_classNotepad

^a::MsgBoxYoupressedControl-AwhileNotepad

isactive.

,?

,Numpad0:

Numpad0&Numpad1::MsgBox,YoupressedNumpad1

whileholdingdownNumpad0.

,Numpad0Numpad0,:

$Numpad0::Send,{Numpad0}

Page 56: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

$("")., .

Windows,Win+U()Win+R()?

.

?

polyethene ().

?

.

000.?

. 000. Send,= .

Page 57: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. .

{...}() . ,Else,Loop,WhileIF.

{...}/Object() .

[...]/Array() .

Abs() Number.

AutoTrim Var1=%Var2% Var2tab.

Asc() UTF-16.

ASin() ( Number).

ACos() ( Number).

ATan() ( Number).

BlockInput .

Break () ..

Catch try.

Ceil() Number(.00).

Chr() number().

Click .,.

ClipWait , .

ComObjActive() COM.

Page 58: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjArray() COMSAFEARRAY.

ComObjConnect() COM.

ComObjCreate() COM.

ComObjEnwrap()/ComObjUnwrap() /COM.

ComObjError() COM.

ComObjFlags() COM.

ComObjGet() COM.

ComObjMissing() COM"".

ComObjParameter() COM.

ComObjQuery() COM.

ComObjType() COM.

ComObjValue() COM.

Continue . .

Control .

ControlClick .

ControlFocus .

ControlGet .

ControlGetFocus ,.

ControlGetPos .

ControlGetText .

ControlMove .

ControlSend/ControlSendRaw .

ControlSetText .

Page 59: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CoordMode ,.

Cos() Number.

Critical ,.

DetectHiddenText "".IfWinExistWinActivate.

DetectHiddenWindows "".

DllCall() DLL,WindowsAPI.

Drive /CDDVD,.

DriveGet .

DriveSpaceFree ,MB.

Edit .

Else IFFALSE., ().

EnvAdd ( - ).: Var+=Value .

EnvDiv .: Var/=Value .

EnvGet .

EnvMult .: Var*=Value .

EnvSet .

EnvSub ( - ).: Var-=Value .

EnvUpdate .

Exit ( ).

ExitApp .

Exp() e(2.71828182845905) N.

FileAppend (,).

Page 60: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCopy .

FileCopyDir (xcopy).

FileCreateDir .

FileCreateShortcut (.lnk).

FileDelete .

FileEncodingFileRead,FileReadLine,LoopRead,FileAppend FileOpen.:

FileExist() .

FileInstall .

FileGetAttrib ,.

FileGetShortcut (.lnk),.

FileGetSize .

FileGetTime .

FileGetVersion .

FileMove .

FileMoveDir ..

FileOpen I/O.

FileRead .

FileReadLine .

FileRecycle ,.

FileRecycleEmpty .

FileRemoveDir .

.

Page 61: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSelectFile

FileSelectFolder .

FileSetAttrib ..

FileSetTime ..

Finally Try.

Floor() Number(.00).

For .

Format .

FormatTime YYYYMMDDHH24MISS/.

Func() .

GetKeyName() .

GetKeyVK() .

GetKeySC() .

GetKeyState /..

Gosub , Return.

Goto .

GroupActivate GroupAdd.

GroupAdd ,.

GroupClose GroupActivate GroupDeactivate...

GroupDeactivate GroupActivate,.

Gui ..

Page 62: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControl GUI.

GuiControlGet GUI.

Hotkey ,,.

if TRUE., ().

if() TRUE.

Ifvar[not]between ().

Ifvar[not]in/containsMatchList .

Ifvaris[not]type ,.

IfEqual/IfNotEqual .: ifVar=Value |ifVar<>Value .

IfExist .

IfGreater/IfGreaterOrEqual .: ifVar>Value |ifVar>=Value .

IfInString/InStr() .

IfLess/IfLessOrEqual .: ifVar<Value |ifVar<=Value .

IfMsgBox MsgBox.

IfWinActive/IfWinNotActive

().

IfWinExist/IfWinNotExist

.

ImageSearch .

IniDelete .ini.

Page 63: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniRead .ini.

IniWrite .ini.

Input .

InputBox .

InStr() ,.

IsByRef() ByRef.

IsFunc() .

IsLabel() .

IsObject() .

KeyHistory .

KeyWait /.

ListHotkeys ,, .

ListLines .

ListVars :.

LoadPicture() .

Log() Number(10).

Ln() Number(e).

Loop() : break.

Loop() ,.

Loop() (),.

Loop() ,( FileReadLine).

Loop(registry) ,.

Menu ,,.. .

Page 64: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MenuGetHandle Win32menu.

MenuGetName Win32menu,.

Mod() . Dividend Divisor.

MouseClick ,.: Click.

MouseClickDrag ,,.

MouseGetPos ().

MouseMove .

MsgBox ("""").

NumGet() +.

NumPut() +.

ObjAddRef()/ObjRelease() .

ObjBindMethod() ,.

ObjClone()ObjDelete()ObjGetAddress()ObjGetCapacity()ObjHasKey()ObjInsert()ObjInsertAt()ObjLength()ObjMaxIndex()ObjMinIndex()ObjNewEnum()ObjPop()ObjPush()ObjRemove()ObjRemoveAt()ObjSetCapacity()

..

ObjRawSet() , .

Page 65: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnClipboardChange() or.

OnExit .

OnMessage() .

Ord() String.

OutputDebug ().

Pause .

PixelGetColor x,y.

PixelSearch .

PostMessage .

Process :.

Progress .

Random .

RegExMatch() ().

RegExReplace() ().

RegDelete .

RegRead .

RegWrite .

RegisterCallback() , .

Reload .

Return ,Gosub, Hotkey,GroupActivate.

Round() N0, Number. N,Number N. N, Number N.

Run .

Page 66: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RunAs Run RunWait.

RunWait .

Send/SendRaw/SendInput/SendPlay

.

SendLevel .

SendMessage .

SendMode SendSendInputSendPlay(SendEvent).ClickMouseMove/Click/Drag.

SetBatchLines (CPU).

SetCapslockState Capslock..

SetControlDelay .

SetDefaultMouseSpeed Click MouseMove/Click/Drag.

SetEnv(Var=Value) .

SetFormat .

SetKeyDelay Send ControlSend.

SetMouseDelay .

SetNumlockState Numlock..

SetScrollLockState Scrolllock..

SetRegView 3264,.

SetStoreCapslockMode SendCapsLock.

SetTimer .

SetTitleMatchMode WinWaitWinTitle.

Page 67: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetWinDelay ( WinActivate).

SetWorkingDir .

Shutdown ,.

Sin() Number.

Sleep .

Sort ,().

SoundBeep PC.

SoundGet (,).

SoundGetWaveVolume .

SoundPlay ,.

SoundSet (,).

SoundSetWaveVolume .

SplashImage JPG,GIFBMP.

SplashTextOn .

SplashTextOff .

SplitPath URL,,.

Sqrt() Number.

StatusBarGetText .

StatusBarWait .

StrPut()/StrGet() ,.

StringCaseSense ("").

StringGetPos/InStr()

.

Page 68: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringLeft .

StringLen/StrLen()

.

StringLower .

StringMid/SubStr()

.

StringReplace/StrReplace()

.

StringRight .

StringSplit/StrSplit() .

StringTrimLeft .

StringTrimRight .

StringUpper .

Suspend .

SysGet ,,.

Tan() Number.

Thread . .

Throw . try-catch.

ToolTip .

Transform ,ASCII/Unicode.

TrayTip .

Trim /.

Try () throw.

Page 69: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Until LoopFor.

UrlDownloadToFile .

Var=value .

Var:=expression .

VarSetCapacity() ., DllCall.

While , .

WinActivate ().

WinActivateBottom WinActivate,().

WinActive() ID(HWND).

WinClose .

WinExist() ID(HWND).

WinGetActiveStats WinGetActiveTitle WinGetPos.

WinGetActiveTitle .

WinGetClass .

WinGet ID,ID,..

WinGetPos .

WinGetText .

WinGetTitle .

WinHide .

WinKill .

Page 70: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinMaximize .

WinMenuSelectItem .

WinMinimize .

WinMinimizeAll .

WinMinimizeAllUndo WinMinimizeAll.

WinMove /.

WinRestore ,.

WinSet ,"".

WinSetTitle .

WinShow .

WinWait .

WinWaitActive .

WinWaitClose .

WinWaitNotActive .

#ClipboardTimeout .

#CommentFlag .

#ErrorStdOut .

#EscapeChar (:).

#HotkeyInterval #MaxHotkeysPerInterval,.

#HotkeyModifierTimeout :CTRL,ALT,WINSHIFT.

#Hotstring .

#If #IfWinActive,.

Page 71: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfTimeout #If.

#IfWinActive/#IfWinExist

.().

#Include .

#InputLevel .

#InstallKeybdHook .

#InstallMouseHook .

#KeyHistory KeyHistory.0.

#LTrim .

#MaxHotkeysPerInterval #HotkeyInterval,.

#MaxMem .

#MaxThreads .

#MaxThreadsBuffer #MaxThreadsPerHotkey,.

#MaxThreadsPerHotkey .

#MenuMaskKey WinAltkeyup.

#NoEnv ().

#NoTrayIcon .

#Persistent ( ExitApp).

#SingleInstance .

#UseHook .

#Warn .

#WinActivateForce .

Page 72: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkeyNiftyWindows()--:Enovatic-Solutions :,,,,..

9.:..NiftyWindows,"",,.

ScreenMagnifier()--:Holomind :,:(/);;(

,,).

LiveWindows():--:Holomind :(,),.,

().,(controlshift),Win+W.

MouseGestures()--:deguix :."",().

README.

ContextSensitiveHelpinAnyEditor()--:Rajat :Ctrl+2()

AutoHotkey.,.

EasyWindowDragging()(XP/2k/NT) :..,CapsLock

,.

EasyWindowDragging()--KDE(XP/2k/NT)--:Jonny ::

1)ALT; 2)ALT;

EasyAccesstoFavoriteFolders()--:Savage :,.,.

; 2); 3)().,.

IntelliSense()--:Rajat(XP/2k/NT) :AutoHotkey.,

.,Ctrl+F1().,EscapeEnter.

Page 73: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

UsingaJoystickasaMouse() :.,CPU.,,..

JoystickTestScript() :.;,.,.

On-ScreenKeyboard()(XP/2k/NT)--:Jon :.()..

,.

MinimizeWindowtoTrayMenu() :,..,.

ChangingMsgBox'sButtonNames(MsgBox) :,MsgBox.

,IfMsgBox.

Numpad000Key(000) :000. Send,= .

UsingKeyboardNumpadasaMouse()--:deguix :,()..

,"".

Seek()--:Phi :,.'Seek'/,,..

ToolTipMouseMenu()(XP/2k/NT)--:Rajat :...

(Word).

VolumeOn-Screen-Display(OSD)()--:Rajat :/..

WindowShading()()--:Rajat :,.().,"

".

WinLIRCClient(WinLIRC) : WinLIRC.Winamp,Windows

MediaPlayer,..,WinLIRC"VolUp",VolUp

SoundSet+5 5%.

Page 75: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey(AutoHotkey_L).

, .

Page 76: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.26.01-2017716

A_LoopRegSubKey,,RegDelete().

RAlt/LAlt:: alt-tabs.

SC→VK,CtrlBreak,Pause,LWinRWin,Windows2000XP

CtrlBreak.

VK→SC,CtrlBreakPause.

'WaitRunWaitListLines,,,.

Page 77: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.26.00-2017610

ListVars..

"class""clsid"ComObjType().

,.

FileSetAttrib,FileSetTimeFileDelete..

.

GetKeySC()Esc,Escape,ScrollLockPrintScreen.

,.

Page 78: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.25.02-2017513

GUI.

ASCII.

new ,__New.

Page 79: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.25.01-201735

Send,,Shift SendM?rt .

Page 80: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.25.00-201734

Hotkey,If,%FunctionObject() .

.

Page 81: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.24.05-201723

WinSetAlwaysOnTop/Trans/TransColor0.

Page 82: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.24.04-20161217

File.ReadNum() , File.Read() .

File.Read() .

GuiControl+Password XP.

GuiControl+/-Password .

Page 83: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.24.03-20161119

COM `r .

{U+x} (x>0xFFFF).

get{}..

(,WindowsClassic),Tab3.

(,OnExit).v2-alpha,bug.

(,stopdetach).

property_get-m0 "unlimited",DBGp.

base64 property_set-tinteger/float ,DBGp.

Page 84: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.24.02-20161013

RunwithUIAccess(UIAccess).

Tab3 autosizing.

Tab3bug:

AutoSize w h , GuiShow.

Tab3,,.

,, GuiTab.

,.

GuiControlTab3/.

OnMessagelParam32.

GuiName: .

HWNDGuiGuiControl.

ComObject .

,GuiShow().

LV_InsertCol(n,width) ,ListView.

FileRecycleEmpty.

Page 85: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.24.01-201682

Hotkey,If,Expression ,.

&& ,|| , if(a.subObject&&b) .

Gui/GuiControlTab3radio.

FileCreateShortcutWindows10LinkFile.

Tab3.

.

Page 86: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.24.00-2016522

:

. .

,., PeriodPriority.

SetTimer,Hotkey,GuiControlMenu().,ErrorLevel().

:

A_ThisLabel().

:

Tab3,Tab.

Bug:

GuiControl/.:

|| .

.

+Disabled /+Hidden .

Ctrl+Tab.

GuiTab ,radio(). GuiTab ,.

Page 87: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.07-2016520

Menux,Insert,y,z,%object .

Menux,Add,:itemtext,%object .

Page 88: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.06-2016515

breaklabel .

Page 89: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.05-2016327

InputBox,MsgBox,FileSelectFileFileSelectFolderAltAlt-up

.v1.1.22.01Ctrl/Shift.

Ctrl/Shift,Ctrl,ShiftAltWin.

Page 90: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.04-2016326

LV_Modify, LV_Modify(r,,col1) .

Page 91: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.03-2016312

__Delete,.

, fn(x,,y) .

Page 92: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.02-2016312

RegDelete.

;,.

Page 93: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.01-2016124

.

Ahk2Exe:Unicode(v1.1.23.00).

Page 94: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.23.00-2016116

MenuInsert.

MenuGetHandle().

MenuGetName().

Menu:Radio,Right,BreakBarBreak.

Menu: 1&

LoadPicture().

hicon/hbitmap:.

:A_CoordModeToolTip/Pixel/Mouse/Caret/Menu,A_DefaultGui,

A_DefaultListView,A_DefaultTreeView,A_KeyDelayPlay,

A_KeyDuration/Play,A_MouseDelayPlay,A_SendLevel,A_SendMode

A_StoreCapslockMode.

Hotkey Ix ,x.

Picture.

Picture.

.

.

Page 95: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_ThisMenuItemPos.

.

AutoHotkeyXXX.exeAutoHotkey.chm,AutoHotkeyXXX.chm.

Page 96: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.09-20151111

SetTimerDelete.

KeyHistorytimertimer.

,KeyHistory.

.

Page 97: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.08-20151111

For_NewEnum/Next.

Finally.

Finally(v1.1.20BUG).

Page 98: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.07-2015927

DPI150+%Gui -DPIScale ,Gui w-1 h-1 .

~keyup Send{keydown} ..

Page 99: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.06-2015913

Unicode.

Edit.

ComObj.

ComObjArray().

GuiControl""Tabs(, ).

XP64.

Page 100: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.05-2015910

ID.

Gui,+g.

GuiShowGuiGUI.

Caps/Num/ScrollLock.

Gui().

GuiShowGuiSize.

:

VC++.

VC++2015.

64-bitVC++2015.32-bitVC++2010.

Page 101: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.04-2015819

ObjRawSet().

Windows10supportedOSmanifest().

")".

Page 102: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.03-2015612

A_EndCharUnicode.

:

A_LanguageGetSystemDefaultUILanguage().

WindowSpy.

Gui/Menu/Hotkey/Hotstring/OnClipboard().

Page 103: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.02-2015527

TreeView * .

.

RWin-up LWin-up.

Page 104: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.01-2015524

Text/Edit/Button.

: .

.

else/try/catch/finally hotkey::trycmd .

CtrlShift.

Page 105: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.22.00-201551

SetErrorMode(SEM_FAILCRITICALERRORS),"".Drive

DriveGet.

MonthCaltab-stopVista.

ComObjConnectIProvideClassInfo,.

,.

Text/Link+Border(WS_BORDER).

BreakN loopIf/Else/Try/Catch.

Page 106: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.21.03-2015412

.

Page 107: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.21.02-201544

OnMessage(msg,fnobj,0) fnobj.

Page 108: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.21.01-201543

StrReplace()ReplaceText.

ASCII.

Page 109: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.21.00-2015328

Loop,Reg,RootKey[\Key,Mode].

Loop,Files,FilePattern[,Mode].

InputVar %().

:

Object.InsertAt(),Object.Push()ObjRawSet().

Object.Delete(),Object.RemoveAt()Object.Pop().

Object.Length().

Ord()Chr()(>0xFFFF).

StrReplace().

RegRead5,AutoItv2().

RegRead,RegWriteandRegDelete.

Page 110: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.20.03-2015321

MouseGetPos(OutputVarControl),GuiContextMenu,GuiDropFiles

(A_GuiControl)[v1.1.20.00].

Page 111: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.20.02-2015311

OnMessageadd-first.

A_OSVersionx64.

ExitApp__delete.

.

Page 112: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.20.01-2015310

ErrorLevel,v1.1.20.00.

ErrorLevel,,,v1.1.19.

ErrorLevel,,v1.1.19.

,ErrorLevel127,,v1.1.19.

ErrorLevel.

.

Page 113: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.20.00-201538

:

Hotkey,Menu,SetTimer,GuieventsGuicontrolevents ,.

Hotkey,Menu,SetTimerandGuicontrolevents Func.settimer.

OnMessage().

OnExit()OnClipboardChange().

.

U/L/TFormat().

Input E,.

FileAppend**(stderr).

ObjBindMethod(obj,method,args*)Func.Bind(args*).

:

:

,.

(),.

WinActivate.

Page 114: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinActivateDetectHiddenWindows,.

A_CaretX/A_CaretY.

,.

.

console.

A_OSVersion RtlGetVersion()win10.

A_OSVersion"major.minor.build".

x[,y] ,x.y[,z] x[](y) .

this.__Call,, x.__Call(,y) .

COMDISPID_VALUE., x[] x fn[]() JScript

.

bug,,:

#if.

{}.

:

VKA-Z.

GetKeyName,Hotkey,A_PriorKey,KeyHistoryInputEndKey

ErrorLevel(Shift).

ASCIIAutohotkey.

Page 115: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileAppend*(stdout)ANSI.

GUI.

Exception(m,n) n.

GuiContextMenux64A_GuiEvent.

,FileGetSize.

ErrorLevel[v1.1.20.01].

ControlClick.

Gui+MaxSize+MinSize.

GuiControl/GetGUIHWNDGUI.

Exception().

Page 116: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.19.03-2015211

scXXX::Y scXXX VK., Y .

breakn until ,.

ControlGetFocus(thanksHotKeyIt).

ListViewg,LVN_GETEMPTYMARKUP.

#Include*i<X> X.

forvarinexpression expression.

Page 117: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.19.02-2015125

Win9x/Win2k16.

.

DLL/EXE.

,.125%150%DPI.20/4024/48,16/32.,.

.

,,foo::,.

^!ä::,("^!ä""^!ä:")./ILIB,.

.

,,/ErrorStdOut.

/iLib.

return/break/continue/try.. finally.

Page 118: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.19.01-201515

Hotkey(v1.1.19.00).

HotkeyA_TimeIdle(Win9x).

Page 119: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.19.00-201514

Func.Call() . Func.() .

X.Y X.Y(Z) VBScript/JScript/C#:

X.__Call name,.

X.Y(Z) ,Z. X.Y[Z] X.Y.

~ .

$$

%Fn%() JavaScript.

EXEmanifestUAC(v1.1.17).

.

,,,hotkey.

.

Page 120: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.18.00-20141230

AutohotkeyIDispatch:

X.Y VBScriptC#X.Y;X.Y().

X(Y) VBScript,JScriptC#X[Y]X,.

X[Y] C#X[Y]X;X.[Y]().

X.Y() C#X.Y,C#.

IDispatch.

JavaScript/IEDOM.

FileAppend,%VarContainingClipboardAll%,File .

Page 121: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.17.01-20141228

COM.

Page 122: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.17.00-20141227

:

Format().

FileOpen()stdinstoutsterr "*""**" . AutoHotkey.exe*

. ExecScript().

AutohotkeyCOMAPIIDispatch.

ComObjectVT_BYREF. obj[] .

:

XPSP2.

ComObjArray,.,,,.

URL.

sc15D vk5D /AppsKey(Send,GetKeyName).

EditAltGr+ACtrl+A.

,.

Page 123: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.16.05-2014928

x.y/[]/{}

Page 124: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.16.04-2014916

.

RegExMatch.

Page 125: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.16.03-2014911

Abs()Mod()

Page 126: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.16.02-2014911

#include(a6ea27f).

CF_HDROP.

FileGetSize.

forCOM.

Page 127: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.16.01-2014910

.

Guix+my+m.

ListHotkeys()#InputLevel.

O()RegExMatch().,.

,__Call(__Set__Get).

VarSetCapacity.

FileRead,4GB,,.

FileRead*c,,.

ClipboardAll,:

#ClipboardTimeoutGetClipboardData(),.(Windows8,

zip),.

1,.

ScintillaMSDEVColumnSelect/MSDEVLineSelec,VS

.

ClipboardAll,Unicode(ClipboardAllv1.1.08).

UnicodeClipboardAllFileRead*c,.,StrLen1,

.

Page 128: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TreeViewA_EventInfo.

ListView/TreeView.

A_LineFile/A_LineNumber#If().

#If,ListLines(If).

Abs(["-"]*) .

}funcdef(){}} //.

Page 129: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.15.04-2014,812

: & .

:,.

, continue ,Loop.

, File.Encoding:=x"-RAW" ASCII/. -RAW .

Page 130: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.15.03-201482

ExitThrow.

FileInstallDestA_WorkingDir.

Page 131: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.15.02-201477

.

Page 132: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.15.01-2014630

.

Until .

Page 133: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.15.00-201454

A_OSVersion WIN_8.1 .

Hotkey (~).

exemanifest GetVersion/GetVersionExWindows8.1.

Page 134: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.14.04-2014425

Function0DllCall().

IsFunc("ComObj(") .

ControlClickXButton1/XButton2.

Page 135: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.14.03-2014214

<c10>X.__Init newX .

.

Page 136: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.14.02-2014130

x:: xup:: ,x.v1.1.14x( x&y:: ),x.

Page 137: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.14.01-2014115

Catch/FinallyTry.

Page 138: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.14.00-2014115

Finallytry/catch.[fincs]

~,.

x&y:: ,x x:: xup:: .

ImageSearch,GDIErrorLevel=2(0).

EnvGet,32767.

StatusBarWaitErrorLevel.

ANSIFileRead*c.

.

,.

PixelSearch,OutputVarX/Y.

Page 139: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.13.01-20131011

.

Page 140: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.13.00-2013827

v2 StrSplit().

Page 141: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.12.00-2013814

, InStr(a,b,,2) .,(COM). [a,,b] .

, x[y*]:=z y/.

Page 142: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.11.02-2013628

GuiControl/GetComboBoxEditClassNN.ComboBox

EditHWND,ComboBox.

Page 143: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.11.01-2013625

InputBox/(v1.1.11.00-commit 7373cc6443).

DllCallargSYM_OBJECT,#WarnUseUnset().

VarSetCapacity(var).

Page 144: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.11.00-2013621

%A_LineFile% #Include.

AutoHotkeySC.bin().

XY YX.

fincs:AutoHotkeyDPI.DPI96,Gui. Gui-

DPIScale.

Page 145: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.10.01-2013517

RegReadREG_BINARY64K.

RegWriteREG_BINARY/REG_MULTI_SZ64K.

()WindowsXP.

Page 146: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.10.00-2013511

Gui .

SoundSet,SoundGetWindowsVista.

Run"<file>"<args> args.

(CONIN$).

Page 147: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.09.04-2013314

Gui(),Gui.

Page 148: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.09.03-201329

twobugs.

GuiControlGuiControlGetHWNDGui,.,.

OnMessageGuiA_GuiA_GuiControl.

Page 149: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.09.02-20121224

MsgBox,.

.

Page 150: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.09.01-20121215

AND/OR, ((x,y)andz) .

RegExReplace.

Object.Remove().

base.Invoke().

Page 151: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.09.00-2012117

:

.aut #AllowSameLineComments.

AutoItv2.

:

:= = ,.

ASCII( {key:x} obj.key ).

"AutoHotkey_L""AutoHotkey".

Bug:

,.

PixelSearch"".

ahk_exeahk_.

elsecontinue2 .

,RegRead.

File.Length .

Gui.

Page 152: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

.

elsefoo() {bar() .

,,.

Page 153: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.08.01-201283

:max_depth.

Page 154: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.08.00-2012614

:

ANSI,.UTF-8(BOM).BOMUTF-8.

returnx ; return(x) .

Gui,Name:New GUI.

:

ClipboardAllCF_UNICODETEXT.

GuiShow.

Windows8A_OSVersionWIN_8.

AutoHotkey.exe"ANSI/Unicode32/64-bit".

newMyObject() ,.

PCRE8.30.

warnings,.

:

Func,ComObjectRegExMatchObject.

,"". 83f0a0e.

Page 155: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

RegExMatchObject.Mark PCRE (*MARK:NAME) .

classvar.x:=y ( classvar).

A_Is64bitOS.

SetRegView A_RegView.

:

Func.() .

Object.Remove() .

key-down/key-up,.

#Include<Lib> ,#include.

objaddref() ObjRelease() 'a'.

A_AhkPath3264AutoHotkey,.

-Background TreeView,.

While/Until,.

Page 156: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.07.03-2012325

Ctrl/Alt/Shiftkey-down(-)key-up(-).

--,.-"reg",--.

., gosub%"foo" "foo": ., %"" ,.

Page 157: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.07.02-2012322

GetClipboardData(),.

ComObjArray(),.

Object.Remove(i,"") !Object.HasKey(i) .

Page 158: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.07.01-201232

UnicodeUTF-16,FileRead#MaxMem.

, %A_ThisLabel%() .

Page 159: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.07.00-2012227

%var%() __Call .

ControlGetList,32,64.

SendEvent0;v1.1.05.04.

Object.Remove(i)Object[i].

ComObjType() ,.

ExitApp, OnExit,ExitApp .

., Exit classmethod,.

base.Method() UseUnset., , base.__Init .

Page 160: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.06.02-2012213

SectionKeyIniRead.

4GBFileGetSize.

Page 161: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.06.01-2012212

MsgBox,.

Page 162: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.06.00-2012212

:

#InputLevel SendLevel byRussellDavis.

Link byChrisS85.

:

, `t ` .

MsgBox.

% .

,""() ()/[]/{}.

,.

,,.().

Timeout%(;, %Timeout%.500 ). ,

,.

A_IsUnicode/A_IsCompiledANSI/,. #Warn.:

A_IsCompiledA_IsUnicode.,./Unicode.

A_IsCompiledA_IsUnicode.

A_IsCompiledA_IsUnicode/Unicode,ListVars.

, Send, #MenuMaskKey.

:

Page 163: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

N=0, GuiControlChooseListBox/ComboBox/DDL's.

RegisterCallback Funcobject.

ListLines().

ShellExecuteEx, RunID.

:

RegRead.

x.y, x.y++ .

SendInputWin+LWin"".

- #Include<Lib>Ahk2Exe-.

Page 164: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.06-20111231

,inc(++)dec(--).

,inc(++)dec(--).

Page 165: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.05-20111217

"{..}" continuen .

RegExMatchObject[Name] .

Page 166: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.04-2011125

:ControlGetSelected64.

:,CPU().

Page 167: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.03-20111130

Loop...Until .

Page 168: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.02-20111120

,.

SendInput{U+xxxx},(v1.1.00.01).

ComObjConnect-dispatch,.

new%VarContainingClassName%() .

Page 169: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.01-20111016

,#Include.

Page 170: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.05.00-2011108

Client.

objectRegExMatchRegEx.

super-global() ,.

: Classc .

.

Gui+Owner GUI.

-.

#Include(;ErrorStdOut).

ThrowException.

,.

PCREUnicodeUTF-16,.

PCRE8.13.

,.

#MaxMem.

Try/CatchCOM.

Page 171: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControlGet2.

,.

RegEx.

ErrorLevel-3,DllCall-4.

While,ListLines.

Try/CatchIf/Loop/For/While.

UntilFor-loop,.

Page 172: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.04.01-2011915

FileRemoveDirErrorLevel.

Page 173: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.04.00-2011911

.

: try/catch/throw Exception().

#Warn.

Gui+HwndVARNAME.

Gui,New[,Options,Title].

,Ctrl+O Guimenus.

/iLib, #Include<Lib> Ahk2Exe .

Progress,GuiControl.

GuiControlGuiControlGet ControlIDHWND.

FileRead1GB.

:

Hotkey,If, , #If,.

Hotkey,IfSomething , Something,.

("{...}").

,.

,GroupAdd,.

OutputDebugStdOut,"unsetvar".

Page 174: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,GuiShow,GuiNew GuiControl,( try).,(

).

RegRead,RegWriteRegDeleteA_LastErrorGetLastError()

.

+LastFoundExist,( +LastFound).

bug.

Page 175: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.03.00-2011828

GUI.

HWNDGUI.

+Parent%ParentGui% Gui.

+Owner%HWND% Gui.

GuiControlGetName.

GuiActiveX.

:hotkey"vk00".

:COMeventsComObjConnect.

: GuiControlGetOutputVar,Subcmd,%OutputVar%.

"Missing)/]/}""Unexpected)/]/}".

ListLinesWhileUntil.

~==/!=/</>/<=/>=("."),.

Page 176: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.02.03-2011821

():Object.Base.

Page 177: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.02.02-2011820

:x64,2GB.

: #ifWinExist(T) .

Page 178: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.02.01-2011813

A_PriorKeykey-up.

,:

3264/.

(UAC).

Page 179: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.02.00-201186

TV_SetImageList().

Shift(1632),.

.

Page 180: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.01.00-2011630

.

var ; static .

:A_ScriptHwndA_PriorKey.

:GetKeyName(),GetKeyVK(),GetKeySC()IsByRef().

:WinGet,OutputVar,ProcessPath.

ahk_exe%Name%.exe ahk_exe%FullPath% .

WinGetProcessName.

,SetTimerA_ThisLabel.

ComObjConnect().

ComObjConnect()/.

,,"(" (x.y)[z]() .

32;64.

AltGr(Unicode).

,SendInputAltGr-upLCtrl-up.

Page 181: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.00.01-2011617

:,.

:/,sc1xxvs^sc0xx.

:$#UseHook,.

:__Delete.

:"".

: base.Method() .

: Gui+(Ex)Style / Gui.

type="undefined".

"hankaku",.

.

"Static".

Page 182: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.00.00-201151

:

.

new .

Func() IsFunc .

++ -- , x.y[z]++ .

:

__Delete__Call.

OnClipboardChange(,WindowsVista)

AddClipboardFormatListener.

( ,,, 12(34) .

:

SetTimerLabel,-0 ",".

A_MyDocumentsSHGetFolderPath,.

ExcludeText.

Page 183: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.97.02-2011414

{} ,.

,For-loopA_Index,.

EXE(),.

Goto.

Page 184: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.97.01-201142

64HWNDSendMessage/PostMessage32.

*/:: (L54).

.

Page 185: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.97.00-2011328

{key:value} Object("key",value) .

[x,y,z] Array(x,y,z) , Object(1,x,2,y,

3,z) .

:,True,False,A_PtrSizeA_IsUnicode.

, x&^y ^ .

Page 186: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.96.00-2011321

:

ComObjQuery:COM.

ComObjFlags:COM.

ComObjCreatedispatch,interfaceidentifier(IID,).

COMfor-loopsClone().

ListVarsCOM,.

:

,.COM,COM.

ComObjParameterVT_UNKNOWNVT_DISPATCH.

(.NET),COM.

FileRecycle.

ComObjArraySafeArraySafeArray,.""

ComObjFlags

:

VT_DISPATCHVT_UNKNOWNCOM,.

Page 187: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,BreakContinue.

(`r).

MouseMoveInputEvent,.

EditThisScriptEdit(v1.0.95).

,.

Page 188: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.95.00-2011312

I/O.

#Warn;ac.

, name_var, name_var.() ., .

Run,, Run*RunAs%A_ScriptFullPath%/Param .

( &x ) ( x&y ),.,.,., "x"&y

"x"++y .

:

,,, ^!+ .

File.Pos;-1.

File.AtEOF.

,COMA_LastError.

Windows2000/XP/Server2003,Gui.

>,SplashImage.

,ComObjConnect.

,SplashImageGDI+.

"~" ~x:: x&y:: , ~x&z:: ,.

#If,A_PriorHotkeyA_TimeSincePriorHotkey.

ASCII,RegExReplace.

Page 189: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.92.02-2011119

,,, file.ReadLine() SubStr(x,y,z) .

v1.0.92.01, k::MsgBox(),x:=y if() .

Page 190: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.92.01-2011118

:FileCreateDirA_LastError.

:, GuiControl() .

Page 191: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.92.00-2011113

,, x.y+=z .

Unicode,IniWrite..

. { /} /Else ,.

Page 192: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.91.05-201111

:COM.

(ANSI):DllCall,wstr.

:,.

Page 193: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.91.04-20101229

(Unicode):RegExReplace(1.0.90.00).

Page 194: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.91.03-20101227

:RegEx-v1.0.90.00.

Page 195: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.91.02-20101226

COM:NULLIDispatch/IUnknown.

COM:VT_DISPATCH,QueryInterfaceforIDispatch.

: obj.field:=var SYM_STRING,SYM_OPERAND.

Page 196: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.91.01-20101224

:, File.Write(Str) .

:BOMUTFBOM.

(ANSI):loop File.ReadLine() Chr(255) EOF.

(Unicode):UTF-8UTF-16RegExReplace.

:.

:RegExMatch/Replace.

Page 197: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.91.00-20101221

COM.

: ComObjError.

: ComObjType(co) ComObjValue(co).

: ComObjMissing().

: ComObjArray()SAFEARRAY.

: ComObjParameter()"Takeownership".

:,ComObjParameterCOM.

:'x', ComObj.x() PROPERTYGET.for-loops.

:,.

:,VT_UNKNOWN/VT_ARRAY.

Page 198: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.90.00-20101127

:Windows<7UnicodeUrlDownloadToFile.

:ANSI,ANSIAlt+0.

:EOF,File.Pos.

:#If.

:ClipboardAll.

:TransformHTML&#NNN;.

:ByRef,VarSetCapacity#MaxMem.

: FileAppend,,file.txt ErrorLevel=1.

:P)RegEx,.

SeanCOM.

RegExReplaceRegExMatchUnicode.

Page 199: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision61-2010103

: ObjClone(Object) , Object.Clone() .

:UnicodeUnicode.PCRE8.10.

: Object.Remove(int,"") Object[int] .

: ComObj.xyz() .

:, Var:=123 . Var:=123 Var:=(123) ,

,.,COM.

:.

:.

:.

:64,PCRE.

:Input'M',Ctrl-M( `r )Ctrl-J( `n ).

: Object[n] , Object.Remove(n) 0("").

Page 200: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision60-2010924

: File.Encoding..

: indirectmode.

: Object.Clone()

:ByRef.

: Obj.foo:="" foo().

:OnMessageByRef.

:RegisterCallback32(64).

:RegisterCallbackParamCount="".

:For-loop"0".

:ANSI,ComEvent(ComObjConnect).

:ComEvent(ComObjConnect),/.

:,A_EndChar.

:Func->mNextFuncNULL().

:().

:bug.

Page 201: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision59-2010912

:,#If , .

:SplashImage;PNG,.

: Forx,yinz .

: Loop...Until ,For.

:; continueouter_loop ,break2 ,.

:UTF-8.

:,, .

: .

:"detach"DBGp.

Page 202: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision58-201095

: staticvar:=expression .

Page 203: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision57-201094

64,DllCallStr*,WStr*AStr*.

InStr,StringGetPos:

StartingPos,.

.

#include<LibName> .

IniRead IniWrite,.

IniRead,.

Run/RunWait : Run*verbfile .

Run/RunWait .

NumGet/NumPut Offset, Type.

.

Page 204: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision56-2010829

64.Ahk2Exe_Lx64AutoHotkeySC.bin.

:Deref( *addr )32.

:64, #If .

:U+00FF.

:SendInput/Play.

: */ (L54).

Page 205: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision55-2010819

:Label,GroupActivateErrorLevel=1.

:x64,Tab.

:,StrPut;L53.

:x64,.

:File*A_LastError.

FileAppend,FileRead,FileReadLine,FileDelete,FileCopy,FileMove,

FileGetAttrib/Time/Size/VersionFileSetAttrib/Time.

FileCopyDir,FileRecycle,FileMoveDir,FileRemoveDir,FileRecycleEmpty,

FileCreateDirFileInstallAPIWin32.

Page 206: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision54-2010815

:UnicodeRunAs.[jackieku]

:64RegisterCallback.[fincs]

:Win2kWinXPSP2.Win2kSP4( KB816542).XP

.

:MsgBox.L45/.

:ANSI;.

:ComObjectproperty/method.

FileOpen/File.

FileOpen Flags.

FileOpen"update""read/write",.

FileOpenA_LastError.

File:=FileOpen(handle,"h") .

File.Seek(n) nSEEK_END.

File.Pos ( File.Position )TellSeek.

File.Pos ,File.Length ,File.AtEOF File.__Handle

() .

File.Length , File.Length:=n .

File.ReadNum() File.WriteNum(n) ,NumNumGet

.

Page 207: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

File.WriteLine(s) File.Write(s"`n") ,

File.ReadLine() .

File.Read() .

"" "".

:GroupAdd. []

:GroupActivate/ErrorLevel.(.)

: /* , */ . []

TransformToCodePageFromCodePage.

Page 208: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision53-201088

AutoHotkey64 -COM64.

x64(AutoHotkey64 ):

DllCall.

RegExcallouts.

DllCallGetProcAddress.

64NumPutNumGet"Int64".

COM(AutoHotkey64 ):

ComObjParameter3264.

ComObjActive.

,ComObjectAddRef.

InvokepdispVal==NULL.

,.

ComObjType,"IID".

ComEvent.

ComEventpVarResult;.

ComEventComObject.

ComError;.

. Enum[] Enum.Next() .AutoHotkey_COM/AutoHotkey64

Enum[]:=val .

Page 209: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"Ptr"(AutoHotkey64),.

:

: Object.HasKey(key) .

: Object(obj) .

: ObjAddRef() ObjRelease() .

:A_ThisHotkey#If,.

:UnicodeRunAs(jackieku).

:ANSIcodepageCP0(ANSI).

: x.y[] (x.y)[] x["y"] .

:(, obj.MaxIndex() obj._MaxIndex() ).

Page 210: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision52(again)-2010610

.(:)

C=A_ScriptFullPath

if(%C%="G:\Users\xxx\Desktop\test.ahk");

msgbox%%C%

C=qq

qq=

if(%C%="");

msgbox%%C%

,(,932,936,949,9501361).

:WC_NO_BEST_FIT_CHARS,UTF-7,StrPut.

:- literal%var%.literal .

: StrPut("",Encoding) .

Page 211: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision52-2010612

:ObjRemove,, Object._Remove.

:,,.

:.

:,RegExMatch. bug.

Page 212: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision51-2010411

:<>.ahkAutoHotkey.iniAutoHotkey.ahk.

:UTF-8;/CPnnn.

:,__Delete.

Page 213: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision50-2010327

Object._Insert.

Object._Insert(x) - _MaxIndex()=""?1:

_MaxIndex()+1 x.

Object._Insert(i,x,y,z) - i,i+1,i+2 x,y,z .

Object._Remove.

Object._Remove(k) -k.

Object._Remove() -_MaxIndex().

FileOpen[byjackieku].

:RegExMatch'P'1,.

: Object._SetCapacity(key,n) .

:StatusBarGetTextUnicode.

Page 214: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision49-2010314

obj._NewEnum().

ObjMethod(obj). obj._Method() ObjMethod(obj).

:ObjSet/Get/Call/.

:L48VK_PACKET.

:VK_PACKET.

:ExcludeText.

Page 215: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision48-2010221

: obj.() .

ControlSendWM_CHAR.,"…"(en-US),"∞"Unicode

{U+221e} .

VK_PACKET(VK=E7),KeyHistory16. SendUnicode.

Page 216: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision47-2010213

(Unicode):ControlGet,.

Page 217: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision46-2010211

A_FileEncoding,.

StrPut StrGet.

Page 218: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision45-201028

_GetAddress;_SetCapacity/_GetCapacity. []

WM_PAINT.

obj.() ; obj[""]() .

:MSBuild4.0&VS2010. []

(Unicode):'Running'ListHotkeys.

Page 219: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision44-201027

:"nothing"., x[]:=z .

(Unicode):(Documents\AutoHotkey.ahk).

(Unicode):A_Desktop,A_ProgramFiles.

(ANSI):InStrStringReplace0x80-0xFF .

(ANSI):ToCodePage/FromCodePage/.

Page 220: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision43-2010129

:obj.Func(),.

Page 221: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision42-2010128

AutoHotkeyU.

bug-,.

Page 222: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision41-20091220

:,. floatformat,.

Page 223: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision40-20091213

.(*before*);,x.base

.

():,.

(): "Exit",(*below*),.

Page 224: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision39-2009122

():Base64property_set.

Page 225: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision38-20091117

: #MenuMaskKeyWinAltkeyup.

: x[1,2]:=3 x[1] , x.base . .

Page 226: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision37-2009117

: obj[method_name](params) .

Page 227: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision36-2009114

: x.y ( [ ),., a.b.c[d] ObjGet(a.b,"c",d)

x.y[z]:=v ObjSet(x,"y",z,v) .,.

:,, x.y() ,"()""[]"., x.y(z):=v

ObjSet(x,"y",z,v) .

:If(expr)While(expr).

Page 228: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision35-20091025

:".",, x.y.z() (L34).'(''['':='.

Page 229: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision34-20091024

:,-._Remove-.

:,.: <>:+-*/!~&|^[] ., MsgBox<foo If!foo

.

:,Return., Returnx:=y ,Return(x) ,Returnx,...

( Returnx ).

:get/set(,for x x[y] x[y,z] ).

:, x[y]:=z r:=x[y]:=z -L33.

: x y ,x._Remove(y) .

: x.=y ,ifx.y=... ..

:., x?F(1):F(2) .

:,__Delete.

Page 230: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision33-2009103

:,.

: Object().

:,.

:,.

:,.

:(Return),,.

:__Deletederef.

:&objectObject(address).

Page 231: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision32-2009926

:,Send/PostMessage.

Page 232: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision31-2009926

:/.

:While(expression).

:Trim,LTrim,RTrim.

:A~=B;RegExMatch(A,B)..

:LowLevel.

:[,]?.,?().

:.,.

:.

:DllCall,,i.

v1.0.48.03v1.0.48.04.

Page 233: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision30-2009531

v1.0.48.02v1.0.48.03.

Page 234: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision29-200952

.WindowsVista,"".:

Menu,Icon,MenuItemName,Filename.png,,0

Page 235: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision28-200952

.,OnMessage,RegisterCallback.

Page 236: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision27-2009426

v1.0.48.00v1.0.48.02.

Page 237: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision26-2009411

:owner-drawing,.

:.

():AutoHotkey.slnAutoHotkey_L.slnVS.

Page 238: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision25-2009330

:Send{U+xxxx}.

:Send{U+..xx}hotkeySCxx.

Page 239: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision24-2009330

:Send{U+xxxx}.SendInput()Unicode,Alt+Numpad.

Page 240: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision23-2009330

:GuiControl,Enable/Disable.

Page 241: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision22-2009326

Ifvar[not]in/containsMatchList,.

Page 242: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision21-2009316

While.[Chris]

():1920.

():XML.

():,transaction_id.

Page 243: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision20-2009227

:,.

Page 244: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision19-2009226

:Gui,Font,qN/,N05.

:IL_Add.

AutoHotkeyv1.0.48,Chrisbug,.AutoHotkey_L;

:

While-"While%x%""Whilex".

One-True-BraceWhile.

.

,,,,.

Page 245: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision18-2009221

:,.

Page 246: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision17-2009220

:IconNoIcon.

:ID.

:MNS_CHECKORBMP.

:,.

:.

Page 247: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision16-200924

:.

Page 248: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision15-200921

:SetFormat**.SetFormat.

Page 249: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision14-200921

Chris(pre-v1.0.48beta).

:'C'.

:A_AhkVersion.,1.0.47.07.L14.

:HWND/windowID64.,0xb482057e0xffffffffb482057e.

Page 250: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision13-20081129

:DllCallINT.

:GuiEscape.

:,()"AutoHotkey_L""AutoHotkey".

Page 251: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision12-200896

:property_get.--DBGP

Page 252: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision11-200895

:AutoHotkeySC.bin(AutoHotkey).

:.LA_AhkVersion.

:DBGp().

Page 253: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision10-200882

:WheelLeft/WheelRight,revision9.

Page 254: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision9-2008629

:WhileBreak/Continue.

:,TrayTipVista.

Page 255: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision8-2008627

:#IfTimeout#If,.1000.

:.""/.

:One-true-braceWhile.

:WhileA_Index.

Page 256: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision7-2008626

:IsFunc(FuncName)-,FuncName.

Page 257: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision5-2008619

.

.

Page 258: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Revision4-2008618

:#if()-#IfWinActive,.

:WheelLeft,WheelRight-WindowsVistaWM_MOUSEHWHEEL.

(Vista.)

:While,-.

:A_IsPaused-.

:A_IsCritical-"Critical".

:.

:WinGetClass.

:.

Page 259: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(,)

()

Alt-Tab

Page 260: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,( ).,Win+N.[#]Windows, :

#n::

RunNotepad

return

, return .,,., return :

#n::RunNotepad

,(). ^!s Control+Alt+S:

^!s::

SendSincerely,{enter}JohnSmith;().

return

:

#Win(Windows).v1.0.48.01+,WindowsVista,Windows(#a)Windows"L".PC. SendPlay() .

! Alt

^ Control

+ Shift

& ,. .

Page 261: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

< .<!a!a,Alt.

> .

<^>!

AltGr(alternategraving).AltGrAlt,AltGr.:

<^>!m::MsgBoxYoupressedAltGr+m.

<^<!m::MsgBoxYoupressed

LeftControl+LeftAlt+m.

,AltGr,():

LControl&RAlt::MsgBoxYoupressed

AltGritself.

*

:. .:

*#c::RunCalc.exe;

Win+C,Shift+Win+C,Ctrl+Win+C.

*ScrollLock::RunNotepad;

ScrollLock.

,., *a:: ^a:: .

,().,:

~RButton::MsgBoxYouclickedtheright

mousebutton.

~RButton&C::MsgBoxYoupressedCwhile

holdingdowntherightmousebutton.

, ., , .

Page 262: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

~

alt-tab.

[v1.1.14+]:( ),., ~RButton.v1.1.14(),, RButton&C

,.,,AppsKeyToolTip:

AppsKey::ToolTipPress<or>tocycle

throughwindows.

AppsKeyUp::ToolTip

~AppsKey&<::Send!+{Esc}

~AppsKey&>::Send!{Esc}

.

$

Send,.$ , Send.$ #UseHook .

$,., (~) (*) ,key-up.,ListHotkeys.

[v1.1.06+]:#InputLevel SendLevelSend.

UP

UP,.LWin

*LWin::Send{LControlDown}

*LWinUp::Send{LControlUp}

"Up",: ^!rUp::MsgBoxYoupressedand

releasedCtrl+Alt+R . ( F1&eUp:: )

:1)"Up" 2)/"Up". ( ~LControl

up:: )

"Up".

Page 263: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.,.:

LControl&F1::return;control

"&".

LControl::MsgBoxYoureleasedLControl

withouthavingusedittomodifyany

otherkey.

( /)

.:

^Numpad0::

^Numpad1::

MsgBoxPressingeitherControl+Numpad0or

Control+Numpad1willdisplaythismessage.

return

.Windows:

RWin::return

Page 264: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfWinActive/Exist #If().:

#IfWinActive,ahk_classNotepad

^a::MsgBoxCtrl-A.Ctrl-A.

#c::MsgBoxWin-C.

#IfWinActive

#c::MsgBoxWin-C.

#IfMouseIsOver("ahk_classShell_TrayWnd")

WheelUp::Send{Volume_Up};:/.

WheelDown::Send{Volume_Down};

Page 265: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()"&".,Numpad0:

Numpad0&Numpad1::MsgBoxYoupressedNumpad1

whileholdingdownNumpad0.

Numpad0&Numpad2::RunNotepad

: ,Numpad0 ;Numpad0.,Numpad0,:

Numpad0::WinMaximizeA;/.

Numpad0::Send{Numpad0};Numpad0

Numpad0..

: Numpad0,Numpad0.v1.1.14+, .

: , (*) ., 1&2:: CtrlAlt, ^1::

Ctrl+1,Ctrl+Alt+1.

,""., <+s:: LShift&s:: .

., #If GetKeyState,.:

;AppsKeyAlt,(/).

#ifGetKeyState("AppsKey","P")

Alt&/::MsgBoxHotkeyactivated.

;AppsKeyAlt,Alt():

#ifGetKeyState("Alt","P")

AppsKey&/::MsgBoxHotkeyactivated.

Page 266: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:[&]&\::

#ifGetKeyState("[")&&GetKeyState("]")

\::MsgBox

: ,., a&b:: ^a:: .

Page 267: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Numlock,CapslockScrolllock: "AlwaysOn""AlwaysOff".:

SetNumlockStateAlwaysOn .

: WindowsWin-E(#e)Win-R(#r). .

Alt-Tab: Alt-Tab.,alt-tab:

RControl&RShift::AltTab;control

shift.

RControl&Enter::ShiftAltTab;control,

Enter.

, Alt-Tab.

Page 268: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WheelDownWheelUp.v1.0.48+WheelLeftWheelRight,

WindowsVista.:

MButton&WheelDown::MsgBoxYouturnedthe

mousewheeldownwhileholdingdownthemiddle

button.

^!WheelUp::MsgBoxYourotatedthewheelup

whileholdingdownControl+Alt.

v1.0.43.03+, A_EventInfo,1.,A_EventInfo1:

,A_EventInfo0;

(),A_EventInfo1.: ~WheelDown::ToolTip

%A_EventInfo% .

.,Control:

~LControl&WheelUp::;.

ControlGetFocus,fcontrol,A

Loop2;<--.

SendMessage,0x114,0,0,%fcontrol%,A;

0x114WM_HSCROLL,0SB_LINELEFT.

return

~LControl&WheelDown::;.

ControlGetFocus,fcontrol,A

Loop2;<--.

SendMessage,0x114,1,0,%fcontrol%,A;

0x114WM_HSCROLL,1SB_LINERIGHT.

Page 269: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

,(), .

Page 270: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Numlock,.,Numlock.:

NumpadEnd::

Numpad1::

MsgBox,Thishotkeyislaunchedregardlessof

whetherNumlockison.

return

(~) ,,.,,,:

~RButton&LButton::MsgBoxYoupressedtheleft

mousebuttonwhileholdingdowntheright.

RButton&WheelUp::MsgBoxYouturnedthemouse

wheelupwhileholdingdowntherightbutton.

Suspend,., #IfWinActive/Exist.

Hotkey,.Hotkey,.

,^(Control)#(Win)., GetKeyState,:

Joy2::

ifnotGetKeyState("Control");Control.

return;.

MsgBoxYoupressedthefirstjoystick'ssecond

buttonwhileholdingdowntheControlkey.

return

,.:

Page 271: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

^!s::Send{Delete}

Control-Alt-SControl-Alt-Delete(Ctrl-Alt-Delete).,

KeyWait;:

^!s::

KeyWaitControl

KeyWaitAlt

Send{Delete}

return

#z:: "",/("Z")..

Gosub Goto.: Gosub^!s .

,., FAQ .

, ,., MsgBox.

Page 272: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Alt-Tab

Alt-Tab,(&).,AltJKalt-tab:

RAlt&j::AltTab

RAlt&k::ShiftAltTab

AltTab ShiftAltTab,.:

AltTab:alt-tab,.,("&";,).

ShiftAltTab:,.

AltTabAndMenu:alt-tab,.,.

AltTabMenuDismiss:Alt-tab.

,Alt-tab.,,:

MButton::AltTabMenu

WheelDown::AltTab

WheelUp::ShiftAltTab

Alt-tab,::1)alt-tab;2) .

LCtrl&CapsLock::AltTab

!MButton::;. !Alt(alt-tab,

alt).

IfWinExistahk_class#32771;alt-tab.

Send!{Escape}{Altup}

return

Page 273: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,Alt-tab(). #IfWin #If.

alt-tab.,F1.F2(Escape):

*F1::Send{Altdown}{tab};.

!F2::Send{Altup};Alt.

~*Escape::

IfWinExistahk_class#32771

Send{Escape}{Altup};.

return

Page 274: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.20+]

,,:

;Ctrl+Shift+Otoopencontainingfolderin

Explorer.

;Ctrl+Shift+E.

;SciTENotepad++.

^+o::

^+e::

editor_open_folder(){

WinGetTitle,path,A

ifRegExMatch(path,"\*?\K(.*)\\[^\\]+

(?=[-*])",path)

if(FileExist(path)&&A_ThisHotkey

="^+e")

Runexplorer.exe

/select`,"%path%"

else

Runexplorer.exe"%path1%"

}

,.; .

..

Hotkey.

Page 275: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(),., ,().

,,:

::btw::bytheway

,btw"bytheway"(,btw ,,).

"bytheway",.,,. .

::btw::

MsgBoxYoutyped"btw".

return

:*:]d::;"]d".

FormatTime,CurrentDateTime,,M/d/yyyyh:mmtt

;9/1/20053:53PM

SendInput%CurrentDateTime%

return

,., b0.

Page 276: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .: -()[]{}':;"/\,.?!`n`t(`n,`tTab,)., ,

.

#HotstringEndChars-()[]{}:;'"/\,.?!`n`t

Page 277: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

1. #Hotstring,.CR: #Hotstringcr .

2. .C*:

:c*:j@::[email protected];"". .

.,.

*():(,).:

:*:j@::[email protected]

@. #Hotstring, *0.

?():;,., :?:al::airline ,"practical"

"practicairline". ?0.

B0(B): . B.{bs5},5.,{left5}.

,"<em></em>"5():

:*b0:<em>::</em>{left5}

C::,. C0.

C1:. .().,().,. #Hotstring

, C0,.

Page 278: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Kn:: . n;,k1010msk-1. :

SI(SendInput):,.SendInput ,SendPlay().

SP(SendPlay):,SendPlay-1()., .

SE(SendEvent):.,( Sleep0).k-1,CPU.

-1,.,

O: .,., :o:ar::aristocrat ,"ar"

"aristocrat",. O0(O).

Pn: (P1). .

R:;,{Enter}ENTER,^cControl-C,. .

R0.

SI,SP SE[v1.0.43+]:.:.:

SI SendInput,.SendPlay,SendInput ..

SendInput,SendPlay.

SP SendPlay,.

SE SendEvent,1.0.43.

,v1.0.43SendInput.,SI,SendInputSendEvent

SendPlay.

Z:.,,..,:

:b0*?:11::

SendInputxx

return

Page 279: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Z,111(1),1 , .b0Z,1

. Z0.

Page 280: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.:

::text1::

(

Anytextbetweenthetopandbottomparentheses

istreatedliterally,includingcommasand

percentsigns.

Bydefault,thehardcarriagereturn(Enter)

betweenthepreviouslineandthisoneisalso

preserved.

Bydefault,theindentation(tab)tothe

leftofthislineispreserved.

Seecontinuationsectionforhowtochange

thesedefaultbehaviors.

)

. r0( :r0:text1:: ).

Page 281: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfWinActive/Exist.,.:

#IfWinActiveahk_classNotepad

::btw::Thisreplacementtextwillappearonly

inNotepad.

#IfWinActive

::btw::Thisreplacementtextappearsinwindows

otherthanNotepad.

Page 283: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%MyVar% ., . SendInput,Return.

tab,,/(`).:

:*:btw::Bytheway`

.,,(, #HotstringNoMouse )."",

()/.,:1) ;2).

A_EndChar.( *),.A_EndCharSend.,

SendRaw%A_EndChar% ( SendRawSend!{}).

, ,tab. .

( ) Send{Enter},.`nENTER,`t(tab)

TAB( ).,"ab"tab :*:ab`t:: .

tab.: ::btw::bytheway ::btw::bytheway .

40.., SendInput5000. 16,383.

, SendPlay%MyVariable% .

.,,.: .

,.,,PageUp,PageDown,HomeEnd.,.

.,.,().

Page 284: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gosub Goto,().: Gosub::xyz ., ()

return.

Input,Input.

,AutoHotkey..v1.1.06, #InputLevel SendLevel

.,0, .

Input.,().,Escape.

.

:

Suspend.

#MaxThreads #MaxThreadsPerHotkey(

#MaxThreadsBuffer).

.

.,, A_ThisHotkey.

:Java,diacritical(dead)., Suspend().

Page 285: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AndreasBorutta,,.Win+H(),.,"bytheway",

Win+H(btw),..

#h::;Win+Hhotkey

;.

;"ControlGetSelected",

;().

;.,

;:

AutoTrimOff;.

ClipboardOld=%ClipboardAll%

Clipboard=;,.

Send^c

ClipWait1

ifErrorLevel;ClipWait.

return

;CRLF/LF`n"":

;

;:

StringReplace,Hotstring,Clipboard,``,````,All

;.

StringReplace,Hotstring,Hotstring,`r`n,``r,

All;MSWord`r`n.

StringReplace,Hotstring,Hotstring,`n,``r,All

StringReplace,Hotstring,Hotstring,%A_Tab%,``t,

All

StringReplace,Hotstring,Hotstring,`;,```;,All

Clipboard=%ClipboardOld%;.

;InputBox:

SetTimer,MoveCaret,10

;InputBox,:

InputBox,Hotstring,NewHotstring,Typeyour

Page 286: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

abreviationattheindicatedinsertionpoint.You

canalsoeditthereplacementtextifyou

wish.`n`nExampleentry::R:btw`::bythe

way,,,,,,,,:R:`::%Hotstring%

ifErrorLevel;.

return

IfInString,Hotstring,:R`:::

{

MsgBoxYoudidn'tprovideanabbreviation.The

hotstringhasnotbeenadded.

return

}

;:

FileAppend,`n%Hotstring%,%A_ScriptFullPath%;

`n.

Reload

Sleep200;,reloadSleep,.

MsgBox,4,,Thehotstringjustaddedappearstobe

improperlyformatted.Wouldyouliketoopenthe

scriptforediting?Notethatthebadhotstringis

atthebottomofthescript.

IfMsgBox,Yes,Edit

return

MoveCaret:

IfWinNotActive,NewHotstring

return

;InputBox.

Send{Home}{Right3}

SetTimer,MoveCaret,Off

return

Page 287: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:AutoHotkeyWindows., .

Page 288: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OriginKey::DestinationKey ., "a""b":

a::b

"b"."b""b",,:

a::b

b::a

,,(CapslockShift).,.,"a""A"B

(Capslock):

a::B

:,.:

MButton::Shift Shift.

XButton1::LButton .

RAlt::RButton Alt.

:

Page 289: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Capslock::CtrlCapslockControl.Capslock,+Capslock::Capslock .,ShiftCapslock,Cpaslock.,

XButton2::^LButton (XButton2)Control-LeftClick.

RAlt::AppsKey AltApps().

RCtrl::RWin ControlWindows.

Ctrl::Alt ControlAlt., alt-tab.

^x::^c Control-XControl-C.Control-Alt-XControl-Alt-C,.

RWin::Return Windows return.

:("Remap.ahk"),.

.

Page 290: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfWinActive/Exist.:

#IfWinActiveahk_classNotepad

a::b;'a''b'.

#IfWinActive;.

"":

(ControlShift),., b::a Control-BControl-

A.

Capslock.

.,;,.

,().

, ( ListHotkeys)., a::b ,Ctrl-Alt-A ^!b ,

^!b . ^!b ,Ctrl-Alt-ACtrl-Alt-B, ^!a .:

a::b

^!a::

^!b::

ToolTipYoupressed%A_ThisHotkey%.

return

v1.1.06, #InputLevel.:

#InputLevel1

a::b

Page 291: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InputLevel0

^!b::

ToolTipYoupressed%A_ThisHotkey%.

return

() SendMode,., Send{Blind} SendPlay

{Blind},SendPlay(Control,Shift,AltWin).,SendPlay;

SendPlaySend.,(),SendEventSend.

, ., a::b :

*a::

SetKeyDelay-1;,SetMouseDelay.

Send{Blind}{bDownTemp};DownTempDown,

DownTempSend"b".

return

*aup::

SetKeyDelay-1;SetKeyDelay.

Send{Blind}{bUp}

return

,:

1. LCtrlAlt, Send{Blind}{LAltDownTemp} Send

{Blind}{LCtrlUp}{LAltDownTemp} .RCtrl, {RCtrl

up} .

2. ( RCtrl::RButton ),SetMouseDelaySetKeyDelay.,,

:

Page 292: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

*RCtrl::

SetMouseDelay-1

ifnotGetKeyState("RButton");.

Send{Blind}{RButtonDownTemp}

return

SetKeyDelay( )., {bdown} {bup} .,Shift/Ctrl/Alt/Win

, a::B a::^b ., .

( a&c::b ),: *a:: a&c:: , *aup:: a&c

up:: .

, Suspend., Hotkey., a::b .

Hotkey,*a,off

Hotkey,*aup,off

Alt-tab:Alt,alt-tab. *Tab::Send{Blind}{Tab} ,

Alt alt-tab.,/ alt-tab

, (VKnn)(SCnnn).,.,

sc01e::vk42sc030 a::b .

, return., F1::return F1.

:

(WheelUp/Down/Left/Right).

PauseBreak().

Page 293: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{}. VK/SC x::+sc01A y::+sc01B .

(%). VK/SC.

"Return"."Enter".

Page 294: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.,,,.,:

*#up::MouseMove,0,-10,0,R;Win+UpArrow

=>

*#Down::MouseMove,0,10,0,R;Win+DownArrow

=>

*#Left::MouseMove,-10,0,0,R;

Win+LeftArrow=>

*#Right::MouseMove,10,0,0,R;

Win+RightArrow=>

*<#RCtrl::;LeftWin+RightControl=>Left-

click(Control/ShiftControl-Click

Shift-Click).

SendEvent{Blind}{LButtondown}

KeyWaitRCtrl;.

SendEvent{Blind}{LButtonup}

return

*<#AppsKey::;LeftWin+AppsKey=>Right-

click

SendEvent{Blind}{RButtondown}

KeyWaitAppsKey;.

SendEvent{Blind}{RButtonup}

return

Page 295: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

""

:

AutoHotkey.,, alt-tab,AutoHotkey(

AutoHotkey ).

(),. KeyTweak,KeyTweak(AutoHotkey

,).

:

:.

:,.

Shift,Control,AltAltGr.,.

(AutoHotkey ).

: :

1. KeyTweak()..

2. .reg(). www.autohotkey.com/forum/post-

56216.html#56216

Page 296: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetKeyState()

Page 297: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,

LButton

RButton

MButton

XButton1 .Browser_Back.

XButton2 .Browser_Forward.

Wheel

WheelDown ().

WheelUp ().

WheelLeftWheelRight

[v1.0.48+]:.

WindowsVista.().,., Send Click.

Page 298: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:.:b"b"5"5".

CapsLock

Space

Tab Tab

Enter(Return)

Escape(Esc)

Backspace(BS)

ScrollLock

Delete(Del)

Insert(Ins)

Home Home

End End

PgUp

PgDn

Up

Down

Left

Right

Numpad

,NumLockONOFF.NumLockOFFShift,

Page 299: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ShiftNumLockON.

NumLock NumLock

Numpad0 NumpadIns 0/

Numpad1 NumpadEnd 1/End

Numpad2 NumpadDown 2/

Numpad3 NumpadPgDn 3/

Numpad4 NumpadLeft 4/

Numpad5 NumpadClear 5/

Numpad6 NumpadRight 6/

Numpad7 NumpadHome 7/Home

Numpad8 NumpadUp 8/

Numpad9 NumpadPgUp 9/

NumpadDot NumpadDel /

NumLock[:)]

NumLock Numberlock()

NumpadDiv Divide()

NumpadMult Multiply()

NumpadAdd Add()

NumpadSub Subtract()

NumpadEnter Enterkey()

F1-F24 12.

LWin Windows. <# .

Windows.Correspondstothe ># hotkeyprefix.

Page 300: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RWin :Control/Alt/Shift,/"Win",.However,hotkeyswiththe# modifiercanbetriggeredbyeitherWinkey.

Control(Ctrl) Control.( Control:: ),. ^ .

Alt Alt.( Alt:: ),. ! .

Shift Shift.( Shift:: ),. + .

LControl(LCtrl) Control. <^ .

RControl(RCtrl) Control. >^ .

LShift Shift. <+ .

RShift Shift. >+ .

LAlt Alt. <! .

RAltAlt. >! .:AltGrRAlt, <^>! ., LControl&

RAlt:: AltGr.

Browser_Back

Browser_Forward

Browser_Refresh

Browser_Stop

Browser_Search

Browser_Favorites

Browser_Home

Volume_Mute

Volume_Down

Volume_Up

Media_Next

Page 301: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Media_Prev

Media_Stop

Media_Play_Pause Play/Pause

Launch_Mail

Launch_Media

Launch_App1

Launch_App2

: Windows.Windows.

AppsKey ..

PrintScreen

CtrlBreak

Pause

Break .Pause, ^CtrlBreak ^Pause ^Break .

..F1.

Sleep .sleep.

SCnnn nnn.. .

VKnn

nn. .,,HomeNumpadHome :

^VK24::MsgBoxYoupressedHome

orNumpadHomewhileholding

downControl.

:VK, *VK24 ~VK24 ,,(NumpadHomeHome). VKnn,

Page 302: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Joystick

Joy1Joy32 :., . ,^(control)+(shift)(

GetKeyState).,,"".

, GetKeyState:

JoyX,JoyY,andJoyZ:X(),Y()Z(/).

JoyR:4.

JoyUandJoyV:56.

JoyPOV:().

JoyName:.

JoyButtons:().

JoyAxes::.

JoyInfo:,: Z(Z), R(R), U(U), V(V), P(POV

), D(POV/), C(POV/).:ZRUVPD

:,(16).,2joy1.

:,1., .

:

: .

:.

Page 303: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinLIRC.

Page 304: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.

1. ."View->Keyhistory".

2. .

3. "".

4. "View->Keyhistory"

5. ..:,.,,AutoHotkey.,.

6. ,3( 159).

7. ,:

SC159::;159.

MsgBox,%A_ThisHotKey%waspressed.

return

: "",:

;159.FF()

;,.

#c::Send{vkFFsc159}

:,:

1. ()""..,Control+F1, ^F1:: .

2. AHKHID. forum RawInput* ,USBHID orAHKHID .

3. ,.:

Page 305: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,,..

Page 306: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

() :,.

:`%`,.

:/*...*/.

:.

EXE(ahk2exe) :.ahkPC.exe.

:%1%,%2%.

:ASCII.

:.

AutoHotkey.exe:AutoHotkey.exe.ahk.

:/.

Page 307: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,(AutoHotkey.exe). .,,.

,16,383., .,.

Page 308: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()

,, Return,Exit,/ (). .

,,OnMessage GUI,.,,,, GUI, .

,,,GUI .,(): DetectHiddenWindows,

DetectHiddenText,SetTitleMatchMode,SetBatchLines,SendMode,

SetKeyDelay,SetMouseDelay,SetWinDelay,SetControlDelay,

SetDefaultMouseSpeed,CoordMode,SetStoreCapslockMode,AutoTrim,

SetFormat,StringCaseSense,Thread Critical.

(),100.(),., ,, ., .

.

Page 309: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey /(`),..

AutoHotkey, `, , `% . MsgBox,.:.

#EscapeChar.

. `t (tab),`n () `r ().

:(:==, ).:

MsgBoxThisisok.

MsgBox,Thisisoktoo(ithasanexplicit

comma).

Page 310: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.:

;.

,tab.:

RunNotepad;.

,/**/, ,:

/*

MsgBox,Thislineiscommentedout(disabled).

MsgBox,Thisonetoo.

*/

,.

#CommentFlag().

Page 311: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,.

#1 :"and","or",||,&&, (v1.0.46+,++-- ).,

,:

FileAppend,Thisisthetexttoappend.`n;

.

,

%A_ProgramFiles%\SomeApplication\LogFile.txt;

.

,,"and""or":

if(Color="Red"orColor="Green"orColor

="Blue";.

orColor="Black"orColor="Gray"or

Color="White");.

andProductIsAvailableInColor(Product,

Color);.

:

ProductIsAvailable:=(Color="Red")

?false;,.

:ProductIsAvailableInColor(Product,Color)

,.,"AND""OR";., .

Page 312: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#2 :#1. , .:

;#1:

Var=

(

Line1ofthetext.

Line2ofthetext.Bydefault,alinefeed(`n)

ispresentbetweenlines.

)

;#2:

FileAppend,;.

(

Alineoftext.

Bydefault,thehardcarriagereturn(Enter)

betweenthepreviouslineandthisonewillbe

writtentothefileasalinefeed(`n).

Bydefault,thetabtotheleftofthis

linewillalsobewrittentothefile(thesame

istrueforspaces).

Bydefault,variablereferencessuchas%Var%

areresolvedtothevariable'scontents.

),C:\MyFile.txt

,. . FileAppend.;.

,.,.: (LTrimJoin|% .

Join:.,(`n). Join,. Join15.

, Join`s ("`s", Join). Join`r`n ,CR+LF.

, Join| .,.

:Join,. (Join: Join, (LTrimJoin: ,

Page 313: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(Join:C .

LTrim:tab.., #LTrim . #LTrim :. #LTrim

Off .

RTrim0(RTrim):tab.

Comments( Comment Com C)[v1.0.45.03+]:( /*..*/ ).(

tab)..

%():. ., .

,():., .,.,(),.

`(): ..,`r`t.

)[v1.1.01+]:( Join),,. (x.y)[z]() .

(`) , ,`n()`t(tab).

,/*..*/,.,.:

FileAppend,;.

;.

(LTrimJoin;.

;Thisisnotacomment;itisliteral.

IncludethewordCommentsinthelineaboveto

makeitacomment.

),C:\File.txt;.

Page 314: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .

16,383(,)..:

Var=

(

...

)

Var=%Var%`n;.

(

...

)

FileAppend,%Var%,C:\MyFile.txt

,,/: `) .

..

#Include.

Page 315: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EXE(ahk2exe)

(fincs).

,,AutoHotkey.:AutoHotkey, FileInstall.

Ahk2Exe:

1. GUI:"Convert.ahkto.exe".

2. :,.ahk"CompileScript"(AutoHotkey).EXE

,.:EXE#1,.bin

3. ::

Ahk2Exe.exe/inMyScript.ahk[/out

MyScript.exe][/iconMyIcon.ico][/bin

AutoHotkeySC.bin][/mpress0or1]

:

Ahk2Exe.exe/in"MyScript.ahk"/icon

"MyIcon.ico"

:

.

"out",EXE.

:

.

Page 316: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

v1.1.01,/NoDecompile.

#NoTrayIcon" Menu,Tray,ShowMainWindow".

ResourceHacker()"AutoHotkeySC.bin"().

AutoHotkey"Compiler". Compile_AHKII.v1.1.01,

AutoHotkeySC.bin.

.

,A_IsCompiled1..

Ahk2Exe,.,"". [v1.0.43+]

,,Ahk2Exe,. GitHub(ErrorCodes.md).[v1.1.22.03+]

GitHub.

Ahk2ExeMPRESS(MATCODESoftware).AutoHotKey

"Compiler" mpress.exe,MPRESS, /mpress0 .

(20163): http://www.matcode.com/mpress.htm

(): https://autohotkey.com/mpress/

: PE,.

Page 317: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.:

AutoHotkey.exe[Switches][ScriptFilename]

[ScriptParameters]

,:

CompiledScript.exe[Switches][Script

Parameters]

Switches::

/for/force ,. #SingleInstanceOff.

/r/restart Reload.

/ErrorStdOut . #ErrorStdOut./iLib.

:

/Debug [AHK_L11+]:., .

/CPn [AHK_L51+]:., .

/iLib"OutFile"

[v1.0.47+]:AutoHotkey.include ,OutFile,::

#IncludeLibDir\

#IncludeAgainLibDir\LibFile.ahk

Page 318: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. * stout.

,.;,2./ErrorStdOut.

ScriptFilename: ScriptParameters,.,():

AutoHotkey.

.

AutoHotkey.ahk Autohotkey.AutoHotkey.exeMyScript.exe,

MyScript.ahk .AutoHotkeyU32.exeAutoHotkeyU32.ahk.

: revision51,AutoHotkey.iniAutoHotkey.ahk.

[v1.1.17+]:(*)(stdin). ExecScript().

: . "."(\").\("C:\MyDocuments \")(C:\My

Documents")., StringReplace,1,1,",,All .

%1%,%2%.%0%.1,2.:

if0<3; non-expressionif-statement.

{

MsgBox3,%0%.

ExitApp

}

(),:

Loop,%0%;:

{

Page 319: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

param:=%A_Index%;A_Index.

MsgBox,4,,Parameternumber%A_Index%is

%param%.Continue?

IfMsgBox,No

break

}

,(),/.

Loop%0%;():

{

GivenPath:=%A_Index%;A_Index.

Loop%GivenPath%,1

LongPath=%A_LoopFileLongPath%

MsgBoxThecase-correctedlongpathnameof

file`n%GivenPath%`nis:`n%LongPath%

}

:NTFS8.3(),.ahk. ,EXE.

Page 320: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[AHK_L51+]

.

UTF-8UTF-16(LE), /CPn.

/CPn, n., MSDN.

ANSI.

AutoHotkey,I/O. FileEncoding, IniRead IniWrite

UTF-16ANSI.

() ,:ANSI'?'Unicode'?'.Unicode,.

RegWrite():

;

;.:

;codepage=0;ANSI

;codepage=65001;UTF-8

;codepage=1200;UTF-16

;codepage=1252;ANSILatin1;

(Windows)

if(codepage!="")

codepage:="/CP".codepage

cmd="%A_AhkPath%"%codepage%"`%1"`%*

key=AutoHotkeyScript\Shell\Open\Command

ifA_IsAdmin;.

RegWrite,REG_SZ,HKCR,%key%,,%cmd%

else;.

RegWrite,REG_SZ,HKCU,

Software\Classes\%key%,,%cmd%

Page 321: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey.,.

Page 322: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListVars Pause.,,"":

ListVars

Pause

,.,File.,""().

"",WinActivate..

: ListLines,KeyHistory OutputDebug.

,"global", .

[AHK_L11+]

DBGp.:

- .

-,.

.

.

.

,, /Debug.

AutoHotkey.exe/Debug[=SERVER:PORT]...

Page 323: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SERVER PORT.,:

AutoHotkey/Debug"myscript.ahk"

AutoHotkey/Debug=localhost:9000"myscript.ahk"

[AHK_L59+]:,,:

ScriptPath=;

DetectHiddenWindowsOn

ifWinExist%ScriptPath%ahk_classAutoHotkey

;:

;wParam=IPv4,32.

;lParam=.

PostMessage

DllCall("RegisterWindowMessage","str",

"AHK_ATTACH_DEBUGGER")

,"detach"DBGp.

Page 324: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey.exe

.ahkAutoHotkey.exe.

[AHK_L51+]:AutoHotkey.exe ,AutoHotkey.,

MyScript.exe MyScript.ahk,.

Page 325: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey(),/S.:

AutoHotkey110800_Install.exe/S

/D(/S,).:

AutoHotkey110800_Install.exe/S/D=C:\Program

Files\AutoHotkey

Version:AutoHotkey,AutoHotkey.exe.,64Unicode

32Unicode64.AutoHotkey.exe,:

/A32 /ANSI :ANSI32.

/U64 /x64 :Unicode64(64).

/U32 :Unicode32.

,ANSI32:

AutoHotkey110800_Install.exe/S/A32

Uninstall:AutoHotkey,Installer.ahk /Uninstall .:

"C:\ProgramFiles\AutoHotkey\AutoHotkey.exe"

"C:\ProgramFiles\AutoHotkey\Installer.ahk"

/Uninstall

Page 326: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.1.08.00AutoHotkey, uninst.exe/S .:

"C:\ProgramFiles\AutoHotkey\uninst.exe"/S

: Installer.ahk.

Extract:., /E .:

AutoHotkey110903_Install.exe/D=F:\AutoHotkey

/E

[v1.1.19.02+]:/,. /R ,EXE, ().

(Explorer),(UAC),.

[v1.1.08+]:Windows7,,. ,AutoHotkey

(IsHostApp).

[v1.1.24.02+]:, /IsHostApp /IsHostApp=1 ,

/IsHostApp=0 .

UIAccess [v1.1.24.02+]

"'RunwithUIAccess'(UIAccess)". UAC,,

.:

AutoHotkeyA32.exe,AutoHotkeyU32.exeAutoHotkeyU64.exe()

AutoHotkey*_UIA.exe.

UIA(manifest) uiAccess.

Page 327: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"AutoHotkey",UIA.

exe.

UIA,UIAccess,.

, /uiAccess /uiAccess=1 , /uiAccess=0 .

UAC()UIAccess,.

UIaccess, RunUIA.exe .

:

UIA;ProgramFiles.

,UIA.exe.

,UIA.exeCreateProcess.ShellExecute. Run.

UIA.exe,.

UIA"integritylevel()","UIA".,

ComObjActive("Word.Application") ,WordUI

Access.

,"UIA".

"UIA"( #InstallMouseHook ),UIA,

"UIA".:"UIA".

, Enableinteractionwithadministrativeprograms.

Page 328: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

Page 329: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 330: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:AutoHotkey.,(),.(,.)

: ,;. ,().

:(, CurrentDate currentdate).253,,:#_@$

,,(: CursorPosition,Total_Items entry_is_valid)..,

AutoHotkey,.

, . ,.

AND,OR NOT ,..

:,:. (=) .:

MyNumber=123

MyString=Thisisaliteralstring.

CopyOfVar=%Var%;=,.

, (:=) , .:

MyNumber:=123

MyString:="Thisisaliteralstring."

CopyOfVar:=Var;,:=.

.

():

Page 331: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MyVar=

MyVar:=""

:=,=,.

:,:..:

MsgBoxThevalueinthevariablenamedVaris

%Var%.

CopyOfVar=%Var%

,,.,:

MsgBox%"ThevalueinthevariablenamedVar

is".Var.".";(join).

CopyOfVar:=Var

MsgBox,.(),.,,.,, Sleep:

SleepMillisecondsToWait

Sleep%MillisecondsToWait%

Sleep%MillisecondsToWait

:,.

Page 332: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,/.

().,,.:

if(CurrentSetting>100orFoundColor<>

"Blue")

MsgBoxThesettingistoohighorthewrong

colorispresent.

,"Blue",. ,,: "Shesaid,""Anapplea

day.""" .

:if if ( IfFoundColor<>Blue ),"if".,: if

(x>0)and(y>0) .,"if" "not""!",.

:,., MyVar if(MyVar<>"") ., if ,

., MyVar ifMyVar="" .,if,=<>

,: ifVar= .

, (x+*3) .

:, :=.:

NetPrice:=Price*(1-Discount/100)

:(IF),,.,ItemCount0 ifItemCount

Page 333: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

., ifnotItemCount .

NOT/AND/OR/>/=/<:10.,, Done1:

Done:=A_Index>5orFoundIt

,0., ifDone Done.

true false10.,:

CaseSensitive:=false

ContinueSearch:=true

:,;.(),,.

,.0x., Sleep0xFF Sleep255 .v1.0.46.11+,

;( 1.0e4 -2.1E-4 ).

:tab,( StringLenOutputVarInputVar). .:

FileAppend,%MyArray%i%,MyFile.txt

FileAppend,%MyPseudoArray%i%,MyFile.txt

MsgBox%"ThevariableMyVarcontains".MyVar

."."

Loop%Iterations+1

WinSet,Transparent,%X+100

Control,Choose,%CurrentSelection-1

Page 334: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(*)(/),.,(+)(*) .,3+2*23+(2*

2).,:(3+2)*2

,() .,.,X,X+11.

, "123" ,(,). , "0x"n (n,

).,,

(: : if("1"<2) ,,).

()

%Var%

(%Var%), (,%Var%). ,:

Var:=MyArray%A_Index%+100

,""(%Var%,Array%i%).Sleep(%Var%) .

[AHK_L52+]:,%Var% , / .52,%Var%.

x.y [AHK_L31+]:. x, y. .

new[v1.1.00+]:., x:=newy x:={base:y} .new GlobalClass.NestedClass , x:=new

y(z) ( y ). .

/ .1(1.0.46,;).. ,., Var

Page 335: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

++--

:=++X X Var., , ., Var:=X++

X Var.,++--;, y:=1,++x MsgBox%++x x.,

x=1

y=1

var1:=x++;var1=1,x=2

var2:=++y;var2=2,y=2

,x2,y2,var11,var22.

**..,,.**, -2**2 -(2**2) -4.,,, (-2)**2

(-2)**0.5 ;. (-2)**2 (-2)**2.0 .

-!~&*

(-) :,,: -(3/-x) .,(+).

(!) :0,1,"".,0().: !xor!(y

andz) .:NOT !, !.v1.0.46+,,!!Var ,.

(~) :.,.04294967295(0xffffffff),32., 64., ~0xf0f 0xfffff0f0(4294963440).

(&):&MyVar MyVar, DllCall. &MyVar ,,.(

(*):*Expression Expression 0255(00,).,

*/

(*) :,;.

(/) : EnvDiv,,., 3/2 1.51, 4/2

2.02.

(//) :,., 5//3 1 5//-3 -1.,.

Page 336: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

// , 5//3.0 1.0 5.0//-3 -2.0.,,., mod().

*= /=., Var*=2 Var:=Var*2 ().

().

+-

(+) (-) ., += -=., Var+=2 Var:=Var+2 ()., Var++,Var--,++Var--Var 1.

<<>>

(<<) (>>) .: Value1<<Value2 ..( <<) Value1"2 Value2".( >>) Value1"2 Value2", -3>>1 -2.

&^|

(&) ,(^) (|) ., & |..

.

.().(, x-y ,++--).,.():<c6>Var:="Thecoloris" .FoundColor(): Var=Thecoloris%FoundColor%

.: Var:="Thenetpriceis".Price*(1

-Discount/100) .

() .

[AHK_L31+]: RegExMatch., "abc123"~=

"\d" ErrorLevel04().v1.1.03, (=)(:=),.,~=not(!),., :

str:="d"

if(!str~="abc"){ ;~

if!(str~="abc")

Page 337: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

~=

Msgbox%str% ;~

}else{

Msgbox%str%;~

}

,not(!):=, :

if(!str:="a"){ ;~if!

(str:="a")

Msgbox:%str%false

}else{

Msgbox:%str%true ;~

}

><>=<=

(>),(<) ,(>=) , (<=) .,("55").StringCaseSense,.: Sort

===

<>!=

(=) ,(==) (<>!=) . != <>., == =,, ==, =( StringCaseSense)., StringCaseSense.:"55".

NOT ., !., not(x=3ory=3) !(x=

3ory=3) .

AND&&

.: x>3andx<10 ., .,AND/OR/&&/||() .

OR|| .: x<=3orx>=10 ., .

?: [v1.0.46+]. if-else.., var:=x>y?2:

3 ,xy2 Var3.,( ).

.,(1.0.46,,). (:=) ,.,., Var//=2 , Var2, Var., Var.=

"abc" Var:=Var."abc" .

Page 338: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:=+=-=*=/=//=.=|=&=^=>>=<<=

,., Var1:=Var2:=0 0 Var2, Var2 Var1.

,., Var50, (Var+=2)>50 .ByRef,: &(x:="abc") .

,.: notx:=y not(x:=y) ., ++Var:=

X ++(Var:=X) Z>0?X:=2:Y:=2 Z>0?

(X:=2):(Y:=2) .

():1) /=,, (, /=)2) += -=, /3) +=,-=*=, y:=1,x+=1 MsgBox%x-

=3 x.

,

() [v1.0.46+]...: x:=1,y+=2,++index,

func() ..:() .: .

v1.0.46.01+,, (:=) .,: x:=1,y=2,

a=b=c .,.

/:

(expression) ., (3+2)*2 3+2 .

mod()round()abs()

.,., Functions.

%func%() .

Page 339: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

func.()

: . %func%() () func.Call() ().

[AHK_L48+]: func.,"". func, .

[v1.0.95+]: func,.

Fn(Params*) [AHK_L60+]:.Params() ().

x[y][a,b,c]

[AHK_L31+]:. x, y().

[v1.0.97+]:.(),., [a,b,c] Array(a,b,c) (a,bc).

arraysyntaxandobjectsyntax.

{a:b,c:d}[v1.0.97+]:.., x:={a:b} x:=

Object("a",b) x:=Object(),x.a:=b . AssociativeArrays.

:v1.0.48+,,(: x:=y,a:=b ).,;,35%.

Page 340: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,. Clipboard,ErrorLevel ,;.

: A_Space,A_Tab

: ,A_WorkingDir,A_ScriptDir,A_ScriptName,(......)

: A_YYYY,A_MM,A_DD,A_Hour,A_Min,A_Sec,(......)

: A_IsSuspended,A_BatchLines,A_TitleMatchMode,(......)

: A_TimeIdle,A_TimeIdlePhysical

GUI: A_Gui,A_GuiControl,A_GuiEvent,A_EventInfo

,: A_ThisHotkey,A_EndChar,A_ThisMenuItem,(......)

: A_OSVersion,A_ScreenWidth,A_ScreenHeight,(......)

: A_Cursor,A_CaretX,A_CaretY,Clipboard,ClipboardAll,ErrorLevel

: A_Index,(......)

A_Space . AutoTrim.

A_Tab tab. AutoTrim.

1,2,3 ,.(:%1%).%0%(0). .

A_WorkingDir ,.,.:C:\C:\MyDocuments.SetWorkingDir.

Page 341: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_ScriptDir .().

A_ScriptName ,,MyScript.ahk.

A_ScriptFullPath ,,C:\MyDocuments\MyScript.ahk

A_ScriptHwnd[v1.1.01+] ID(HWND/).

A_LineNumber

( #Include). ListLines,: MsgBox

Couldnotwritetologfile(linenumber

%A_LineNumber%) .

#Include,.

A_LineFile A_LineNumber, #Include, A_ScriptFullPath.

A_ThisFunc[v1.0.46.16+] ();:MyFunction.: IsFunc()

A_ThisLabel[v1.0.46.16+]

()();:MyLabel. Gosub/Return Goto.,""A_ThisLabel,.:IsLabel()

A_AhkVersion1.0.22,.,AutoHotkey,1.0.22.,.>>=A_AhkVersion,:A_AhkVersion>=1.0.25.07 .

A_AhkPath

:EXE.:C:\ProgramFiles\AutoHotkey\AutoHotkey.exe

:HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey\InstallDirAutoHotkey,.,A_AhkPath.

A_IsUnicode Unicode(16)1,ANSI(8)( false).AutoHotkey.exe,,.

Page 342: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_IsCompiled EXE 1,( false).

A_ExitReason . OnExit,. OnExit.

A_YYYY4(2004).A_Year.:,FormatTime,OutputVar () FormatTime,

OutputVar,,LongDate ().

A_MM 2(01-12).A_Mon.

A_DD 2(01-31).A_MDay.

A_MMMM ,July

A_MMM ,Jul

A_DDDD ,Sunday

A_DDD 3,Sun

A_WDay 1(1-7).1.

A_YDay (1-366).,9,009.,: FormatTime,

OutputVar,,YDay0 .

A_YWeek

ISO8601(200453)., StringLeft,

Year,A_YWeek,4 StringRight,Week,

A_YWeek,2 .A_YWeek:11,.,,.

A_Hour24(,175pm)2(00-23).AM/PM12,: FormatTime,OutputVar,,

h:mm:sstt

A_Min 2(00-59).

A_Sec 2(00-59).

3(000-999).,: Milliseconds:=A_MSec

Page 343: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_MSec +0 .

A_Now YYYYMMDDHH24MISS.: EnvAddEnvSub., FormatTime/.

A_NowUTC YYYYMMDDHH24MISS(UTC).UTC(GMT).

A_TickCount

.A_TickCount,A_TickCount,.:

StartTime:=A_TickCount

Sleep,1000

ElapsedTime:=A_TickCount-

StartTime

MsgBox,%ElapsedTime%milliseconds

haveelapsed.

A_TickCount10ms,QueryPerformanceCounter()().

A_IsSuspended 1,0.

A_IsPaused[v1.0.48+] 1.0.

A_IsCritical[v1.0.48+]

Critical0.,Critical .Critical0 ,Critical: Old_IsCritical:=A_IsCritical , Critical%Old_IsCritical% .

A_BatchLines (A_NumBatchLines) SetBatchLines.:20010ms().

A_TitleMatchMode SetTitleMatchMode:1,2,3RegEx.

Page 344: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_TitleMatchModeSpeed SetTitleMatchMode(fastslow).

A_DetectHiddenWindows DetectHiddenWindows(OnOff).

A_DetectHiddenText DetectHiddenText(OnOff).

A_AutoTrim AutoTrim(OnOff).

A_StringCaseSense StringCaseSense(On,OffLocale).

A_FileEncoding [AHK_L46+]; FileEncoding.

A_FormatInteger SetFormat(HD). [AHK_L42+]:h.

A_FormatFloat SetFormat.

A_SendMode [v1.1.23+]: SendMode(:Event,Input,PlayInputThenPlay).

A_SendLevel [v1.1.23+]: SendLevel(:0100,0100).

A_StoreCapslockMode [v1.1.23+]: SetStoreCapslockMode(:OnOff).

A_KeyDelayA_KeyDuration

SetKeyDelay(,).A_KeyDuration [v1.1.23+].

A_KeyDelayPlayA_KeyDurationPlay

SetKeyDelay SendPlay(,). [v1.1.23+].

A_WinDelay SetWinDelay(,).

A_ControlDelay SetControlDelay(,).

A_MouseDelayA_MouseDelayPlay

SetMouseDelay(,).A_MouseDelaySendEvent,A_MouseDelayPlay SendPlay.A_MouseDelayPlay [v1.1.23+].

A_DefaultMouseSpeed SetDefaultMouseSpeed(,).

A_CoordModeToolTipA_CoordModePixel

[v1.1.23+]:CoordMode.(:Window,

Page 345: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_CoordModeMouseA_CoordModeCaretA_CoordModeMenu

ClientScreen)

A_RegView [v1.1.08+]: SetRegView.

A_IconHidden 1,0. #NoTrayIcon Menu.

A_IconTip Menu,Tray,Tip ,,.

A_IconFile Menu,tray,icon ,,. :DLL, Menu,Tray,Icon,

user32.dll,2 .

A_IconNumber A_IconFile.,A_IconFile(1).

A_TimeIdle

,.. ( Send MouseMove).10,.,.:A_TimeIdle,600000,MsgBox,Thelast

keyboardormouseactivitywasat

least10minutesago .

A_TimeIdlePhysical,( )/;.(.),A_TimeIdle.,A_TimeIdlePhysical(/,,).

GUI

A_DefaultGui[v1.1.23+] GUI .

A_DefaultListView[v1.1.23+]

ListView , ListView.GUIListView,.

Page 346: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_DefaultTreeView[v1.1.23+]

TreeView , TreeView.GUITreeView,.

A_Gui GUI.Gui,Gui(GuiClose/GuiEscape),.

A_GuiControl

GUI. ,A_GuiControl/63().A_GuiControl:1)A_Gui;2)GUI(GuiClose/GuiEscape);3),;4)( GuiDestroy).

A_GuiWidthA_GuiHeight

GuiSize,GUI.,,.[v1.1.11+]: DPI.

A_GuiXA_GuiY

GuiContextMenu GuiDropFilesXY.. [v1.1.11+]: DPI.

A_GuiEventorA_GuiControlEvent

. GUI,.,:

Normal:(,TAB,,).Gui,GuiCloseGuiEscape.

DoubleClick:.: Normal.,:,.

RightClick: GuiContextMenu,ListViewsTreeViews.

: GuiContextMenu,GuiDropFiles,Slider,MonthCal,ListView TreeView.

A_EventInfo

:

OnClipboardChange(WheelDown/Up/Left/Right)OnMessage()RegisterCallback()RegularExpressionCalloutsGUI, GuiContextMenu,GuiDropFiles,

Page 347: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListBox,ListView,TreeView StatusBar.,A_EventInfo0.

:A_ThisHotkey, A_Gui,A_GuiControl,A_GuiX/Y,

A_GuiEventA_EventInfo.,,/.

,

A_ThisMenuItem ().

A_ThisMenu A_ThisMenuItem.

A_ThisMenuItemPos

A_ThisMenuItemA_ThisMenu .1,2,..A_ThisMenuItemA_ThisMenu,.A_ThisMenu,.

A_ThisHotkey

(),#z. ,,,.

( Hotkey ),, variants.

: A_ThisLabel

A_PriorHotkey ,..

A_PriorKey [v1.1.01+]:,.AutoHotkey., .

A_TimeSinceThisHotkey A_ThisHotkey.A_ThisHotkey,-1.

A_TimeSincePriorHotkey A_PriorHotkey.A_PriorHotkey,-1.

A_EndChar .(*),.

Page 348: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComSpec[v1.0.43.08+]

ComSpec(C:\Windows\system32\cmd.exe). Run/RunWait.:A_.

A_Temp[v1.0.43.09+]

(C:\DOCUME~1\UserName\LOCALS~1\Temp).():1) TMP,TEMPUSERPROFILE;2)Windows.

A_OSType.AutoHotkey1.1NT,WIN32_NT.AutoHotkeyWindows95/98/MEWIN32_WINDOWS.

A_OSVersion

():WIN_7 [AHK_L42+] ,WIN_8[v1.1.08+],WIN_8.1[v1.1.15+] ,WIN_VISTA,WIN_2003,WIN_XP,WIN_2000.

AutoHotKey,A_OSVersion.

[v1.1.20+]:,"major.minor.build".,10.0.14393 Windows10build14393,1607.

;,.

ifA_OSVersionin

WIN_NT4,WIN_95,WIN_98,WIN_ME

;:.

{

MsgBoxThisscript

requiresWindows2000/XPor

later.

ExitApp

}

Page 349: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_Is64bitOS [v1.1.08+]:641(),320().

A_PtrSize [AHK_L42+]:,.4(32)8(64),.

A_Language , 4- .

A_ComputerName .

A_UserName .

A_WinDir Windows.:C:\Windows

A_ProgramFilesProgramFiles

ProgramFiles( C:\ProgramFiles C:\ProgramFiles(x86) ).ProgramFiles .

64(32):

(EXE)32,A_ProgramFiles"ProgramFiles(x86)".32, ProgramW6432 64ProgramFiles.Windows7,64. ProgramFiles(x86) 32ProgramFiles.

v1.0.43.08+,A_, #NoEnv.

A_AppData[v1.0.43.09+]

.:C:\DocumentsandSettings\Username\ApplicationData

A_AppDataCommon[v1.0.43.09+] .

A_Desktop .

A_DesktopCommon .

A_StartMenu .

A_StartMenuCommon .

Page 350: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_Programs .

A_ProgramsCommon .

A_Startup .

A_StartupCommon .

A_MyDocuments "".,,.,M:M:\

A_IsAdmin

,1.0.

Tohavethescriptrestartitselfasadmin(orshowaprompttotheuserrequestingadmin),useRun*RunAs.However,notethatrunningthescriptasadmincausesallprogramslaunchedbythescripttoalsorunasadmin.Forapossiblealternative,seetheFAQ.

A_ScreenWidthA_ScreenHeight

,(1024768).

, SysGet.

(),:

SysGet,VirtualWidth,78

SysGet,VirtualHeight,79

, SysGet,,.

A_ScreenDPI[v1.1.11+] .,.96(DPI). Gui-DPIScale.

A_IPAddress14 4IP.

Page 351: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_Cursor

.:AppStarting,Arrow,Cross,Help,IBeam,Icon,No,Size,SizeAll,SizeNESW,SizeNS,SizeNWSE,SizeWE,UpArrow,Wait,Unknown.size,NESW=NorthEast+SouthWest.()Unknown.

A_CaretXA_CaretY

()XY. CoordMode,.,.

,.(MSWord).

#Persistent

SetTimer,WatchCaret,100

return

WatchCaret:

ToolTip,X%A_CaretX%Y%A_CaretY%,

A_CaretX,A_CaretY-20

return

Clipboard ,. .

ClipboardAll (). ClipboardAll.

ErrorLevel ErrorLevel.

A_LastError GetLastError()COM., DllCall()Run/RunWait.

Loop

A_Index (64).,,1. Loop While.

A_LoopFileName .

A_LoopRegName .

A_LoopReadLine .

Page 352: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_LoopField .

Page 353: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

""

.SET,.

EnvSet.,;. Run RunWait():,.

v1.0.43.08+,, Path:

EnvGet,OutputVar,Path;, #NoEnv.

Page 354: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

64MB( #MaxMem).

,.

, Var:="" .

..

,15.,64,-9223372036854775808

(-0x8000000000000000)9223372036854775807

(0x7FFFFFFFFFFFFFFF).,.,(

0x7FFFFFFFFFFFFFFF+1=-0x8000000000000000).

Page 355: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Return,Exit

#Include

:

Page 356: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

( Gosub),().,.,Add:

Add(x,y)

{

returnx+y;"Return" .

}

,"Add"(),(xy)., :=.:

Var:=Add(2,3);5Var.

,:

Add(2,3)

,;(:;ByRef...),.

,.,.:

ifInStr(MyVar,"fox")

MsgBoxThevariableMyVarcontainstheword

fox.

,( StringLenOutputVarInputVar)., "%"

(),:

MsgBox%"Theansweris:".Add(3,2)

Page 357: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"%",.(:'%',.)

Page 358: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,().,,: GetCurrentTimestamp() .

ByRef:, , ByRef,:

Swap(ByRefLeft,ByRefRight)

{

temp:=Left

Left:=Right

Right:=temp

}

, ByRef.,.Swap Left Right,.

, ByRef,Left Right,Swap.

return, ByRef.().

, ByRef,., ByRef ReturnHugeString .

[AHK_L60+]:ByRef,"ByRef"., Swap(A_Index,i)

A_Index i, Swap Left.(:A_Index.)

[v1.1.01+]:IsByRef()ByRef.

:

ByRef., foo.bar ByRef, ByRef.

Clipboard, ByRef, #NoEnv.

Page 359: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, ByRef ByRef, ByRef., , ByRef.

( Var ++Var Var*=2 ),., Var0

func(Var,Var++) 10, ByRef.,.

ByRefCOM,COM., wrapperobject()

VarType() .

Page 360: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.(v1.1.09+ := ).Z:

Add(X,Y,Z:=0){

returnX+Y+Z

}

v1.1.09, = := .AutoHotkey,.

,Z. ,Z0.

.,. [AHK_L31+]:,:v1.1.12,.

Func(1,,3)

Func(X,Y:=2,Z:=0){;:Z.

MsgBox%X%,%Y%,%Z%

}

v1.0.46.13, ByRef;: Func(ByRefp1="") .,;

,"ByRef".

: true ,false ,,/"fox"""(1.0.46.13"").

Page 361: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .

Test:=returnTest()

MsgBox%Test

returnTest(){

return123

}

, ByRef:

returnByRef(A,B,C)

MsgBox%A","B","C

returnByRef(ByRefval1,ByRefval2,ByRefval3)

{

val1:="A"

val2:=100

val3:=1.1

return

}

[v1.0.97+]: :

Test1:=returnArray1()

MsgBox%Test1[1]","Test1[2]

Test2:=returnArray2()

MsgBox%Test2[1]","Test2[2]

Page 362: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Test3:=returnObject()

MsgBox%Test3.id","Test3.val

returnArray1(){

Test:=[123,"ABC"]

returnTest

}

returnArray2(){

x:=456

y:="EFG"

return[x,y]

}

returnObject(){

Test:={id:789,val:"HIJ"}

returnTest

}

Page 363: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[AHK_L60+]

,,:

Join(sep,params*){

forindex,paraminparams

str.=param.sep

returnSubStr(str,1,-StrLen(sep))

}

MsgBox%Join("`n","one","two","three")

,. params[1] , params[2] .,

params.MaxIndex() ().,MaxIndex.

:

""().

RegEx,"".

.

, :

substrings:=["one","two","three"]

MsgBox%Join("`n",substrings*)

:

Page 364: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.

.

,.

,,.

;, Object.Property[Params*] .v1.1.12,.

:

., Func(x,y*) Func(x*,y) .

( * ).

Page 365: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.,,..

, ().

,,:

, classes.

Clipboard,ErrorLevel, A_TimeIdle.

,.

,.

.

(),.:

LogToFile(TextToLog)

{

globalLogFileName;.

FileAppend,%TextToLog%`n,%LogFileName%

}

:,"global"().:

Page 366: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetDefaults()

{

global;"localMyVar",.

MyGlobal:=33;33,.

localx,y:=0,z;,.

}

, Array%A_Index% .

[v1.1.05+]:,..,,. class.

,.:

LogToFile(TextToLog)

{

staticLoggedLines=0

LoggedLines+=1;().

globalLogFileName

FileAppend,%LoggedLines%:%TextToLog%`n,

%LogFileName%

}

:1.0.46,;.v1.0.46+, "" , := =

: true ,false ,,/, "fox" .: staticX:=0,Y:="fox" .

().

[AHK_L58+]: Staticvar:=expression .,.

[v1.0.48+]:"static"().:

Page 367: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetFromStaticArray(WhichItemNumber)

{

static

staticFirstCallToUs:=true;().

ifFirstCallToUs;.

{

FirstCallToUs:=false

Loop10

StaticArray%A_Index%:="Value#".

A_Index

}

returnStaticArray%WhichItemNumber%

}

,.

,:

globalLogFileName,MaxRetries:=5

staticTotalAttempts=0,PrevResult

v1.0.46+, := or= ,( = := ). ,,

., localx=0 : localx x=0 .

local,global static, IF.,IFELSE .,

globalArray%i% .

( StringSplit), (, ByRef,)., ,.

, . StringSplitArrayName0., WinGetList,

Page 368: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ArrayName().

,, Array%i% ,,., ., , (

Array%i%:=A_Index ).

: non-dynamic().,, MsgBox%Array1% Array1.

, MsgBox%Array1% Array1( ),ArrayArray0

.

Page 369: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

v1.0.47.06+,( )., %Var%(x,"fox") Var.,

Func%A_Index%() Func1()Func2(),A_Index.

v1.1.07.00+, %Var%() Var, ., __Call.

,,.

, IfIsFunc(VarContainingFuncName) . ,

, #Include .

, IsFunc()().:v1.0.48+,;().

,,().

Page 370: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AND,OR ,()..,:

if(ColorName<>""ANDnot

FindColor(ColorName))

MsgBox%ColorName%couldnotbefound.

, ColorNameFindColor(). AND false, true.

,, AND OR,().

AND OR., ColorName.:

if(ColorName=""ORFindColor(ColorName,

Region1)ORFindColor(ColorName,Region2))

break;.

, AND OR..

v1.0.46+, (?:) .

Page 371: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,. Gosub Return(ReturnGosub).

:().,.

Gosub(), .,A_ThisFunc.

Goto, Gosub/,Goto.

Goto,..

, ,GUIg. #Include, .,:

, ( ). ().,,.

( ) GUI.

, ().

Page 372: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Return,Exit

Return,(). Return.

Exit ,., Var:=Add(2,3) , Add() Var

., ( UseErrorLevel),.

, ErrorLevel.

(),,: FindColor(ColorName,"") .

, SendMode SetTitleMatchMode.

, ByRef., GetNextLine(BlankArray%i%)

BlankArray%i% ( ).

ListVars, ..

Page 373: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.,"p""p_", .,"r""r_" ByRef,

"s""s_" .

OneTrueBrace(OTB).:

Add(x,y){

returnx+y

}

Page 374: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Include

#Include( ).

:,().,, .

Page 375: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: [v1.0.47+]

#Include.,:

%A_ScriptDir%\Lib\;-AHK_L42+.

%A_MyDocuments%\AutoHotkey\Lib\;.

path-to-the-currently-running-

AutoHotkey.exe\Lib\;.

, MyFunc() ,"MyFunc.ahk".,.(

MyPrefix_MyFunc ), MyPrefix.ahk ,.

MyPrefix.ahk MyPrefix_MyFunc MyPrefix_ .

[AHK_L42+]:.

MyFunc() .,timer()GUIevent(GUI),,:

#Include<MyFunc>

,.,,;,.

#Include,#Include.,.

(ahk2exe) .,AutoHotkey.exe().AutoHotkey.exe,

.

,.

Page 376: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

., WinExist("Untitled-Notepad") ,.

,.,WinExist().,.

DLLExternalfunctions() DllCall().

.

FileExist .

GetKeyState ,true(1)false(0).

InStr .

RegExMatch ().

RegExReplace ().

StrLen .

StrReplace .

StrSplit .

SubStr .

WinActive (),ID(HWND).

WinExist ID(HWND).

Page 377: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Asc(String)

StringUTF-16,String0.(ANSI)0-255(Unicode)0-0xFFFF.UnicodevsANSI.Unicodesupplementarycharacters(Unicode),Ord(String).

Chr(Number)

Number().127stringencoding(),UnicodeANSI.Unicode,NumberUnicode00x10FFFF(0xFFFF[v1.1.21]);ANSI0255.Number,.9(tab),10(linefeed),13(carriagereturn),32(space),48-57(thedigits0-90-9),65-90(uppercaseA-ZA-Z),97-122(lowercasea-za-z).

DllCall DLL,WindowsAPI.

FileOpen I/O.

Func(FunctionName) .

GetKeyName/GetKeyVK/GetKeySC /,.

IsByRef(Var) VarByRef1;Var0.

IsFunc(FunctionName)

FunctionName(#Include),IsFunc()0.(1,21).,ifIsFunc("MyFunc")ifIsFunc(VarContainingFunctionName),.v1.1.00+,FunctionName.

LabelName,(LabelName),.,if

Page 378: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsLabel(LabelName) IsLabel(VarContainingLabelName),.Gosub,Hotkey,MenuGui,.

IsObject .

ListView ,,ListView/,.

NumGet(VarOrAddress[,Offset=0][,Type="UPtr"]) +.

NumPut(Number,VarOrAddress[,Offset=0][,Type="UPtr"]) +.

OnMessage(MsgNumber[,"FunctionName"]) /.

Ord(String)

String.StringUnicode,Ord(String)Unicode(0x100000x10FFFF).Asc(String).

StrGet(Address[,Length][,Encoding=None]) ,.

StrPut(String,Address[,Length][,Encoding=None]) ,.

RegisterCallback ,.

TreeView ,TreeView,.

Trim /.

VarSetCapacity(UnquotedVarName[,RequestedCapacity,FillByte]) .

Page 379: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Abs(Number) Number.

Ceil(Number) Number(.00).

Exp(N) e(2.71828182845905) N.

Floor(Number) Number(.00).,Floor(1.2)1Floor(-1.2)-2.

Log(Number) Number(10)..Number,.

Ln(Number) Number(e)..Number,.

Mod(Dividend,Divisor)

, Dividend Divisor..,mod(5,3)mod(5,-3)2,mod(-5,3)mod(-5,-3)-2.,.,mod(5.0,3)2.0mod(5,3.5)1.5.,().

Round(Number[,N])

Number N.N0,Number.N,NumberN.N,NumberN.,Round(345,-1)350Round(345,-2)300.TransformRound,N1.000.v1.0.44.01+,NNSetFormat.,Round();:Round(3.333,1)+0.

Sqrt(Number) Number..Number,.

Sin(Number)/Cos(Number)/Tan(Number)

Numbersine()/cosine()/tangent().Number.

ASin(Number)/ACos(Number)/ATan(Number)

Numberarcsine()/arccosine()/arctangent().

Polyethene:OutputVarAutoHotkey. #Include.

Page 380: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, Goto .

LabelName:

,.,.

: ,,tab, (`).,,,(: MyListView,

Menu_File_Open outer_loop)..

,:On,Off,Toggle,AltTab,ShiftAltTab,AltTabAndMenuand

AltTabMenuDismiss. Hotkey.

: .,, ,,,., run_notepad #n Run :

run_notepad:

#n::

RunNotepad

return

: ,.,: Gosub,:

gosubLabel1

Label1:

MsgBox%A_ThisLabel%

return

Page 381: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, ., Return Exit.,Goto.

Page 382: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(%MyLabel%),.,,"".

Page 383: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Goto,Gosub., ,.,(::).

Page 384: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, Continue Break..

Page 385: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Functions

[v1.1.20], ,:

GuiGuiClose

Gui(g-)

SetTimer

,(GUI),.

Page 386: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsLabel(),A_ThisLabel,Gosub,Goto,OnExit,SetTimer,Hotkey,Gui,g,

OnClipboardChange

Page 387: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

; ,SetTimer, GUI..

AutoHotkey,:,, () .,,.

,,,., ErrorLevel SendMode,( ).

: KeyHistory/, ListHotkeys/.

MsgBox,InputBox,FileSelectFile FileSelectFolder.( ,,)

.

, . #MaxThreadsPerHotkey.

Page 388: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

( ,,).,,( GUI),.,,

Critical.

0.,:

1) SetTimer.

2) Hotkey.

3) #Hotstring.

4) Menu.

5)<a10>Thread</a10><e11></e11>.

, OnExit().

Page 389: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DBGp,DGBpUI. .AutoHotkeyUI"".

Page 390: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SciTE4AutoHotkey

SciTE4AutoHotkey SciTEAutoHotkey.DBGp,

AutoHotkey,,,.

:

.

,//.

.

.

.

.

.

http://fincs.ahk4.net/scite4ahk/

Page 391: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

XDebugClient

XDebugClient .NETFramework2.0DBGp.XDebugClient

XdebugPHP,AutoHotkey.

:

"php".

AutoHotkey.

, .

,AutoHotkeyXDebugClient.

: ;( SharpDevelop,DockpanelSuite AdvancedTreeview.)

:

XDebugClient.

AutoHotkey/Debug.XDebugClient.

.

F5.

,.

:

.

.

,//.

.

Page 392: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-,,.

:

.

.

Page 393: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Notepad++DBGp

Notepad++DBGp.PHP,AutoHotkey.

: DBGppluginforNotepad++.

:

Notepad++.

,DBGp,... DBGp

: ., (windows) .

,DBGp,.

.

.

AutoHotkey/Debug.

.

:

.

.

,//,,.

/.

.

.

.

Page 394: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-,...,.

:

-,"a""a""a".

,.

Notepad++,.,AutoHotkey.

Page 395: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GitHubDBGp.

dbgp_console.ahk:.

dbgp_test.ahk:.

dbgp_listvars.ahk:.

GitHub:Lexikos/dbgp

DebugVars().dbgp.ahk.

GitHub:Lexikos/DebugVars

Page 396: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

xdebug.org,DBGp.

Page 397: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DBGp,AutoHotkey., Xdebug:.

Page 398: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey ,:

.

.

().

"".,,., x:=y ,.

IsObject:

Result:=IsObject(expression)

:

-.

-/.

-Func, .

ComObject-IDispatch(COM"").

Page 399: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-,,,,

-,,

-,,,

-,,

-,

Page 400: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

Array:=[Item1,Item2,...,ItemN]

Array:=Array(Item1,Item2,...,ItemN)

:

Value:=Array[Index]

:

Array[Index]:=Value

:

Array.InsertAt(Index,Value,Value2,...)

:

Array.Push(Value,Value2,...)

:

Page 401: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RemovedValue:=Array.RemoveAt(Index)

:

RemovedValue:=Array.Pop()

, MinIndex MaxIndex/Length.1,MaxIndex.,

MaxIndexLength0 For.:

array:=["one","two","three"]

;1:

Loop%array.Length()

MsgBox%array[A_Index]

;:

Forindex,valueinarray

MsgBox%"Item"index"is'"value"'"

,.,,.:

Array:={KeyA:ValueA,KeyB:ValueB,...,

KeyZ:ValueZ}

Array:=Object("KeyA",ValueA,"KeyB",ValueB,

...,"KeyZ",ValueZ)

{key:value} ,,.,,., {(KeyVar):

Value} {GetKey():Value} .

Page 402: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

Value:=Array[Key]

:

Array[Key]:=Value

:

RemovedValue:=Array.Delete(Key)

:

array:={ten:10,twenty:20,thirty:30}

Forkey,valueinarray

MsgBox%key%=%value%

- {1:"a",1000:"b"} ,1000.

,.,v1.x., [] ,AutoHotkey,.

, Object.LiteralKey ,, LiteralKeyObject.,,

[v1.1.09+],ASCII., match.Pos match["Pos"] arr.1

arr[1] ..

Page 403: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

:

Value:=Object.Property

:

Object.Property:=Value

:

ReturnValue:=Object.Method(Parameters)

:

ReturnValue:=Object[MethodName](Parameters)

COM:

Value:=Object.Property[Parameters]

Object.Property[Parameters]:=Value

: ,,Func,COM

:

x.y[z]() x["y",z]() ,., (x.y)[z]() x.y ,

Page 404: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. x.y[z].Call() , (x.y[z]).Call()

.,.,.:

obj:={};.

obj:="";,.

,,.,.

arr:=[{}];.

arr[1]:={};,.

arr.RemoveAt(1);.

,,., x.child y y.parent x , x y

,,.,.

x:={},y:={};.

x.child:=y,y.parent:=x;.

y.parent:="";.

x:="",y:="";,.

, .

Page 405: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()().

,:

===!=<> ,.

true, ifobj ,!obj obj?x:y .

& . .

,., MsgBox%object% MsgBox object+1 .,

.

,.,:

obj.item(x):=y

obj.item[x]:=y

x.y+=1 --arr[1] .

[v1.1.20+]:gettingsetting., x[,2] . .,

x[](a) .__Call ,., x.(a) , x[""](a) .COM

,"".

[] ,{} new :

.AutoHotkey32-21474836482147483647.AutoHotkey

64,AutoHotkey64.

,., x[0x10] ,x[16] x[00016] ..

Page 406: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

v1.x, x[1] x["1"] .,( "0x"x ),.

,, x[1] x[y:="1"] .v2,.

-.v1.x,,( 0+1.0 Sqrt(y) ) .,

.

,"base" ,.,,.( ObjRawSet(Object,

"base","") Object.SetCapacity("base",0) ),

"base".

,,"Length",obj.Length().(, ObjLength).

Page 407: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.00+]

func,: %func%() func.() .,,.,:

Func:=Func("MyFunc")

:

RetVal:=%Func%(Params);v1.1.07+

RetVal:=Func.Call(Params);v1.1.19+

RetVal:=Func.(Params);

, .

AutoHotkey"".,,.,

table[x][y]:=content;A

table[x,y]:=content;B

table[x] , A B:

A B table[x] .

table base ,:

Page 408: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

table.base.__Get(table,x)[y]:=content;

A

table.base.__Set(table,x,y,content);

B

, B.

table[a,b,c,d]:=value :

,.:

.

,.

,.

,.

,COMCOM.

.:

array:=[Func("FirstFunc"),

Func("SecondFunc")]

;,"foo":

Loop2

array[A_Index].Call("foo")

;,:

Loop2

array[A_Index]()

Page 409: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FirstFunc(param){

MsgBox%A_ThisFunc":"(IsObject(param)?

"object":param)

}

SecondFunc(param){

MsgBox%A_ThisFunc":"(IsObject(param)?

"object":param)

}

, array[A_Index] , array.,

array[A_Index] array.base[A_Index] , array.

Page 410: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. ("""").,., .

,:

classbaseObject{

staticfoo:="bar"

}

;

baseObject:={foo:"bar"}

, base new :

obj1:=Object(),obj1.base:=baseObject

obj2:={base:baseObject}

obj3:=newbaseObject

MsgBox%obj1.foo""obj2.foo""obj3.foo

base ,.

base .,:

;.

thing:={}

;.

thing.foo:="bar"

;.

thing.test:=Func("thing_test")

Page 411: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.

thing.test()

thing_test(this){

MsgBox%this.foo

}

thing.test() , thing.,,()().,

"".

, :

other:={}

other.base:=thing

other.test()

, other thing foo test., thing.foo , other.foo

. other.foo , other thing.foo other.foo .

other.test() , other thing.

[v1.1.00+]

,"". , .,"Class":

classClassNameextendsBaseClassName

{

InstanceVar:=Expression ;()

staticClassVar:=Expression ;()

classNestedClass ;

{

Page 412: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

...

}

Method() ;,

{

...

}

Property[] ;,

{

get{

return...

}

set{

return...:=value ;value

,

}

}

}

,(v1.1.05, ) ClassName.v1.1.05,, ,,

globalClassName . extendsBaseClassName ,

BaseClassName(v1.1.11,). object.__Class .

,"class" class .

,.

InstanceVariables() [v1.1.01+]

instancevariable()., this. ():

InstanceVar:=Expression

Page 413: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

new. __Init ,. __New(),. this ,.

,;, this.InstanceVar .

[v1.1.08+]: x.y:=z , x ., x:={},x.y:=42

x this.x.y .

Static/ClassVariables(/) [v1.1.00.01+]

/,().,static:

staticClassVar:=Expression

.. .

,;, ClassName.ClassVar:=Value . x ClassName,

x"ClassVar", x.ClassVar ClassName.ClassVar .

, x.ClassVar:=y x, ClassName.

[v1.1.08+]: x.y:=z , x .: staticx:={},x.y:=42

x ClassName.x.y .

NestedClasses()

., classNestedClass ClassName.NestedClass .

( newthis.NestedClass ).

classNestedClass

{

...

Page 414: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

. this ,.,,. .

Method()

{

...

}

, base ., base.Method() BaseClassName Method

. ;, base.Method()

BaseClassName.Method.Call(this) .,

base.Method() , this sub-class.

base.Method() this ().

base . [] , obj:=base,obj.Method() .

base,. base, #NoEnv.

Properties() [v1.1.16+]

.

Property[]

{

get{

return...

}

set{

Page 415: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return...:=value

}

}

Property,., obj.Property get, obj.Property:=

value set. get set, this . set,value .

,.,-,ByRef.

get set,., val:=obj.Property:=42 set val .

., base.Property . get set,. set,,

,.

get set,( this ).

Meta-functions() ,,.

new [v1.1.00+] , __New .,

__Delete .:

m1:=newGMem(0,20)

m2:={base:GMem}.__New(0,30)

classGMem

{

__New(aFlags,aSize)

{

this.ptr:=DllCall("GlobalAlloc",

"uint",aFlags,"ptr",aSize,"ptr")

Page 416: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

if!this.ptr

return""

MsgBox%"NewGMemof"aSize"bytes

ataddress"this.ptr"."

returnthis;'new'.

}

__Delete()

{

MsgBox%"DeleteGMemataddress"

this.ptr"."

DllCall("GlobalFree","ptr",this.ptr)

}

}

__Delete"__Class". Classobjects() .

(Meta-Functions)

:

classClassName{

__Get([Key,Key2,...])

__Set([Key,Key2,...],Value)

__Call(Name[,Params...])

}

:

MyGet(this[,Key,Key2,...])

MySet(this[,Key,Key2,...],Value)

MyCall(this,Name[,Params...])

ClassName:={__Get:Func("MyGet"),__Set:

Page 417: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Func("MySet"),__Call:Func("MyCall")}

., obj.key , __Get., obj.key:=value

__Set obj.key() __Call.() obj.base ,obj.base.base

.

,,:

,. return ,()..

Set:,., a.x:=b.y:=z . z ().

.

[v1.1.16+]:, get set(),., get.

,().,,.

, set( set).

get set,.,,.

,

Get:.

Call:,( this ). .

return ,.__Set, .

,:

Get:"base",.

Page 418: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Set:"base",().

Call: .

,

Get Call.

Set:,.,,.( .)

:

return return"" , return "".()

Exit.

,,. __Get __Set.

,""().,.,,().,.

__Get __Set."Color",R,G,BRGB,RGB

:

red:=newColor(0xff0000),red.R-=5

cyan:=newColor(0),cyan.G:=255,cyan.B:=

255

MsgBox%"red:"red.R","red.G","red.B"=

"red.RGB

MsgBox%"cyan:"cyan.R","cyan.G","cyan.B

"="cyan.RGB

classColor

Page 419: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

__New(aRGB)

{

this.RGB:=aRGB

}

staticShift:={R:16,G:8,B:0}

__Get(aName)

{

;: this.Shift!this.Shift

__Get.

shift:=Color.Shift[aName];

shift.

if(shift!="");.

return(this.RGB>>shift)&0xff

;: 'return'this.RGB.

}

__Set(aName,aValue)

{

if((shift:=Color.Shift[aName])!=

"")

{

aValue&=255;.

;RGB.

this.RGB:=(aValue<<shift)|

(this.RGB&~(0xff<<shift))

;'Return'.

;'x:=clr[name]:=val''x'

:

returnaValue

}

;NOTE:'return'this._RGB

this.RGB.

Page 420: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

;:

RGB{

get{

;:

returnformat("0x{:06x}",

this._RGB)

}

set{

returnthis._RGB:=value

}

}

}

, ,.,().

, .

,. ,,.

blue:=newColor(0x0000ff)

MsgBox%blue.R","blue.G","blue.B

classPropertiesextendsFunctionObject

{

Call(aTarget,aName,aParams*)

{

;.

ifObjHasKey(this,aName)

returnthis[aName].Call(aTarget,

aParams*)

}

Page 421: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

classColor

{

__New(aRGB)

{

this.RGB:=aRGB

}

class__GetextendsProperties

{

R(){

return(this.RGB>>16)&255

}

G(){

return(this.RGB>>8)&255

}

B(){

returnthis.RGB&255

}

}

;...

}

table[x,y]:=content ,,. __Set ,.

x:={base:{addr:Func("x_Addr"),__Set:

Func("x_Setter")}}

;,x_Setter.

x[1,2,3]:="..."

;.

Page 422: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox%x[1,2,3]"`n"x.addr()"`n"

x[1].addr()"`n"x[1,2].addr()

x_Setter(x,p1,p2,p3){

x[p1]:=newx.base

}

x_Addr(x){

return&x

}

x_Setter ,.,:

x[1] , x_Setter(x,1,2,3) ( "..." ).

x[1] x .

–.

x[1][2] , x_Setter(x[1],2,3,"...") .

x[1][2] x[1] .

–.

x[1][2][3] , x_Setter ( x[1][2],3,"..." ),

.

Page 423: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .,/. .base ;, "".base . "".base:=

Object() set, "".base.base:=Object() .

set,__Set,.,;, .

"".base.__Set:=

Func("Default_Set_AutomaticVarInit")

empty_var.foo:="bar"

MsgBox%empty_var.foo

Default_Set_AutomaticVarInit(ByRefvar,key,

value)

{

if(var="")

var:=Object(key,value)

}

"".

"".base.__Get:=

Func("Default_Get_PseudoProperty")

"".base.is:=Func("Default_is")

MsgBox%A_AhkPath.length"=="

StrLen(A_AhkPath)

Page 424: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox%A_AhkPath.length.is("integer")

Default_Get_PseudoProperty(nonobj,key)

{

if(key="length")

returnStrLen(nonobj)

}

Default_is(nonobj,type)

{

ifnonobjis%type%

returntrue

returnfalse

}

,:

"".base.length:=Func("StrLen")

MsgBox%A_AhkPath.length()"=="

StrLen(A_AhkPath)

,:

"".base.__Get:="".base.__Set:=

"".base.__Call:=Func("Default__Warn")

empty_var.foo:="bar"

x:=(1+1).is("integer")

Default__Warn(nonobj,p1="",p2="",p3="",

p4="")

{

Page 425: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListLines

MsgBoxAnon-objectvaluewasimproperly

invoked.`n`nSpecifically:%nonobj%

}

Page 426: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,AutoHotkey., .

AutoHotkeyv1.1,()., Fn(&{}) , {} , .

, __Delete.

:

.: .

,..

,, __Delete.,,.

(:,..)

DllCall. address:=&object ;,, . ,

.,().:

;#1:.

address:=&object

ObjAddRef(address)

;#2:Object(),.

address:=Object(object)

Page 427: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

object:=Object(address)

,:

;:

ObjRelease(address)

,ObjAddRefObjRelease,.

, x:=address ,ObjAddRef.

, x( x),ObjRelease.

,Object(), COM File.

Page 428: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey_LAutoHotkey_L,"AutoHotkey1.1".

: ,.

BreakLoopLabel .

ContinueLoopLabel ,.

Forx,yinz .

LoopUntil ..

Try...Catch...Finally .

Throw .

FileEncodingFileRead,FileReadLine,LoopRead,FileAppendFileOpen.:

Gui GUI.

IniRead/Write/Delete ,,.

Menu,Icon .

Run .

SendInput{U+nnnn} Unicode.UnicodeUnicode.

SendLevel .

SetFormat,IntegerFast,h|H .

SetRegView,RegView 3264,.

Transform,HTML HTML.

Page 429: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGet,...,ProcessPath .

#Ifexpression #IfWinActive,.

#IfTimeout #If.

#MenuMaskKey WinAltkeyup.

#Include<Lib> .

#InputLevel .

#Warn .

ComObjActive--ComObjActiveComObjEnwrap/UnwrapComObjParameterComObjType

COM./COM..COM.

ComObjArray COMSAFEARRAY.

ComObjConnect COM.

ComObjCreate COM.

ComObjError COM.

ComObjFlags COM.

ComObjGet COM.

ComObjQuery COM.

ComObjType COM.

ComObjValue COM.

Exception Throw().

FileOpen I/O.

Func .

Page 430: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetKeyName/VK/SC ,,.

InStr ,.

IsByRef ByRef.

IsObject .

StrPut/StrGet ,.

Trim /.

RegEx(?CNum:Func) .

"" #Include<LibName> .

.

.

.

.

.

. FileOpen.

Func .

ComObject ComObj.

A_Is64bitOS 641(),320().

A_IsUnicode Unicode,1( true).ANSI,false.

A_FileEncoding , FileEncoding.

A_OSVersion Windows7Windows8, A_OSVersion.

A_PriorKey ... ()

A_PtrSize ,.4(32)8(64).

Page 431: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_RegView SetRegView.

A_ScriptHwnd ID(HWND/).

Ptr 32 Int64 Int64. DllCall,NumPut NumGet.

AStr,WStr DllCall, .

Unicode

Compatibility DllCallUnicode.

Unicode.

SendInput SendInputUnicode.

ahk_exe (EXE).

().

Try/catch/throwA_LastError.

GUI Gui.

.

.

AutoHotkey_L.

Page 432: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

try/catchErrorLevel.:

try

{

FileCopy,file1.txt,C:\folder

FileDelete,C:\folder\old.txt

}

catch

MsgBoxAnerroroccured!

, A_LastError:FileAppend,FileRead,FileReadLine,FileDelete,

FileCopy,FileMove,FileGetAttrib/Time/Size/Version,FileSetAttrib/Time,

FileCreateDir,RegRead,RegWrite,RegDelete.

Page 433: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%A_MyDocuments%\AutoHotkey\Lib AutoHotkey,

%A_ScriptDir%\Lib ""., .

#Include<LibName>.

Page 434: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI

Gui:

GUI HWND 199.

Gui,NewGUI.

GUI.

GUI: +HwndOutputVar,+ParentGUI

GUI: +Owner%HWND%.

Gui,Font.

InternetExplorerWebBrowser ActiveX.

GuiControlGet,OutputVar,NameGUI.

GuimenusCtrl+O.

Font.

Page 435: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.:

Sleep500

MsgBox%Time()"mssincethescriptstarted."

Time(){

staticTick:=A_TickCount

returnA_TickCount-Tick

}

Page 436: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileRead,FileReadLine,LoopRead FileAppendWindows,

ANSI. FileEncoding,FileReadFileAppend:

FileRead,OutputVar,*PnnnFilename

FileAppend[,Text,Filename,Encoding]

nnn , Encoding FileEncoding.

:

Page 437: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .

Page 438: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,.17,,,.

.,ahk.

Menu,Tray,Icon,%A_AhkPath%,-160

Page 439: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey1.0AutoHotkey1.1,.(DllCall),.

AutoHotkey1.1"AutoHotkey_L",AutoHotkey1.0"AutoHotkey

Basic".AutoHotkey_L1.0.*,,AutoHotkey.

: Unicode,AutoHotkey_LANSI.

:

FileRead

[,]?

DPIGUI

:

Transform UnicodeUnicode

AutoHotkey.ahkAutoHotkey.ini

SetFormat,Integer,H

A_LastError

MsgBox

Gui+Owner

SoundSetSoundGetVista

Page 440: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

~

x&y:: x:: xup:: x.

:

Ifvaristype

GroupActivateErrorLevelGroupAdd Label

RunRunWait Target

Control-Z

A_IsCompiled

`t

UnicodeANSI

VarSetCapacity

DllCall

NumPut/NumGet

Page 441: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey_LAutoHotkeyBasic.,.AutoHotkey_L,

:

,tab., MsgBox<foo If!foo .

Hotkey,IfSomething , Something.

.:

: Gui,GuiShow GuiControl.

GroupAdd. .

Gui +LastFoundExist, +LastFound.

AutoHotkey_L:

( , 12(34) .

FileRead

FileRead,., *c FileOpen.

[ ,] ? ,., ? ( ). .

:

Page 442: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,,.

( Array%n% , n),.

(,,),.

DPI

DPIGUI, DPI .,DPI96(100%),Gui.

DPIScale DPI.

Transform

AutoHotkey_LUnicode Transform:

Transform,Unicode.Unicode,.: StrPut/StrGet.

Transform,HTML.

AutoHotkey_L,.ahk.ini.., .

SetFormat,Integer[Fast],H

H,A-F.AutoHotkeyBasic. SetFormat.

A_LastError

A_LastError:FileAppend,FileRead,FileReadLine,FileDelete,FileCopy,

FileMove,FileGetAttrib/Time/Size/Version,FileSetAttrib/Time,FileCreateDir,

Page 443: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegRead,RegWrite,RegDelete.A_LastError.

MsgBox

MsgBox,.,MsgBox.,.:

;()()

; ():

MsgBox%x,y

;:

MsgBox%(x,y)

;"0,Title":

MsgBox0,Title

;AutoHotkey_LAutoHotkeyBasic:

MsgBox0,Title,%"";

MsgBox0`,Title;"0,Title"

;",Title":

MsgBox,,Title

Gui+Owner

Gui +OwnerWS_CHILDWS_POPUP. +Owner

Gui.

WindowsVistaSound

SoundSet,SoundGet,SoundSetWaveVolume SoundGetWaveVolume

WindowsVista. :

Page 444: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

().

__.

~

v1.1.14, .

Down/Up

,,., x&y:: x:: xup:: x, x:: .

Ifvaristype

Ifvaristype StringCaseSense,Locale.

GroupActivateErrorLevel1,0.ErrorLevel.

GroupAdd Label. ., GroupActivateErrorLevel.

Run/RunWait

AutoHotkey_L Run RunWait Target.,AutoHotkey

Basic.:

Target,,.

.exe,.bat,.com,.cmd.hta..ahk,.vbs.lnk,""

(wordpad.exe).

Page 445: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Control-Z

LoopRead FileReadLineControl-Z(0x1A).Control-Z,,

. FileRead,.

EXE Windows95,98/MENT4,.Windows,

AutoHotkey_L.Windows9598/ME MsgBox

%A_OSVersion% WIN_NT4 .

A_IsCompiled

A_IsCompiled.,( A_IsCompiled:=1 )..

( `t ` )., StringReplaces,s,`t , stab.

Page 446: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

UnicodeANSI

(textvalue)( string),(sequence) .(bytes)AutoHotkey:

Unicode ANSI.:

DllCall.

PostMessage/SendMessage.

NumPut/NumGet.

VarSetCapacity.

AutoHotkey.,AutoHotkeyBasicAutoHotkey_LANSI

,Unicode.,:

MsgBox%A_IsUnicode?"Unicode":"ANSI"

ANSI:(8).127.

Unicode:(16). UTF-16.

: ,Unicode 16,""., ANSI( ).,("

").

VarSetCapacity

VarSetCapacity, .,.:

VarSetCapacity(ansi_var,capacity_in_chars)

VarSetCapacity(unicode_var,capacity_in_chars*

Page 447: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

2)

VarSetCapacity(native_var,capacity_in_chars*

(A_IsUnicode?2:1))

VarSetCapacity(native_var,

t_size(capacity_in_chars));

VarSetCapacity:

1. ., VarSetCapacity(var,1000) 1000,

AutoHotkey_LUnicode500.,.

2. .,.,AutoHotkey_LUnicodeANSI.,

().

DllCall

"Str",.,:

C/Win32 Encoding

WStr 16- wchar_t*,WCHAR*,LPWSTR,LPCWSTR UTF-16

AStr 8- char*,CHAR*,LPSTR,LPCSTR ANSI(ANSI)

Str -- TCHAR*,LPTSTR,LPCTSTR Unicode WStrANSI AStr.

"Str",,.,"AStr""WStr".

: "AStr""WStr".

,DllCall,:

Page 448: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1. Unicode(W)ANSI(A),.,"DeleteFile"

"DeleteFileA""DeleteFileW"."DeleteFile",DllCall"A"

"W".

DllCall("DeleteFile","Ptr",&filename)

DllCall("DeleteFile","Str",filename)

, &filename ,"Str".AutoHotkeyBasic"UInt"

"Ptr",64.

: ,AutoHotkey_LDLL"A""W".,AutoHotkey

BasicUser32.dll,Kernel32.dll,ComCtl32.dllGdi32.dll"A"

.

2. ,:

DllCall("DeleteFileA","AStr",filename)

DllCall("DeleteFileW","WStr",filename)

3. (), .,; StrPut.

NumPut/NumGet

NumPutNumGet,.:

;8/ANSI:size_of_char=1

type_of_char="Char"

;16/UTF-16:size_of_char=2

type_of_char="UShort"

nth_char:=NumGet(var,(n-1)*size_of_char,

Page 449: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

type_of_char)

NumPut(nth_char,var,(n-1)*size_of_char,

type_of_char)

var , A_IsUnicode .

nth_char:=NumGet(var,t_size(n-1),t_char())

NumPut(nth_char,var,t_size(n-1),t_char())

;:

t_char(){

returnA_IsUnicode?"UShort":"Char"

}

t_size(char_count=1){

returnA_IsUnicode?char_count*2:

char_count

}

Page 450: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

32(AutoHotkeyBasic)4648.DllCall.

:

.

.

DllCall,NumPut NumGet.

, A_PtrSize.DllCall,NumPutNumGet, Ptr.

.(HWNDHBITMAP).

/*

typedefstruct_PROCESS_INFORMATION{

HANDLEhProcess;//Ptr

HANDLEhThread;

DWORDdwProcessId;//UInt(4)

DWORDdwThreadId;

}PROCESS_INFORMATION,

*LPPROCESS_INFORMATION;

*/

VarSetCapacity(pi,A_PtrSize*2+8);Ptr+Ptr

+UInt+UInt

DllCall("CreateProcess",<> ,"Ptr",&pi,

<omitted>)

hProcess:=NumGet(pi,0);

"Ptr".

hThread:=NumGet(pi,A_PtrSize);

dwProcessId:=NumGet(pi,A_PtrSize*2,

"UInt")

dwProcessId:=NumGet(pi,A_PtrSize*2+4,

Page 451: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"UInt")

Page 452: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ClipWait, .

ClipWait[,SecondsToWait,1]

SecondsToWait

,.,( ).00.5.

1

,,("").1( ),.

ErrorLevel

, ErrorLevel1.(),ErrorLevel0.

.,.

(HTML).,Control-C,.(%clipboard%),

(). .

1,. ClipboardAll.

, , .

Page 453: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Clipboard,WinWait,KeyWait

clipboard=;

Send,^c

ClipWait,2

ifErrorLevel

{

MsgBox,Theattempttocopytextontothe

clipboardfailed.

return

}

MsgBox,clipboard=%clipboard%

return

Page 454: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvGet [v1.0.43.08+]

.

EnvGet,OutputVar,EnvVarName

OutputVar

.

EnvVarName

.: EnvGet,OutputVar,Path .

, OutputVar.

32KB.

EnvSet,#NoEnv,,EnvUpdate,SetEnv,Run,RunWait

EnvGet,OutputVar,LogonServer

Page 455: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvSet.

EnvSet,EnvVar,Value

EnvVar

,"COMSPEC""PATH".

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

32KB.

Run RunWait. .

SetEnv, .32KB.

Page 456: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvGet,#NoEnv,,EnvUpdate,SetEnv,Run,RunWait

EnvSet,AutGUI,Sometexttoputinthevariable.

Page 457: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvUpdate.

EnvUpdate

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

..

,,EnvUpdate

:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session

EnvSet,RegWrite

EnvUpdate

Page 458: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnClipboardChange()OnClipboardChange()..

A_EventInfo:

0;

1( );

2,.

.ToolTip.

#Persistent

return

OnClipboardChange:

ToolTipClipboarddatatype:%A_EventInfo%

Sleep1000

ToolTip;.

return

Page 459: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnClipboardChange() [v1.1.20+]

.

OnClipboardChange(Func[,AddRemove])

Func

. .

AddRemove

:

1():.

-1:.

0:.

OnClipboardChange,.

Func

FunctionName(Type)

Type

:

0;

Page 460: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1( );

2,.

OnClipboardChange,.,.

,.

#Persistent

OnClipboardChange("ClipChanged")

return

ClipChanged(Type){

ToolTipClipboarddatatype:%Type%

Sleep1000

ToolTip;.

}

Page 461: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnClipboardChange,., Critical.OnClipboardChange,/

().

,OnClipboardChange;. Sleep20 OnClipboardChange.

Clipboard,OnExit,OnMessage(),RegisterCallback()

Page 462: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SysGet,,.

SysGet,OutputVar,Sub-command[,Param3]

OutputVar

.

Sub-command

.

Param3

,.

MonitorCount:.SM_CMONITORS, MonitorCount,.

MonitorPrimary:,1.

Monitor[,N]: N( N,). OutputVar. N,.:

SysGet,Mon2,Monitor,2

MsgBox,Left:%Mon2Left%--Top:%Mon2Top%--

Right:%Mon2Right%--Bottom%Mon2Bottom%.

Page 463: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,, Mon2( ,).,, .

MonitorWorkArea[,N]:,.

MonitorName[,N]: N( N,).

() : Sub-command."MouseButtonCount": SysGet,

MouseButtonCount,43 .

80 SM_CMONITORS:("").

43 SM_CMOUSEBUTTONS:(0).

16,17 SM_CXFULLSCREEN,SM_CYFULLSCREEN:,.

61,62 SM_CXMAXIMIZED,SM_CYMAXIMIZED:,.

59,60 SM_CXMAXTRACK,SM_CYMAXTRACK:,...

28,29 SM_CXMIN,SM_CYMIN:,.

57,58 SM_CXMINIMIZED,SM_CYMINIMIZED:,.

34,35

SM_CXMINTRACK,SM_CYMINTRACK:,..WM_GETMINMAXINFO.

0,1 SM_CXSCREEN,SM_CYSCREEN:,. A_ScreenWidth A_ScreenHeight.

78,79

SM_CXVIRTUALSCREEN,SM_CYVIRTUALSCREEN:,..SM_XVIRTUALSCREEN,SM_YVIRTUALSCREEN.

Page 464: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

19 SM_MOUSEPRESENT:,.

75 SM_MOUSEWHEELPRESENT:,.

63 SM_NETWORK:,. .

8193 SM_REMOTECONTROL:. ;.

4096 SM_REMOTESESSION:. ,.

70 SM_SHOWSOUNDS:,.

8192 SM_SHUTTINGDOWN:,. Windows2000:

23 SM_SWAPBUTTON:,.

76,77

SM_XVIRTUALSCREEN,SM_YVIRTUALSCREEN:..,theSM_CXVIRTUALSCREEN,SM_CYVIRTUALSCREEN().

56 SM_ARRANGE:.MSDN.

67

SM_CLEANBOOT::01-2-

5,6

SM_CXBORDER,SM_CYBORDER:,.3D,SM_CXEDGE.

13,14 SM_CXCURSOR,SM_CYCURSOR:,..

36,37 SM_CXDOUBLECLK,SM_CYDOUBLECLK:,..(.)

68,69 SM_CXDRAG,SM_CYDRAG:,...

Page 465: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

45,46

SM_CXEDGE,SM_CYEDGE:3D,.SM_CXBORDERSM_CYBORDER3D.

7,8

SM_CXFIXEDFRAME,SM_CYFIXEDFRAME(SM_CXDLGFRAME,SM_CYDLGFRAME):,.SM_CXFIXEDFRAME,SM_CYFIXEDFRAME.

83,84

SM_CXFOCUSBORDER,SM_CYFOCUSBORDER:,.Windows2000:0.

21,3 SM_CXHSCROLL,SM_CYHSCROLL:,;,.

10 SM_CXHTHUMB:,.

11,12 SM_CXICON,SM_CYICON:,.

38,39

SM_CXICONSPACING,SM_CYICONSPACING:,..SM_CXICONSM_CYICON.

71,72 SM_CXMENUCHECK,SM_CYMENUCHECK:,.

54,55 SM_CXMENUSIZE,SM_CYMENUSIZE:,,.

47,48

SM_CXMINSPACINGSM_CYMINSPACING:,..SM_CXMINIMIZEDSM_CYMINIMIZED.

30,31 SM_CXSIZE,SM_CYSIZE:,.

32,33

SM_CXSIZEFRAME,SM_CYSIZEFRAME:,.SM_CXSIZEFRAME,SM_CYSIZEFRAME.SM_CXFRAMESM_CYFRAME.

49,50 SM_CXSMICON,SM_CYSMICON:,..

52,53 SM_CXSMSIZESM_CYSMSIZE:,.

2,20 SM_CXVSCROLL,SM_CYVSCROLL:,;,.

Page 466: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

4 SM_CYCAPTION:,.

18 SM_CYKANJIWINDOW:,Kanji,.

15 SM_CYMENU:,.

51 SM_CYSMCAPTION:,.

9 SM_CYVTHUMB:,.

42 SM_DBCSENABLED:User32.dllDBCS;.

22 SM_DEBUG:User.exe;.

82

SM_IMMENABLED:/;.

SM_IMMENABLEDUnicodeUnicode.,SM_DBCSENABLEDANSI.ANSIUnicode,,.

87 SM_MEDIACENTER:WindowsXPMediaCenterEdition,.

40 SM_MENUDROPALIGNMENT:;.

74 SM_MIDEASTENABLED:,.

41 SM_PENWINDOWS:MicrosoftWindowsforPencomputing;.

44 SM_SECURE:;.

81 SM_SAMEDISPLAYFORMAT:,..,,,.

86 SM_TABLETPC:WindowsXPTabletPC,.

A_ScreenWidth A_ScreenHeight,.

Page 467: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DllCall,WinGet

;#1:

SysGet,MouseButtonCount,43

SysGet,VirtualScreenWidth,78

SysGet,VirtualScreenHeight,79

;#2::

SysGet,MonitorCount,MonitorCount

SysGet,MonitorPrimary,MonitorPrimary

MsgBox,MonitorCount:`t%MonitorCount%`nPrimary

Monitor:`t%MonitorPrimary%

Loop,%MonitorCount%

{

SysGet,MonitorName,MonitorName,%A_Index%

SysGet,Monitor,Monitor,%A_Index%

SysGet,MonitorWorkArea,MonitorWorkArea,

%A_Index%

MsgBox,

Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`

t%MonitorLeft%(%MonitorWorkAreaLeft%

work)`nTop:`t%MonitorTop%(%MonitorWorkAreaTop%

work)`nRight:`t%MonitorRight%

(%MonitorWorkAreaRight%

work)`nBottom:`t%MonitorBottom%

(%MonitorWorkAreaBottom%work)

}

Page 468: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DllCall()DLL,WindowsAPI.

Result:=DllCall("[DllFile\]Function"[,Type1,

Arg1,Type2,Arg2,"CdeclReturnType"])

Result

DllCall.,. ,().

[DllFile\]Function

DLLEXE,.: "MyDLL\MyFunction" (".dll").,

DllFilePATH A_WorkingDir.

User32.dll,Kernel32.dll,ComCtl32.dllGdi32.dll DllFile.,

"User32\IsWindowVisible" "IsWindowVisible" .

,AutoHotkeyA(ANSI)W(Unicode).

, "MessageBox" ANSI "MessageBoxA" Unicode

"MessageBoxW" .

DLL DLL .

1.0.46.08+,. COM RegisterCallback().

Type1,Arg1

Page 469: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.. Type,, Arg,.

CdeclReturnType

Cdecl"C"(wsprintf).Cdecl ErrorLevelAn

( n), Cdecl.C++ thiscall.

, Cdecl(),tab.: "CdeclStr" .

[AHK_L53+]:64"C",AutoHotkey64 Cdecl.

ReturnType:32(Int),BOOL, ReturnType.,

. .

Str

"Blue"MyVar,,., MyVar: DllCall("CharUpper","Str",MyVar) .

,,. VarSetCapacity(MyVar,123) ,123 MyVar.

Str(i+1) .,ErrorLevel-2.

"Str*"."TCHAR**""LPTSTR*".

:, .

AStrWStr [AHK_L42+]:ANSIUnicode( ). Win32.

Int64 64,-9223372036854775808(-0x8000000000000000)9223372036854775807(0x7FFFFFFFFFFFFFFF).

Page 470: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Int

32(),-2147483648(-0x80000000)2147483647(0x7FFFFFFF).Int"Long".

BOOLInt(BOOL10).

(UInt),DWORD.

Short 16,-32768(-0x8000)32767(0x7FFF). (UShort)WORD.

Char 8,-128(-0x80)127(0x7F). (UChar)BYTE.

Float 32,6.

Double 64,15.

Ptr

[AHK_L42+]:,3264IntInt64. Ptr(RECT*LPPOINT)(HWND,HBRUSHHBITMAP).(LPDWORDint*),*P"Ptr".

Ptr*P;LPVOID*.

UPtr,32,AutoHotkey64.

AutoHotkey,:

Ptr:=A_PtrSize?"Ptr":"UInt";

A_PtrSize,UInt.

DllCall("DeleteFile",Ptr,&filename);

Ptr.

: NULL,0.

()().,,.,MyVarMyFunction,MyVarMyFunction: DllCall("MyDll\MyFunction","Int*",MyVar) .

Page 471: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

*P()

,"LP".LPDWORD,DWORD.DWORD32,"UInt*""UintP"LPDWORD.(LPTSTR),(LPRECT);,

:"Char*" "Str","Char*"8, "Str",AutoHotkey8(ANSI)16(Unicode),,"UInt*"32,32.

AutoHotkey,, VarSetCapacity,DllCall.

U()

U(UInt64,UInt,UShortUChar)., ,(Int64).

,.,-1UInt,0xFFFFFFFF.

64.,0x8000000000000000,U.,UInt64Int64-1,0xFFFFFFFFFFFFFFFF.

:,., Str "Str" CDecl "CDecl" ,,P

.: UIntP .

ErrorLevel

[v1.1.04+]., .

ErrorLevel.

0:.

-1(1): [DllFile\]Function..

-2: . (str).

Page 472: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-3: DllFile, DllFile,PATH A_WorkingDir.,

AutoHotkey32DLL64,.

-4:DLL.

N():, N(,0xC0000005"").(), .,

NULL. Cdecl "An",.

An(A n):,." n". n,(), CDecl.

n,..,.x64,64ErrorLevel An.

A_LastError

,DllCall.(),.,, "str",( str),

.

A_LastErrorGetLastError(),().A_LastError0

4294967295(). ErrorLevel,A_LastError;

Run/RunWaitA_LastError.

DLL,( DLL User32, ).DllCallLoadLibrary

FreeLibrary.:

hModule:=DllCall("LoadLibrary","Str",

"MyFunctions.dll","Ptr");DllCall().

Loop,C:\MyDocuments\*.*,,1

result:=DllCall("MyFunctions\BackupFile",

"Str",A_LoopFileFullPath)

Page 473: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DllCall("FreeLibrary","Ptr",hModule);,

DLL.

v1.0.46.08+,.:

;,DLL,LoadLibrary

GetModuleHandle.

MulDivProc:=DllCall("GetProcAddress",Ptr,

DllCall("GetModuleHandle",Str,"kernel32",

"Ptr"),AStr,"MulDiv","Ptr")

Loop500

DllCall(MulDivProc,Int,3,Int,4,Int,3)

[AHK_L31+]:DllCall "MulDiv" DLL,..

, #NoEnv(Int"Int")DllCall.

,, (&MyVar)" str"().

: DllCall("CharUpper",Ptr,&MyVar,Ptr) .

()..

().:

1) VarSetCapacity(MyStruct,123,0) .123.;

,NumPut().

2), NumPut(123,MyStruct,4,"UInt") .123(

&Var ).4(""#4)."UInt",.

Page 474: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

3),MyStruct UInt(PtrAHK_L42+).,

DllCall("MyDll\MyFunc",Ptr,&MyStruct) ./.

4) MyInteger:=NumGet(MyStruct,4,"UInt") .4

.0.0(4)..(DWORD,Int

."UInt",.

.

( &MyVar ),,,:1)MyVar "Str"Ptr/1)

v1.0.44.03+,DllCall VarSetCapacity(MyVar,-2) .

;., NumPut/NumGetDllCall.

,. CharLower(CharUpper(MyVar)) MyVar,

DllCall(), MyVar,CharLower MyVar:

MyVar=ABC

result:=DllCall("CharLower",str,

DllCall("CharUpper",Str,MyVar,Str),Str)

,"Str"Ptr.CharUpperCharLower.

. .

(COM)

Page 475: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

VBScriptCOMAutoHotkey ComObjCreate,ComObjGet

ComObjActive.

IDispatchCOMDllCall., .

.NETFrameworkCOMDllCall.

http://www.autohotkey.com/forum/topic26191.html.

,PostMessage,OnMessage(),RegisterCallback(),Run,VarSetCapacity,,

SysGet,MSDNLibrary

;:WindowsAPI"MessageBox".

WhichButton:=DllCall("MessageBox","Int","0",

"Str","PressYesorNo","Str","Titleofbox",

"Int",4)

MsgBoxYoupressedbutton#%WhichButton%.

;:(.bmp).

DllCall("SystemParametersInfo",UInt,0x14,UInt,

0,Str,A_WinDir."\winnt.bmp",UInt,2)

;:API"IsWindowVisible".

DetectHiddenWindowsOn

ifnotDllCall("IsWindowVisible","Ptr",

Page 476: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinExist("Untitled-Notepad"));WinExist()

HWND.

MsgBoxThewindowisnotvisible.

;:APIwsprintf()43210

(0000000432).

VarSetCapacity(ZeroPaddedNumber,20);.

DllCall("wsprintf","Str",ZeroPaddedNumber,

"Str","%010d","Int",432,"Cdecl");Cdecl

.

MsgBox%ZeroPaddedNumber%

;:QueryPerformanceCounter(), A_TickCount

10ms.

DllCall("QueryPerformanceCounter","Int64*",

CounterBefore)

Sleep1000

DllCall("QueryPerformanceCounter","Int64*",

CounterAfter)

MsgBox%"ElapsedQPCtimeis".CounterAfter-

CounterBefore

;:,.

;F1..

F1::

SPI_GETMOUSESPEED=0x70

SPI_SETMOUSESPEED=0x71

;:

DllCall("SystemParametersInfo",UInt,

SPI_GETMOUSESPEED,UInt,0,UIntP,OrigMouseSpeed,

UInt,0)

;(1-20,10):

Page 477: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DllCall("SystemParametersInfo",UInt,

SPI_SETMOUSESPEED,UInt,0,Ptr,3,UInt,0)

KeyWaitF1;DllCall.

return

F1up::DllCall("SystemParametersInfo",UInt,0x71,

UInt,0,Ptr,OrigMouseSpeed,UInt,0);.

;:IDClassNN,

;HWND(ID).

;v1.0.43.06+:,.

ControlGet,OutputVar,Hwnd,,ClassNN,WinTitle

;:

;().v1.0.43.06+, ControlGetHwnd

#Persistent

SetTimer,WatchScrollBar,100

return

WatchScrollBar:

ActiveWindow:=WinExist("A")

ifnotActiveWindow;.

return

ControlGetFocus,FocusedControl,ahk_id

%ActiveWindow%

ifnotFocusedControl;.

return

;:

ControlGet,ChildHWND,Hwnd,,%FocusedControl%,

ahk_id%ActiveWindow%

ToolTip%DllCall("GetScrollPos","Ptr",

ChildHWND,"Int",1);1SB_VERT,0

SB_HORZ.

Page 478: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

;:,,(v1.0.34+).

;.

;AHK_L42+, FileOpen.

FileSelectFile,FileName,S16,,Createanewfile:

ifFileName=

return

GENERIC_WRITE=0x40000000;.

CREATE_ALWAYS=2;().

hFile:=DllCall("CreateFile",Str,FileName,

UInt,GENERIC_WRITE,UInt,0,Ptr,0,UInt,

CREATE_ALWAYS,UInt,0,Ptr,0,Ptr)

ifnothFile

{

MsgBoxCan'topen"%FileName%"forwriting.

return

}

TestString=Thisisateststring.`r`n;,

`r`n`n.

DllCall("WriteFile",Ptr,hFile,Str,TestString,

UInt,StrLen(TestString),UIntP,

BytesActuallyWritten,Ptr,0)

DllCall("CloseHandle",Ptr,hFile);Closethe

file.

;,.

GENERIC_READ=0x80000000;.

OPEN_EXISTING=3;.

FILE_SHARE_READ=0x1;.

FILE_SHARE_WRITE=0x2

hFile:=DllCall("CreateFile",Str,FileName,

UInt,GENERIC_READ,UInt,

FILE_SHARE_READ|FILE_SHARE_WRITE,Ptr,0,UInt,

OPEN_EXISTING,UInt,0,Ptr,0)

Page 479: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifnothFile

{

MsgBoxCan'topen"%FileName%"forreading.

return

}

;,:

BytesToRead:=VarSetCapacity(TestString,

StrLen(TestString))

DllCall("ReadFile",Ptr,hFile,Str,TestString,

UInt,BytesToRead,UIntP,BytesActuallyRead,Ptr,

0)

DllCall("CloseHandle",Ptr,hFile);.

MsgBoxThefollowingstringwasreadfromthe

file:%TestString%

;:Win+C.Win+C.

; www.autohotkey.com/forum/topic6107.html

OnExit,ShowCursor;.

return

ShowCursor:

SystemCursor("On")

ExitApp

#c::SystemCursor("Toggle");Win+C.

SystemCursor(OnOff=1);="I","Init";=

0,"Off";=-1,"T","Toggle";=

{

staticAndMask,XorMask,$,h_cursor

,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13;

,

b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13;

,

Page 480: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13;

if(OnOff="Init"orOnOff="I"or$="")

;

{

$=h

;

VarSetCapacity(h_cursor,4444,1)

VarSetCapacity(AndMask,32*4,0xFF)

VarSetCapacity(XorMask,32*4,0)

system_cursors=

32512,32513,32514,32515,32516,32642,32643,32644,32

645,32646,32648,32649,32650

StringSplitc,system_cursors,`,

Loop%c0%

{

h_cursor:=DllCall("LoadCursor",

"Ptr",0,"Ptr",c%A_Index%)

h%A_Index%:=DllCall("CopyImage",

"Ptr",h_cursor,"UInt",2,"Int",0,"Int",0,

"UInt",0)

b%A_Index%:=DllCall("CreateCursor",

"Ptr",0,"Int",0,"Int",0

,"Int",32,"Int",32,

"Ptr",&AndMask,"Ptr",&XorMask)

}

}

if(OnOff=0orOnOff="Off"or$="h"and

(OnOff<0orOnOff="Toggle"orOnOff="T"))

$=b;

else

$=h;

Loop%c0%

{

h_cursor:=DllCall("CopyImage",

"Ptr",%$%%A_Index%,"UInt",2,"Int",0,"Int",0,

"UInt",0)

Page 481: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DllCall("SetSystemCursor",

"Ptr",h_cursor,"UInt",c%A_Index%)

}

}

;:RECTGetWindowRect(),

;,,().

RunNotepad

WinWaitUntitled-Notepad;" "WinExist().

VarSetCapacity(Rect,16);RECT32(

4*4=16).

DllCall("GetWindowRect",Ptr,WinExist(),Ptr,

&Rect);WinExist()HWND.

MsgBox%"Left".NumGet(Rect,0,"Int")."Top

".NumGet(Rect,4,"Int")

."Right".NumGet(Rect,8,"Int")."

Bottom".NumGet(Rect,12,"Int")

;:RECTFillRect(),

;.

VarSetCapacity(Rect,16,0);44.

NumPut(A_ScreenWidth//2,Rect,8,"Int");

"rect.right".

NumPut(A_ScreenHeight//2,Rect,12,"Int");

"rect.bottom".

hDC:=DllCall("GetDC","Ptr",0,"Ptr");.

hBrush:=DllCall("CreateSolidBrush","UInt",

0x0000FF,"Ptr");(0x0000FFBGR).

DllCall("FillRect","Ptr",hDC,"Ptr",&Rect,

"Ptr",hBrush);.

DllCall("ReleaseDC","Ptr",0,"Ptr",hDC);.

DllCall("DeleteObject","Ptr",hBrush);.

Page 482: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:.

;!

SetSystemTime("20051008142211"); (,

UTC).

SetSystemTime(YYYYMMDDHHMISS)

;.

;

;(,UTC).,.

{

;UTCSetSystemTime().

UTC_Delta-=A_NowUTC,Seconds;.

UTC_Delta:=Round(-UTC_Delta/60);.

YYYYMMDDHHMISS+=UTC_Delta,Minutes;

UTC.

VarSetCapacity(SystemTime,16,0);8

UShort(8*2=16).

StringLeft,Int,YYYYMMDDHHMISS,4;YYYY

()

NumPut(Int,SystemTime,0,"UShort")

StringMid,Int,YYYYMMDDHHMISS,5,2;MM(

,1-12)

NumPut(Int,SystemTime,2,"UShort")

StringMid,Int,YYYYMMDDHHMISS,7,2;DD(

)

NumPut(Int,SystemTime,6,"UShort")

StringMid,Int,YYYYMMDDHHMISS,9,2;HH(24

)

NumPut(Int,SystemTime,8,"UShort")

StringMid,Int,YYYYMMDDHHMISS,11,2;MI(

)

NumPut(Int,SystemTime,10,"UShort")

StringMid,Int,YYYYMMDDHHMISS,13,2;SS(

Page 483: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

)

NumPut(Int,SystemTime,12,"UShort")

returnDllCall("SetSystemTime",Ptr,

&SystemTime)

}

/*:

1) WinLIRC DllCall()

TCP/IP.

2)/.

,: www.autohotkey.com/forum/topic17230.html

*/

/*

:COM.

ITaskbarListVTable:

IUnknown:

0QueryInterface-- ComObjQuery

1AddRef-- ObjAddRef

2Release-- ObjRelease

ITaskbarList:

3HrInit

4AddTab

5DeleteTab

6ActivateTab

7SetActiveAlt

*/

IID_ITaskbarList:="{56FDF342-FD6D-11d0-958A-

006097C9A090}"

CLSID_TaskbarList:="{56FDF344-FD6D-11d0-958A-

Page 484: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

006097C9A090}"

;TaskbarListtbl.

tbl:=ComObjCreate(CLSID_TaskbarList,

IID_ITaskbarList)

activeHwnd:=WinExist("A")

DllCall(vtable(tbl,3),"ptr",tbl)

;tbl.HrInit()

DllCall(vtable(tbl,5),"ptr",tbl,"ptr",

activeHwnd);tbl.DeleteTab(activeHwnd)

Sleep3000

DllCall(vtable(tbl,4),"ptr",tbl,"ptr",

activeHwnd);tbl.AddTab(activeHwnd)

;dispatch.

ObjRelease(tbl)

vtable(ptr,n){

;NumGet(ptr+0)

;(vtable).

;vtablen.

returnNumGet(NumGet(ptr+0),n*A_PtrSize)

}

Page 485: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

NumGet+.

Number:=NumGet(VarOrAddress[,Offset=0][,Type=

"UPtr"])

VarOrAddress()

. VarOrAddress MyVar , &MyVar ,"&"+ .

,;, MyVar+0 .

Offset()

(), VarOrAddress.

Type()

(UPtr):

UInt,Int,Int64,Short,UShort,Char,UChar,Double,Float,PtrUPtr

DllCall,.

DllCall.

,.,.

Page 486: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

+.

, Offset Type., NumGet(var,"int") .

NumPut,DllCall,VarSetCapacity

Page 487: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

NumPut+.

NumPut(Number,VarOrAddress[,Offset=0][,Type=

"UPtr"])

Number

.

VarOrAddress

. VarOrAddress MyVar . &MyVar .,"&"+ .

. ;, MyVar+0 .

Offset

(), VarOrAddress.

Type

(UPtr):

UInt,Int,Int64,Short,UShort,Char,UChar,Double,Float,PtrUPtr

DllCall,.

DllCall.

Page 488: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.,.

.,DllCall.

Type,;. NumPut(257,var,0,"Char") 1.

, Offset Type., NumPut(x,var,"int") .

NumGet,DllCall,VarSetCapacity

Page 489: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegisterCallback() [v1.0.47+]

, .

Address:=RegisterCallback("FunctionName"[,Options

="",ParamCount=FormalCount,EventInfo=Address])

Address

,RegisterCallback(), DllCall().,. FunctionName

:1)2) ParamCount3) ByRef.

FunctionName

,,. Address. Address.

[v1.1.06+]: .

Options

.( CFast ).

Fast F: FunctionName ., Address().

FunctionName( ErrorLevel,A_LastError )., .

CDecl C: Address"C".,.

ParamCount

Page 490: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Address., FunctionName .,.

EventInfo

Address FunctionName, A_EventInfo.

FunctionName Address., Address.:,

A_EventInfo .

32,04294967295.64,64.

A_EventInfo,AutoHotkey64,.

31. ,.

x86.AutoHotKey,.

32: 32.,:

,:

;#1

ifwParam>0x7FFFFFFF

wParam:=-(~wParam)-1

;#2:AutoHotkey64.

wParam:=wParam<<32>>32

64: 64.AutoHotkey64.

AutoHotkey32/64: 816(x6432),,:

Page 491: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Callback(UCharParam,UShortParam,UIntParam){

UCharParam&=0xFF

UShortParam&=0xFFFF

UIntParam&=0xFFFFFFFF

;...

}

,., StrGet:

MyString:=StrGet(MyParameter);AHK_L46+

, DllCall.

[AHK_L60+]: , .:

callback:=RegisterCallback("TheFunc","F",3)

;.

TheFunc("TheFuncwascalleddirectly.")

;TheFunc.

DllCall(callback,float,10.5,int64,42)

;TheFunc.

TheFunc(params*){

ifIsObject(params)

MsgBox%params[1]

else

MsgBox%NumGet(params+0,"float")","

NumGet(params+A_PtrSize,"int64")

}

stdcall,., ParamCount,Int6432.

Cdecl64, ParamCount.,, params.

Page 492: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Return,""(Return),0 Address.,-2147483648

4294967295, Address.

/, SendMode DetectHiddenWindows. .

, .,( ErrorLevel ) .,.

(), Critical.,0x312,(Critical ).,

Critical, SendMessage DllCall.

RegisterCallback()(32)., .,RegisterCallback()

/:

DllCall("GlobalFree","Ptr",Address,"Ptr")

DllCall(),OnMessage(),OnExit,OnClipboardChange,Sort,Critical,

Post/SendMessage,,Windows,

Page 493: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:,.

;,RegisterCallback():

ifnotEnumAddress;,:

EnumAddress:=

RegisterCallback("EnumWindowsProc","Fast")

DetectHiddenWindowsOn;,.

;EnumWindows(),:

DllCall("EnumWindows",Ptr,EnumAddress,Ptr,0)

MsgBox%Output%;.

EnumWindowsProc(hwnd,lParam)

{

globalOutput

WinGetTitle,title,ahk_id%hwnd%

WinGetClass,class,ahk_id%hwnd%

iftitle

Output.="HWND:".hwnd."`tTitle:".

title."`tClass:".class."`n"

returntrue;EnumWindows(),.

}

;:,GUI

;WindowProcWindowProc.,

;.

TextBackgroundColor:=0xFFBBBB;BGR.

TextBackgroundBrush:=DllCall("CreateSolidBrush",

UInt,TextBackgroundColor)

Gui,Add,Text,HwndMyTextHwnd,Hereissometext

Page 494: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

thatisgiven`nacustombackgroundcolor.

Gui+LastFound

GuiHwnd:=WinExist()

;64SetWindowLongPtrSetWindowLong:

SetWindowLong:=A_PtrSize=8?"SetWindowLongPtr"

:"SetWindowLong"

WindowProcNew:=RegisterCallback("WindowProc",""

;"".

,4,MyTextHwnd);EventInfo

ParamCount.

WindowProcOld:=DllCall(SetWindowLong,Ptr,

GuiHwnd,Int,-4;-4GWL_WNDPROC

,Ptr,WindowProcNew,Ptr);PtrUPtr

Int.

GuiShow

return

WindowProc(hwnd,uMsg,wParam,lParam)

{

Critical

globalTextBackgroundColor,

TextBackgroundBrush,WindowProcOld

if(uMsg=0x138&&lParam=A_EventInfo);

0x138WM_CTLCOLORSTATIC.

{

DllCall("SetBkColor",Ptr,wParam,UInt,

TextBackgroundColor)

returnTextBackgroundBrush;HBRUSH

HDC.

}

;(),WindowProc.

returnDllCall("CallWindowProc",Ptr,

WindowProcOld,Ptr,hwnd,UInt,uMsg,Ptr,wParam,

Ptr,lParam)

Page 495: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

GuiClose:

ExitApp

Page 496: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StrPut()/StrGet() [AHK_L46+]

,.

StrPut(String[,Encoding=None])

StrPut(String,Address[,Length][,Encoding=None

])

StrGet(Address[,Length][,Encoding=None])

String

..

Address

.

Length

/,..

Encoding

StrGetStrPut;,"UTF-8","UTF-16""CP936".

Address Length,"CP"."CP0"ANSI.

,.

Page 497: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StrPut, Address,0. Length,0. Length,

;.

StrGet.

StrPut StringStrGet , Encoding Address.

Encoding,.

, String.

AutoHotkeyBasicStrPutStrGet, . AutoHotkey

.

,FileEncoding,VarSetCapacity()

Length Encoding Address, Encoding:

strA:=StrGet(addressA,"cp0");OK

strA:=StrGet(addressA,length,0);OK

strA:=StrGet(addressA,0);

StrPut,.StrPut, :

Page 498: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StrPutVar(string,ByRefvar,encoding)

{

;.

VarSetCapacity(var,StrPut(string,encoding)

;StrPut,VarSetCapacity.

*((encoding="utf-16"||encoding="cp1200")

?2:1))

;.

returnStrPut(string,&var,encoding)

}

Page 499: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

VarSetCapacity()., DllCall.

GrantedCapacity:=VarSetCapacity(UnquotedVarName[,

RequestedCapacity,FillByte])

UnquotedVarName

( ).: VarSetCapacity(MyVar,1000) .

, Array%i% .

ByRef.

RequestedCapacity

,(UnquotedVarName).,().

,. !

Unicode,ANSI(x2).

:ANSI,.

.

,1.

:AHK,,.

Page 500: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,, RequestedCapacity0., RequestedCapacity,

(,).

,, VarSetCapacity(Var,0) ,

VarSetCapacity(Var,NewCapacity) .

,64(Unicode128),.,0.

,4096( Var:="" )., VarSetCapacity(Var,

0) .

v1.0.44.03+, RequestedCapacity-1.,

DllCall(),.,VarSetCapacity().

FillByte

,(,).,0255.(,

RequestedCapacity).,, DllCall.

, RequestedCapacity.

UnquotedVarName(),0.

,.().

DllCall,.., RequestedCapacity:,,.,

,, VarSetCapacity(Var,0) Var:=""

Page 501: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxMem, VarSetCapacity.

DllCall,#MaxMem,NumPut,NumGet

;MyVar.

VarSetCapacity(MyVar,10240000);~10MB

Loop

{

...

MyVar=%MyVar%%StringToConcatenate%

...

}

;.

bytes_per_char:=A_IsUnicode?2:1

max_chars:=500

max_bytes:=max_chars*bytes_per_char

Loop2

{

;DllCall.

VarSetCapacity(buf,max_bytes)

ifA_Index=1

;DllCall.

DllCall("wsprintf","ptr",&buf,"str",

"0x%08x","uint",4919)

else

;"str":

DllCall("wsprintf","str",buf,"str",

Page 502: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"0x%08x","uint",4919)

;:

wrong_str:=buf."<end>"

wrong_len:=StrLen(buf)

;.

VarSetCapacity(buf,-1)

right_str:=buf."<end>"

right_len:=StrLen(buf)

MsgBox,

(

Beforeupdating

String:%wrong_str%

Length:%wrong_len%

Afterupdating

String:%right_str%

Length:%right_len%

)

}

Page 503: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjActive() [AHK_L53+]

OLE.

ComObject:=ComObjActive(CLSID)

.

ParamObj:=ComObj(VarType,Value[,Flags])

:

,.

COM.v1.1.12:, Obj.Method(1,,3)

ParamObj:=ComObjMissing()

IDispatch,AddRef().

ComObject:=ComObjEnwrap(DispPtr) ;

DispPtr:=ComObjUnwrap(ComObject) ;

:

ComObject:=ComObject(9,DispPtr,1),

ObjAddRef(DispPtr)

DispPtr:=ComObjValue(ComObject),

Page 504: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ObjAddRef(DispPtr)

CLSID

COMCLSIDProgID.

ComObject

COM.

VarType

. ComObjType().

Value

..

Flags

,.

DispPtr

IDispatch.

Flags

0. AddRef() IUnknownIDispatch, ObjRelease.

, 1 ,ObjAddRef().

Page 505: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1 IUnknown,IDispatchSAFEARRAY().AddRef.SAFEARRAY(VT_BYREF), SafeArrayDestroy

ByRef [v1.1.17+]

VT_BYREF(0x4000), [] .

, ,,.,VBScript:

VarSetCapacity(var,24,0)

vref:=ComObject(0x400C,&var);0x400C

VT_BYREFVT_VARIANT.

vref[]:="invalue"

sc.Run("Example",vref);sc .

MsgBox%vref[]

,COM,"ComObj"ComObjActive., ComObjEnwrap(DispPtr)

ComObjActive(DispPtr)ComObject(DispPtr) (, 9).,,

ComObject()ComObjActive() .

IDispatchIUnknown,COM.,, ..,.

: COM,. obj1==obj2 ,array[obj1]:=value ,

,COM.

Page 506: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjCreate,ComObjGet,ComObjConnect,ComObjError,ComObjFlags,

ObjAddRef/ObjRelease,ComObjQuery,GetActiveObject(MSDN)

ComObjUnwrap(COM): ComObjConnect.

;-ScriptControl32AutoHotkey.

code=

(

SubExample(Var)

MsgBoxVar

Var="outvalue!"

EndSub

)

sc:=ComObjCreate("ScriptControl"),sc.Language

:="VBScript",sc.AddCode(code)

;:VARIANTByRefCOM.

var:=ComVar()

var[]:="invalue"

sc.Run("Example",var.ref)

MsgBox%var[]

;ComVar:(ByRef).

;ComVar[].

;ComVar[]:=Val.

;ComVar.refCOM.

ComVar(Type=0xC)

{

staticbase:={__Get:"ComVarGet",__Set:

"ComVarSet",__Delete:"ComVarDel"}

;1VARIANT.

Page 507: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;VARIANTAutoHotkey.

arr:=ComObjArray(Type,1)

;VARIANT.

DllCall("oleaut32\SafeArrayAccessData","ptr",

ComObjValue(arr),"ptr*",arr_data)

;VARIANT.

return{ref:ComObject(0x4000|Type,

arr_data),_:arr,base:base}

}

ComVarGet(cv,p*){;.

ifp.MaxIndex()="";Noname/parameters,

i.e.cv[]

returncv._[0]

}

ComVarSet(cv,v,p*){;Calledwhenscriptsets

anunknownfield.

ifp.MaxIndex()="";/,,cv[]:=v

returncv._[0]:=v

}

ComVarDel(cv){;.

;.

DllCall("oleaut32\SafeArrayUnaccessData",

"ptr",ComObjValue(cv._))

}

Page 508: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjArray() [v1.0.91+]

COM(SafeArray)

ArrayObj:=ComObjArray(VarType,Count1[,Count2,

...Count8])

VarType

().VarType.VT_ARRAYVT_BYREF.VT_EMPTYVT_NULL

..

ComObjType.

CountN

.8.

ArrayObj

.

:

Array.MaxIndex(n) : n. n,1.

Array.MinIndex(n) : n. n,1.

Page 509: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Array.Clone() [v1.0.96.00+]:.

Array._NewEnum() [v1.0.96.00+]: for.

COM ComObjActive.:

ifComObjType(obj)&0x2000

MsgBox%":".ComObjType(obj)&0xfff

else

MsgBox.

8.

[v1.0.96.00+]:,,.,F_OWNVALUE,

. ComObjFlags.

[v1.1.17.00+]:COMF_OWNVALUE,,.

ComObjType,ComObjValue,ComObjActive,ComObjFlags,Array

ManipulationFunctions()(MSDN)

;#1:.

arr:=ComObjArray(VT_VARIANT:=12,3)

arr[0]:="Auto"

arr[1]:="Hot"

Page 510: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

arr[2]:="key"

Loop%arr.MaxIndex()+1

t.=arr[A_Index-1]

MsgBox%t

;#2:.

arr:=ComObjArray(VT_VARIANT:=12,3,4)

;:

dim:=DllCall("oleaut32\SafeArrayGetDim","ptr",

ComObjValue(arr))

;:

Loop%dim%

dims.=arr.MinIndex(A_Index)".."

arr.MaxIndex(A_Index)"`n"

MsgBox%dims%

;:

Loop3{

x:=A_Index-1

Loop4{

y:=A_Index-1

arr[x,y]:=x*y

}

}

MsgBox%arr[2,3]

Page 511: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjConnect() [AHK_L53+]

.

ComObjConnect(ComObject[,Prefix])

ComObject

.

IConnectionPointContainer,,,. ComObjError try/catch

.

[v1.1.22]+,,IProvideClassInfo.,ComObjConnect

IDispatch,.

Prefix

,(EventName)(Prefix).

,"";.

[v1.1.01+]:.,., this ,,COM.,, __Call.

."":

Page 512: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PrefixEventName([Params...,ComObject])

{

...event-handlingcode...

returnreturnValue

}

Prefix; EventName,.

Params., Params. ComObject, ;ComObjConnect

()."ComObject".

,.COM, ComObject(,) ., returnComObject(0,0)

VT_EMPTY,JavaScript undefined ().

ComObjConnect(," Prefix") .

ComObjConnect() ().

, .

ComObjCreate,ComObjGet,ComObjActive,ComObjError,

WScript.ConnectObject(MSDN)

ie:=ComObjCreate("InternetExplorer.Application")

;"IE_".

Page 513: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjConnect(ie,"IE_")

ie.Visible:=true;IE7.

ie.Navigate("https://autohotkey.com/")

#Persistent

IE_DocumentComplete(ieEventParam,url,

ieFinalParam){

globalie

if(ie!=ieEventParam)

s.=".`n"

if(ie==ieFinalParam)

s.=".`n"

if((disp1:=ComObjUnwrap(ieEventParam))==

(disp2:=ComObjUnwrap(ieFinalParam)))

s.="IDispatch.`n"

ObjRelease(disp1),ObjRelease(disp2)

MsgBox%s.""ie.Document.title"@"url

ie.Quit()

ExitApp

}

Page 514: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjCreate() [AHK_L53+]

COM.

ComObject:=ComObjCreate(CLSID[,IID])

CLSID

COMCLSIDProgID.

IID

[v1.0.96.00+]:.

,.

IID,. ObjRelease.

,. .

ComObjGet,ComObjActive,ComObjConnect,ComObjArray,ComObjError,

ComObjQuery,CreateObject(MSDN)

Page 515: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: http://www.autohotkey.com/forum/topic61509.html.

ie:=ComObjCreate("InternetExplorer.Application")

ie.Visible:=true;IE7.

ie.Navigate("https://autohotkey.com/")

Page 516: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjGet() [AHK_L53+]

COM.

ComObject:=ComObjGet(Name)

Name

. MkParseDisplayName(MSDN).

ComObjCreate,ComObjActive,ComObjConnect,ComObjError,

ComObjQuery,CoGetObject(MSDN)

;:Shift+Escape

;.XP.

+Esc::

WinGetpid,PID,A

;WMI.

wmi:=ComObjGet("winmgmts:")

;.

queryEnum:=wmi.ExecQuery(""

."Select*fromWin32_Processwhere

ProcessId=".pid)

._NewEnum()

;.

Page 517: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifqueryEnum[process]

MsgBox0,Commandline,%

process.CommandLine

else

MsgBoxProcessnotfound!

;().

wmi:=queryEnum:=process:=""

return

;Win32_Process:http://msdn.microsoft.com/en-

us/library/aa394372.aspx

Page 518: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjError() [AHK_L53+]

COM.

Enabled:=ComObjError([Enable])

Enable

()..

Enabled

[v1.0.91+]:.

COM, A_LastErrorCOM IDispatch::InvokeHRESULT.

ComObjError(false) A_LastError,.

ComObjCreate,ComObjGet,ComObjActive,ComObjConnect

Page 519: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjFlags() [v1.0.96.00+]

COM.

Flags:=ComObjFlags(ComObject[,NewFlags,Mask])

ComObject

COM.

NewFlags

Mask.

Mask

.

Flags

ComObject( NewFlags,).

Flags

F_OWNVALUE1 SafeArray.,SafeArray.SafeArray,SafeArraySafeArray,.

Page 520: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Mask, NewFlags()()., ComObjFlags(obj,

-1) F_OWNVALUE. Mask01,.

ComObjActive,ComObjArray

;:F_OWNVALUE.

arr:=ComObjArray(0xC,1)

ifComObjFlags(arr)&1

MsgBoxarrwillbeautomaticallydestroyed.

else

MsgBoxarrwillnotbeautomatically

destroyed.

;:.

arr1:=ComObjArray(0xC,3)

arr2:=ComObjArray(0xC,1)

arr2[0]:="originalvalue"

arr1[0]:=arr2;.

ComObjFlags(arr2,-1);F_OWNVALUE.

arr1[1]:=arr2;.

arr1[2]:=arr2.Clone();.

arr2[0]:="newvalue"

forarrinarr1

MsgBox%arr[0]

arr1:=""

;arr2==arr1[1],,:

Page 521: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;arr2[0]:="foo"

Page 522: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjQuery() [v1.0.96.00+]

COM.

InterfacePointer:=ComObjQuery(ComObject,[SID,]

IID)

ComObject

COM.

IID

"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"(GUID).

SID

IID.,.

, IUnknown::QueryInterface.SIDIID, IServiceProvider,

IServiceProvider::QueryService.,. .

ObjRelease,ComObjCreate,ComObjGet,ComObjActive,ComObjError

Page 523: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:.

obj:=ComObjCreate("Scripting.Dictionary")

MsgBox%"Interfacename:"ComObjType(obj,

"name")

IID_IProvideClassInfo:="{B196B283-BAB4-101A-

B69C-00AA00341D07}"

;IProvideClassInfo.

if!(pci:=ComObjQuery(obj,

IID_IProvideClassInfo))

{

MsgBoxIProvideClassInfointerfacenot

supported.

return

}

;GetClassInfoITypeInfo.

DllCall(vtable(pci,3),"ptr",pci,"ptr*",ti)

;GetDocumentation.

DllCall(vtable(ti,12),"ptr",ti,"int",-1,

"ptr*",name,"ptr",0,"ptr",0,"ptr",0)

;BSTR.

name:=StrGet(name,"UTF-16")

;.

ObjRelease(ti)

ObjRelease(pci)

;!

Page 524: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox%"Classname:"name

vtable(ptr,n){

;NumGet(ptr+0)

;(vtable).

;vtablen.

returnNumGet(NumGet(ptr+0),n*A_PtrSize)

}

;:InternetExplorer.

sURL:="https://autohotkey.com/boards/"

ifwebBrowser:=GetWebBrowser()

webBrowser.Navigate(sURL)

return

GetWebBrowser()

{

;IE.

staticmsg:=DllCall("RegisterWindowMessage",

"str","WM_HTML_GETOBJECT")

SendMessagemsg,0,0,Internet

Explorer_Server1,ahk_classIEFrame

ifErrorLevel=FAIL

return;IE.

lResult:=ErrorLevel

DllCall("oleacc\ObjectFromLresult","ptr",

lResult

,"ptr",GUID(IID_IHTMLDocument2,"

{332C4425-26CB-11D0-B483-00C04FD90119}")

,"ptr",0,"ptr*",pdoc)

;WebBrowserApp.,

;SIDIID,.

staticIID_IWebBrowserApp:="{0002DF05-0000-

0000-C000-000000000046}"

Page 525: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

staticSID_SWebBrowserApp:=

IID_IWebBrowserApp

pweb:=ComObjQuery(pdoc,SID_SWebBrowserApp,

IID_IWebBrowserApp)

;.

ObjRelease(pdoc)

;WebBrowser:

staticVT_DISPATCH:=9,F_OWNVALUE:=1

returnComObject(VT_DISPATCH,pweb,

F_OWNVALUE)

}

GUID(ByRefGUID,sGUID);GUID.

{

VarSetCapacity(GUID,16,0)

returnDllCall("ole32\CLSIDFromString",

"wstr",sGUID,"ptr",&GUID)>=0?&GUID:""

}

Page 526: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjType() [v1.0.91+]

COM.

VarType:=ComObjType(ComObject)

Name:=ComObjType(ComObject,"Name")

IID:=ComObjType(ComObject,"IID")

Class:=ComObjType(ComObject,"Class");v1.1.26+

CLSID:=ComObjType(ComObject,"CLSID");v1.1.26+

ComObject

COM.

2

.

2:

2

,COM.

"Name" .

"IID" (GUID).

[v1.1.26+]:.,ClassProgID(ProgID

Page 527: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"Class" ComObjCreate).

"CLSID" [v1.1.26+]:(GUID).CLSID, HKCR\CLSID .

,.

VT_EMPTY=0;

VT_NULL=1;SQL

VT_I2=2;16

VT_I4=3;32

VT_R4=4;32

VT_R8=5;64

VT_CY=6;

VT_DATE=7;

VT_BSTR=8;COM(Unicode)

VT_DISPATCH=9;COM

VT_ERROR=0xA;(32)

VT_BOOL=0xB;(-1)(0)

VT_VARIANT=0xC;VARIANT(VT_ARRAY

VT_BYREF)

VT_UNKNOWN=0xD;IUnknown

VT_DECIMAL=0xE;()

VT_I1=0x10;8

VT_UI1=0x11;8

VT_UI2=0x12;16

VT_UI4=0x13;32

VT_I8=0x14;64

VT_UI8=0x15;64

VT_INT=0x16;

VT_UINT=0x17;

VT_RECORD=0x24;-

VT_ARRAY=0x2000;SAFEARRAY()

VT_BYREF=0x4000;

Page 528: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

/*

VT_ARRAY/VT_BYREF(""),

.,0x200332 SAFEARRAY()

0x400C VARIANT.

*/

,COMAutoHotkey. VariantChangeType;VT_ARRAY

VT_BYREF,.

x, ComObjType(x) , xCOM.

2"Name""IID", IDispatch::GetTypeInfo. ComObject

VT_DISPATCH.

2"Class""CLSID", IProvideClassInfo::GetClassInfo.

ComObjectVT_DISPATCHVT_UNKNOWN,iprovideclassinfo

().

ComObjValue,ComObjCreate,ComObjGet,ComObjActive

d:=ComObjCreate("Scripting.Dictionary")

VarType:=ComObjType(d);9.

Name:=ComObjType(d,"Name");.

IID:=ComObjType(d,"IID");.

Page 529: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CName:=ComObjType(d,"Class");v1.1.26+

CLSID:=ComObjType(d,"CLSID");v1.1.26+

MsgBox:`t%VarType%`n:`t%Name%`nIID:`t%IID%`n

:`t%CName%`n(CLSID):`t%CLSID%

Page 530: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComObjValue() [v1.0.91+]

COM.

Value:=ComObjValue(ComObject)

Value

64.

ComObject

COM.

.

ComObjValue variant.llVal , ComObject VARIANT.

.,, Release, AddRef.

ComObjType,ComObjCreate,ComObjGet,ComObjActive

Page 531: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ObjAddRef()/ObjRelease() [AHK_L53+]

.

ObjAddRef(Ptr)

ObjRelease(Ptr)

Ptr

COM.

. .

COM,AutoHotkey: IUnknown::AddRef,IUnknown::Release,.

ComObjConnect.

obj:=Object()

;:

ptr1:=Object(obj)

ptr2:=ObjectToPointer(obj)

Page 532: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ObjectToPointer(obj){

if!IsObject(obj)

return""

ptr:=&obj

ObjAddRef(ptr)

returnptr

}

;Object()ObjectToPointer(),

;.

ObjRelease(ptr2)

ObjRelease(ptr1)

Page 533: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Drive/CDDVD,.

Drive,Sub-command[,Drive,Value]

sub-command,drivevalue,.

Label,Drive[,NewLabel]: Drive NewLabel( NewLabel,).

Drive,(UNC).: Drive,Label,C:,Seagate200 .

,: DriveGet,OutputVar,Label,C: .

Lock,Drive:.: Drive,Lock,D: ."".,.(),.,

,,.,ErrorLevel1.0.

Unlock,Drive:., Unlock()., Drive,Lock,D: ,

Drive,Unlock,D: ., .

Eject[,Drive,1]:CDDVD(,DllCall).

Drive,CD/DVD.,./,1: Drive,Eject,D:,1 .

DriveEject,.(), ErrorLevel0("").

Page 534: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DriveEjectCD/DVD.,

,.,():

#c::

Drive,Eject

;,.

;,:

ifA_TimeSinceThisHotkey<1000;.

Drive,Eject,,1

return

CDDVD(,,,), DriveGet.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

,CD/DVD/:

;().

Driveletter=I:;.

hVolume:=DllCall("CreateFile"

,Str,"\\.\".Driveletter

,UInt,0x80000000|0x40000000;

GENERIC_READ|GENERIC_WRITE

,UInt,0x1|0x2;FILE_SHARE_READ|

Page 535: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FILE_SHARE_WRITE

,UInt,0

,UInt,0x3;OPEN_EXISTING

,UInt,0,UInt,0)

ifhVolume<>-1

{

DllCall("DeviceIoControl"

,UInt,hVolume

,UInt,0x2D4808;

IOCTL_STORAGE_EJECT_MEDIA

,UInt,0,UInt,0,UInt,0,UInt,0

,UIntP,dwBytesReturned;.

,UInt,0)

DllCall("CloseHandle",UInt,hVolume)

}

DriveGet,DriveSpaceFree

Drive,Label,D:,BackupDrive

Drive,Eject,,1;()CDDVD.

Page 536: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DriveGet.

DriveGet,OutputVar,Cmd[,Value]

OutputVar

Cmd.

Cmd,Value

.

Cmd,Value

Cmd Value,., OutputVar ErrorLevel1.

List[,Type]: OutputVar,.:ACDEZ. Type,., Type

:CDROM,REMOVABLE,FIXED,NETWORK,RAMDISK,UNKNOWN.

Capacity(orCap),Path: Path(e.g.C:\),MB.

DriveSpaceFree.

Filesystem(FS),Drive : Drive, Drive,,UNC(

\\server1\share1).OutputVar:FAT,FAT32,NTFS,CDFS(CD),UDF(

DVD)., OutputVar ErrorLevel1.

Page 537: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Label,Drive: Drive, Drive,,UNC(

\\server1\share1).,: Drive,Label,C:,MyLabel .

Serial,Drive: Drive, Drive,,UNC(\\server1\share1).

SetFormat.

Type,Path: Path,:Unknown,Removable,Fixed,Network,

CDROM,RAMDisk.

Status,Path: Path,:Unknown(/RAW),Ready,NotReady(

),Invalid( Path,).

StatusCD[,Drive]:CDDVD, Drive( Drive,

CD/DVD)., OutputVar.,:

notready ,.:DVDCD,"".

open ,.

playing .

paused .

seeking .

stopped CD.

CD/DVD;, OutputVar ErrorLevel1.

,.

, Drive.

ErrorLevel

Page 538: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.04+]., .

ErrorLevel1,0.

Path,\\MyServer\MyShare\

Drive,DriveSpaceFree

;.

FileSelectFolder,folder,,3,Pickadriveto

analyze:

iffolder=

return

DriveGet,list,list

DriveGet,cap,capacity,%folder%

DrivespaceFree,free,%folder%

DriveGet,fs,fs,%folder%

DriveGet,label,label,%folder%

DriveGet,serial,serial,%folder%

DriveGet,type,type,%folder%

DriveGet,status,status,%folder%

MsgBoxAllDrives:%list%`nSelectedDrive:

%folder%`nDriveType:%type%`nStatus:

%status%`nCapacity:%cap%M`nFreeSpace:%free%

M`nFilesystem:%fs%`nVolumeLabel:%label%`nSerial

Number:%serial%

Page 539: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DriveSpaceFree,MB.

DriveSpaceFree,OutputVar,Path

OutputVar

,.

path

.NTFS,"".

OutputVar,MB().

Drive,DriveGet

DriveSpaceFree,FreeSpace,c:\

Page 540: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileAppend(,).

FileAppend[,Text,Filename,Encoding]

.(`n)., .

Text, Filename(,).

Text %ClipboardAll%ClipboardAll, Filename(

FileDelete).

Filename

, %A_WorkingDir%.

(EOL) :EOL.(`n)(LF)WindowsCR+LF.

: *C:\MyUnixFile.txt

( ),EOL, Text(`r`n),.,., Text

`r`n, Text`r`n.

(stdout) : Filename(*) Text(stdout).,EXE

.,:

Page 541: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"%ProgramFiles%\AutoHotkey\AutoHotkey.exe"

"MyScript.ahk">"ErrorLog.txt"

,..:

"%ProgramFiles%\AutoHotkey\AutoHotkey.exe"

"MyScript.ahk"|more

For/F"tokens=*"%Lin

('""%ProgramFiles%\AutoHotkey\AutoHotkey.ex

e""MyScript.ahk""')do@Echo%L

[v1.1.20+]: Filename(**) Text(stderr).

Encoding

[AHK_L42+]: FileEncoding, Encoding.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

,FileAppend FileDelete.

Page 542: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

( / FileAppend).

[AHK_L42+]: FileOpen()FileAppend.,

file.Write(string) . RawWrite/RawRead

WriteNum/ReadNumI/O,FileAppend.

FileOpen/,FileRead,,FileReadLine,IniWrite,FileDelete,OutputDebug,

FileAppend,Anotherline.`n,C:\My

Documents\Test.txt

; :

FileAppend,

(

Alineoftext.

Bydefault,thehardcarriagereturn(Enter)

betweenthepreviouslineandthisonewillbe

writtentothefile.

Thislineisindentedwithatab;bydefault,

thattabwillalsobewrittentothefile.

Variablereferencessuchas%Var%areexpandedby

default.

),C:\MyFile.txt

;FTP

;FTP.WindowsXP.

Page 543: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FTPCommandFile=%A_ScriptDir%\FTPCommands.txt

FTPLogFile=%A_ScriptDir%\FTPLog.txt

FileDelete%FTPCommandFile%;.

FileAppend,;.

(

openhost.domain.com

username

password

binary

cdhtdocs

put%VarContainingNameOfTargetFile%

deleteSomeOtherFile.htm

renameOldFileName.htmNewFileName.htm

ls-l

quit

),%FTPCommandFile%

RunWait%comspec%/cftp.exe-s:"%FTPCommandFile%"

>"%FTPLogFile%"

FileDelete%FTPCommandFile%;.

Run%FTPLogFile%;.

Page 544: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCopy.

FileCopy,SourcePattern,DestPattern[,Flag]

SourcePattern

,C:\Temp\*.tmp. SourcePattern %A_WorkingDir%.

DestPattern

, %A_WorkingDir%.(),,:

FileCopy,C:\*.txt,C:\MyFolder

FileCopy,C:\*.txt,C:\MyFolder\*.*

Flag

() :

0=()

1=

,(10).

ErrorLevel

Page 545: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.04+]., .

ErrorLevel,0.

,(),ErrorLevel0., IfExist FileExist().

FileMove,,.

, A_LastError0()GetLastError().A_LastError.

FileCopy.(),.(), FileCopyDir.

.

FileMove,FileCopyDir,FileMoveDir,FileDelete

FileCopy,C:\MyDocuments\List1.txt,D:\Main

Backup\;.filename.

FileCopy,C:\MyFile.txt,C:\MyFileNew.txt;

.

FileCopy,C:\Folder1\*.txt,D:\NewFolder\*.bkp;

.

Page 546: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

ErrorCount:=CopyFilesAndFolders("C:\My

Folder\*.*","D:\Foldertoreceiveallfiles&

folders")

ifErrorCount<>0

MsgBox%ErrorCount%files/folderscouldnotbe

copied.

CopyFilesAndFolders(SourcePattern,

DestinationFolder,DoOverwrite=false)

;SourcePatternDestinationFolder

;/.

{

;():

FileCopy,%SourcePattern%,

%DestinationFolder%,%DoOverwrite%

ErrorCount:=ErrorLevel

;:

Loop,%SourcePattern%,2;2"".

{

FileCopyDir,%A_LoopFileFullPath%,

%DestinationFolder%\%A_LoopFileName%,

%DoOverwrite%

ErrorCount+=ErrorLevel

ifErrorLevel;.

MsgBoxCouldnotcopy

%A_LoopFileFullPath%into%DestinationFolder%.

}

returnErrorCount

}

Page 547: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCopyDir(xcopy).

FileCopyDir,Source,Dest[,Flag]

Source

(), %A_WorkingDir%.:C:\MyFolder

Dest

(), %A_WorkingDir%.:C:\CopyofMyFolder

Flag

():

0():. Dest,.

1:., Dest Source.

,(10).

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0., PageName.htm PageName_files,

Page 548: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

,.

,.,, FileMoveDir.

FileCopyDir.(), FileCopy.

FileMoveDir,FileCopy,FileMove,FileDelete,,FileSelectFolder,SplitPath

FileCopyDir,C:\MyFolder,C:\CopyofMyFolder

;#2:.

FileSelectFolder,SourceFolder,,3,Selectthe

foldertocopy

ifSourceFolder=

return

;.

FileSelectFolder,TargetFolder,,3,Selectthe

folderINWHICHtocreatetheduplicatefolder.

ifTargetFolder=

return

;.

MsgBox,4,,Acopyofthefolder"%SourceFolder%"

willbeputinto"%TargetFolder%".Continue?

IfMsgBox,No

return

Page 549: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SplitPath,SourceFolder,SourceFolderName;.

FileCopyDir,%SourceFolder%,

%TargetFolder%\%SourceFolderName%

ifErrorLevel

MsgBoxThefoldercouldnotbecopied,perhaps

becauseafolderofthatnamealreadyexistsin

"%TargetFolder%".

return

Page 550: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCreateDir/.

FileCreateDir,DirName

DirName

, %A_WorkingDir%.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

DirName,.

FileRemoveDir

Page 551: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCreateDir,C:\Test1\MyImages\Folder2

Page 552: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCreateShortcut(.lnk).

FileCreateShortcut,Target,LinkFile[,WorkingDir,

Args,Description,IconFile,ShortcutKey,IconNumber,

RunState]

Target

,,(Notepad.exe).;,.

LinkFile

, %A_WorkingDir%. .lnk.,.

WorkingDir

Target.,"",.

Args

Target..,.

(,.)

IconFile

LinkFile.icoEXEDLL.

Page 553: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ShortcutKey

, (). .,CTRL+ALT.,B,

CTRL-ALT-B.

IconNumber

IconFile,( ).,2.

RunState

Target,:

1-()3-7-

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

TargetPATH,.

, ShortcutKey. ShortcutKey,.

URL,URL.: IniWrite,http://www.google.com,

C:\MyShortcut.url,InternetShortcut,URL .

:

Page 554: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniWrite,<IconFile>,C:\MyShortcut.url,

InternetShortcut,IconFile

IniWrite,0,C:\MyShortcut.url,

InternetShortcut,IconIndex

,0(0)<IconFile>URL,EXE,DLLICO.:

C:\Icons.dll,C:\App.exe,http://www.somedomain.com/ShortcutIcon.ico

.URL,.LNK.

FileGetShortcut,FileAppend

;"i"Ctrl-Alt-I:

FileCreateShortcut,Notepad.exe,%A_Desktop%\My

Shortcut.lnk,C:\,"%A_ScriptFullPath%",My

Description,C:\MyIcon.ico,i

Page 555: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileDelete.

FileDelete,FilePattern

FilePattern

, C:\Temp\*.tmp . FilePattern %A_WorkingDir%.

, FileRemoveDir.

ErrorLevel

[v1.1.04+]., .

ErrorLevel,0. *.tmp ErrorLevel0.

, A_LastError0()GetLastError().A_LastError.

,.: FileSetAttrib,-R,C:\MyFile.txt .

FileRecycle,FileRemoveDir,FileCopy,FileMove

Page 556: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileDelete,C:\tempfiles\*.tmp

Page 557: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileEncoding [AHK_L42+]

FileRead,FileReadLine,LoopRead,FileAppend FileOpen.

FileEncoding[,Encoding]

:

UTF-8 :UnicodeUTF-8,CP65001.

UnicodeUTF-16CP1200.

UTF-8-RAW UTF-16-RAW :,.

CPnnn : nnn. .

:ANSI,.

A_FileEncoding .

FileOpen,StrPut/StrGet,

Page 558: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileExist(FilePattern).

AttributeString:=FileExist(FilePattern)

FilePattern

,,("*.txt"Dos). FilePattern,

%A_WorkingDir%.

("RASHNDOCT"):

R=READONLY()

A=ARCHIVE()

S=SYSTEM()

H=HIDDEN()

N=NORMAL()

D=DIRECTORY()

O=OFFLINE()

C=COMPRESSED()

T=TEMPORARY()

X=NONE()

Page 559: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(),"X"..

IfExist FileGetAttrib.

"false",., ifFileExist("C:\MyFile.txt") ,.

, ifInStr(FileExist("C:\MyFolder"),"D") .

IfExist,FileGetAttrib,Blocks,Else,File-loops()

ifFileExist("D:\")

MsgBox,.

ifFileExist("D:\Docs\*.txt")

MsgBox,.txt.

if!FileExist("C:\Temp\FlagFile.txt")

MsgBox,.

;:

ifInStr(FileExist("C:\MyFile.txt"),"H")

MsgBox.

Page 560: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetAttrib,.

FileGetAttrib,OutputVar[,Filename]

AttributeString:=FileExist(FilePattern)

OutputVar

.

Filename

, %A_WorkingDir%., .

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

"RASHNDOCT":

R=

Page 561: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A=

S=

H=

N=

D=

O=

C=

T=

,:

FileGetAttrib,Attributes,C:\MyFile.txt

IfInString,Attributes,H

MsgBoxThefileishidden.

,8.3,:

Loop,C:\MyDocuments\AddressList.txt

ShortPathName=%A_LoopFileShortPath%;

C:\MYDOCU~1\ADDRES~1.txt

8.3.

FileExist(),FileSetAttrib,FileGetTime,FileSetTime,FileGetSize,

FileGetVersion,

Page 562: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetAttrib,OutputVar,C:\NewFolder

Page 563: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetShortcut(.lnk),.

FileGetShortcut,LinkFile[,OutTarget,OutDir,

OutArgs,OutDescription,OutIcon,OutIconNum,

OutRunState]

LinkFile

, %A_WorkingDir%. .lnk.

OutTarget

().:C:\WINDOWS\system32\notepad.exe

OutDir

.:C:\MyDocuments.%WinDir%, StringReplace.

: StringReplace,OutDir,OutDir,`%WinDir`%,

%A_WinDir% .

OutArgs

().

OutDescription

().

Page 564: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OutIcon

().

OutIconNum

().1,.

OutRunState

,:

1:

3:

7:

ErrorLevel

[v1.1.04+]., .

( LinkFile), ErrorLevel1.,ErrorLevel0.

,.

FileCreateShortcut,SplitPath

Page 565: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSelectFile,file,32,,Pickashortcutto

analyze.,Shortcuts(*.lnk)

iffile=

return

FileGetShortcut,%file%,OutTarget,OutDir,

OutArgs,OutDesc,OutIcon,OutIconNum,OutRunState

MsgBox

%OutTarget%`n%OutDir%`n%OutArgs%`n%OutDesc%`n%OutI

con%`n%OutIconNum%`n%OutRunState%

Page 566: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetSize.

FileGetSize,OutputVar[,Filename,Units]

OutputVar

().

Filename

, %A_WorkingDir%., .

Units

,:

K=

M=

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

Page 567: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(4GB), Units.

,().

,:

SetBatchLines,-1;.

FolderSize=0

FileSelectFolder,WhichFolder;.

Loop,%WhichFolder%\*.*,,1

FolderSize+=%A_LoopFileSize%

MsgBoxSizeof%WhichFolder%is%FolderSize%

bytes.

FileGetAttrib,FileSetAttrib,FileGetTime,FileSetTime,FileGetVersion,

FileGetSize,OutputVar,C:\MyDocuments\test.doc

;.

FileGetSize,OutputVar,C:\MyDocuments\test.doc,

K;.

Page 568: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetTime.

FileGetTime,OutputVar[,Filename,WhichTime]

OutputVar

YYYYMMDDHH24MISS.,UTC/GMT.

Filename

, %A_WorkingDir%., .

WhichTime

:

M=()

C=

A=

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

Page 569: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

YYYYMMDDHH24MISS.

FileSetTime,FormatTime,Ifvaris[not]type,FileGetAttrib,FileSetAttrib,

FileGetSize,FileGetVersion,,EnvAdd,EnvSub

FileGetTime,OutputVar,C:\MyDocuments\test.doc

;.

FileGetTime,OutputVar,C:\MyDocuments\test.doc,

C;.

Page 570: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetVersion.

FileGetVersion,OutputVar[,Filename]

OutputVar

/.

Filename

., LoadLibrary., .

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

(),OutputVar.

Page 571: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileGetAttrib,FileSetAttrib,FileGetTime,FileSetTime,FileGetSize,

FileGetVersion,version,C:\MyApplication.exe

FileGetVersion,version,

%A_ProgramFiles%\AutoHotkey\AutoHotkey.exe

Page 572: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileInstall.

FileInstall,Source,Dest[,Flag]

Source

.,.

,(%A_ProgramFiles%).,() ().

,FileInstall( ).

Dest

Source. %A_WorkingDir%.. Source,.

Flag

():

0=()1=

,(10).

ErrorLevel

[v1.1.04+]., .

Page 573: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

Ahk2Exe,.,,.

."FileInstall", Dest.

.

(),,.

FileCopy,#Include

FileInstall,C:\MyDocuments\MyFile.txt,

%A_ProgramFiles%\MyApplication\Readme.txt,1

Page 574: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileMove.

FileMove,SourcePattern,DestPattern[,Flag]

SourcePattern

,C:\Temp\*.tmp. SourcePattern %A_WorkingDir%.

DestPattern

, %A_WorkingDir%.(),,:

FileMove,C:\*.txt,C:\MyFolder

FileMove,C:\*.txt,C:\MyFolder\*.*

Flag

():

0=()

1=

,(10).

ErrorLevel

Page 575: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.04+]., .

ErrorLevel,0.,(),ErrorLevel0.,

IfExist FileExist().

FileCopy,,.

, A_LastError0()GetLastError().A_LastError.

FileMove.(),., FileMoveDir.

.

,.,.

FileCopy,FileCopyDir,FileMoveDir,FileDelete

FileMove,C:\MyDocuments\List1.txt,D:\Main

Backup\;.

FileMove,C:\FileBefore.txt,C:\FileAfter.txt;

.

FileMove,C:\Folder1\*.txt,D:\NewFolder\*.bkp;

.

Page 576: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

ErrorCount:=MoveFilesAndFolders("C:\My

Folder\*.*","D:\Foldertoreceiveallfiles&

folders")

ifErrorCount<>0

MsgBox%ErrorCount%files/folderscouldnotbe

moved.

MoveFilesAndFolders(SourcePattern,

DestinationFolder,DoOverwrite=false)

;SourcePatternDestinationFolder

;/.v1.0.38+

;FileMoveDir2.

{

ifDoOverwrite=1

DoOverwrite=2; FileMoveDir2

1.

;():

FileMove,%SourcePattern%,

%DestinationFolder%,%DoOverwrite%

ErrorCount:=ErrorLevel

;:

Loop,%SourcePattern%,2;2"".

{

FileMoveDir,%A_LoopFileFullPath%,

%DestinationFolder%\%A_LoopFileName%,

%DoOverwrite%

ErrorCount+=ErrorLevel

ifErrorLevel;.

MsgBoxCouldnotmove

%A_LoopFileFullPath%into%DestinationFolder%.

}

returnErrorCount

}

Page 577: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileMoveDir..

FileMoveDir,Source,Dest[,Flag]

Source

(), %A_WorkingDir%.:C:\MyFolder

Dest

(), %A_WorkingDir%.:D:\MyFolder. :Dest;

Source().

Flag

():

0():. Dest,.

1:., Dest Source. : Source Dest, Source

.,.

2:1,.

R:.,""; Source(). Source,

. Dest,.

Page 578: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

FileMoveDir.(), FileMove.

UNC,/.

FileCopyDir,FileCopy,FileMove,FileDelete,,FileSelectFolder,SplitPath

FileMoveDir,C:\MyFolder,D:\MyFolder;.

FileMoveDir,C:\MyFolder,C:\MyFolder(renamed),

R;.

FileMoveDir,C:\MyFolder,C:\NewLocation\My

Folder,R;,"".

Page 579: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileOpen [AHK_L42+]

.

file:=FileOpen(Filename,Flags[,Encoding])

Filename

, A_WorkingDir.

[v1.1.17+]:()input/output/error:

FileOpen("*","r");forstdin

FileOpen("*","w");forstdout

FileOpen("**","w");forstderr

Flags

[AHK_L54+] ,(tab); [AHK_L42+] ()..

Encoding

.UTF-8UTF-16 , h (handle)., A_FileEncoding

.

Flags

()

Page 580: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

r 0 : .

w 1 : , .

a 2 : ,.

rw 3 /: .

h Filename.., Close. Filename() Seek,Tell Length.

-rwd ,/. r ,w d . - -rwd .,.

0 Flags,.

0x100 .

0x200 .

0x400 .

(EOL)

`n 4 `r`n `n `n `r`n .

`r 8 `r `n .

, .

,0 [inAHK_L54+]A_LastError.

iffile IsObject(file) .

Page 581: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

UTF-8UTF-16,, Encoding( A_FileEncoding, Encoding)

"UTF-8-RAW""UTF-16-RAW".

UTF-8UTF-16(BOM),BOM., File.Position 32.

FileEncoding,,FileRead

;:,,.

; DllCall .

FileSelectFile,FileName,S16,,Createanewfile:

if(FileName="")

return

file:=FileOpen(FileName,"w")

if!IsObject(file)

{

MsgBoxCan'topen"%FileName%"for

writing.

return

}

TestString:="Thisisateststring.`r`n";,

`r`n`n.

file.Write(TestString)

file.Close()

;,.

file:=FileOpen(FileName,"r-d");("r"),

("-d")

if!IsObject(file)

{

Page 582: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxCan'topen"%FileName%"for

reading.

return

}

CharsToRead:=StrLen(TestString)

TestString:=file.Read(CharsToRead)

file.Close()

MsgBoxThefollowingstringwasreadfromthe

file:%TestString%

;:

file:=FileOpen(A_ScriptFullPath,"r")

MsgBox%file.ReadLine()

;:

DllCall("AllocConsole")

;stdin/stdout.

stdin:=FileOpen("*","r`n");Requires

v1.1.17+

stdout:=FileOpen("*","w`n")

;Forolderversions:

;stdin:=FileOpen(DllCall("GetStdHandle",

"int",-10,"ptr"),"h`n")

;stdout:=FileOpen(DllCall("GetStdHandle",

"int",-11,"ptr"),"h`n")

stdout.Write("Enteryourquery.`n\>")

stdout.Read(0);Flushthewritebuffer.

query:=RTrim(stdin.ReadLine(),"`n")

stdout.WriteLine("Yourquerywas'"query"'.Have

aniceday.")

stdout.Read(0);.

Sleep5000

Page 583: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileReadLine.

FileReadLine,OutputVar,Filename,LineNum

OutputVar

.

Filename

, %A_WorkingDir%.WindowsUnix;(`r`n)

(`n).

LineNum

(1,2,). .

, ErrorLevel1 OutputVar.,/CRLF,.

ErrorLevel

[v1.1.04+]., .

ErrorLevel0.1 OutputVar.

A_LastErrorGetLastError().

Page 584: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.(), ., FileRead.

tab OutputVar,(`n). AutoTrim(),tab.

: MyLine=%MyLine% .

65,534.,( FileRead ).

FileOpen/File.ReadLine(),FileRead,FileAppend,,IniRead

Loop

{

FileReadLine,line,C:\My

Documents\ContactList.txt,%A_Index%

ifErrorLevel

break

MsgBox,4,,Line#%A_Index%is"%line%".

Continue?

IfMsgBox,No

return

}

MsgBox,Theendofthefilehasbeenreachedor

therewasaproblem.

return

Page 585: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileRead.

FileRead,OutputVar,Filename

OutputVar

.("")), OutputVar( ErrorLevel1).

Filename,(ErrorLevel0).

Filename

, %A_WorkingDir%.

:.tab.: *t*m5000C:\Log

Files\200601.txt .

*c: ClipboardAll. *c.

*m1024:,,,( Try).,1024.,

.:(`r)`r`n.

*t:(`r`n)(`n).,.,`r`n Gui.,

FileAppend`r`n;`r`n`r`r`n.,`r`n`n, : Loop,

parse,MyFileContents,`n,`r .

Page 586: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

*Pnnn:[AHK_L42+]: FileEncoding, nnn .

ErrorLevel

[v1.1.04+]., .

ErrorLevel0.,1,:1);2);3).

A_LastErrorGetLastError().

,,FileRead .,,:

*C ,.

*Pnnn nnn,.

,.

OutputVar,()AutoHotkey"".,( NumGet()).

, FileOpen() File.RawRead() File.ReadNum().

,FileRead .

1GB ErrorLevel1 OutputVar, *m.

FileRead #MaxMem., FileGetSize.

Page 587: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileOpen()FileRead,. .

FileEncoding,FileOpen/FileObject,,FileReadLine,FileGetSize,FileAppend,

IniRead,Sort,UrlDownloadToFile

;#1:OutputVar.

FileRead,OutputVar,C:\MyDocuments\MyFile.txt

;#2:.

FileRead,Contents,C:\AddressList.txt

ifnotErrorLevel;

{

Sort,Contents

FileDelete,C:\AddressList(alphabetical).txt

FileAppend,%Contents%,C:\AddressList

(alphabetical).txt

Contents=;.

}

Page 588: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileRecycle,.

FileRecycle,FilePattern

FilePattern

,C:\Temp\*.tmp. FilePattern %A_WorkingDir%.

,.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

SHFileOperation.,;v1.0.96,.

FileRecycleEmpty,FileDelete,FileCopy,FileMove

Page 589: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileRecycle,C:\tempfiles\*.tmp

Page 590: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileRecycleEmpty.

FileRecycleEmpty[,DriveLetter]

DriveLetter

,.,,C:\

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

MSInternetExplorer4.

FileRecycle,FileDelete,FileCopy,FileMove

FileRecycleEmpty,C:\

Page 591: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 592: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileRemoveDir.

FileRemoveDir,DirName[,Recurse?]

DirName

, %A_WorkingDir%.

?

0(): DirName. DirName,ErrorLevel1.

1:(Windows"rmdir/S").

,(10).

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

Page 593: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileCreateDir,FileDelete

FileRemoveDir,C:\DownloadTemp

FileRemoveDir,C:\DownloadTemp,1

Page 594: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSelectFile.

FileSelectFile,OutputVar[,Options,

RootDir\Filename,Prompt,Filter]

OutputVar

.(),.

,,.

M:.Mshift-click,control-click. M(,MM1

).,.

S:.S. S()(,SS24).

M S,.,.,816,24.

1:

2:

8:

16:

32[v1.0.43.09+]:(.lnk)..

Page 595: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"""",.Windows.

RootDir\Filename

,:

RootDir:(), %A_WorkingDir%.,,(

FileSelectFile).v1.0.43.10+WindowsXP/2003,

::{20d04fe0-3aea-1069-a2d8-08002b30309d} (),

CLSID(,).

Filename:.().,(/<|:").

:

C:\MyPictures\DefaultImageName.gif;

RootDir Filename.

C:\MyPictures; RootDir.

MyPictures; RootDir,.

MyFile; Filename("MyFile",

RootDir).

Prompt

.,"SelectFile-%A_SCRIPTNAME%"().

Filter

.

:Documents(*.txt)

:Audio(*.wav;*.mp2;*.mp3)

Page 596: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,(*.*)."",(*.txt).

,,""(*.*).,,.

ErrorLevel

[v1.1.04+]., .

(), ErrorLevel1.(),1.0.

(), OutputVar.

, OutputVar.

M(), OutputVar,(`n).(,C:\).().:

C:\MyDocuments\NewFolder[]

test1.txt[]

test2.txt

....

(.)

,64KB., OutputVar.

GUI Gui+OwnDialogs.GUI.

:FileSelectFile .,,:

Page 597: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Thread,NoTimers

FileSelectFile,OutputVar

Thread,NoTimers,false

:v1.0.25.06+,"4".,,.,, OutputVar(`n).

,M,(`n).

FileSelectFolder,MsgBox,InputBox,ToolTip,GUI,CLSID,,SplitPath

,,. DllCall(),

www.autohotkey.com/forum/topic17230.html.

FileSelectFile,SelectedFile,3,,Openafile,

TextDocuments(*.txt;*.doc)

ifSelectedFile=

MsgBox,Theuserdidn'tselectanything.

else

MsgBox,Theuserselectedthe

following:`n%SelectedFile%

;CLSID(XP/2003):

FileSelectFile,OutputVar,,::{645ff040-5081-101b-

9f08-00aa002f954e};.

;:

FileSelectFile,files,M3;M3=.

iffiles=

Page 598: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

MsgBox,Theuserpressedcancel.

return

}

Loop,parse,files,`n

{

ifa_index=1

MsgBox,Theselectedfilesareall

containedin%A_LoopField%.

else

{

MsgBox,4,,Thenextfileis

%A_LoopField%.Continue?

IfMsgBox,No,break

}

}

return

Page 599: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSelectFolder.

FileSelectFolder,OutputVar[,StartingFolder,

Options,Prompt]

OutputVar

.(),.(C:\), OutputVar.,:

FileSelectFolder,Folder

Folder:=RegExReplace(Folder,"\\$");

,.

StartingFolder

,(). CLSID ::{20d04fe0-3aea-1069-

a2d8-08002b30309d} ().

,., *C:\ C., *C:\MyFolder .

()., StartingFolder( StartingFolder). StartingFolder

,.

,.tab.,C:\MyFolder(C:\My

Folder\Projects):

Page 600: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

C:\MyFolder*C:\MyFolder\Projects

:

0:(Windows2000,"").

1():.

2 .,3"".

4 BIF_NEWDIALOGSTYLE.4FileSelectFolder

WinPEBartPE.,"",WindowsXP.

["4"v1.0.48+]

, OutputVar,WindowsXP.

.

Prompt

.,"SelectFolder-%A_SCRIPTNAME%"().

ErrorLevel

[v1.1.04+]., .

(), ErrorLevel1.(),1.0.

Page 601: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI Gui+OwnDialogs.GUI.

:FileSelectFolder .,,:

Thread,NoTimers

FileSelectFolder,OutputVar,,3

Thread,NoTimers,false

FileSelectFile,MsgBox,InputBox,ToolTip,GUI,CLSIDList,FileCopyDir,

FileMoveDir,SplitPath

,,. DllCall(),

www.autohotkey.com/forum/topic17230.html.

FileSelectFolder,OutputVar,,3

ifOutputVar=

MsgBox,Youdidn'tselectafolder.

else

MsgBox,Youselectedfolder"%OutputVar%".

;CLSID:

FileSelectFolder,OutputVar,::{20d04fe0-3aea-

1069-a2d8-08002b30309d};.

Page 602: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSetAttrib..

FileSetAttrib,Attributes[,FilePattern,

OperateOnFolders?,Recurse?]

Attributes

().

FilePattern

, C:\Temp\*.tmp . FilePattern %A_WorkingDir%.

, .

OperateOnFolders?

0()().

.

().

:FilePattern,.

.

?

0().

Page 603: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, FilePattern., FilePattern.,259,

,.,.

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel ,0.

, A_LastError0()GetLastError().A_LastError.

Attributes.

:

+

-

^ ()

:

R=

A=

S=

H=

Page 604: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

N=()

O=

T=

:,.

FileGetAttrib,FileGetTime,FileSetTime,FileGetSize,FileGetVersion,

FileSetAttrib,+RH,C:\MyFiles\*.*,1;+RH

+R+H

FileSetAttrib,^H,C:\MyFiles;"".

FileSetAttrib,-R+A,C:\NewTextFile.txt

FileSetAttrib,+A,C:\*.ini,,1;C.ini

.

Page 605: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSetTime..

FileSetTime[,YYYYMMDDHH24MISS,FilePattern,

WhichTime,OperateOnFolders?,Recurse?]

YYYYMMDDHH24MISS

,.,().1601.

.,, .: FileSetTime,Year.Month.

Day,C:\MyFile.txt .

FilePattern

,C:\Temp\*.tmp. FilePattern %A_WorkingDir%.

, .

WhichTime

:

M=(,)

C=

A=

OperateOnFolders?

Page 606: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

0()().

.

().

:FilePattern,.

.

?

0().

, FilePattern., FilePattern.,259,

,.,.

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel ,0. FilePattern,ErrorLevel1.

, A_LastError0()GetLastError().A_LastError.

FAT16&FAT32NTFS.

YYYYMMDDHH24MISS:

YYYY 4

Page 607: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MM 2(01-12)

DD 2(01-31)

HH24 242(00-23).,099am219pm.

MI 2(00-59)

SS 2(00-59)

YYYYMMDDHH24MISS(200403),:

MM:01

DD:01

HH24:00

MI:00

SS:00

A_Now., A_NowUTC.

: EnvAdd EnvSub.,,.;,20040201()

200401010533. EnvSub.

FileGetTime,FileGetAttrib,FileSetAttrib,FileGetSize,FileGetVersion,

FormatTime,,EnvAdd,EnvSub

;:

FileSetTime,,C:\temp\*.txt

Page 608: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;():

FileSetTime,20040122,C:\MyDocuments\test.doc

;.4:55pm:

FileSetTime,200401221655,C:\My

Documents\test.doc,C

;.

;,.:

FileSetTime,20040122165500,C:\Temp\*.*,M,1

Page 609: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfExist/IfNotExist.

IfExist,FilePattern

IfNotExist,FilePattern

AttributeString:=FileExist(FilePattern)

FilePattern

,. FilePattern %A_WorkingDir%.

FileExist(),,Else,

IfExist,D:\

MsgBox,Thedriveexists.

IfExist,D:\Docs\*.txt

MsgBox,Atleastone.txtfileexists.

IfNotExist,C:\Temp\FlagFile.txt

MsgBox,Thetargetfiledoesnotexist.

Page 610: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniDelete.ini.

IniDelete,Filename,Section[,Key]

Filename

.ini, %A_WorkingDir%.

Section

.ini,().

.ini. , Section.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

ini:

[SectionName]

Page 611: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Key=Value

IniRead,IniWrite,RegDelete

IniDelete,C:\Temp\myfile.ini,section2,key

Page 612: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniReadini,.

IniRead,OutputVar,Filename,Section,Key[,

Default]

IniRead,OutputVarSection,Filename,Section

IniRead,OutputVarSectionNames,Filename

OutputVar

., Default().

OutputVarSection

[AHK_L57+]: Key.65,533,.

OutputVarSectionNames

[AHK_L57+]: Key Section( `n ).

Filename

ini, %A_WorkingDir%.

Section

ini,().

Key

Page 613: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ini.

Default

OutputVar.,ERROR.(), %A_Space%.

[AHK_L57+]: Key.

ErrorLevel

ErrorLevel., OutputVar Default.

/tab.,.,.

65,535.

ini:

[SectionName]

Key=Value

Unicode:IniReadIniWrite GetPrivateProfileString

WritePrivateProfileString.UTF-16Unicode;ANSI.

IniDelete,IniWrite,RegRead,,FileRead

Page 614: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniRead,OutputVar,C:\Temp\myfile.ini,section2,

key

MsgBox,Thevalueis%OutputVar%.

Page 615: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniWrite.ini.

IniWrite,Value,Filename,Section,Key

IniWrite,Pairs,Filename,Section

Value

Key(=).

, ,.

Pairs

[AHK_L57+]:Sectionini,[SectionName]. Key.

Pairs.section,key=value. Pairs(=),.

, IniRead.

Filename

ini, %A_WorkingDir%.

Section

ini,().

Key

ini.

Page 616: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

65,535.

ini:

[SectionName]

Key=Value

ANSIcodepageUTF-16, AutoHotkey .UTF-16,UTF-16

..

Unicode:IniReadIniWrite GetPrivateProfileString

WritePrivateProfileString.UnicodeUTF-16;ANSI.

Unicode,IniWriteUTF-16.,IniWrite.:

FileAppend,,NonUnicode.ini,CP0;.

IniDelete,IniRead,RegWrite

Page 617: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IniWrite,thisisanewvalue,C:\Temp\myfile.ini,

section2,key

Page 618: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop(),.

Loop,Files,FilePattern[,Mode];v1.1.21+()

Loop,FilePattern[,IncludeFolders?,Recurse?]

Files[v1.1.21+]

Files ()..

FilePattern

, C:\Temp\*.tmp . FilePattern %A_WorkingDir%.

./ 8.3.

() Recurse1,,.

Mode[v1.1.21+]

():

D :().

F :.FD,.

R :.R,.

Page 619: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IncludeFolders??

,:

0 :()().

1 :.

2 :().

Recurse??

,:

0 :().

1 :, FilePattern., FilePattern.

.,:

A_LoopFileName ().

A_LoopFileExt (TXT,DOCEXE).(.).

A_LoopFileFullPath /. FilePattern,., FilePattern(8.3)().

A_LoopFileLongPathA_LoopFileFullPath:1) FilePattern,/;2)FilePattern.,.

/8.3.:C:\MYDOCU~1\ADDRES~1.txt.FilePattern,.

8.3, FilePattern:

Loop,C:\My

Page 620: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_LoopFileShortPath Documents\AddressList.txt

ShortPathName=

%A_LoopFileShortPath%

:, ,NtfsDisable8dot3NameCreation.FilePattern SetWorkingDir

A_LoopFileShortName 8.3.(8.3NTFS),A_LoopFileName.

A_LoopFileDir A_LoopFileName. FilePattern,..:C:

A_LoopFileTimeModified . YYYYMMDDHH24MISS.

A_LoopFileTimeCreated . YYYYMMDDHH24MISS.

A_LoopFileTimeAccessed . YYYYMMDDHH24MISS.

A_LoopFileAttrib .

A_LoopFileSize .4GB.

A_LoopFileSizeKB KB,.

A_LoopFileSizeMB MB,.

/,.

,.,DIROS.,/,:

ifA_LoopFileAttribcontainsH,R,S;H(

),R()S().:"H,R,S".

continue;.

Page 621: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, SetWorkingDir,Loop( Loop,*.*,0,1 ).

A_LoopFileFullPath.

,., FileMove,:,.,.:

FileList=

Loop,Files,*.jpg

FileList=%FileList%%A_LoopFileName%`n

Loop,Parse,FileList,`n

FileMove,%A_LoopField%,

renamed_%A_LoopField%

NTFS.., Sort,.

259,,.,.

Loop,Break,ContinueA_Index().

Loop,Break,Continue,,SplitPath,FileSetAttrib,FileSetTime

;#1:

LoopFiles,%A_ProgramFiles%\*.txt,R;.

{

MsgBox,4,,Filename=

%A_LoopFileFullPath%`n`nContinue?

IfMsgBox,No

break

}

Page 622: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#2:,:

SetBatchLines,-1;.

FolderSizeKB=0

FileSelectFolder,WhichFolder;.

Loop,Files,%WhichFolder%\*.*,R

FolderSizeKB+=%A_LoopFileSizeKB%

MsgBoxSizeof%WhichFolder%is%FolderSizeKB%KB.

;#3:():

FileList=;.

Loop,C:\*.*

FileList=%FileList%%A_LoopFileName%`n

Sort,FileList,R;R. Sort.

Loop,parse,FileList,`n

{

ifA_LoopField=;.

continue

MsgBox,4,,Filenumber%A_Index%is

%A_LoopField%.Continue?

IfMsgBox,No

break

}

;#4::

FileList=

Loop,Files,%A_MyDocuments%\Photos\*.*,FD;

Page 623: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileList=

%FileList%%A_LoopFileTimeModified%`t%A_LoopFileNam

e%`n

Sort,FileList;.

Loop,Parse,FileList,`n

{

ifA_LoopField=;().

continue

StringSplit,FileItem,A_LoopField,%A_Tab%;

tab.

MsgBox,4,,Thenextfile(modifiedat

%FileItem1%)is:`n%FileItem2%`n`nContinue?

IfMsgBox,No

break

}

;#5:

;:

CopyIfNewer:

;CopySourcePatternCopyDest.

Loop,Files,%CopySourcePattern%

{

copy_it=n

IfNotExist,%CopyDest%\%A_LoopFileName%;,

.

copy_it=y

else

{

FileGetTime,time,

%CopyDest%\%A_LoopFileName%

EnvSub,time,%A_LoopFileTimeModified%,

seconds;.

iftime<0;.

copy_it=y

Page 624: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

ifcopy_it=y

{

FileCopy,%A_LoopFileFullPath%,

%CopyDest%\%A_LoopFileName%,1;

ifErrorLevel

MsgBox,Couldnotcopy

"%A_LoopFileFullPath%"to

"%CopyDest%\%A_LoopFileName%".

}

}

Return

;#6:,

;/.

Loop%0%;().

{

GivenPath:=%A_Index%;.

Loop%GivenPath%,1

LongPath=%A_LoopFileLongPath%

MsgBoxThecase-correctedlongpathnameof

file`n%GivenPath%`nis:`n%LongPath%

}

Page 625: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop(),( FileReadLine).

Loop,Read,InputFile[,OutputFile]

Read

READ.

InputFile

, %A_WorkingDir%.WindowsUnix;(`r`n)

(`n).

OutputFile

(), %A_WorkingDir%.

,() FileAppend.2 FileAppend,.,

(`n).

,.Loop FileAppend.

(EOL) :EOL.(`n)(LF)WindowsCR+LF

.: *C:\MyUnixFile.txt .,Loop FileAppend

(`r`n),EOL.

Page 626: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(stdout) : OutputFile(*) FileAppend(stdout).,

EXE ,. FileAppend.

:, OutputFile(`,).

,. FileReadLine,:1);2).

A_LoopReadLine.(`r`n).,.

65,534.,.

StringSplit InputFile., InputFiletab,,:

Loop,read,C:\DatabaseExport.txt

{

Loop,parse,A_LoopReadLine,%A_Tab%

{

MsgBox,Fieldnumber%A_Index%is

%A_LoopField%.

}

}

, FileRead,().

, FileOpen DllCall().

Loop,Break,ContinueA_Index().

, FileEncoding.

Page 627: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileEncoding,FileOpen/,FileRead,FileReadLine,FileAppend,Sort,Loop,

Break,Continue,,FileSetAttrib,FileSetTime

;#1:FAMILY.

;.

;FileDelete,C:\Docs\FamilyAddresses.txt

Loop,read,C:\Docs\AddressList.txt,

C:\Docs\FamilyAddresses.txt

{

IfInString,A_LoopReadLine,family,

FileAppend,%A_LoopReadLine%`n

}

;#2:.

Loop,read,C:\LogFile.txt

last_line:=A_LoopReadLine;,.

;#3:HTML

;FTPHTTPURL:

FileSelectFile,SourceFile,3,,Pickatextor

HTMLfiletoanalyze.

ifSourceFile=

return;.

Page 628: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SplitPath,SourceFile,,SourceFilePath,,

SourceFileNoExt

DestFile=%SourceFilePath%\%SourceFileNoExt%

ExtractedLinks.txt

IfExist,%DestFile%

{

MsgBox,4,,Overwritetheexistinglinksfile?

PressNotoappendtoit.`n`nFILE:%DestFile%

IfMsgBox,Yes

FileDelete,%DestFile%

}

LinkCount=0

Loop,read,%SourceFile%,%DestFile%

{

URLSearchString=%A_LoopReadLine%

Gosub,URLSearch

}

MsgBox%LinkCount%linkswerefoundandwrittento

"%DestFile%".

return

URLSearch:

;URLURL,:

StringGetPos,URLStart1,URLSearchString,http://

StringGetPos,URLStart2,URLSearchString,ftp://

StringGetPos,URLStart3,URLSearchString,www.

;:

URLStart=%URLStart1%;.

Loop

{

;"URLStart%A_Index%"

;():

Page 629: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ArrayElement:=URLStart%A_Index%

ifArrayElement=; .

break

ifArrayElement=-1;.

continue

ifURLStart=-1

URLStart=%ArrayElement%

else;URLStart,ArrayElement.

{

ifArrayElement<>-1

ifArrayElement<%URLStart%

URLStart=%ArrayElement%

}

}

ifURLStart=-1;URLSearchString.

return

;,:

StringTrimLeft,URL,URLSearchString,%URLStart%

;/.

Loop,parse,URL,%A_Tab%%A_Space%<>;,tab(

).

{

URL=%A_LoopField%

break;"".

}

;,

;.

;,.StringReplace,

;,

;:

StringReplace,URLCleansed,URL,",,All

FileAppend,%URLCleansed%`n

LinkCount+=1

Page 630: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

StringLen,CharactersToOmit,URL

CharactersToOmit+=%URLStart%

StringTrimLeft,URLSearchString,URLSearchString,

%CharactersToOmit%

Gosub,URLSearch;.

return

Page 631: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetWorkingDir.

SetWorkingDir,DirName

DirName

, %A_WorkingDir%.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

., MyFilename.txt%A_WorkingDir%: FileAppend,ALine

ofText,MyFilename.txt .

.,,"".

,:

SetWorkingDir%A_ScriptDir%

Page 632: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,., , .

%A_WorkingDir%,%A_ScriptDir%,FileSelectFolder

SetWorkingDir%A_ScriptDir%

SetWorkingDir,D:\MyFolder\Temp

Page 633: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SplitPathURL,,.

SplitPath,InputVar[,OutFileName,OutDir,

OutExtension,OutNameNoExt,OutDrive]

InputVar

.

[v1.1.21+]: % ,.

,:

SplitPath,%fileExist("z:\")?"z:\tmp":

"c:\tmp",_fileName,_fileDir

OutFileName

..

OutDir

,()..

OutExtension

(TXT,DOCEXE)..

Page 634: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OutNameNoExt

,.

OutDrive

.,().(UNC),,\\Workstation01

,.

InputVar(), OutDrive,.,, OutDir;,

OutFileName OutNameNoExt.

. InputVar.

(*?),,,,.

URL : InputVar,http://domain.comftp://domain.com,

OutDir(http://domain.com/images) OutDrive(

http://domain.com)..

A_LoopFileExt,StringSplit,StringGetPos,StringMid,StringTrimLeft,

StringLeft,FileSelectFile,FileSelectFolder

FullFileName=C:\MyDocuments\AddressList.txt

Page 635: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

SplitPath,FullFileName,name

;:

SplitPath,FullFileName,,dir

;:

SplitPath,FullFileName,name,dir,ext,

name_no_ext,drive

;:

;name=AddressList.txt

;dir=C:\MyDocuments

;ext=txt

;name_no_ext=AddressList

;drive=C:

Page 636: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Include/#IncludeAgain.

#IncludeFileOrDirName

#Include<LibName>

#IncludeAgainFileOrDirName

FileOrDirName

,. , %A_ScriptDir%,%A_AppData%,%A_AppDataCommon%

(v1.1.11+) %A_LineFile%.( `;),,.

File:,,/( ahk2exe,).: SetWorkingDir

#Include,#Include.

Directory:#Include FileInstall.:( A_WorkingDir).,

SetWorkingDir.

LibName

[AHK_L57+]:., #include<lib> #include

<lib_func> lib.ahk.

#Include().,(,

Page 637: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

www.autohotkey.com/forum/topic18545.html).

#Include FileName,.,#IncludeAgain,#Include.

FileName*i,.: #Include*iSpecialOptions.ahk ..

ListLinesView->Lines.,,#Include( ,).

#Include ., .

#,#Include.,:

ifx=1

#IncludeSomeFile.ahk;x.

y=2;IF,#IF.

(#Include).

[v1.1.11+]:%A_LineFile%\.. ,., #Include

%A_LineFile%\..\other.ahk .

,,FileInstall

#IncludeC:\MyDocuments\Scripts\Utility

Subroutines.ahk

#Include%A_ScriptDir%;#Include

FileInstall.

Page 638: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IncludeC:\MyScripts;,.

Page 639: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{...}(). ,Else,Loop,WhileIF.

{

}

.IF ELSE,, ELSEIF:

ifvar1=1

{

ifvar2=abc

sleep,1

}

else

return

, ,Else,LoopIF IfEqual IfWinExist.

IF,ELSE,Loop,While For,.,.

(),.

OneTrueBrace(OTB,K&R): OTB: if,else, while,For,,,Try,CatchFinally.,

.:

if(x<y){

Page 640: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

...

}else{

...

}

Whilex<y{

...

}

Fork,vinobj{

...

}

Loop%RepeatCount%{

...

}

MyFunction(x,y){

...

}

Try{

...

}Catche{

...

}Finally{

....

}

,(OneTrueBrace).:

ifx=1

{MsgBoxThislineappearstotherightofan

openingbrace.ItexecuteswhenevertheIF-

statementistrue.

MsgBoxThisisthenextline.

}MsgBoxThislineappearstotherightofa

closingbrace.Itexecutesunconditionally.

Page 641: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,While,Loop,Else,If,If(Expression)

ifx=1

{

MsgBox,test1

Sleep,5

}

else

MsgBox,test2

Page 642: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Break() ..

Break[,LoopLabel]

[AHK_L59+]: LoopLabel, .1,. LoopLabel,. ,.

Break Continue goto.

Continue,Loop,While,For,,

Loop

{

...

ifvar>25

break

...

ifvar<=5

continue

}

;.

outer:

Loop3

{

x:=A_Index

Page 643: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop3

{

if(x*A_Index=6)

breakouter; break2 goto

break_outer.

MsgBox%x%,%A_Index%

}

}

break_outer:;goto.

Page 644: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Catch [v1.1.04+]

try.

Catch[,OutputVar]

Statement

Catch[,OutputVar]

{

Statements

}

OutputVar

() .

Statement(s)

.

catch() try. catchtry, .

OneTrueBrace(OTB).:

try{

...

}catche{

Page 645: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

...

}

try-catch.: ErrorLevel., try.(), try. try-

catch ErrorLevel0.

OutputVar() exception.

Related

Try,Throw,Finally,Blocks

Try.

Page 646: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Continue. .

Continue[,LoopLabel]

[AHK_L59+]:,LoopLabel .1,.LoopLabel,. ,.

Continue:

1. A_Index1.

2. .

3. ().,;.

BreakContinue goto.

Break,Loop,Until,While,For,,

;5MsgBox,610.

;Loop5,"continue"

;MsgBox.

Loop,10

{

ifA_Index<=5

continue

MsgBox%A_Index%

Page 647: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

;.

outer:

Loop3

{

x:=A_Index

Loop3

{

if(x*A_Index=4)

continueouter; continue2 goto

continue_outer.

MsgBox%x%,%A_Index%

}

continue_outer:;goto.

ErrorLevel:=ErrorLevel;57,.

}

Page 648: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Critical,.

Critical[,Off]

Critical50; .

(On), ,.Off(v1.0.48+0), ThreadInterrupt

.

,., ,.

.:1) OnExit;2)0x312 OnMessage()( );3)

( SendMessage DllCall).,.

MsgBox,., ThreadInterrupt,.

CriticalOff

, CriticalOff ,5ms.99.999%

. Sleep-1 WinWait.

CriticalOff , GuiSize.

Page 649: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_IsCritical.Critical,,/()."CriticalOff".

Critical(),( ).,Critical, ( ,, ).

ThreadNoTimersCritical, .

v1.0.47+,Critical SetBatchLines-1 .

v1.0.47+,( Critical30 )Critical(ms).,

Critical16ms,Critical5ms./,

""., Sleep WinWait( DllCall("Sleep",Uint,

500) ).:, GUI.

Thread() ,,#MaxThreadsPerHotkey,#MaxThreadsBuffer,OnMessage(),

RegisterCallback(),Hotkey,Menu,SetTimer

#space::;Win+Space.

Critical

ToolTipNonewthreadswilllaunchuntilafter

thisToolTipdisappears.

Sleep3000

ToolTip;.

return;,..

Page 650: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ElseIFFALSE., ().

Else

ELSE()IF.ELSEIF, .

ELSE."elseif"().

IFELSE,.,IFELSE,.:

ifcount>0;,.

MsgBoxPressOKtobegintheprocess.

else;,.

{

WinCloseUntitled-Notepad

MsgBoxTherearenoitemspresent.

}

OneTrueBrace(OTB)"else".:

ifIsDone{

...

}elseif(x<y){

...

}else{

...

}

Page 651: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,IFELSE, IfWinActive,IfWinExist,IfMsgBox,IfInString,

IfBetween,IfIn,IF IF() .

IfWinExist,Untitled-Notepad

{

WinActivate

SendThisisatest.{Enter}

}

else

{

WinActivate,SomeOtherWindow

MouseClick,left,100,200

}

ifx=1

Gosub,a1

elseifx=2;"elseif"

Gosub,a2

elseIfEqual,x,3;

{

Gosub,a3

Sleep,1

}

elseGosub,a4;ELSE.

;:

IfEqual,y,1,Gosub,b1

else{

Sleep,1

Page 652: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gosub,b2

}

Page 653: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Exit( ).

Exit[,ExitCode]

ExitCode

-21474836482147483647( ),.,(RunWait)

(.bat)., ExitCode..

, Num/Scroll/CapsLockAlwaysOnAlwaysOff,Exit

( OnExit).

,Exit ., menu, Return.,Exit Return.

ExitApp .

ExitApp,OnExit,,Gosub,Return,,#Persistent

#z::

Page 654: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gosub,Sub2

MsgBox,Thismsgboxwillneverhappenbecauseof

theEXIT.

return

Sub2:

Exit;.

Page 655: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ExitApp.

ExitApp[,ExitCode]

ExitCode

-21474836482147483647(v1.0.48.01+ ),.,

(RunWait)(.bat)., ExitCode..

OnExit,."Exit".

, Num/Scroll/CapslockAlwaysOnAlwaysOff, Exit

ExitApp.

OnExit,ExitApp.

Exit,OnExit,#Persistent

#x::ExitApp;.

Page 656: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 657: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Finally [v1.1.14+]

try().

FinallyStatement

Finally

{

Statements

}

finally() try( catch). finally try, .

Trycatch finally. Try.

Goto,break,continue return finally, try., try

return42 ,42finally. finally.

v1.1.19.02,bug, finally, try. Return finally,.

OneTrueBrace(OTB)finally.:

try{

...

}finally{

...

}

Page 658: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

try{

...

}catche{

...

}finally{

...

}

Try,Catch,Throw,

try

{

ToolTip,Working...

Example1()

}

catche

{

;e, Catch.

MsgBox,16,,%"Exceptionthrown!`n`nwhat:"

e.what"`nfile:"e.file

."`nline:"e.line"`nmessage:"

e.message"`nextra:"e.extra

}

finally

{

ToolTip;

}

MsgBox,Done!

Page 659: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Finally

Example1()

{

try

Example2()

finally

MsgBox,Thisisalwaysexecutedregardless

ofexceptions

}

;

Example2()

{

ifMod(A_Min,2)

throwException("Testexception")

MsgBox,Example2didnotfail

}

Page 660: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

For [AHK_L59+]

.

ForKey[,Value]inExpression

.

.

Expression

.

.,;, _NewEnum() ., Next().

Next(),.

for,:

_enum:=(Expression)._NewEnum()

ifIsObject(_enum)

while_enum.Next(Key,Value)

{

Page 661: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

...

}

,.,. Object.Remove(first,last) .

for , .,("if""else").OneTrueBrace

(OTB),while.: forx,yinz{

, Break,Continue A_Index.

COM

Key ValueNext(),.COM, Key

IEnumVARIANT::Next(), Value ., Scripting.Dictionary

, Key Value8()3(). ComObjType.

[v1.0.96.00+]: SafeArray, Key Value.

,Object.NewEnum(),While,Loop,Until,Break,Continue,

;:

colours:=Object("red",0xFF0000,"blue",

0x0000FF,"green",0x00FF00)

;"colours":

fork,vincolours

s.=k"="v"`n"

MsgBox%s

Page 662: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;InternetExplorer:

forwindowin

ComObjCreate("Shell.Application").Windows

windows.=window.LocationName"::"

window.LocationURL"`n"

MsgBox%windows

/*

Class:CEnumerator

.,.MaxIndex().1,..,:

_NewEnum()

{

returnnewCEnumerator(this)

}

:http://www.autohotkey.com/board/topic/2667-

suggestions-on-documentation-improvements/?

p=531509

*/

;

Fork,vinTest

MsgBox%k%=%v%

;

classTest

{

staticData:=["abc","def","ghi"]

_NewEnum()

{

returnnewCEnumerator(this.Data)

Page 663: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

}

classCEnumerator

{

__New(Object)

{

this.Object:=Object

this.first:=true

;.MaxIndex().

;,.

this.ObjMaxIndex:=

Object.MaxIndex()

}

Next(ByRefkey,ByRefvalue)

{

if(this.first)

{

this.Remove("first")

key:=1

}

else

key++

if(key<=this.ObjMaxIndex)

value:=this.Object[key]

else

key:=""

returnkey!=""

}

}

Page 664: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gosub, Return.

Gosub,Label

, , Label,ReturnExit. "Return"Gosub.

"Exit" .

, Label (%MyLabel%),.,,"".

%MyLabel%,., IsLabel().:

ifIsLabel(VarContainingLabelName)

Gosub%VarContainingLabelName%

Gosub,, .

Return,,IsLabel(),,Loop,Goto

Page 665: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gosub,Label1

MsgBox,TheLabel1subroutinehasreturned(itis

finished).

return

Label1:

MsgBox,TheLabel1subroutineisnowrunning.

return

Page 666: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Goto.

Goto,Label

.

%MyLabel%,., IsLabel().:

ifIsLabel(VarContainingLabelName)

Goto%VarContainingLabelName%

Goto,. Else,,Break ContinueGoto.

Gosub,Return,IsLabel(),Else,,Break,Continue

Goto,MyLabel

...

Page 667: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MyLabel:

Sleep,100

...

Page 668: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

if() TRUE.

if()

if IfFoundColor<>Blue if ,"if".,: if(x>

0)and(y>0) .,"if" "not""!",.

iftrue(0),if .ELSE,else.

IF ELSE, .,IFELSE,..

if , if(expression) .

OneTrueBrace(OTB)if( if ).:

if(x<y){

...

}

ifWinExist("Untitled-Notepad"){

WinActivate

}

ifIsDone{

...

}else{

...

}

Page 669: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"else",if"{".

, ifvar[not]betweenLowerBoundandUpperBound, ifvar[not]in

value1,value2.

,(:=) ,ifvarin/containsMatchList,ifvarbetween,IfInString,,Else,While

if(A_Index>100)

return

if(A_TickCount-StartTime>2*MaxTime+100)

{

MsgBoxToomuchtimehaspassed.

ExitApp

}

if(Color="Blue"orColor="White")

{

MsgBoxThecolorisoneoftheallowedvalues.

ExitApp

}

elseif(Color="Silver")

{

MsgBoxSilverisnotanallowedcolor.

return

}

else

{

MsgBoxThiscolorisnotrecognized.

ExitApp

Page 670: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

Page 671: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

If/IfEqual/IfNotEqual/IfLess/IfLessOrEqual/IfGreater/IfGreaterOrEqualTRUE., ().

IfEqual,var,value(:ifvar=value)

IfNotEqual,var,value(:ifvar<>value)(!=

<>)

IfGreater,var,value(:ifvar>value)

IfGreaterOrEqual,var,value(:ifvar>=value)

IfLess,var,value(:ifvar<value)

IfLessOrEqual,var,value(:ifvar<=value)

Ifvar;0,false.true.

: IfInString

var

.

value

,(%var2%). var(),Value.

var value,.,( var, value).

IF ELSE,.:

Page 672: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifcount<=0

{

WinCloseUntitled-Notepad

MsgBoxTherearenoitemspresent.

}

,IFELSE,.

,IF.,:

IfEqual,x,1,Sleep,1

IfGreater,x,1,EnvAdd,x,2

:

ifx=1Sleep1

IfGreater,x,1,x+=2

OneTrueBrace(OTB)if.if.

, ifvar[not]betweenLowerBoundandUpperBound, ifvar[not]in

value1,value2.

IF() ,StringCaseSense,(:=) ,ifvarin/containsMatchList,ifvarbetween,

IfInString,,Else

Page 673: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifcounter>=1

Sleep,10

ifcounter>=1;IF,:

{

WinClose,Untitled-Notepad

Sleep10

}

ifMyVar=%MyVar2%

MsgBoxThecontentsofMyVarandMyVar2are

identical.

elseifMyVar=

{

MsgBox,4,,MyVarisempty/blank.Continue?

IfMsgBox,No

Return

}

elseifMyVar<>,

MsgBoxThevalueinMyVarisnotacomma.

else

MsgBoxThevalueinMyVarisacomma.

ifDone

MsgBoxThevariableDoneisneitheremptynor

zero.

Page 674: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Ifvar[not]betweenLowerBoundandUpperBound().

ifVarbetweenLowerBoundandUpperBound

ifVarnotbetweenLowerBoundandUpperBound

Var

.

LowerBound

, Var,.

UpperBound

, Var,.

,.,( Var)., StringCaseSenseOn .

"between","is","in""contains" .

Page 675: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfEqual/Greater/Less,ifvarin/containsMatchList,ifvaristype,IfInString,

StringCaseSense,EnvAdd,,Else

ifvarbetween1and5

MsgBox,%var%isintherange1to5,

inclusive.

ifvarnotbetween0.0and1.0

MsgBox%var%isnotintherange0.0to1.0,

inclusive.

ifvarbetween%VarLow%and%VarHigh%

MsgBox%var%isbetween%VarLow%and

%VarHigh%.

ifvarbetweenblueandred

MsgBox%var%isalphabeticallybetweenthe

wordsblueandred.

LowerLimit=1

UpperLimit=10

InputBox,UserInput,Enteranumberbetween

%LowerLimit%and%UpperLimit%

ifUserInputnotbetween%LowerLimit%and

%UpperLimit%

MsgBoxYourinputisnotwithinthevalid

range.

Page 676: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Ifvaris[not]type,.

ifvaristype

ifvarisnottype

var

.

type

.

Type:

integer var()true.tab..

float var;true.tab.,.

number var()true.

digit var09true.,:,tab,,,,0x.

xdigit :AF(), digit.v1.0.44.09+,0x.

alpha vartrue.,,tab,false., var, alpha.

Page 677: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

upper vartrue.,,tab,false.

lower vartrue.,,tab,false.

alnum 09, alpha.

space vartrue,:( %A_Space%),tab(%A_Tab%or`t),(`n),(`r),tab(`v)(`f).

time

vartrue, YYYYMMDDHH24MISS.,20044. StringLen.

1601,.9999.

DATETIME,.

: "between","is","in""contains" .

[AHK_L42+]: StringCaseSenseLocale,.

%A_YYYY%,SetFormat,FileGetTime,IfEqual,ifvarin/containsMatchList,if

varbetween,StringLen,IfInString,StringUpper,EnvAdd,,Else

ifvarisfloat

MsgBox,%var%isafloatingpointnumber.

elseifvarisinteger

MsgBox,%var%isaninteger.

ifvaristime

MsgBox,%var%isalsoavaliddate-time.

Page 678: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Ifvar[not]in/containsvalue1,value2,... .

ifVarinMatchList

ifVarnotinMatchList

ifVarcontainsMatchList

ifVarnotcontainsMatchList

Var

."in",.

"contains",: Var.

MatchList

, Var. tab ,., MatchList ABC,XYZ ,

VarABCXYZ.

.,string1: IfVarInstring1,,,string2 .,: If

VarInsingle,,item .,: IfVarIn

,string1,string2 ("contains",,).

MatchList,.,16383,,., MatchList

%List1%,%List2%,%List3% ,.

Page 679: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

16384,.,.

,.,"11""11.0".

(),"contains" IfInString/IfNotInString.

StringCaseSenseOn .

MatchList, ,.

"between","is","in""contains" .

ifvarbetween,IfEqual/Greater/Less,IfInString,StringCaseSense,,Else

ifvarinexe,bat,com

MsgBoxThefileextensionisanexecutable

type.

ifvarin1,2,3,5,7,11;.

MsgBox%var%isasmallprimenumber.

ifvarcontains1,3;.

MsgBoxVarcontainsthedigit1or3(Var

couldbe1,3,10,21,23,etc.)

ifvarin%MyItemList%

Page 680: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox%var%isinthelist.

InputBox,UserInput,EnterYESorNO

ifUserInputnotinyes,no

MsgBoxYourinputisnotvalid.

WinGetTitle,active_title,A

ifactive_titlecontainsAddressList.txt,Customer

List.txt

MsgBoxOneofthedesiredwindowsisactive.

ifactive_titlenotcontainsmetapad,Notepad

MsgBoxButthefileisnotopenineither

MetapadorNotepad.

Page 681: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfInString/IfNotInString.

IfInString,var,SearchString

IfNotInString,var,SearchString

Position:=InStr(Haystack,Needle[,CaseSensitive?,

StartingPos]]); InStr() .

var

.

SearchString

. StringCaseSense,.

%A_Space% %A_Tab%tab,.

.,:

IfInString,MyVar,abc,Gosub,Process1

IfInString,MyVar,abc

Gosub,Process1

,.:

Page 682: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfInString,MyVar,abc,found:=true;.

InStr(),RegExMatch(),StringGetPos,StringCaseSense,IfEqual,ifvar

in/containsMatchList,ifvarbetween,ifvaristype,Blocks,Else

Haystack=abcdefghijklmnopqrs

Needle=abc

IfInString,Haystack,%Needle%

{

MsgBox,Thestringwasfound.

return

}

else

Sleep,1

Page 683: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfMsgBox MsgBox.

IfMsgBox,ButtonName

ButtonName

MsgBox:

Yes()

No()

OK()

Cancel()

Abort()

Ignore()

Retry()

Continue() [v1.0.44.08+]

TryAgain() [v1.0.44.08+]

Timeout("timeout"MsgBox )

MsgBox

Page 684: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,4,,Wouldyouliketocontinue?,5;5

.

IfMsgBox,No

Return;"No".

IfMsgBox,Timeout

Return;"No".

;,:

...

Page 685: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfWinActive/IfWinNotActive/WinActive()., WinActive()ID(HWND).

IfWinActive[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

IfWinNotActive[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

UniqueID:=WinActive("WinTitle","WinText",

"ExcludeTitle","ExcludeText")

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.:,, IfWinActive IfWinNotActive., WinActive().

ExcludeText

.

Page 686: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .

, ., IfWinActive"true" IfWinNotActive"false",

.

WinActive() ID(HWND) .,0."true", WinTitle, if

WinActive("WinTitle") .

ID ActiveHwnd:=WinExist("A") .

SetWinDelayIfWinExist/IfWinActive.

. DetectHiddenWindows,.

IfWinExist,SetTitleMatchMode,DetectHiddenWindows,,WinActivate,

WinWaitActive,WinWait,WinWaitClose,#IfWinActive/Exist

IfWinActive,Untitled-Notepad

{

WinMaximize;IfWinActive.

Send,Sometext.{Enter}

return

}

ifWinActive("ahk_classNotepad")or

WinActive("ahk_class".ClassName);"ahk_class"

.

Page 687: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinClose; .

Page 688: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfWinExist/IfWinNotExist/WinExist. WinExist()ID(HWND) .

IfWinExist[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

IfWinNotExist[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

UniqueID:=WinExist("WinTitle","WinText",

"ExcludeTitle","ExcludeText")

UniqueID

ID(HWND) ().

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.:,, IfWinExist IfWinNotExist., WinExist().

ExcludeText

.

Page 689: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, ( IfWinNotExist).

, ., IfWinExist IfWinNotExist, .

WinExist() ID(HWND) (0)."true", WinTitle if

WinExist("WinTitle") .

HWND( Post/SendMessage DllCall), ControlGetHwnd

MouseGetPos.

SetWinDelay IfWinExist,IfWinActive.

. DetectHiddenWindows,.

IfWinActive,SetTitleMatchMode,DetectHiddenWindows,,Process,

WinActivate,WinWaitActive,WinWait,WinWaitClose,#IfWinActive/Exist

;1

IfWinExist,Untitled-Notepad

{

WinActivate;.

WinMaximize;

Send,Sometext.{Enter}

return

}

Page 690: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;2

IfWinNotExist,Calculator

return

else

{

WinActivate;"IfWinNotExist".

WinMove,40,40;.

return

}

;3

ifWinExist("ahk_classNotepad")or

WinExist("ahk_class".ClassName)

WinActivate; .

MsgBox%"Theactivewindow'sIDis".

WinExist("A")

;4:IfWinNotExist,Calculator

If!WinExist("Calculator")

return

Page 691: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop(): break.

Loop[,Count]

Count

().,Loop, break return.

Count%ItemCount%,1,.

,Count.,,%.: Loop%Count+1 .,

.

, .,("if""else").

, break.

break continue goto,."While""Do...While/Until",

IF, break. While Loop...Until.

A_Index. 1.2.,.A_Index, ;A_Index0.

OneTrueBrace(OTB)( ).:

Page 692: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop{

...

}

Loop%RepeatCount%{

...

}

:,(). ., ,., .

Until,While,For,,,,,Break,Continue,

Loop,3

{

MsgBox,Iterationnumberis%A_Index%.;

A_Index1,2,3

Sleep,100

}

Loop

{

ifa_index>25

break;

ifa_index<20

continue;

MsgBox,a_index=%a_index%;2025

}

Page 693: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop,Parse()(),.

Loop,Parse,InputVar[,Delimiters,OmitChars]

Parse

PARSE,,PARSE.

InputVar

., .

[v1.1.21+]: % ,"%"().

, InputVar.

CSV, InputVar.MSExcelCSV:

"firstfield",SecondField,"theword

""special""isquotedliterally",,"last

field,hasliteralcomma"

, Delimiters(), InputVar.

., InputVar,.

Page 694: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: `, ().,%A_Tab%%A_Space% InputVartab.

, StringReplace,:¤|§?a??μ?.,<br>:

StringReplace,NewHTML,HTMLString,<br>,

,All

Loop,parse,NewHTML, ;.

{

...

}

OmitChars

(),., OmitChars%A_Space%%A_Tab%,()

tab.

Delimiters, OmitChars().

, OmitChars(`,).

,. StringSplit(StringSplit ).

A_LoopField. InputVar().,.

"A_LoopDelimiter",.

InputVar., InputVar,"",.

, Sort.

Page 695: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop,Break,ContinueA_Index().

StringSplit,,Loop,Break,Continue,,Sort,FileSetAttrib,FileSetTime

;#1:

Colors=red,green,blue

Loop,parse,Colors,`,

{

MsgBox,Colornumber%A_Index%is

%A_LoopField%.

}

;#2:,( ).

; FileRead:

Loop,parse,FileContents,`n,`r;`r`n,

WindowsUnix.

{

MsgBox,4,,Linenumber%A_Index%is

%A_LoopField%.`n`nContinue?

IfMsgBox,No,break

}

;#3:,.

;,

Page 696: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;():

Loop,parse,clipboard,`n,`r

{

MsgBox,4,,Filenumber%A_Index%is

%A_LoopField%.`n`nContinue?

IfMsgBox,No,break

}

;#4:(CSV):

Loop,read,C:\DatabaseExport.csv

{

LineNumber=%A_Index%

Loop,parse,A_LoopReadLine,CSV

{

MsgBox,4,,Field%LineNumber%-%A_Index%

is:`n%A_LoopField%`n`nContinue?

IfMsgBox,No

return

}

}

;#5:.

;.

Colors=red,green|blue;yellow|cyan,magenta

;.

Position:=0

Loop,Parse,Colors,`,|;

{

Page 697: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.

Position+=StrLen(A_LoopField)+1

;.

Delimiter:=SubStr(Colors,Position,1)

MsgBoxField:%A_LoopField%`nDelimiter:

%Delimiter%

}

Page 698: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop(registry),.

Loop,Reg,RootKey[\Key,Mode];v1.1.21+()

Loop,RootKey[,Key,IncludeSubkeys?,Recurse?]

Reg[v1.1.21+]

Reg (),., (/),., Loop,Reg,

HKLM\Software Loop,Reg,%FullPathOfKey% .

RootKey

HKEY_LOCAL_MACHINE(HKLM),HKEY_USERS(

HKU),HKEY_CURRENT_USER(

HKCU),HKEY_CLASSES_ROOT(HKCR)

HKEY_CURRENT_CONFIG(HKCC).

,,:\\workstation01:HKEY_LOCAL_MACHINE

Key

(Software\SomeApplication)., .

Mode[v1.1.21+]

Page 699: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

K :.

V :.KV,.

R :.R, Key(:R,Key(KVKV,

)).

IncludeSubkeys?

0() Key().

1.

2().

?

0().

1,.

,.(), RegDelete.

.,:

A_LoopRegName ,.Windows,"()",A_LoopRegName.

A_LoopRegType

,:KEY(),REG_SZ,REG_EXPAND_SZ,REG_MULTI_SZ,REG_DWORD,REG_QWORD,REG_BINARY,REG_LINK,REG_RESOURCE_LIST,REG_FULL_RESOURCE_DESCRIPTOR,

Page 700: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

REG_RESOURCE_REQUIREMENTS_LIST,REG_DWORD_BIG_ENDIAN(Windows).,.

A_LoopRegKey

(HKEY_LOCAL_MACHINE,HKEY_USERS,HKEY_CURRENT_USER,HKEY_CLASSES_ROOTHKEY_CURRENT_CONFIG).,

A_LoopRegSubKey . Recurse, Key.,,.:Software\SomeApplication\MySubKey

A_LoopRegTimeModified . YYYYMMDDHH24MISS.(A_LoopRegTypeKEY),.

,:

RegRead,OutputVar .,ErrorLevel1 OutputVar.

RegWrite[,Value] . Value,0.,ErrorLevel1.

RegDelete .,.

( RootKey),:

.

(,),.

,,/,,.----.

(,Guest),,.

WindowsServer2003WindowsXP,MSDN:"[]

,.,."

WindowsXP,MSDN"".,cab.

Page 701: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop,Break,ContinueA_Index().

Loop,Break,Continue,,RegRead,RegWrite,RegDelete,SetRegView

;:InternetExplorerURL:

Loop,HKEY_CURRENT_USER,

Software\Microsoft\InternetExplorer\TypedURLs

RegDelete

;::

Loop,Reg,

HKEY_CURRENT_USER\Software\Microsoft\Windows,KVR

{

ifa_LoopRegType=key

value=

else

{

RegRead,value

ifErrorLevel

value=*error*

}

MsgBox,4,,%a_LoopRegName%=%value%

(%a_LoopRegType%)`n`nContinue?

IfMsgBox,NO,break

}

Page 702: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

;.

SetBatchLines-1;.

RegSearchTarget=Notepad;.

Gosub,RegSearch

return

RegSearch:

ContinueRegSearch=y

Loop,Reg,HKEY_LOCAL_MACHINE,KVR

{

Gosub,CheckThisRegItem

ifContinueRegSearch=n;.

return

}

Loop,Reg,HKEY_USERS,KVR

{

Gosub,CheckThisRegItem

ifContinueRegSearch=n;.

return

}

Loop,Reg,HKEY_CURRENT_CONFIG,KVR

{

Gosub,CheckThisRegItem

ifContinueRegSearch=n;.

return

}

;:HKEY_USERS,

;HKEY_CURRENT_USER.,HKEY_LOCAL_MACHINE,

;HKEY_CLASSES_ROOT.

return

CheckThisRegItem:

ifA_LoopRegType=KEY;,.

Page 703: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

RegRead,RegValue

ifErrorLevel

return

IfInString,RegValue,%RegSearchTarget%

{

MsgBox,4,,Thefollowingmatchwas

found:`n%A_LoopRegKey%\%A_LoopRegSubKey%\%A_LoopRe

gName%`nValue=%RegValue%`n`nContinue?

IfMsgBox,No

ContinueRegSearch=n;.

}

return

Page 704: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnExit () .

OnExit[,Label]

OnExit(Func[,AddRemove]); [v1.1.20+]

Label

,., label() ,( ).

Func

.,.OnExit,.,.

ExitFunc(ExitReason,ExitCode)

AddRemove

:

1:().

-1:.

0:.

label()().

Remarks

Page 705: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: ,, ExitApp. [v1.1.20+]:()--,Exit

ExitApp().

[v1.1.20+]:OnExit.label(), ExitApp.OnExit

ExitApp;,.

OnExit()means(:)(""). #SingleInstance

Reload.

, OnMessage(0x11,"WM_QUERYENDSESSION") .

OnExit #MaxThreads().,, , ,, .,

():exit, Reload #SingleInstance

,.

OnExit ,,.OnExit.

OnExit Exit ExitApp,v1.1.19. [v1.1.20+],,

ExitApp.

OnExitexit,, SendMode. auto-executesection() .

A_ExitReason,OnExit.,:

logoff .

Shutdown , Shutdown.

Close WM_CLOSEWM_QUIT,.,WM_CLOSE WinClose., Send,!{F4}

. Run/RunWait.

Page 706: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Menu .

Exit Exit ExitApp( ).

Reload Reload.

Single #SingleInstance,.

OnMessage(),RegisterCallback(),OnClipboardChange,ExitApp,Shutdown,

#Persistent,Threads,Gosub,Return,Menu

#Persistent., ExitOnExit."Yes""No".

#Persistent

OnExit,ExitSub

return

ExitSub:

ifA_ExitReasonnotinLogoff,Shutdown;,.

{

MsgBox,4,,Areyousureyouwanttoexit?

IfMsgBox,No

return

}

ExitApp;OnExit,ExitApp.

#Persistent

Page 707: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

OnExit("ExitFunc")

;:

OnExit(ObjBindMethod(MyObject,"Exiting"))

ExitFunc(ExitReason,ExitCode)

{

ifExitReasonnotinLogoff,Shutdown

{

MsgBox,4,,Areyousureyouwantto

exit?

IfMsgBox,No

return1;OnExit.

}

;ExitApp--OnExit.

}

classMyObject

{

Exiting()

{

MsgBox,MyObjectiscleaninguppriorto

exiting...

/*

this.SayGoodbye()

this.CloseNetworkConnections()

*/

}

}

Page 708: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Pause.

#p::Pause;Win+P..

Pause[,On|Off|Toggle,OperateOnUnderlyingThread?]

On|Off|Toggle

,Toggle.,:

Toggle:,,.

On:.

Off:,.,.

OperateOnUnderlyingThread?

PauseOff ,.,Pause(Toggle).

:

0():;Pause.

1:,().,, ("PauseScript").

: A_IsPaused.

Page 709: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Suspend , .,.

, .,( ); ,.,.

,.,1Menu.:

Menu,Tray,Icon,C:\MyIcon.ico,,1

, Thread,NoTimers.

Pause"PauseScript".

(,,GUI,)().

Suspend,Menu,ExitApp,,SetTimer

Pause::Pause;"pause"...

#p::Pause;...Win+p.

;Pause.

DetectHiddenWindows,On

WM_COMMAND:=0x111

ID_FILE_PAUSE:=65403

PostMessage,WM_COMMAND,ID_FILE_PAUSE,,,

Page 710: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

C:\YourScript.ahkahk_classAutoHotkey

Page 711: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Reload.

Reload

.,.

.,Reload., Run A_AhkPath A_ScriptFullPath

(, A_IsCompiled)., /restart (),Reload.:

,()., SetWorkingDir.

(),.,reload( return).,:

Reload

Sleep1000;,reloadSleep,.

MsgBox,4,,Thescriptcouldnotbereloaded.

Wouldyouliketoopenitforediting?

IfMsgBox,Yes,Edit

return

Edit

^!r::Reload;Ctrl-Alt-R.

Page 712: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Return,Gosub, Hotkey,GroupActivate.

Return[,Expression]

Expression

return .

,:

return3

return"literalstring"

returnMyVar

returni+1

returntrue;1"true".

returnItemCount<MaxItems;.

returnFindColor(TargetColor)

:,:

returnMyVar

return%MyVar%

,.,: return(%MyVar%) .

Page 713: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, Return Exit.

.

,Gosub,Exit,ExitApp,GroupActivate

#z::

MsgBoxTheWin-Zhotkeywaspressed.

GosubMySubroutine

return

MySubroutine:

Sleep1000

return

Page 714: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetBatchLines(CPU).

SetBatchLines,20ms

SetBatchLines,LineCount

20ms

(20ms.)ms,(10ms).,20ms

10ms:SetBatchLines,20ms .

LineCount

.9223372036854775807.,20ms;.

SetBatchLines-1 ().

10ms,v1.0.1610().

CPU"ms".,10ms50%CPU.,CPU

,/.

A_BatchLines.

,: SetWinDelay,SetControlDelay,SendMode,SetKeyDelay,

Page 715: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetMouseDelay SetDefaultMouseSpeed.

( , ).().

SetWinDelay,SetControlDelay,SendMode,SetKeyDelay,SetMouseDelay,

SetDefaultMouseSpeed,Critical

SetBatchLines,10ms

SetBatchLines,1000

Page 716: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetTimer.

SetTimer[,Label,Period|On|Off|Delete,Priority]

Label

, Label, Return Exit., Label (

%MyLabel%),.

[v1.1.01+]: Label, A_ThisLabel., SetTimer,,Off ,

SetTimer,,1000 Period() label. [v1.1.24+]:

A_ThisLabel,..

[v1.1.20+]:,, ., SetTimer%funcobj%,1000

SetTimer%funcobj,1000 .. .

: [v1.1.24+]:..

Period|On|Off|Delete

On() : .,(250). . ,.

Off() :.

Delete() [v1.1.20+]:. ,.().

Page 717: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:, . .:

,.

[v1.0.46.16+]: ,.-100,100ms

SetTimer,Label,Off .

[v1.1.24+]: Label(),,., Period()

Priority() .

Period() ,,,.4294967295ms(49.7).

::

1):250.

2): , Priority() .

Priority

-21474836482147483647( ).,0. .

,.

,,(),,.( A_TimeIdle).

,.,:, . .

,, ., Gosub(,; SendMode).

:SetTimerON(),"";,.

Page 718: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:, 1015.6().,WindowsNT/2000/XP110()

1015.6.Loop+Sleep,: DllCall+timeBeginPeriod

::

1. CPU.

2. ,( SetBatchLines).

3. ,, ( Critical).,., .

4. Critical ThreadInterrupt/Priority.,.,,.

, " ThreadNoTimers" .,().

,(),.

: .,().

,( SendMode). .

()5ms,15ms.,.

Thread,interrupt,0;.

,.

KeyHistory.

(), #Persistent.

Page 719: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gosub,Return,,Thread() ,Critical,IsLabel(),Menu,#Persistent

;#1::

#Persistent

SetTimer,CloseMailWarnings,250

return

CloseMailWarnings:

WinClose,MicrosoftOutlook,Atimeoutoccured

whilecommunicating

WinClose,MicrosoftOutlook,Aconnectiontothe

servercouldnotbeestablished

return

;#2:,:

#Persistent

SetTimer,Alert1,500

return

Alert1:

IfWinNotExist,VideoConversion,ProcessComplete

return

;Otherwise:

SetTimer,Alert1,Off;.

SplashTextOn,,,Thevideoconversionis

finished.

Sleep,3000

SplashTextOff

return

Page 720: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#3:,.

;

;:

#c::

ifwinc_presses>0;SetTimer,.

{

winc_presses+=1

return

}

;,.1

;:

winc_presses=1

SetTimer,KeyWinC,-400;400.

return

KeyWinC:

ifwinc_presses=1;.

{

Run,m:\;.

}

elseifwinc_presses=2;.

{

Run,m:\multimedia;.

}

elseifwinc_presses>2

{

MsgBox,Threeormoreclicksdetected.

}

;,count

;:

winc_presses=0

return

Page 721: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#4: method.

counter:=newSecondCounter

counter.Start()

Sleep5000

counter.Stop()

Sleep2000

;...

classSecondCounter{

__New(){

this.interval:=1000

this.count:=0

;Tick()"this"

;

;"this"Tick:

this.timer:=ObjBindMethod(this,"Tick")

}

Start(){

;:SetTimer.

timer:=this.timer

SetTimer%timer,%this.interval

ToolTip%"Counterstarted"

}

Stop(){

;:

timer:=this.timer

SetTimer%timer,Off

ToolTip%"Counterstoppedat"this.count

}

;,:

Tick(){

ToolTip%++this.count

}

Page 722: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

#4:

this.timer:=this.Tick.Bind(this) . this.timer

, this.Tick.Call(this) ( this.Tick ).

ObjBindMethod this.Tick() .

Tick Call, this this.timer .. ObjBindMethod

,,,GUI.

/, Label.,,( timer ).

Page 723: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Sleep.

Sleep,DelayInMilliseconds

Delay

(),02147483647(24), .

, Delay1015.6().,Windows2000/XP110()

1015.6., .

CPU,.,CPU(20).

0( ).,0020ms(),(,).,

0 Delay Delay.

, , .

Sleep-1:-1delay,. ,. Critical.

SetKeyDelay,SetMouseDelay,SetControlDelay,SetWinDelay,SetBatchLines

Page 724: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Sleep,1000;1

;,1015.6

;.

;:,

;timeBeginPeriod.

SetBatchLines-1;.

SleepDuration=1;(23).

TimePeriod=3;73..

;15.6ms,TimePeriod=7

;,TimePeriod=3.

DllCall("Winmm\timeBeginPeriod",uint,TimePeriod)

;,DllCall("Sleep"...),SetTimer

50

StartTime:=A_TickCount

Loop%Iterations%

DllCall("Sleep",UInt,SleepDuration);

DllCallSleep.

DllCall("Winmm\timeEndPeriod",UInt,TimePeriod)

;.

MsgBox%"Sleepduration=".(A_TickCount-

StartTime)/Iterations

Page 725: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Suspend.

Suspend[,Mode]

Mode

On:,.

Off:.

Toggle():(OnOff).

Permit:.

Suspend( SuspendOn )/.,ON..

/ .

, #IfWinActive/Exist.

(), Pause.

,S.,1Menu.:

Page 726: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Menu,Tray,Icon,C:\MyIcon.ico,,1

A_IsSuspended1,0.

#IfWinActive/Exist,Pause,Menu,ExitApp

^!s::Suspend;.

;Suspend.

DetectHiddenWindows,On

WM_COMMAND:=0x111

ID_FILE_SUSPEND:=65404

PostMessage,WM_COMMAND,ID_FILE_SUSPEND,,,

C:\YourScript.ahkahk_classAutoHotkey

Page 727: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Thread. .

Thread,NoTimers[,false]

Thread,Priority,n

Thread,Interrupt[,Duration,LineCount]

Thread,NoTimers[,false]:, , Thread,NoTimers,false ,().

() ThreadNoTimers ,( ThreadInterrupt ).,

NoTimers, ( ,).

,( Pause).

Thread,NoTimers Thread,NoTimers,true .,true/false

,1,0.

Thread,Priority,n: n-21474836482147483647( ).. .

, Critical ThreadPriority .

,,: Process,Priority,,High .

Thread,Interrupt[,Duration,LineCount]:,.

Page 728: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,15 1000 ().,( ).

0,.-1,.2147483647.

,, ., ,(:Thread,Interrupt,,).,

LineCount ,, LineCount.

,.,(). ,.

, MsgBox,InputBox,FileSelectFile FileSelectFolder.

.

, Critical ThreadInterrupt ThreadPriority .

Critical,,Hotkey,Menu,SetTimer,Process

Thread,priority,1;.

Thread,interrupt,0;:

Thread,interrupt,50,2000;50ms2000(

).

Page 729: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Throw [v1.1.04+]

. try-catch.

Throw[,Expression]

Expression

catchOutputVar.

,:

throw3

throw"literalstring"

throwMyVar

throwi+1

throw{what:"Customerror",file:

A_LineFile,line:A_LineNumber};

, , .

[v1.1.05+]:, exception.

Exception(Message[,What,Extra])

, :

Message: ErrorLevel.

Page 730: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

What:.

Extra:.

File:.

Line:.

What,..,-1 Exception.What ,

Exception.Line ., , What.

Message Extra.,.

try

BadlyCodedFunc()

catche

MsgBox%"Errorin"e.What",whichwas

calledatline"e.Line

BadlyCodedFunc(){

throwException("Fail",-1)

}

Try,Catch,Finally

Try.

Page 731: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Try [v1.1.04+]

() throw.

TryStatement

Try

{

Statements

}

try -()., try,. try, catch.

throw.try,:

catch,.

catch finally,.

catchfinally,try.

try,.

OneTrueBrace(OTB) try.:

try{

...

}catche{

...

}

Page 732: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Catch,Throw,Finally,

;#1:try/catch/throw.

try;.

{

HelloWorld()

MakeToast()

}

catche;/.

{

MsgBox,Anexceptionwas

thrown!`nSpecifically:%e%

Exit

}

HelloWorld();.

{

MsgBox,Hello,world!

}

MakeToast();.

{

;try:

throwA_ThisFunc"isnotimplemented,sorry"

}

;#2:try/catchErrorLevel.

Page 733: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

try

{

;:

FileCopy,%A_MyDocuments%\*.txt,

D:\Backup\Textdocuments

FileCopy,%A_MyDocuments%\*.doc,

D:\Backup\Textdocuments

FileCopy,%A_MyDocuments%\*.jpg,

D:\Backup\Photos

}

catch

{

MsgBox,16,,Therewasaproblemwhilebacking

thefilesup!

ExitApp

}

;#3:COM.

try

{

obj:=ComObjCreate("ScriptControl")

obj.ExecuteStatement("MsgBox""Thisis

embeddedVBScript""")

obj.InvalidMethod();.

}

catche

{

;e, Exception().

MsgBox,16,,%"Exceptionthrown!`n`nwhat:"

e.what"`nfile:"e.file

."`nline:"e.line"`nmessage:"

e.message"`nextra:"e.extra

}

Page 734: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#4:try-catch.

tryExample1();Try.

catche

MsgBox,Example1()threw%e%.

Example1()

{

tryExample2()

catche

{

ife=1

throwe;,.

else

MsgBox,Example2()threw%e%.

}

}

Example2()

{

Random,o,1,2

throwo

}

Page 735: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Until [AHK_L59+]

LoopFor.

Loop{

...

}UntilExpression

Expression

.

, continue.false(0),; Until.

LoopUntil:

Loop{

...

if(Expression)

break

}

,LoopUntil,,.:

Loop

x*=2

Page 736: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Untilx>y

UntilLoopFor.:

Loop,Read,%A_ScriptFullPath%

lines.=A_LoopReadLine."`n"

UntilA_Index=5;.

MsgBox%lines

A_Index Expression,.

Loop,While,For,Break,Continue,,,,,,If()

Page 737: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

While [v1.0.48+]

, .

WhileExpression

While(Expression)

Expression

.: whilex<y .

.true(0),;.

while , .,("if""else").

OneTrueBrace(OTB),while.: whilex<y{ .

A_Index.1.2.,.A_Index,0.

, Break., Continue,A_Index1while.

true,;.

:,(). ., ,., .

Page 738: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Until,Break,Continue,,Loop,For,,,,,If()

;,.

CoordMode,Mouse,Screen

~LButton::

MouseGetPos,begin_x,begin_y

whileGetKeyState("LButton")

{

MouseGetPos,x,y

ToolTip,%begin_x","begin_y"`n"

Abs(begin_x-x)"x"Abs(begin_y-y)

Sleep,10

}

ToolTip

return

Page 739: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI..

Gui,sub-command[,Param2,Param3,Param4]

Page 740: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

New:.

Add:,,.

Show:.,.

Submit:.

Cancel(Hide):.

Destroy:.

Font:,,.

Color:/.

Margin:/.

:.

Menu:.

Minimize/Maximize/Restore:.

Flash:.

Default:GUI.

:g

:GuiClose|GuiEscape|GuiSize|GuiContextMenu|GuiDropFiles

GUI

GUI,

: ||

:GUI

Page 741: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,New[,Options,Title] [v1.1.04+]

.

Gui,New,Options,Title;GUI.

Gui,Name:New,Options,Title;GUI,

GUI.

OptionsGUI .

Title,.

:

,, GuiNew.

,GUI 1GUI .

GUI GUI ,HWND. +HwndGuiHwnd GuiHwnd.Gui,

%GuiHwnd%:Default Gui.

:

GuiNewGUIGUI.,().

GuiNewGUI.GUI,.

,GUI .

,:

( GuiClose)"Gui", +LabelPrefix.

GUI, A_Gui.

Page 742: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: v1.1.08,Gui.

Page 743: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Add,ControlType[,Options,Text]

GUI(GUI).

ControlType:

Text,Edit,UpDown,Picture

Button,Checkbox,Radio

DropDownList,ComboBox

ListBox,ListView,TreeView

Link,Hotkey,DateTime,MonthCal

Slider,Progress

GroupBox,Tab,StatusBar

ActiveX(InternetExplorerControl)

:

Gui,Add,Text,,Pleaseenteryourname:

Gui,Add,Edit,vName

Gui,Show

Page 744: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Show[,Options,Title]

Options,,(), . Title,(,).

X,Y,WH.,X/Y.,.

Options(,):

Wn: n(),, .

Hn: n,.

Xn: nX,.0.

Yn: nY,.0.

Center:.

xCenter:.: Gui,Show,xCentery0 .

yCenter:.

AutoSize:.,/.::

Gui,Show,AutoSizeCenter

:

Minimize:.

Page 745: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Maximize:.

Restore:,.,.

NoActivate:,..

NA:.,,z(alt-tab).,.

Hide:.,, GuiCancel.: Gui,Show,Hidex55

y66w300h200,NewTitle .

Page 746: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Submit[,NoHide]

()NoHide., , . GuiDestroy,.

Page 747: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Cancel

, . GuiDestroy,.

Page 748: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Destroy

(),.,()(). GuiDestroy ,GUI.

Page 749: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Font[,Options,FontName]

,,/.:

gui,font,s10,Verdana;10Verdana.

GUI,.

FontName, . FontName,(,GUI).,

.,,VerdanaArial,ArialMSsansserif:

gui,font,,MSsansserif

gui,font,,Arial

gui,font,,Verdana;.

Options,.:

C:( )RGB,Default().: cRed ,cFFFFAA ,

cDefault .: Buttons.,C.: Gui,Add,Text,

cRed,MyText .

S:().: s12 (,)

W:,11000 (400700).: w600

: bold,italic,strike,underline,andnorm. Norm,().norm

., normitalic .

,.: cBlues12bold .

Page 750: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI ,"", .

,,. DllCall(),

www.autohotkey.com/forum/topic17230.html.

Q:[AHK_L19+]:.: q3 .Q:

0=DEFAULT_QUALITY .

1=DRAFT_QUALITY PROOF_QUALITY.

2=PROOF_QUALITY .

3=NONANTIALIASED_QUALITY ,.

4=ANTIALIASED_QUALITY ,.

5=CLEARTYPE_QUALITY WindowsXP:,()ClearType.

, MSDN:CreateFont.

,,.

Page 751: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Color[,WindowColor,ControlColor]

/. WindowColorGUI. ControlColor(). ListViews

TreeViews ControlColor, ControlColor.,

GuiControl+BackgroundFF9977,MyListView .

.,16 HTML6RGB(0x),Default.

: Silver ,FFFFAA ,0xFFFFAA ,Default .

,,().

,: Menu,MyMenuBar,Color,White .

, WinSetTransColor., Gui,Color,.,,.:

Gui,Color,EEAA99

Gui+LastFound;GUI .

WinSet,TransColor,EEAA99

,, :

Gui-Caption; , Gui,GuiName:-Caption

,(OSD).

Page 752: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Margin[,X,Y]

XY , X/, Y/,.., GuiShow().

Gui,Margin , Gui,Name:Margin .,, (0.75,

1.25).

,,.,XY.

Page 753: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,+/-Option1+/-Option2...

GUI.,( GuiAdd).

;,.

,.:

Gui+Resize-MaximizeBox; GUI.

GuiMyGui:+Resize-MaximizeBox; MyGui

GUI.

AlwaysOnTop:, WinSetAlwaysOnTop.

Border:..

Caption():. WinSetTransColor,TransColor.

Delimiter:(|), GuiAdd, GuiControl, GuiSubmit

GuiControlGet.Delimiter., Gui+Delimiter`n , .

, Gui+Delimiter| .tab, Gui+DelimiterSpace

Gui+DelimiterTab ., .

Disabled:,.( Owner).

DPIScale[v1.1.11+]: Gui-DPIScale DPI,.DPI

DPI,Gui().,144(150%)DPI,

Gui150, A_GuiWidth100. A_ScreenDPIDPI.

Page 754: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DPIGui,ControlGetPosWinGetPos.:

. , xp,xs,xm x+m .

( Gui+DPIScale )( Gui-DPIScale )DIP..

., x*(A_ScreenDPI/96) xGui()Gui().

HwndOutputVar[v1.1.04+]:GUI(HWND) OutputVar.: Gui

+HwndMyGuiHwnd ., MyGuiHwnd .GUIHWND PostMessage,

SendMessage DllCall. ahk_idWinTitleGUI, Gui

%MyGuiHwnd%:Destroy .

Label[v1.0.44.09+]: ., GuiMyGui:+LabelMyGui_On

MyGui_OnCloseMyGui_OnSize()MyGuiGuiCloseMyGuiGuiSize.

, "MyGuiGui""MyGui_On".( A_Gui).

LastFound: ( Gui,), WinSet,(

DetectHiddenWindows).,.:

Gui+LastFound

WinSet,TransColor,%CustomColor%150

GuiShow

LastFoundExist[v1.0.43.09+]:,LastFoundExist. +LastFoundExist

+LastFound,..:

GuiMyGui:+LastFoundExist

IfWinExist

MsgBoxGUI"MyGui"alreadyexists.

Page 755: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MaximizeBox:. Resize.

MinimizeBox():.

MinSize MaxSize[v1.0.44.13+]:,. MinSize/ MaxSize

(, GuiShow).,X,: Gui+Resize

+MinSize640x480 .(, ).,.

( +MinSize640x +MinSizex480 ).,Min/MaxSize.,

+MinSize+MinSize640x 640.

MinSize MaxSize,(, Gui-MinSize-MaxSize ).:

+Resize.

OwnDialogs:(ButtonOK) Gui+OwnDialogs , MsgBox,

InputBox,FileSelectFile FileSelectFolder.,., ToolTip,

Progress SplashImage;., .

, .,, Gui-OwnDialogs .

( Gui+OwnDialogs GuiMyGui:+OwnDialogs ),.

Owner: +Owner.,.. +Owner ,v1.1.05.

+owner,:

Gui,MyGui:+OwnerMyOtherGui; MyGui

MyOtherGui.

Gui,MyGui:+Owner; MyGui ,.

Page 756: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.03+]:+Owner Gui HWND.

:v1.1.03, +Owner WS_CHILDWS_POPUP.Gui

, +Parent +Owner .

, Gui+Disabled .(), Gui-Disabled ..

Parent[v1.1.03+]: +Parent Gui HWND.Gui, -

Parent. ..

Resize:., +Resize-MaximizeBox .

SysMenu(): -SysMenu (SysMenu).,.

Theme: -Theme ,WindowsXP., +Theme .:

WindowsXP,XP.,

ToolWindow:,.

() : .

() :E., +E0x40000 WS_EX_APPWINDOW,.

(), www.microsoft.comWS_EX_APPWINDOW.

Page 757: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Menu[,MenuName]

. Menu.:

Menu,FileMenu,Add,&Open`tCtrl+O,

MenuFileOpen;Ctrl+O.

Menu,FileMenu,Add,E&xit,MenuHandler

Menu,HelpMenu,Add,&About,MenuHandler

Menu,MyMenuBar,Add,&File,:FileMenu;.

Menu,MyMenuBar,Add,&Help,:HelpMenu

Gui,Menu,MyMenuBar

, &Open Ctrl+O (tab).. [v1.1.04+]:Ctrl,AltShift,

GUI .,,IMEAlt+NNNN.

, ., Send,.

, GuiMenu ().

,.(,,).,,.

() menu(DeleteDeleteAll),( UseErrorLevel

).:1) GuiMenu ( MenuName)2)3)

MyMenuBar .

Page 758: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Hide/Minimize/Maximize/Restore

GuiHide GuiCancel.,()//. GuiDestroy,.

Page 759: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Flash[,Off]

./().OFF().,,:

Loop6

{

GuiFlash

Sleep500;,.

}

Page 760: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,GuiName:Default

GUI, GuiControl,GuiControlGetGui.,

"MyGui": GuiMyGui:Default . .

[v1.1.23+]: A_DefaultGuiGUI.

Page 761: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SmartGUICreator

,RajatSmartGUICreator,;"".SmartGUICreator,

www.autohotkey.com/docs/SmartGUI/

Page 762: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Options/,,.

:

R:(,R2.5). R H(). R H, R.

GroupBox,. DropDownLists,ComboBoxes

WindowsXP,DropDownListComboBox R

, R.

W:,.,.:

: 303 X-margin().

:.

,,DropDownList,ComboBox,ListBox,GroupBox,EditHotkey:15

(GroupBox,18,).

H:,. H R,DropDownList,ComboBox,ListBoxEdit

3;GroupBox2;5;30();2;Hotkey

1;Tab10.,.DropDownListComboBox,

)(,).,

wp+n,hp+n,wp-n,hp-n( n)/,., wp , wp-50

50.

X:X., x0y0 ,(). X Y,(XX

,),"".

Page 763: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Y:Y. Y X,,"".

X,Y,GUI.,,/.

X Y,,.

X Y,()., Y+10 10,., X+10

10. X-10 ,,.: X+-10 .

[v1.1.16+]:X+Y+,M., x+m.. xpy+m,X, yp(whereasspecifying

anXcoordinateonitsownwouldnormallyimplyypbydefault).

xp+n,yp+n,xp-n,yp-n( n), GroupBox.

xm ym (/). ymx,,""..

xs ys: xm ym, Section(,). ysx,y(

Sectiony) Section;.:

gui,add,edit,w600;.

gui,add,text,section,FirstName:;.

gui,add,text,,LastName:

gui,add,edit,ys;.

gui,add,edit

gui,show

( xsy).

xs ys/., Sectionxs/ys;,.

Page 764: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

V:..V,( ByRef,v1.0.46.01+ ).,

vMyEdit , GuiSubmit MyEdit.(TextGroupBox),

GuiControl,GuiControlGet A_GuiControl.: GuiSubmit(Text

GroupBox),( ListView TreeView

G:Gosub(g)..G . gCancel GuiCancel(

"Cancel",).: A_Gui,A_GuiControl

A_EventInfo.

[v1.1.20+]:,., GuiControl .( gCtrlEvent

CtrlEvent):

CtrlEvent(CtrlHwnd,GuiEvent,EventInfo,ErrorLevel)

.

Page 765: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

:,, Wrap +Wrap ., -Wrap .

AltSubmit:.DropDownList,ComboBoxListBox GuiSubmit

.,ComboBox;,DropDownListListBox

:AltSubmit GuiControlGet.

C:( ).C( )RGB(0x).: cRed ,cFF2211 ,

c0xFF2211 ,cDefault .

Disabled:,. GuiControlEnable.:, ReadOnly .

,Disabled01(01).,

Disabled%VarContainingOne% .

Hidden:. GuiControlShow.Hidden01(01

)., Hidden Hidden%VarContainingOne% .

Left:.

Right:.,.

Center:.

Section: xs ys, .

Tabstop: -Tabstop (Tabstop)TAB.

Wrap:., -Wrap .

Page 766: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

VScroll:.

HScroll:. ListBox.ListBox3.,HScroll.,

HScroll500 ListBox500.,ListBox,(

HScroll, GuiControl,+HScroll500,MyScrollBar ,

).

Page 767: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

BackgroundTrans:,Text,PictureGroupBox.,Picture

Text. GuiControl+background

AltSubmit .: ListView Tab,BackgroundTrans.

-Background(Background): GuiColor.Tab.

GuiControl+background .

Border:.,. ,1.

HwndOutputVar[v1.0.46.01+]: GuiAdd,(HWND) OutputVar.

: Gui,Add,Edit,vMyEditHwndMyEditHwnd ., MyEditHwnd

.HWND PostMessage,SendMessage DllCall. ahk_id

WinTitle( DetectHiddenWindows,) [inv1.1.04+]GuiControl

GuiControlGet ControlID.,HWND Gui

MyGui:+HwndOutputVar .

Theme:.;,. Gui+/-Theme.

() : .,.

() :E.,., E0x200 WS_EX_CLIENTEDGE,

.(),

Page 768: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(),GUI:

GuiClose

GuiEscape

GuiSize

GuiContextMenu

GuiDropFiles

[v1.1.20+]:,.GUI HWND..

() ,();,2GuiEscape2GuiClose,

MyGuiGuiEscape MyGuiGuiClose MyGui., Gui+Label .

GuiClose::,"" WinClose.,, GuiCancel

.GuiClose ExitApp;:

GuiClose:

ExitApp

[v1.1.20+]:GuiClose,GUI.,:

GuiClose(GuiHwnd){;.

MsgBox4,,Areyousureyouwanttoclose

theGUI?

ifMsgBoxNo

returntrue;true=1

}

Page 769: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiEscape:GUIEscape.,Escape.:(),

EscapeGuiEscape..

GuiSize:,,. A_GuiWidth A_GuiHeight,,.,

A_EventInfo ErrorLevel:

0:,.

1:.

2:.

GuiSize. AutoXYWH()bytmplinshiandtoralf.

(),GuiSize., ,GuiSize.,GuiSize:

CriticalOff;CriticalOn.

Sleep-1

[v1.1.22.05+]:GuiShow Sleep-1 ,Sleep.

[v1.1.20+]:GuiSize,:

GuiSize(GuiHwnd,EventInfo,Width,Height)

GuiContextMenu:.AppsShift-F10.GUI,

GuiContextMenu .GuiContextMenu:

1. A_GuiControl, ().

2. A_EventInfo:ListBox,ListViewTreeView(A_GuiControl

),A_EventInfo:

Page 770: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListBoxorListView:A_EventInfo(0).

TreeView</a5:,A_EventInfoID(0).AppsKey

Shift-F10,A_EventInfoID.

3. A_GuiXA_GuiY,XY ( Menu,MyContext,Show,

%A_GuiX%,%A_GuiY% )..

4. A_GuiEvent,RightClick,AppsShift-F10Normal.

: Edit MonthCal,GuiContextMenu.

[v1.1.20+]:GuiContextMenu,:

GuiContextMenu(GuiHwnd,CtrlHwnd,EventInfo,

IsRightClick,X,Y)

CtrlHwnd. IsRightClickA_GuiEventRightClickTrue.

GuiDropFiles:/(,).GuiDropFiles:

1. A_GuiControl, ().

2. A_EventInfo ErrorLevel,.

3. A_GuiXA_GuiY,XY().

4. A_GuiEvent,,(`n).

, ,:

;#1:

Loop,parse,A_GuiEvent,`n

{

MsgBox,4,,Filenumber%A_Index%

Page 771: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

is:`n%A_LoopField%.`n`nContinue?

IfMsgBox,No,Break

}

;#2:,:

Loop,parse,A_GuiEvent,`n

{

FirstFile=%A_LoopField%

Break

}

;#3:,:

FileList=%A_GuiEvent%

Sort,FileList

Loop,parse,FileList,`n

MsgBoxFilenumber%A_Index%

is:`n%A_LoopField%.

, Gui-E0x10 WS_EX_ACCEPTFILES., Gui

+E0x10 .

[v1.1.20+]:GuiDropFiles,. CtrlHwndGUI. FileArray

() , FileArray[1] FileArray.MaxIndex() .

for-:

GuiDropFiles(GuiHwnd,FileArray,CtrlHwnd,X,

Y){

fori,fileinFileArray

MsgBoxFile%i%is:`n%file%

}

:GUI OnMessage().,. GUI.

Page 772: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI

,(v1.1.03+, HWND),:

Gui,MyGui:Add,Text,,Textforabout-box.

Gui,MyGui:Show

GuiMyGui:Default "MyGui:"., GUI.

[v1.1.03+]:Gui .199(0x01)GuiHWND,.

.

[v1.1.04+]: Gui,NewGUI.

Page 773: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI,

GUI GUI.GUIGUI g().

GUI .GUI1.

GUI , GUI.( WinMove,WinHide,WinSet,

WinSetTitle ControlGetFocus)GUIWinTitleWinText().

g,., Critical(,/ ,).

A_GuiA_GuiControlID. A_Gui A_GuiControl.

,.:

GuiEscape:

GuiClose:

ButtonCancel:

ExitApp;.

GUI , SendMode. .

Page 774: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TABGUI,( Tabstop)..,Tabstop()

.

(&),().ALT.,,.GroupBoxText

,(,) tabstop

,,: Save&&Exit .

Page 775: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI.,,.: Menu,Tray,Icon,MyIcon.ico .

(alt-tab).DllCallSendMessage;:

hIcon32:=DllCall("LoadImage",uint,0

,str,"MyIcon.ico";().

,uint,1;:IMAGE_ICON

,int,32,int,32;(LoadImage).

,uint,0x10);Flags:LR_LOADFROMFILE

Gui+LastFound

SendMessage,0x80,1,hIcon32;0x80

WM_SETICON;1ICON_BIG(0ICON_SMALL).

GuiShow

,WindowsXP,Checkbox,RadiobuttonGroupBox.

: .

Page 776: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControl GuiControlGetGUI.

GUI11,000.,5000,.

GUI (GUI)., #SingleInstance.

Page 777: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControl,GuiControlGet,Menu,,ListView,TreeView,Control,ControlGet,

SplashImage,MsgBox,FileSelectFile,FileSelectFolder

Page 778: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:SplashTextOn:

Gui,+AlwaysOnTop+Disabled-SysMenu+Owner;

+Owner.

Gui,Add,Text,,Sometexttodisplay.

Gui,Show,NoActivate,TitleofWindow;

NoActivate.

;::

Gui,Add,Text,,Firstname:

Gui,Add,Text,,Lastname:

Gui,Add,Edit,vFirstNameym;ym.

Gui,Add,Edit,vLastName

Gui,Add,Button,default,OK;ButtonOK().

Gui,Show,,SimpleInputExample

return;..

GuiClose:

ButtonOK:

Gui,Submit;.

MsgBoxYouentered"%FirstName%%LastName%".

ExitApp

;::

Page 779: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Add,Tab2,,FirstTab|SecondTab|ThirdTab;

Tab2Tabv1.0.47.05.

Gui,Add,Checkbox,vMyCheckbox,Samplecheckbox

Gui,Tab,2

Gui,Add,Radio,vMyRadio,Sampleradio1

Gui,Add,Radio,,Sampleradio2

Gui,Tab,3

Gui,Add,Edit,vMyEditr5;r55.

Gui,Tab;.

Gui,Add,Button,defaultxm,OK;xm.

Gui,Show

return

ButtonOK:

GuiClose:

GuiEscape:

Gui,Submit;.

MsgBoxYou

entered:`n%MyCheckbox%`n%MyRadio%`n%MyEdit%

ExitApp

;::

Gui,Add,Text,,Pickafiletolaunchfromthe

listbelow.`nTocancel,pressESCAPEorclosethis

window.

Gui,Add,ListBox,vMyListBoxgMyListBoxw640r10

Gui,Add,Button,Default,OK

Loop,C:\*.*;.

{

GuiControl,,MyListBox,%A_LoopFileFullPath%

}

Gui,Show

return

Page 780: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MyListBox:

ifA_GuiEvent<>DoubleClick

return

;,,OK.

;.

ButtonOK:

GuiControlGet,MyListBox;.

MsgBox,4,,Wouldyouyouliketolaunchthefile

ordocumentbelow?`n`n%MyListBox%

IfMsgBox,No

return

;,:

Run,%MyListBox%,,UseErrorLevel

ifErrorLevel=ERROR

MsgBoxCouldnotlaunchthespecifiedfile.

Perhapsitisnotassociatedwithanything.

return

GuiClose:

GuiEscape:

ExitApp

;:():

Gui,Add,Edit,vMyEdit

MyEdit_TT:="Thisisatooltipforthecontrol

whosevariableisMyEdit."

Gui,Add,DropDownList,vMyDDL,Red|Green|Blue

MyDDL_TT:="Chooseacolorfromthedrop-down

list."

Gui,Add,Checkbox,vMyCheck,Thiscontrolhasno

tooltip.

Gui,Show

Page 781: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnMessage(0x200,"WM_MOUSEMOVE")

return

WM_MOUSEMOVE()

{

staticCurrControl,PrevControl,_TT;_TT

ToolTip.

CurrControl:=A_GuiControl

If(CurrControl<>PrevControlandnot

InStr(CurrControl,""))

{

ToolTip;.

SetTimer,DisplayToolTip,1000

PrevControl:=CurrControl

}

return

DisplayToolTip:

SetTimer,DisplayToolTip,Off

ToolTip%%CurrControl%_TT;.

SetTimer,RemoveToolTip,3000

return

RemoveToolTip:

SetTimer,RemoveToolTip,Off

ToolTip

return

}

GuiClose:

ExitApp

;:(OSD):

Page 782: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CustomColor=EEAA99;RGB().

Gui+LastFound+AlwaysOnTop-Caption+ToolWindow

;+ToolWindowalt-tab.

Gui,Color,%CustomColor%

Gui,Font,s32;(32).

Gui,Add,Text,vMyTextcLime,XXXXXYYYYY;XX&

YY.

;(150):

WinSet,TransColor,%CustomColor%150

SetTimer,UpdateOSD,200

Gosub,UpdateOSD;.

Gui,Show,x0y400NoActivate;NoActivate.

return

UpdateOSD:

MouseGetPos,MouseX,MouseY

GuiControl,,MyText,X%MouseX%,Y%MouseY%

return

;:.

Gui,Color,White

Gui,Add,Picture,x0y0h350w450,

%A_WinDir%\system32\ntimage.gif

Gui,Add,Button,Defaultxp+20yp+250,Startthe

BarMoving

Gui,Add,Progress,vMyProgressw416

Gui,Add,Text,vMyTextwp;wp"".

Gui,Show

return

ButtonStartTheBarMoving:

Loop,%A_WinDir%\*.*

Page 783: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

ifA_Index>100

break

GuiControl,,MyProgress,%A_Index%

GuiControl,,MyText,%A_LoopFileName%

Sleep50

}

GuiControl,,MyText,Barfinished.

return

GuiClose:

ExitApp

;::

Gui,+Resize

Gui,Add,Button,default,&LoadNewImage

Gui,Add,Radio,ym+5x+10vRadiochecked,Load

&actualsize

Gui,Add,Radio,ym+5x+10,Loadto&fitscreen

Gui,Add,Pic,xmvPic

Gui,Show

return

ButtonLoadNewImage:

FileSelectFile,file,,,Selectanimage:,Images

(*.gif;*.jpg;*.bmp;*.png;*.tif;*.ico;*.cur;

*.ani;*.exe;*.dll)

iffile=

return

Gui,Submit,NoHide;.

ifRadio=1;.

{

Width=0

Page 784: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Height=0

}

else;:.

{

Width:=A_ScreenWidth-28;28.

Height=-1;"".

}

GuiControl,,Pic,*w%width%*h%height%%file%;

.

Gui,Show,xCentery0AutoSize,%file%;.

return

GuiClose:

ExitApp

;:.

;:

Menu,FileMenu,Add,&New,FileNew

Menu,FileMenu,Add,&Open,FileOpen

Menu,FileMenu,Add,&Save,FileSave

Menu,FileMenu,Add,Save&As,FileSaveAs

Menu,FileMenu,Add;.

Menu,FileMenu,Add,E&xit,FileExit

Menu,HelpMenu,Add,&About,HelpAbout

;:

Menu,MyMenuBar,Add,&File,:FileMenu

Menu,MyMenuBar,Add,&Help,:HelpMenu

;:

Gui,Menu,MyMenuBar

;:

Page 785: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,+Resize;.

Gui,Add,Edit,vMainEditWantTabW600R20

Gui,Show,,Untitled

CurrentFileName=;.

return

FileNew:

GuiControl,,MainEdit;.

return

FileOpen:

Gui+OwnDialogs;FileSelectFile.

FileSelectFile,SelectedFileName,3,,OpenFile,

TextDocuments(*.txt)

ifSelectedFileName=;.

return

GosubFileRead

return

FileRead:;SelectedFileName.

FileRead,MainEdit,%SelectedFileName%;.

ifErrorLevel

{

MsgBoxCouldnotopen"%SelectedFileName%".

return

}

GuiControl,,MainEdit,%MainEdit%;.

CurrentFileName=%SelectedFileName%

Gui,Show,,%CurrentFileName%;.

return

FileSave:

ifCurrentFileName=;,.

GotoFileSaveAs

GosubSaveCurrentFile

return

Page 786: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileSaveAs:

Gui+OwnDialogs;FileSelectFile.

FileSelectFile,SelectedFileName,S16,,SaveFile,

TextDocuments(*.txt)

ifSelectedFileName=;.

return

CurrentFileName=%SelectedFileName%

GosubSaveCurrentFile

return

SaveCurrentFile:;CurrentFileName.

IfExist%CurrentFileName%

{

FileDelete%CurrentFileName%

ifErrorLevel

{

MsgBoxTheattempttooverwrite

"%CurrentFileName%"failed.

return

}

}

GuiControlGet,MainEdit;.

FileAppend,%MainEdit%,%CurrentFileName%;.

;(FileSaveAs):

Gui,Show,,%CurrentFileName%

return

HelpAbout:

Gui,About:+owner1;(Gui#1)"".

Gui+Disabled;.

Gui,About:Add,Text,,Textforaboutbox.

Gui,About:Add,Button,Default,OK

Gui,About:Show

return

AboutButtonOK:;"".

AboutGuiClose:

Page 787: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AboutGuiEscape:

Gui,1:-Disabled;().

GuiDestroy;.

return

GuiDropFiles:;.

Loop,Parse,A_GuiEvent,`n

{

SelectedFileName=%A_LoopField%;().

break

}

GosubFileRead

return

GuiSize:

ifErrorLevel=1;..

return

;,..

NewWidth:=A_GuiWidth-20

NewHeight:=A_GuiHeight-20

GuiControl,Move,MainEdit,W%NewWidth%

H%NewHeight%

return

FileExit:;File"Exit".

GuiClose:;.

ExitApp

Page 788: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI

Text,Edit,UpDown,Picture

Button,Checkbox,Radio

DropDownList,ComboBox

ListBox,ListView,TreeView

Link,Hotkey,DateTime

MonthCal,Slider,Progress

GroupBox,Tab3,StatusBar

ActiveX(InternetExplorerControl)

Page 789: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:..:

Gui,Add,Text,,Pleaseenteryourname:

.(`n)., .

Options(W) (R) (H),,.

Gui,..

g gMySubroutine . MySubroutine.,:

Gui,Font,underline

Gui,Add,Text,cBluegLaunchGoogle,Clickhere

tolaunchGoogle.

;Link:

Gui,Add,Link,,Click<a

href="www.google.com">here</a>tolaunch

Google.

Gui,Font,norm

Gui,Show

return

LaunchGoogle:

Runwww.google.com

return

A_GuiEventDoubleClick.

Page 790: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(&).:

Gui,Add,Text,,&FirstName:

Gui,Add,Edit

,F, Alt+F.,(&&)., 0x80.

( Right,Center Hidden).: .

Page 791: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Edit

:.:

Gui,Add,Edit,r9vMyEdit,Texttoappear

insidetheeditcontrol(omitthisparameterto

startoffempty).

,., r3 3:, .

,()(`n)(`r`n).Edit`r`n., GuiSubmit

GuiControlGet,`r`n(`n).,: FileAppend,%MyEdit%,

C:\SavedFile.txt .

(),().

g gMySubroutine . MySubroutine.

:, FileRead GuiControl.:

Gui,Add,Edit,R20vMyEdit

FileRead,FileContents,C:\MyFile.txt

GuiControl,,MyEdit,%FileContents%

Edit

,:

Limit:.,,., Limit10 10.

Page 792: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Lowercase:.

Multi:.,,(H), (R) ( Text).

Number:(,). UpDownEdit.

Password:().,Password., Password* (),

WindowsXP.:.

ReadOnly:.,,.

Tn:T (TAB,).T,32().T,

n., Gui,Add,Edit,vMyEditr16t64 .,T,

: Gui,Add,Edit,vMyEditr16t8t16t32t64t128 .,

50.:.

Uppercase:.

WantCtrlA[v1.0.44+]:-WantCtrlA(WantCtrlA)Control-A.

WantReturn:-WantReturn(WantReturn). ().Control-

Enter.

WantTab:tab.,Control-Tab.: WantTab,

(tab).

-Wrap(wrap):.,:1) ;2),./.

( Right,Center Hidden).: .

Page 793: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:HiEdit,,..,

www.autohotkey.com/forum/topic19141.html

Page 794: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

UpDown

:,.,UpDown.UpDown ."",UpDown

Edit.:

Gui,Add,Edit

Gui,Add,UpDown,vMyUpDownRange1-10,5

,EditUpDown.,Edit.

UpDown Text ListBox.,,(ComboBox

DropDownList) g.

UpDown(,00).

GuiSubmit, ()UpDown.UpDown,UpDown.

UpDown,.,

UpDown g,.gUpDown ().

UpDown

Horz://., Horz(). Horz16 .

Left:UpDown.

Range:0100.Range,.,Range1-10001

1000;Range-50-50-5050;Range-10--5-10-5.

.-2147483648-2147483647., ListBox,32767-0(

Page 795: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Wrap:. Wrap,.

-16(16):UpDown;.,.,UpDown. Gui

Submit.

0x80: 0x80 .,,UpDown().

1 : ,NumEricUpDown1(50.1).

: .

Page 796: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Picture(Pic)

:()., A_WorkingDir.:

Gui,Add,Picture,w300h-1,C:\My

Pictures\CompanyLogo.gif

/,W/H.,/(.ICO).,-1.,

w200h-1 200.(),.

g gMySubroutine . MySubroutine. A_GuiEvent

DoubleClick.

,., g, 0x4000000 (WS_CLIPSIBLINGS). Tab

ListView.

, ::ICO,CUR,ANI,EXE,DLL,CPL,SCR., Icon

.,: Gui,Add,Picture,Icon2,C:\My

Application.exe .

AltSubmitGDIPlus.dll,GIF,BMP.,ICO/GIF

, BackgroundTrans( [v1.1.23+],AltSubmit).

GDIPlus(),AltSubmit.

GIF,JPG,BMP,ICO,CURANI.WindowsXP,,PNG,

TIF,Exif,WMFEMF.XPGDI+DLLAutoHotkey.exe(

DLL).DLL, www.microsoft.com:gdiredistributable

Page 797: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GIF:GIF,.,AniGIFDLL(),

www.autohotkey.com/forum/topic19264.html

[v1.1.23+]:bitmap()icon() handle() .,

HBITMAP:%handle% .

Page 798: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:.(),(`n).:

Gui,Add,Button,Default,OK

Default"OK"., WantReturn.,,

Cancel: GuiControl,+default,Cancel .,:

GuiControl,-default,OK .

(&).:

Gui,Add,Button,,&Pause

,P,Alt+P .,(&&).

g,.,GUIOK,ButtonOK(). GUI,

;: 2ButtonOK .

&`r`n`t`,.,"&Pause"ButtonPause.,"Save&&

Exit"ButtonSaveExit().

:., -Wrap (Wrap)..

Page 799: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Checkbox

:,On/Off,Yes/No,.:

Gui,Add,Checkbox,vShipToBillingAddress,Ship

tobillingaddress?

,.(`n). (W) (R) (H),,. ()1,

0,-1.

Check3(). Checked CheckedGray.

Checked0,1-1., Checked

Checked%VarContainingOne% .

g gMySubroutine . MySubroutine.

:., -Wrap (Wrap)..

Page 800: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Radio

,()().:

Gui,Add,Radio,vMyRadioGroup,Waitforall

itemstobeinstockbeforeshipping.

,.,().., Group,,.

.,(`n). (W)(R)(H),,.

Checked.Checked01:0,1.

, Checked Checked%VarContainingOne% .

()10.,,:1(),2,.,0.

g gMySubroutine . MySubroutine.,g,.

., A_GuiEventDoubleClick.

:., -Wrap (Wrap)..

Page 801: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DropDownList(DDL)

:.,, Choice1|Choice2|Choice3 .:

Gui,Add,DropDownList,vColorChoice,

Black|White|Red|Green|Blue

,( Red|Green||Blue )., Choose., Choose5 (

,, Choose%Var% )./, GuiControl.

Uppercase Lowercase. Sort( GuiControl).Sort

;.

GuiSubmit, ()., AltSubmit,(1,2,.).

g gMySubroutine . MySubroutine.

RH ., R5 5, H400 400.RH

,(WindowsXP3).

, CB_SETITEMHEIGHT,:

GuiAdd,DDL,vcbxw200hwndhcbx,One||Two

;CB_SETITEMHEIGHT=0x153

PostMessage,0x153,-1,50,,ahk_id%hcbx%;

.

PostMessage,0x153,0,50,,ahk_id%hcbx%;

.

GuiShow,h70,Test

Page 802: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(|). Gui+Delimiter`n Gui+DelimiterTab

tab(`t).

Page 803: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ComboBox

:DropDownList,.:

Gui,Add,ComboBox,vColorChoice,

Red|Green|Blue|Black|White

DropDownList, LimitComboBox., Simple

ComboBoxListBoxEdit.

GuiSubmit, ()., AltSubmit,(1,2,.).

,,ComboBox.

g gMySubroutine . MySubroutine.

Page 804: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListBox

:.,, Choice1|Choice2|Choice3 .:

Gui,Add,ListBox,vColorChoice,

Red|Green|Blue|Black|White

,(, Multi)., Choose., Choose5 .

/, GuiControl.

GuiSubmit, ()., AltSubmit,(1,2,).

g gMySubroutine . MySubroutine.,A_GuiEvent

DoubleClickNormal.,A_EventInfo(1,2,).

ListBox, GuiControl,-Redraw,MyListBox

GuiControl,+Redraw,MyListBox .

ListBox

Choose: .

Multi:shift-clickcontrol-click(shift/control-click, 8

Multi)., GuiSubmit ., AltSubmit, GuiSubmit.

, 1|2|3 ., ,:

Loop,parse,MyListBox,|

{

MsgBoxSelectionnumber%A_Index%is

Page 805: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%A_LoopField%.

}

(|). Gui+Delimiter`n Gui+DelimiterTab

tab(`t).

ReadOnly:( GuiSubmit).

Sort:( GuiControl).Sort;.

Tn:T,.T,32().T, n., Gui,

Add,ListBox,vMyListBoxt64 .,T,: Gui,

Add,ListBox,vMyListBoxt8t16t32t64t128 .,50

.

0x100:0x100LBS_NOINTEGRALHEIGHT.ListBox.

ListBox.

(), .

Page 806: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListViewTreeView

ListView TreeView.

Page 807: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Link [v1.1.06+]

:.HTML,<A>.,HREF="value"ID="value"

.:

Gui,Add,Link,,Thisisa<a

href="https://autohotkey.com">link</a>

Gui,Add,Link,,Linksmaybeusedanywherein

thetextlike<aid="A">this</a>or<a

id="B">that</a>

href,URL, .,.URL, `%22 ,Web,.

g-label gMySubroutine ,href,URL.:

A_GuiEvent;"Normal".

A_EventInfo.

ErrorLevelhref,;,id.

g-label:

MyFunction(CtrlHwnd,GuiEvent,LinkIndex,HrefOrID)

Page 808: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey

:,.,Control+Alt+C,"Ctrl+Alt+C".

Gui,Add,Hotkey,vChosenHotkey

GuiSubmit, (), Hotkey.

: ^!C ,+!Home ,+^Down ,^Numpad1 ,!NumpadEnd .,.:.

, ^Numpad7 ^NumpadHome Ctrl+Num7.

,.,,: Gui,Add,Hotkey,vChosenHotkey,^!p

^(Control),!(Alt),+(Shift). .

g-label() gMySubroutine . MySubroutine.g ().:

g.,Control,g,(^).,g,.

, Limit:

1:

2:Shift

4:Control

8:Alt

16:Shift-Control

32:Shift-Alt

64:().

128:Shift-Control-Alt.

Page 809: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, Limit1 (), Limit15 .,Control+Alt.

Hotkey.,/Windows(LWinRWin). checkbox(

Windows).

Page 810: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DateTime

:,/..:

Gui,Add,DateTime,vMyDateTime,LongDate

:

() :,.,:6/1/2005

LongDate:.,in:Wednesday,June01,2005

Time:,., YYYYMMDDHH24MISS.

() : ., M/d/yyHH:mm 6/1/0521:37., ddddMMMM

d,yyyyhh:mm:sstt WednesdayJune1,200509:37:45PM.,

: 'Date:'MM/dd/yy'Time:'hh:mm:sstt .,(,tab,

,,).:,(''''),.

DateTime

, ChooseYYYYMMDD., Choose20050531

May31,2005(,, Choose%Var% )./,

ChooseNone.ChooseNone,., GuiSubmit GuiControlGet().

.,,.HH24MISS(,,),HH2424;

,099am219pm., YYYYMMDDHH24MISS

Page 811: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

YYYYMMDDHH24MISS,.:

MM:Month01

DD:Day01

HH24:Hour00

MI:Minute00

SS:Second00

,.,.

:/,NumpadPlus/Minus,Home/End..,;

PageUp/Down/;Ctrl-PageUp/Down;Home/End/.

GuiSubmit, () YYYYMMDDHH24MISS.,.

g,., ()/.

DateTime

Choose: .

Range:.RangeYYYYMMDD().

, Range20050101-20050615 5.55.,.

, Range20010101 2001 Range-20091231 ()2009.

Range,16019999..

Right:.

1:1,.LongDate.

Page 812: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

2: 2,/..

Page 813: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MonthCal

:,..:

Gui,Add,MonthCal,vMyCalendar

,YYYYMMDD( 20050531 ).( 20050525-20050531 ).

MonthCal(W)(H),., R2 ., W-2 (W2).

,.

.,.

DateTime,MonthCal.

GuiSubmit, ()YYYYMMDD()., ,( 20050101-

20050108 ).,. StringSplit.,Date1

Date2:StringSplit,Date,MyMonthCal,- .

MonthCalg,().,:1);2),().,

AltSubmit, g,A_GuiEventNormal,1,MonthCal

""2.,,:Normal,1,2.

YYYYMMDD,MM/DD,1., 200205 20020501,

2005 20050101.

MonthCal

Page 814: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Multi:.shift-clickclick-drag()..: Gui,Add,

MonthCal,vMyCal,20050101-20050108 ..

Range:.RangeYYYYMMDD().

, Range20050101-20050615 20055.,.

, Range20010101 2001 Range-20091231 ()2009.

Range,16019999.

4: 4(1-52).Week1.

8: 8.

16: 16.

Page 815: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Slider

:,..:

Gui,Add,Slider,vMySlider,50

.,00.

:1);2);3);4):,,,HomeEnd.

GuiSubmit, (). g.

g,()., AltSubmit,g,A_GuiEvent:

0:.

1:.

2:.

3:.

4:.

5:,.

6:Home.

7:End.

Normal:. :(#4), g,"normal".

Slider

Buddy1 Buddy2:.Buddy1(Vertical).Buddy2.

Page 816: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Buddy1Buddy2 .,Buddy1MyTopTextMyTopText.

Center:().

Invert:,//..:,.

Left:()(,//).Vertical,.

Line:.Line.: Line2 .

NoTicks:.

Page:.Page.: Page10 .

Range:0100.Range,., Range1-1000 1

1000 Range-50-50 -5050 Range-10--10 -10

-5.

Thick:.Thick( Thick30 ).WindowsXP,Center

( -Theme ).

TickInterval:.TickInterval(,1).

, TickInterval10 10.

ToolTip:,.,: ToolTipLeft ToolTipRight (

) ToolTipTop ToolTipBottom ().

Vertical:.

GuiControl.

Page 817: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Progress

:,.:

Gui,Add,Progress,w300h20cBluevMyProgress

(,00).,, MyProgress:

GuiControl,,MyProgress,+20;20.

GuiControl,,MyProgress,50;50.

,..

Progress

Cn:. n16HTML 6RGB.

: cRed ,cFFFF33 ,cDefault .C( cDefault ,.

BackgroundN:. n16HTML 6RGB.

: BackgroundGreen ,BackgroundFFFF33 ,BackgroundDefault .

Background( BackgroundDefault ),.

Range:0100.Range,., Range0-1000 0

1000 Range-50-50 -5050 Range-10--5 -10

-5.

-Smooth(Smooth):. -Smooth WindowsXP.,C

Background.

Page 818: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Vertical:.

GuiControl.

Page 819: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupBox

:,.,().:

Gui,Add,GroupBox,w400h300,Geographic

Criteria

,. Wrap .

(), .

Page 820: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tab3

:,.,"".

:

Tab3[v1.1.23.00+]:Tab2Tab."tabdialog()",.

.

Tab2[v1.0.47.05+]:Tab, .

Tab:,Tab2/Tab3Tab .

:

Gui,Add,Tab3,,

General|View|Appearance|Settings

.,( Red|Green||Blue )., Choose., Choose5

(,, Choose%Var% )., GuiControl

,.,:

Gui,Tab;.

Gui,Tab,3;.

Gui,Tab,3,2;.

Gui,Tab,Name; Name().

Gui,Tab,Name,,Exact;,().

( Name).,.

Page 821: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:,:1)XY,( ),2) X+n/Y+n ,.,

x+10y+10 10.

V: GuiSubmit, ()., AltSubmit,(1,2,

.).

G:g-label gMySubroutine . MySubroutine. g-label ,

, ( AltSubmit).

:Control-PageDown/PageUp;,.Control-TabControl-

Shift-Tab,().

:255.256().,.

Tab3vs.Tab2vs.Tab

:Tab.Tab3,"tabdialog",.,TabTab2,

Gui.

:TabTab2,:."".

Tab3, TabTab2..

Tab3,.TabTab2..

WinMove(DllCall),,Gui( )., GuiControl

GUI ControlMove,.

:,Tab3/():

Page 822: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tab3. Gui,Tab().

Gui Gui,Show.

,.,.Tab3,TabTab2.

TabTab2;.

Tab:Tab.,:

TabTab2.

Tab2.

Tab3.

(Tab3) : .Tab3 tabdialogWM_COMMAND,

WM_NOTIFY,WM_VSCROLL,WM_HSCROLLWM_CTLCOLOR'

GUI OnMessage. +BackgroundTrans,tabdialog

WM_CTLCOLORSTATIC.().

Tab2:

Tab2.

WebBrowser() .

Win32API.

Tab:

,,.

TabListView.

WebBrowser() .

Page 823: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tab

Choose: .

-Background(background): . +Theme-Background .

,,.(

Buttons:(,).

Left/Right/Bottom:,. TCS_VERTICALLeftRight.

-Wrap:(,).

(), .

: SendMessage/. Iconsintabs.

Page 824: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StatusBar [v1.0.44+]

:/,.:

Gui,Add,StatusBar,,Bar'sstartingtext(omit

tostartoffempty).

SB_SetText("Thereare".RowCount."rows

selected.")

SB_SetText()., SB_SetParts()., SB_SetIcon().

GUI ( Gui,2:Default ).,SB0.

SB_SetText(NewText[,PartNumber,Style])

NewText. PartNumber,1.,1256. Style,0,

.,1,2., NewTexttab(`t):tab,tab

.SB_SetText()10.

SB_SetParts([Width1,Width2,...Width255])

().,.,()., SB_SetParts(50,50) :50,

.:SB_SetParts()""().,SB_SetParts()(

0.

SB_SetIcon(Filename[,IconNumber,PartNumber])

( PartNumber,1). Filename(.ICO),(.CUR)(.ANI)().:EXE,

Page 825: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DLL,CPL,SCR.,

, SB_SetIcon("Shell32.dll",2) . IconNumber,

ID.SB_SetIcon()HICON0.HICON,.,SB_SetIcon()

.:

Gui+LastFound

SendMessage,0x40F,part_number-1,my_hIcon,

msctls_statusbar321;0x40FSB_SETICON.

[v1.1.23+]:iconhandle() ., SB_SetIcon("HICON:"

handle) .

SB_SetProgress()

. www.autohotkey.com/forum/topic37754.html

G

g gMySubroutine . MySubroutine. A_Gui

A_GuiControl., A_GuiEvent,(,):

Normal:.A_EventInfo(,,).

RightClick:.A_EventInfo.:g GuiContextMenu.

,(A_EventInfo),gRightClick

DoubleClick:.A_EventInfo.

R: .A_EventInfo.

Page 826: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, GuiFont(),., GuiColor, Background

( )RGB(0x).

: BackgroundSilver ,BackgroundFFDD99 ,BackgroundDefault .

, Gui,Add,StatusBar,HiddenvMyStatusBar .,

GuiControl,Hide,MyStatusBar ., GuiControl,

Show,MyStatusBar .:., Gui,Show,AutoSize .

()

.

1),. GuiSize.2).

TreeView.

Page 827: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ActiveX [v1.1.03+]

ActiveX(MSIE)GUI,:

GuiAdd,ActiveX,w980h640vWB,Shell.Explorer

;ActiveX.

WB.Navigate("https://autohotkey.com/boards/")

;web.

GuiShow

,ActiveX(). GuiControlGet.

, ComObjConnect,:

GuiAdd,Edit,w930r1vURL,

https://autohotkey.com/boards/

GuiAdd,Button,x+6ypw44Default,Go

GuiAdd,ActiveX,xmw980h640vWB,

Shell.Explorer

ComObjConnect(WB,WB_events);WBWB_events.

GuiShow

;:

ButtonGo:

GuiSubmit,NoHide

WB.Navigate(URL)

return

classWB_events

{

NavigateComplete2(wb,NewURL)

{

GuiControl,,URL,%NewURL%;URL

.

Page 828: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

}

GuiClose:

ExitApp

ComObjType.

Page 829: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.10+]

AutoHotkeyGUI., Gui,Add Class Win32.

:

Gui,Add,Custom,ClassComboBoxEx32;

ComboBoxEx.

Gui,Add,Custom,ClassScintilla;

Scintilla.SciLexer.dll.

AutoHotkey Gui,Add GuiControl/Get Windows.

G: gMySubroutine g,. A_Gui A_GuiControl.

, A_GuiEvent,(,):

Normal: WM_COMMAND . A_EventInfo (C/C++

HIWORD(wParam) ).

N: WM_NOTIFY . A_EventInfo (NMHDR ). ErrorLevel

32(g ErrorLevel )..

IP:

Gui,Add,Custom,ClassSysIPAddress32r1w150

hwndhIPControlgIPControlEvent

Gui,Add,Button,Default,OK

IPCtrlSetAddress(hIPControl,A_IPAddress1)

Gui,Show

return

GuiClose:

Page 830: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ExitApp

ButtonOK:

Gui,Hide

ToolTip

MsgBox%"Youchose"

IPCtrlGetAddress(hIPControl)

ExitApp

IPControlEvent:

ifA_GuiEvent=Normal

{

;WM_COMMAND.

if(A_EventInfo=0x0300);EN_CHANGE

ToolTipControlchanged!

}

elseifA_GuiEvent=N

{

;WM_NOTIFY.

;.UInt,IP

;,.

nmhdr_code:=NumGet(A_EventInfo+

2*A_PtrSize,"int")

if(nmhdr_code!=-860);IPN_FIELDCHANGED

return

;NMIPADDRESS

iField:=NumGet(A_EventInfo+3*A_PtrSize

+0,"int")

iValue:=NumGet(A_EventInfo+3*A_PtrSize

+4,"int")

ifiValue>=0

ToolTipField#%iField%modified:

%iValue%

else

Page 831: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ToolTipField#%iField%leftempty

}

return

IPCtrlSetAddress(hControl,ipaddress)

{

staticWM_USER:=0x400

staticIPM_SETADDRESS:=WM_USER+101

;IP32SendMessage.

ipaddrword:=0

Loop,Parse,ipaddress,.

ipaddrword:=(ipaddrword*256)+

A_LoopField

SendMessageIPM_SETADDRESS,0,ipaddrword,,

ahk_id%hControl%

}

IPCtrlGetAddress(hControl)

{

staticWM_USER:=0x400

staticIPM_GETADDRESS:=WM_USER+102

VarSetCapacity(addrword,4)

SendMessageIPM_GETADDRESS,0,&addrword,,

ahk_id%hControl%

returnNumGet(addrword,3,"UChar")"."

NumGet(addrword,2,"UChar")"."

NumGet(addrword,1,"UChar")"."

NumGet(addrword,0,"UChar")

}

Page 832: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView,TreeView,Gui,GuiControl,GuiControlGet,Menu

Page 833: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControlGUI.

GuiControl,Sub-command,ControlID[,Param3]

Sub-command

.

ControlID

, ControlID().,GuiControlGuiControlGet,

(GroupBoxText).

ControlIDClassNN(),WindowSpy.,

SetTitleMatchMode.:() ControlID.

[v1.1.04+]:ControlID HWND

GUI, GUI -- [v1.1.20+]ControlIDHWND,

HWND. .

Param3

,.

ErrorLevel

Page 834: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.04+]., .

/, ErrorLevel1.0.

Sub-command

() : Sub-command Param3.:

Picture:Param3( handle)( GuiPicture).: *wN (

N),*hN (N) *IconN (DLLEXEN).,,100""

: GuiControl,,MyPic,*icon2*w100*h-1C:\My

Application.exe . *w0*h0 . *w *h ,..ICO,.:

tab;tab.

Text/Button/GroupBox/StatusBar/Link: Param3.,

GuiControl,Move,MyText,W300 . StatusBar,( SB_SetText()

).

Edit:Param3(`r)(`n)CR+LF(`r`n).,, GuiSubmit

GuiControlGetOutputVar CR+LFLF(`n).

Hotkey: Param3,.: ^!c ,^Numpad1 ,+Home .^(Control),!

(Alt)+(Shift). .

Checkbox: Param30,1-1., Param3/. Text

.

Radio:Checkbox.,(),.,, ControlID

/.

Page 835: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DateTime/MonthCal: Param3 YYYYMMDDHH24MISS.

%A_Now% ().DateTime, Param3/( ).MonthCal, .

UpDown/Slider/Progress: Param3. Param3,., +10

10 +-10 ()10.,.

Tab/DropDownList/ComboBox/ListBox: Param3.(),(

|Red|Green|Blue ).,(|).,( Red|Green||Blue )..

Gui+Delimiter`n Gui+DelimiterTab tab(`t).

Tab:,;.,.,"Red|Green|Blue",

MyTab,|Red|Blue ,GreenBlue.,.,.

ListView TreeView: Sub-command., ListView TreeView

.

GuiControl,Text:,:

Checkbox/Radio: Param3/,-1,01.

DateTime: Param3 / .Param3,.

ComboBox: Param3ComboBox.

GuiControl,Move:. Param3:X(GUIx,,)Y(y

),W(),H().(,.):

GuiControl,Move,MyEdit,x10y20w200h100

GuiControl,Move,MyEdit,%"x"VarX+10"y"

VarY+5"w"VarW*2"h"VarH*1.5;"%" .

GuiControl,MoveDraw:"Move",GUI.,( GroupBox).

Page 836: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

v1.0.48.04+,.

GuiControl,Focus:.,.

GuiControl,Enable/Disable:().,., GuiControlDisable

,.DisableEnable01..,

Enable%VarContainingOne% ,

Enable%VarContainingZero% .

GuiControl,Hide/Show:.,.(), GuiControlDisable

.HideShow01.., Show

Show%VarContainingOne% , Show%VarContainingZero% .

GuiControl,Delete() :., Hide/ Disable, GuiDestroy.

GuiControl,Choose,ControlID,N:ListBox,DropDownList,ComboBox

TabN. N1,2,. N,ChooseString.

[v1.1.06+]: N,ListBox,DropDownListComboBox.

ControlChoose, g, N(,g, Tab).

: GuiControl,Choose,MyListBox,|3 .

(ListBox),(Tab).

ListBox ,:

Gui+LastFound;WinTitle.

PostMessage,0x185,1,-1,ListBox1;.

0x185isLB_SETSEL.

PostMessage,0x185,0,-1,ListBox1;.

Page 837: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControl,Choose,ListBox1,0;(

v1.1.06+).

GuiControl,ChooseString,ControlID,String:

ListBox,DropDownList,ComboBoxTab String..,"UNIX

Text",unix().("Choose").

GuiControl,Font:,,.:

Gui,Font,s18cRedBold,Verdana;,.

GuiControl,Font,MyEdit;.

GuiControl,+/-Option1+/-Option2...:.

, AltSubmit g:

GuiControl,+AltSubmit-g,MyListBox

,OK:

GuiControl,+Default,OK

,.,ErrorLevel0.,1.,().

[v1.1.20+]: ,3,..

GuiControl+g,ControlID,%FuncObj%

GuiControl+g,ControlID,%FuncObj

Page 838: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(),,:

GuiControl,MyGui:Show,MyButton

GuiControl,MyGui:,MyListBox,Item1|Item2

ControlIDHWND,GUI. [v1.1.20+], ControlID

HWNDGUI.

GUI GUI.GUIGUI g().

GUI .GUI1.

Gui,GuiControlGet,Control

GuiControl,,MyListBox,|Red|Green|Blue;.

GuiControl,,MyEdit,Newtextline1.`nNewtext

line2.

GuiControl,,MyRadio2,1;.

GuiControl,Move,OK,x100y200;OK.

GuiControl,Focus,LastName;"LastName".

Page 839: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControlGetGUI.

GuiControlGet,OutputVar[,Sub-command,ControlID,

Param4]

OutputVar

.(ErrorLevel),.

Sub-command

.

ControlID

,., GuiControlGet,MyEdit GuiControlGet,

MyEdit,,MyEdit .

, ControlID().,GuiControlGuiControlGet,

(GroupBoxText).

ControlIDClassNN(),WindowSpy.,

SetTitleMatchMode.:() ControlID.

[v1.1.04+]:ControlID HWND.

GUI, GUI -- [v1.1.20+], ControlIDHWND,

Page 840: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

HWND. .

Param4

,.

ErrorLevel

[v1.1.04+]., .

/, ErrorLevel1.0.

() : Sub-command.,:

Picture:.,.

Edit:,(`n)GUI( ControlGetText ControlSetText)

CR+LF(`r`n).

Hotkey:,..: ^!C ,^Home ,+^NumpadHome .

Checkbox/Radio:1,0,-1./,Text Param4.: Gui

Submit,,.

UpDown/Slider/Progress:.

Tab/DropDownList/ComboBox/ListBox:/( AltSubmit).,,

. , .

Page 841: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView TreeView: Sub-command., ListView TreeView

.

StatusBar:.

ActiveX:ActiveX.

:(CheckBoxRadioDropDownListComboBox)/, Param4Text.

GuiControlGet,OutputVar,Pos:.GUI,,. OutputVar.

:

GuiControlGet,MyEdit,Pos

MsgBoxTheXcoordinateis%MyEditX%.TheY

coordinateis%MyEditY%.Thewidthis

%MyEditW%.Theheightis%MyEditH%.

,, OutputVar( ,).,, .

GuiControlGet,OutputVar,Focus:(ClassNN).GUI ,,

OutputVar.: GuiControlGet,focused_control,focus .

GuiControlGet,OutputVar,FocusV[v1.0.43.06+]: Focus, .

,/63().

GuiControlGet,OutputVar,Enabled:1,0.

Page 842: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControlGet,OutputVar,Visible:1,0.

GuiControlGet,OutputVar,Hwnd[v1.0.46.16+]:(HWND).HWND

PostMessage,SendMessage DllCall.: HwndOutputVarHWND.

GuiControlGet,OutputVar,Name[v1.1.03+]: , OutputVar.

(),,:

GuiControlGet,MyEdit,MyGui:

GuiControlGet,MyEdit,MyGui:Pos

GuiControlGet,Outputvar,MyGui:Focus

, ControlID,GUI. [v1.1.20+], ControlIDHWND

GUI.

GUIGUI.GUIGUI g().

GUI .GUI1.

Gui,GuiControl,ControlGet

GuiControlGet,MyEdit

GuiControlGet,CtrlContents,,MyEdit;,.

Page 843: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiControlGet,MyCheckbox1;1,0.

GuiControlGet,MyCheckbox1,,,Text;/.

GuiControlGet,Pic,Pos,Static4;/PicX,

PicY,PicWPicH

Page 844: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView

:(),,,.

:

(,)

ListView

G

(ListView)

ListView

Page 845: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

List-View.,,().

,ListView.ListView:

Gui,Add,ListView,Options,

ColumnTitle1|ColumnTitle2|...

,""ListView:

;ListView:

Gui,Add,ListView,r20w700gMyListView,

Name|Size(KB)

;ListView:

Loop,%A_MyDocuments%\*.*

LV_Add("",A_LoopFileName,

A_LoopFileSizeKB)

LV_ModifyCol();.

LV_ModifyCol(2,"Integer");,2.

;..

Gui,Show

return

MyListView:

ifA_GuiEvent=DoubleClick

{

LV_GetText(RowText,A_EventInfo);.

ToolTipYoudouble-clickedrownumber

%A_EventInfo%.Text:"%RowText%"

Page 846: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

return

GuiClose:;.

ExitApp

Page 847: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"Gui,Add,ListView,Options"

AltSubmit:ListView.,g. ListView.

Background:Background( )RGB(0x).

: BackgroundSilver ,BackgroundFFDD99 .,ListView Gui

Color(,). BackgroundDefault ().,

GuiControl,+BackgroundDefault,MyListView ListView

.

C:.C( )RGB(0x).

: cRed ,cFF2211 ,c0xFF2211 ,cDefault .

Checked:. , Check..

Count:CountListView.:.,,,().,

GuiControl,-Redraw,MyListView ., GuiControl,

+Redraw,MyListView ().

Grid:.

Hdr: -Hdr (Hdr)., GuiControl,+Hdr,MyListView .

LV:LV ListView .., -E0x200

WS_EX_CLIENTEDGE,., -LV0x20

LVS_EX_FULLROWSELECT.

LV0x10: -LV0x10 .,,.,column1,.

Page 848: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LV0x20: -LV0x20 (, )..

Multi: -Multi (Multi).

NoSortHdr:..ListView,ListView.

NoSort:.,(NoSortHdr).,g ColClick,.

ReadOnly: -ReadOnly (ReadOnly)., F2 .,,,

.

R:().R., R10 10. ListView,.:

ListView,.

Sort:.

SortDesc:,.

WantF2[v1.0.44+]: -WantF2 (WantF2)F2 . -ReadOnly .

,gF2 .

(): ,. ListView.

Page 849: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView,().,.: GuiControl,+IconSmall,

MyListView .

Icon:. Report,.,ListView .

Tile:,,. Checkbox.,WindowsXP.

IconSmall:.

List:,..

Report:,.: GuiControl,+Report,MyListView .

Page 850: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView

ListView GUI ( Gui,2:Default ).ListView,.

ListView,., Gui,ListView,ListViewName ,

ListViewNameListView WindowSpyClassNN(v1.1.04+)

HWND., ListView. [v1.1.23+]:A_DefaultListView.

"rownumber",ListView.1,2,.,,.,

, LV_GetText().

Page 851: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LV_Add([Options,Field1,Field2,...])

. Field1,( ).,"".,.,.

,LV_Add()0. ,ListView Sort SortDesc.

Options().tab.,.,.

Check:(ListView )., LV_Modify(RowNumber,"-

Check") .

ColN:Col, Col1. LV_Modify(),.

Focus:(Select)., LV_Modify(RowNumber,"-

Focus") .

Icon:Icon,., .,., .

Select:., LV_Modify(RowNumber,"-Select") ., ,

Appskey (). Select01., "Select" "Select"

VarContainingOne ( ). Focus Check.

Vis[v1.0.44+]:ListView.LV_Modify(),

: LV_Modify(RowNumber,"Vis") .

Page 852: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LV_Insert(RowNumber[,Options,Col1,Col2,...])

LV_Add(),. RowNumber. RowNumber(

2147483647),. ,.

LV_Modify(RowNumber,Options[,NewCol1,NewCol2,...])

/,10. RowNumber0, (10).,.,

,. OptionsColN .Options,

LV_Delete([RowNumber])

,ListView ., RowNumber.10.

Page 853: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LV_ModifyCol([ColumnNumber,Options,ColumnTitle])

/.1(0).,.,.().10.

Options().tab.,.,.

:

N:N,.,.,: LV_ModifyCol(1,50)

LV_ModifyCol(1,"50Integer") .

Auto:.().

AutoHdr:,.,ListView.,.().

Icon:Icon . -Icon (icon).

IconRight:.

:

Float:,().25.

Integer:,.,32;-21474836482147483647.

(,).( 0xF9E0

Page 854: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Text:,.8190( Logical,4094).

:/

Center:.IntegerFloat,CenterIntegerFloat.

Left:,.,.

Right:.IntegerFloat,. "IntegerLeft"

"FloatCenter" .

:

Case:( ). Case,CaseLocale Logical,A-Z.

CaseLocale[v1.0.43.03+]:( ).,A-ZANSI?ü.

"","coop""co-op".

Desc:..

Logical[v1.0.44.12+]: CaseLocale,.,"T33"

"T4".LogicalWindowsXP(, CaseLocale)., Logical

Case:.

NoSort:.,ListView NoSort.ListViewg,no-

sort ColClick.

Sort:( Desc).

SortDesc:.

Page 855: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Uni:..

LV_InsertCol(ColumnNumber[,Options,ColumnTitle])

, ColumnNumber().1(0). ColumnNumber,().

,,.(

LV_DeleteCol(ColumnNumber)

.10.,1., LV_DeleteCol(2) .Windows

XP,0.

Page 856: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView

LV_GetCount(["Selected|Column"])

,."S""Selected",/."Col""Column",.,.

,().:

Loop%LV_GetCount()

{

LV_GetText(RetrievedText,A_Index)

ifInStr(RetrievedText,"somefiltertext")

LV_Modify(A_Index,"Select");.

}

ListView(INI),:

Gui+LastFound

Loop%LV_GetCount("Column")

{

SendMessage,4125,A_Index-1,0,

SysListView321;4125LVM_GETCOLUMNWIDTH.

MsgBoxColumn%A_Index%'swidthis

%ErrorLevel%.

}

LV_GetNext([StartingRowNumber,"Checked|Focused"])

,.,. StartingRowNumber1,.,

StartingRowNumber.,/.,"C""Checked";"F"

Page 857: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"Focused"(,).ListView:

RowNumber=0;.

Loop

{

RowNumber:=LV_GetNext(RowNumber);.

ifnotRowNumber;,.

break

LV_GetText(Text,RowNumber)

MsgBoxThenextselectedrowis

#%RowNumber%,whosefirstfieldis"%Text%".

}

:

Gui+LastFound

SendMessage,4140,RowNumber-1,0xF000,

SysListView321;4140LVM_GETITEMSTATE.

0xF000LVIS_STATEIMAGEMASK.

IsChecked:=(ErrorLevel>>12)-1;

RowNumberIsChecked,.

LV_GetText(OutputVar,RowNumber[,ColumnNumber])

RowNumber ColumnNumber OutputVar. ColumnNumber,

1(). RowNumber0,.8191,8191.10.

, OutputVar.

.,1,.

Page 858: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

G()

g gMySubroutine . MySubroutine. A_Gui

A_GuiControlListView., A_GuiEvent,(,):

DoubleClick:.A_EventInfo. LV_GetNext(),0.

R: .A_EventInfo.

ColClick:.A_EventInfo,;.(YYYYMMDD)

().(MM/DD/YY).,

column3, LV_ModifyCol(2,"NoSort") column2.

column2ColClick, LV_ModifyCol(3,"Sort") ListView

.

D:().A_EventInfo.v1.0.44+, AltSubmit.

d(D):,.

e(E):(ListView -ReadOnly ).A_EventInfo.

Page 859: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

G()

ListView AltSubmit,g A_GuiEvent:

Normal:.A_EventInfo.

RightClick:.A_EventInfo.,. GuiContextMenu,

Appskey.:

GuiContextMenu:;Appskey.

ifA_GuiControl<>MyListView;.

ListView.

return

;,A_GuiXA_GuiY.

;Appskey:

Menu,MyContextMenu,Show,%A_GuiX%,%A_GuiY%

return

A:,.A_EventInfo.

C:ListView.

E:(ListView -ReadOnly ).A_EventInfo.

F:ListView.

f(F):ListView.

I:./,/.,:,.v1.0.44+,A_EventInfo.

v1.0.46.10+,ErrorLevel:S()s(),/F()f(),/

Page 860: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

C()c().,SF.,

"S",true) .:,"SsFfCc"., Critical g"I"

(,,).

K:ListView.A_EventInfo,1255. GetKeyName

., key:=GetKeyName(Format("vk{:x}",

A_EventInfo)) .,A-Z Chr(A_EventInfo) .F2 WantF2

.,;.

M:..

S:ListView.

s(S):ListView.

Page 861: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(ListView)

..IL_Add(),,1..,ListView:

Gui,Add,ListView,h200w180,Icon&

Number|Description;ListView.

ImageListID:=IL_Create(10);10.

LV_SetImageList(ImageListID);ListView.

Loop10;DLL.

IL_Add(ImageListID,"shell32.dll",A_Index)

Loop10;ListView(,).

LV_Add("Icon".A_Index,A_Index,"n/a")

LV_ModifyCol("Hdr");.

GuiShow

return

GuiClose:;ListViewGUI.

ExitApp

IL_Create([InitialCount,GrowCount,LargeIcons?])

,ID(0). InitialCount(,2). GrowCount(,

5).LargeIcons:,.,()..

LV_SetImageList(ImageListID[,0|1|2])

ListView. ,ListView(,).ImageListID IL_Create()

.,.,0,1,2(,

ListView:/..ListView,LV_SetImageList(),

Page 862: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ImageListID.ListView.ID.

, ,LV_SetImageList1().ListView.

,LV_SetImageList()ListViewImageListID(0).

IL_Destroy(ImageListID).

IL_Add(ImageListID,Filename[,IconNumber,ResizeNonIcon?])

ImageListID(1,2,). Filename(.ICO),(.CUR)(.ANI)(

ListView).:EXE,DLL,CPL,SCR.,

IconNumber,ID.,: IL_Add(ImageListID,"C:\My

Application.exe",2) .

,BMP,GIFJPG.,: IconNumber/(0xFFFFFF[]

); ResizeNonIcon,.

GIF,JPG,BMP,ICO,CURANI.WindowsXP,,PNG,

TIF,Exif,WMFEMF.XPGDI+DLLAutoHotkey.exe(

DLL).DLL, www.microsoft.com:gdiredistributable

[v1.1.23+]:bitmap()icon()handle() .,

HBITMAP:%handle% .

IL_Destroy(ImageListID)

,10.,ListView,ListView.,ListView

ListView( 0x40 ),ListView.,ListView,.

Page 863: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView

GuiSubmitListView.,ListView ().

( LV_ModifyCol(1,"Sort") ),. Sort SortDesc,.

ListView, ().:

Gui,Add,Button,HiddenDefault,OK

...

ButtonOK:

GuiControlGet,FocusedControl,FocusV

ifFocusedControl<>MyListView

return

MsgBox%"Enterwaspressed.Thefocusedrow

numberis".LV_GetNext(0,"Focused")

return

,..

ListView,260.

ListView, Count..

ListView(ListView).,ListView 0x4000000 (

WS_CLIPSIBLINGS).

ListView.ListView, .

SendMessage. ,., .

Page 864: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView(,), GuiControl.

ListView(), ControlGetList.

Page 865: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TreeView,,Gui,GuiContextMenu,GuiControl,GuiControlGet,ListView

Page 866: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;0:

LV_Modify(0,"Select");.

LV_Modify(0,"-Select");.

LV_Modify(0,"-Check"); .

;:

LV_ModifyCol();.

;

;.

;,.

;,.

;:

Gui+Resize

;:

Gui,Add,Button,DefaultgButtonLoadFolder,Load

afolder

Gui,Add,Button,x+20gButtonClear,ClearList

Gui,Add,Button,x+20,SwitchView

;ListView:

Gui,Add,ListView,xmr20w700vMyListView

gMyListView,Name|InFolder|Size(KB)|Type

LV_ModifyCol(3,"Integer");,Size.

;,ListView:

ImageListID1:=IL_Create(10)

ImageListID2:=IL_Create(10,10,true);.

Page 867: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;ListView,:

LV_SetImageList(ImageListID1)

LV_SetImageList(ImageListID2)

;:

Menu,MyContextMenu,Add,Open,ContextOpenFile

Menu,MyContextMenu,Add,Properties,

ContextProperties

Menu,MyContextMenu,Add,ClearfromListView,

ContextClearRows

Menu,MyContextMenu,Default,Open;"Open".

;.

;:

Gui,Show

return

ButtonLoadFolder:

Gui+OwnDialogs;.

FileSelectFolder,Folder,,3,Selectafolderto

read:

ifnotFolder;.

return

;,,

;C:\.,.

StringRight,LastChar,Folder,1

ifLastChar=\

StringTrimRight,Folder,Folder,1;.

;SHFILEINFO.

sfi_size:=A_PtrSize+8+(A_IsUnicode?680:

340)

VarSetCapacity(sfi,sfi_size)

Page 868: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;ListView:

GuiControl,-Redraw,MyListView;.

Loop%Folder%\*.*

{

FileName:=A_LoopFileFullPath;.

;ID,

;.ID,

;.

SplitPath,FileName,,,FileExt;.

ifFileExtinEXE,ICO,ANI,CUR

{

ExtID:=FileExt;ID.

IconNumber=0;.

}

else;/,ID.

{

ExtID=0;.

Loop7;7,64.

{

StringMid,ExtChar,FileExt,A_Index,

1

ifnotExtChar;.

break

;ID:

ExtID:=ExtID|(Asc(ExtChar)<<(8*

(A_Index-1)))

}

;.,

;,

;:

IconNumber:=IconArray%ExtID%

}

ifnotIconNumber;,.

{

;:

ifnotDllCall("Shell32\SHGetFileInfo".

Page 869: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(A_IsUnicode?"W":"A"),"str",FileName

,"uint",0,"ptr",&sfi,"uint",

sfi_size,"uint",0x101);0x101

SHGFI_ICON+SHGFI_SMALLICON

IconNumber=9999999;.

else;.

{

;hIcon:

hIcon:=NumGet(sfi,0)

;HICON.

;1:

IconNumber:=

DllCall("ImageList_ReplaceIcon","ptr",

ImageListID1,"int",-1,"ptr",hIcon)+1

DllCall("ImageList_ReplaceIcon",

"ptr",ImageListID2,"int",-1,"ptr",hIcon)

;,:

DllCall("DestroyIcon","ptr",hIcon)

;:

IconArray%ExtID%:=IconNumber

}

}

;ListView:

LV_Add("Icon".IconNumber,A_LoopFileName,

A_LoopFileDir,A_LoopFileSizeKB,FileExt)

}

GuiControl,+Redraw,MyListView;().

LV_ModifyCol();.

LV_ModifyCol(3,60);Size.

return

ButtonClear:

LV_Delete();ListView,.

return

Page 870: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ButtonSwitchView:

ifnotIconView

GuiControl,+Icon,MyListView;.

else

GuiControl,+Report,MyListView;.

IconView:=notIconView;.

return

MyListView:

ifA_GuiEvent=DoubleClick;.

{

LV_GetText(FileName,A_EventInfo,1);.

LV_GetText(FileDir,A_EventInfo,2);.

Run%FileDir%\%FileName%,,UseErrorLevel

ifErrorLevel

MsgBoxCouldnotopen

"%FileDir%\%FileName%".

}

return

GuiContextMenu:;Appskey.

ifA_GuiControl<>MyListView;ListView.

return

;,A_GuiXA_GuiY.

;Appskey:

Menu,MyContextMenu,Show,%A_GuiX%,%A_GuiY%

return

ContextOpenFile:;"Open".

ContextProperties:;"Properties".

;,:

FocusedRowNumber:=LV_GetNext(0,"F");.

ifnotFocusedRowNumber;.

return

LV_GetText(FileName,FocusedRowNumber,1);.

LV_GetText(FileDir,FocusedRowNumber,2);.

IfInStringA_ThisMenuItem,Open;"Open".

Page 871: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Run%FileDir%\%FileName%,,UseErrorLevel

else;"Properties".

RunProperties"%FileDir%\%FileName%",,

UseErrorLevel

ifErrorLevel

MsgBoxCouldnotperformrequestedactionon

"%FileDir%\%FileName%".

return

ContextClearRows:;"Clear".

RowNumber=0;.

Loop

{

;,

;1,

;():

RowNumber:=LV_GetNext(RowNumber-1)

ifnotRowNumber;,.

break

LV_Delete(RowNumber);ListView.

}

return

GuiSize:;ListView.

ifA_EventInfo=1;..

return

;,.ListView.

GuiControl,Move,MyListView,%"W".(A_GuiWidth

-20)."H".(A_GuiHeight-40)

return

GuiClose:;,:

ExitApp

Page 872: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TreeView [v1.0.44+]

:

,,

TreeView

G

Page 873: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tree-View..

TreeView:

Gui,Add,TreeView,Options

:

Gui,Add,TreeView

P1:=TV_Add("Firstparent")

P1C1:=TV_Add("Parent1'sfirstchild",P1);

P1.

P2:=TV_Add("Secondparent")

P2C1:=TV_Add("Parent2'sfirstchild",P2)

P2C2:=TV_Add("Parent2'ssecondchild",P2)

P2C2C1:=TV_Add("Child2'sfirstchild",P2C2)

Gui,Show;TreeView.

return

GuiClose:;TreeViewGUI.

ExitApp

Page 874: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

" Gui,Add,TreeView,Options"

AltSubmit:TreeView.,g. TreeView.

Background:Background( )RGB(0x).

: BackgroundSilver ,BackgroundFFDD99 .,TreeView Gui

Color(,). BackgroundDefault ().,

GuiControl,+BackgroundDefault,MyTreeView TreeView

.

Buttons: -Buttons (Buttons).

C:.C( )RGB(0x).

: cRed ,cFF2211 ,c0xFF2211 ,cDefault .

Checked:. , Check..TreeView,

TV_GetNext() TV_Get().

HScroll: -HScroll (HScroll)().

ImageList:TreeView. ImageList IL_Create()

ImageListID.TreeView(, TV_SetImageList()).:

ImageListID:=IL_Create(10);10.

Loop10;.

IL_Add(ImageListID,"shell32.dll",A_Index)

Gui,Add,TreeView,ImageList%ImageListID%

TV_Add("NameofItem",0,"Icon4");

TreeView.

GuiShow

Page 875: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Lines: -Lines (Lines).,/.

ReadOnly: -ReadOnly (ReadOnly)/., F2 .,,,

.,,:

Gui,Add,TreeView,-ReadOnlygMyTree

;...

MyTree:

if(A_GuiEvent=="e");(==).

TV_Modify(TV_GetParent(A_EventInfo),

"Sort");,.

return

R:().R., R10 10.

WantF2: -WantF2 (WantF2)F2 . -ReadOnly.,gF2

.

(): ,. TreeView.

Page 876: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TreeView

TreeView GUI ( Gui,2:Default ).TreeView,

.

TreeView,., Gui,TreeView,TreeViewName ,

TreeViewNameTreeView WindowSpyClassNN(v1.1.04+)

HWND., TreeView. [v1.1.23+]:A_DefaultTreeView

TV_SetImageList(ImageListID[,0|2]) [v1.1.02+]

TreeView ImageList.ImageListID IL_Create().,0.,

2(, SendMessage).,TV_SetImageList()TreeView

ImageListID(0). IL_Destroy(ImageListID)

Page 877: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,

TV_Add(Name,[ParentItemID,Options])

TreeViewID(0). Name,( ). ParentItemIDID(0

)., GuiControl,-Redraw,MyTreeView

GuiControl,+Redraw,MyTreeView .

TV_Add()TV_Modify()

Options().tab.,.,.

Bold:., TV_Modify(ItemID,"-Bold") .

Check:(TreeView )., TV_Modify(ItemID,"-

Check") . Check01., "Check" "Check".

VarContainingOne ( ).

Expand:()., TV_Modify(ItemID,"-Expand") .,

TV_Modify()0ID., TV_Add()."Select",.,

Expand01., "Expand" "Expand".

VarContainingOne .

First|Sort|N: TV_Add().( ).,/., First

/, Sort.( N),ID,(N,).

Icon: Icon,., .,.,.

Page 878: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:.,.,., TV_GetSelection().

Sort: TV_Modify(),., TV_Modify(0,"Sort") .,

0ID.

Vis:TreeView/().

VisFirst:,TreeView. TV_Modify() TV_Add().

TV_Modify(ItemID[,Options,NewName])

/.ID()0., . NewName,. Options,.

TV_Delete([ItemID])

ItemID,TreeView ., ItemID.10.

Page 879: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TreeView

TV_GetSelection()

ID.

TV_GetCount()

.,.

TV_GetParent(ItemID)

ID.,0.

TV_GetChild(ParentItemID)

/ID(0).

TV_GetPrev(ItemID)

ID(0).

TV_GetNext([ItemID,"Checked|Full"])

:

1. ,TreeView/ID(0).

2. (ItemID),ID(0).0,TreeView/ID(0).

Page 880: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

3. "Full""F",,..:

ItemID=0;.

Loop

{

ItemID:=TV_GetNext(ItemID,"Full");

"Full""Checked".

ifnotItemID;.

break

TV_GetText(ItemText,ItemID)

MsgBoxThenextItemis%ItemID%,whose

textis"%ItemText%".

}

4. "Check","Checked""C",,.TreeView.

TV_GetText(OutputVar,ItemID)

ItemID/ OutputVar.8191,8191.ID.0(

OutputVar).

TV_Get(ItemID,"Expand|Check|Bold")

, ItemID.0."E","Expand""Expanded" ()"C",

"Check""Checked" "B""Bold" .

:IF"",:

1. ifTV_Get(ItemID,"Checked")=ItemID

2. ifTV_Get(ItemID,"Checked")

Page 881: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

G()

g gMySubroutine . MySubroutine. A_Gui

A_GuiControlTreeView., A_GuiEvent,(,):

DoubleClick:.A_EventInfoID.

D:().A_EventInfoID.

d(D):,.

e(E):(TreeView -ReadOnly ).A_EventInfoID.

S:,.A_EventInfoID.

Page 882: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

G()

TreeView AltSubmit,g A_GuiEvent:

Normal:.A_EventInfoID.

RightClick:.A_EventInfoID.,. GuiContextMenu,

Appskey.:

GuiContextMenu:;Appskey.

ifA_GuiControl<>MyTreeView;.

TreeView.

return

;,A_GuiXA_GuiY.

;Appskey:

Menu,MyContextMenu,Show,%A_GuiX%,%A_GuiY%

return

E:(TreeView -ReadOnly).A_EventInfoID.

F:TreeView.

f(F):TreeView.

K:TreeView.A_EventInfo,1255.,

Chr(A_EventInfo) . WantF2F2.,Enter,

.

+():.A_EventInfoID.

Page 883: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-():.A_EventInfoID.

Page 884: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiSubmitTreeView.,TreeView ().

TreeView, ().:

Gui,Add,Button,HiddenDefault,OK

...

ButtonOK:

GuiControlGet,FocusedControl,FocusV

ifFocusedControl<>MyTreeView

return

MsgBox%"Enterwaspressed.Theselecteditem

IDis".TV_GetSelection()

return

,..

TreeView,260.

TreeView65536,. TV_Add().

ListView,TreeView.,TreeView,TreeView

IL_Destroy(ImageListID).,,,.

TreeView.TreeView, .

,,TreeView, GuiControl.

TreeVieweXtension(TVX)TreeView,,.

www.autohotkey.com/forum/topic19021.html

Page 885: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListView,,Gui,GuiContextMenu,GuiControl,GuiControlGet,TreeView

Page 886: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.

;TreeView.

;,ListView(Windows).

;, StatusBar.

;TreeView.

;C:\,:

TreeRoot=%A_StartMenuCommon%

TreeViewWidth:=280

ListViewWidth:=A_ScreenWidth-TreeViewWidth-

30

;:

Gui+Resize

;:

ImageListID:=IL_Create(5)

Loop5

IL_Add(ImageListID,"shell32.dll",A_Index)

;TreeViewListView,Windows:

Gui,Add,TreeView,vMyTreeViewr20

w%TreeViewWidth%gMyTreeView

ImageList%ImageListID%

Gui,Add,ListView,vMyListViewr20

w%ListViewWidth%x+10,Name|Modified

;ListView():

Col2Width=70;YYYYMMDD.

LV_ModifyCol(1,ListViewWidth-Col2Width-30);

.

LV_ModifyCol(2,Col2Width)

;,:

Page 887: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Add,StatusBar

SB_SetParts(60,85);().

;.,:

SplashTextOn,200,25,TreeViewandStatusBar

Example,Loadingthetree...

AddSubFoldersToTree(TreeRoot)

SplashTextOff

;.,:

Gui,Show,,%TreeRoot%;().

return

AddSubFoldersToTree(Folder,ParentItemID=0)

{

;TreeView.

;.

Loop%Folder%\*.*,2;.

AddSubFoldersToTree(A_LoopFileFullPath,

TV_Add(A_LoopFileName,ParentItemID,"Icon4"))

}

MyTreeView:;().

ifA_GuiEvent<>S;"".

return;.;,ListView.;:

TV_GetText(SelectedItemText,A_EventInfo)

ParentID:=A_EventInfo

Loop;.

{

ParentID:=TV_GetParent(ParentID)

ifnotParentID;.

break

TV_GetText(ParentText,ParentID)

SelectedItemText=

%ParentText%\%SelectedItemText%

}

SelectedFullPath=%TreeRoot%\%SelectedItemText%

Page 888: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;ListView:

LV_Delete();.

GuiControl,-Redraw,MyListView;.

FileCount=0;.

TotalSize=0

Loop%SelectedFullPath%\*.*;,,ListView

.

{

LV_Add("",A_LoopFileName,

A_LoopFileTimeModified)

FileCount+=1

TotalSize+=A_LoopFileSize

}

GuiControl,+Redraw,MyListView

;,:

SB_SetText(FileCount."files",1)

SB_SetText(Round(TotalSize/1024,1)."KB",2)

SB_SetText(SelectedFullPath,3)

return

GuiSize:;/ListViewTreeView.

ifA_EventInfo=1;..

return

;,..

GuiControl,Move,MyTreeView,%"H".(A_GuiHeight

-30);30.

GuiControl,Move,MyListView,%"H".(A_GuiHeight

-30)."W".(A_GuiWidth-TreeViewWidth-30)

return

GuiClose:;TreeViewGUI.

ExitApp

Page 889: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Image [v1.1.23+]

(imagefilename),:

HBITMAP:bitmap-handle

HICON:icon-handle

bitmap-handle icon-handle., hicon:%handle% (

"hicon:"handle ), handle.

:

GuiAdd,Picture( GuiControlPicture).

IL_Add

LoadPicture

SB_SetIcon

ImageSearch

MenuTray,Icon MenuMenuName,Icon

SplashImage

.,AutoHotKey.(WM_GETICON). LoadPicture.

AutoHotKeyImage,,GUIPicture,.,,:

hbitmap:*%handle% ( "hbitmap:*"handle ).ImageSearch.

Page 890: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;n,.

pattern=%A_ScriptDir%\*

n=15

;SHFILEINFOW.

VarSetCapacity(fileinfo,fisize:=A_PtrSize+

688)

Loop,Files,%pattern%,FD

{

;.

MenuF,Add,%A_LoopFileName%,donothing

;.

ifDllCall("shell32\SHGetFileInfoW","wstr",

A_LoopFileFullPath

,"uint",0,"ptr",&fileinfo;,"uint",

fisize,"uint",0x100)

{

hicon:=NumGet(fileinfo,0,"ptr")

;.

MenuF,Icon,%A_Index%&,HICON:%hicon%

;":"":*",

;

}

}

untilA_Index=n

MenuF,Show

donothing:

return

: LoadPicture.

Page 891: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

InputBox.

InputBox,OutputVar[,Title,Prompt,HIDE,Width,

Height,X,Y,Font,Timeout,Default]

OutputVar

.

.,.

Prompt

,. Prompt, ,.

HIDE

HIDE,,.

Width

,375. .

Height

,189. .

Page 892: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

X,Y

XY(0,0), .,..

Font

().verdana:8

( ).2147483(24.8),2147483., ErrorLevel2. OutputVar

.

Default

..

ErrorLevel

[v1.1.04+]., .

.

OKCANCEL..

ErrorLevel1,0,2., OutputVar.CANCEL.

GUI Gui+OwnDialogs.GUI.

Page 893: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI,Input,MsgBox,FileSelectFile,FileSelectFolder,SplashTextOn,ToolTip

InputBox,password,EnterPassword,(yourinput

willbehidden),hide

InputBox,UserInput,PhoneNumber,Pleaseentera

phonenumber.,,640,480

ifErrorLevel

MsgBox,CANCELwaspressed.

else

MsgBox,Youentered"%UserInput%"

Page 894: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LoadPicture [v1.1.23+]

.

Handle:=LoadPicture(Filename[,Options,ByRef

ImageType])

Filename

, A_WorkingDir.DLLEXE,(),

(AutoHotkey.exe),(PATH).

Options

,:

WnandHn:, n.-1,..0.: "w80h50" ,

"w48h-1" or"w48" (), "h0w100" ().

Iconn:(EXEDLL), n,., "Icon2" .

GDI+:GDI+.: "GDI+w100" .

ImageType

,:0(IMAGE_BITMAP),1(IMAGE_ICON)2

(IMAGE_CURSOR).,(/).

Page 895: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LoadPicture ,, ImageType.

.

if(notImageType);IMAGE_BITMAP(0)orthe

ImageTypeparameterwasomitted.

DllCall("DeleteObject","ptr",Handle)

elseif(ImageType=1);IMAGE_ICON

DllCall("DestroyIcon","ptr",Handle)

elseif(ImageType=2);IMAGE_CURSOR

DllCall("DestroyCursor","ptr",Handle)

Image

;

Pics:=[]

;

Loop,Files,%A_WinDir%\Web\Wallpaper\*.jpg,R

{

;

Pics.Push(LoadPicture(A_LoopFileFullPath))

}

if!Pics.Length()

{

;loop

Page 896: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,Nopicturesfound!Tryadifferent

directory.

ExitApp

}

;,

Gui,Add,Pic,w600h-1vPic+Border,%

"HBITMAP:*"Pics.1

Gui,Show

Loop

{

;!

GuiControl,,Pic,%"HBITMAP:*"

Pics[Mod(A_Index,Pics.Length())+1]

Sleep3000

}

return

GuiClose:

GuiEscape:

ExitApp

Page 897: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Menu,,.. .

Menu,MenuName,Cmd[,P3,P4,P5]

MenuName

TRAY. Add.: Menu,MyMenu,Add,Item1 .

, Show. Add.

Cmd,P3,P4,P5

4..

MenuItemName

.:

,&.,.&&: Save&&Exit .

,&,: &Open .

[v1.1.23+]:,&., 1& .

Page 898: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Add[,MenuItemName,Label-or-Submenu,Options]:,,().

MenuItemName,., Label-or-Submenu MenuItemName.

,.

, ( Gosub ). Label-or-Submenu, MenuItemName.

[v1.1.20+]:, Label-or-Submenu, ., %funcobj% %

funcobj ..,:

FunctionName(ItemName,ItemPos,MenuName)

MenuItemName(), Label-or-Submenu MenuName.:

Menu,MySubmenu,add,Item1

Menu,tray,add,ThisMenuItemIsASubmenu,

:MySubmenu

, :

Pn n , P1 .,0.,.().

+Radio [v1.1.23+]:.

+Right [v1.1.23+]:. .

+Break [v1.1.23+]:.

+BarBreak [v1.1.23+]:,.

Page 899: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(+)(-), -Radio ..

, Label-or-Submenu.

Insert[,ItemToInsertBefore,NewItemName,Label-or-Submenu,Options]

[v1.1.23+]:. Add, ItemToInsertBefore1 +1(&).

ItemToInsertBefore(). Add, Insert NewItemName.

Delete[,MenuItemName]: MenuItemName.Exit().

, NoDefault. MenuItemName, MenuName MenuName

. Win32,.

DeleteAll:, (). Delete(),,.

Win32,.

Rename,MenuItemName[,NewName]: MenuItemName NewName(

NewName, MenuItemName).. [v1.1.23+]: &

NewName, Add.

Check,MenuItemName:MenuItemName().

Uncheck,MenuItemName:MenuItemName().

ToggleCheck,MenuItemName:;.

Enable,MenuItemName:() MenuItemName.

Disable,MenuItemName: MenuItemName.

ToggleEnable,MenuItemName: MenuItemName;.

Page 900: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Default[,MenuItemName]: MenuItemName(TRAY).,

.,. MenuItemName, NoDefault

NoDefault::,OPEN ( MainWindow).

NoStandardOPEN,,.TRAY:.

Standard:()..

NoStandard:()().

Page 901: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[AHK_L17+]

Icon,MenuItemName,FileName[,IconNumber,IconWidth]:

MenuItemName. FileNameAutoHotkey., IconNumber

(,1). IconNumber,ID. IconWidth.

IconNumber,..

WindowsVista,"".:

Menu,MenuName,Icon,MenuItemName,

Filename.png,,0

:WindowsXP,Gui.

[v1.1.23+]:bitmap()icon()handle .,

HBITMAP:%handle% .

NoIcon,MenuItemName: MenuItemName().

Page 902: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(MenuNameTRAY)

Icon[,FileName,IconNumber,1]: FileName.:ICO,CUR,ANI,

EXE,DLL,CPL,SCR.,

IconNumber,ID. FileName(*).

:1,0(/)., Pause Suspend.: ,10,

: Menu,Tray,Icon,,,1 .

InputBox,Progress GUI. ,.: #NoTrayIcon,,

Menu,Tray,Icon ().

.ICO.16x16.,.ICO.

DLLCPL.: Menu,Tray,Icon,Shell32.dll,174 .

A_IconNumber A_IconFile()().

[v1.1.23+]:bitmap()icon()handle .,

HBITMAP:%handle% .

Icon():. #NoTrayIcon,.

NoIcon:.,., #NoTrayIcon., A_IconHidden1,

0.

Tip[,Text]:,.,(`n),Line1`nLine2. Text127, Texttab

,. Text,. A_IconTip(,).

Page 903: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Show[,X,Y]: MenuName,,()., GUI.X

Y,.,.XY."

Color,ColorValue[,Single]: ColorValue,16HTML6

RGB( ). ColorValue(Default).Single,.

Click,ClickCount: ClickCount1. ClickCount2().

: Menu,Tray,Click,1 .

MainWindow: .,.View("Linesmostrecently

executed"),. MenuNameTRAY.

NoMainWindow(): .,.,: ListLines,ListVars,

ListHotkeys KeyHistory.MenuNameTRAY.

UseErrorLevel[,off]:,OFF.Menu,OFF . Menu,

Tray,UseErrorLevel , ErrorLevel10.off,

OFF.,, MenuName.

Page 904: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Win32

,Menu,

.

.

Menu,MenuName,DeleteAll.

Menu,MenuName,NoStandard().

Win32API"",.

ID.ID, MenuGetHandleGetMenuItemIDID.ID

Menu, Win32.

Page 905: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

260.

Menu,MenuName,Add ().,(v1.1.23+).,

Menu,MenuName,Delete,3& . Menu,MenuName,

DeleteAll .

.:,() Menu,tray,NoStandard Menu,tray,

Standard .

,"PauseScript""SuspendHotkeys".

( Menu,MyMenu,DeleteAll ),.,( #NoTrayIcon

).

, ,., Critical(,/,).

,( SendMode). .

A_ThisMenuItem A_ThisMenuItemPos()., A_ThisMenu

A_ThisMenuItem..,,.

GUI(), #Persistent.

Page 906: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI,,Thread,Critical,#NoTrayIcon,Gosub,Return,SetTimer,#Persistent

Page 907: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#1:,.

#Persistent;,.

Menu,tray,add;.

Menu,tray,add,Item1,MenuHandler;.

return

MenuHandler:

MsgBoxYouselected%A_ThisMenuItem%frommenu

%A_ThisMenu%.

return

;#2:,Win-Z.

;.

Menu,MyMenu,Add,Item1,MenuHandler

Menu,MyMenu,Add,Item2,MenuHandler

Menu,MyMenu,Add;.

;.

Menu,Submenu1,Add,Item1,MenuHandler

Menu,Submenu1,Add,Item2,MenuHandler

;()..

Menu,MyMenu,Add,MySubmenu,:Submenu1

Menu,MyMenu,Add;.

Menu,MyMenu,Add,Item3,MenuHandler;.

return;.

Page 908: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MenuHandler:

MsgBoxYouselected%A_ThisMenuItem%fromthemenu

%A_ThisMenu%.

return

#z::Menu,MyMenu,Show;Win-Z.

;#3:,.

#Persistent

#SingleInstance

menu,tray,add;

menu,tray,add,TestToggle&Check

menu,tray,add,TestToggleEnable

menu,tray,add,TestDefault

menu,tray,add,TestStandard

menu,tray,add,TestDelete

menu,tray,add,TestDeleteAll

menu,tray,add,TestRename

menu,tray,add,Test

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

TestToggle&Check:

menu,tray,ToggleCheck,TestToggle&Check

menu,tray,Enable,TestToggleEnable;,.

menu,tray,add,TestDelete;.

return

TestToggleEnable:

menu,tray,ToggleEnable,TestToggleEnable

return

Page 909: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TestDefault:

ifdefault=TestDefault

{

menu,tray,NoDefault

default=

}

else

{

menu,tray,Default,TestDefault

default=TestDefault

}

return

TestStandard:

ifstandard<>n

{

menu,tray,NoStandard

standard=n

}

else

{

menu,tray,Standard

standard=y

}

return

TestDelete:

menu,tray,delete,TestDelete

return

TestDeleteAll:

menu,tray,DeleteAll

return

TestRename:

ifNewName<>renamed

{

Page 910: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OldName=TestRename

NewName=renamed

}

else

{

OldName=renamed

NewName=TestRename

}

menu,tray,rename,%OldName%,%NewName%

return

Test:

MsgBox,Youselected"%A_ThisMenuItem%"inmenu

"%A_ThisMenu%".

return

;#4:.

Menu,FileMenu,Add,ScriptIcon,MenuHandler

Menu,FileMenu,Add,SuspendIcon,MenuHandler

Menu,FileMenu,Add,PauseIcon,MenuHandler

Menu,FileMenu,Icon,ScriptIcon,%A_AhkPath%,2

;

Menu,FileMenu,Icon,SuspendIcon,%A_AhkPath%,

-206;206

Menu,FileMenu,Icon,PauseIcon,%A_AhkPath%,

-207;207

Menu,MyMenuBar,Add,&File,:FileMenu

Gui,Menu,MyMenuBar

Gui,Add,Button,gExit,ExitThisExample

Gui,Show

MenuHandler:

Return

Exit:

ExitApp

Page 911: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MenuGetHandle [v1.1.23+]

Win32.

Handle:=MenuGetHandle(MenuName)

MenuName

..

Win32.,. Win32.

Menu,MenuGetName

MenuMyMenu,Add,Item1,no

MenuMyMenu,Add,Item2,no

MenuMyMenu,Add,ItemB,no

;.

item_count:=DllCall("GetMenuItemCount","ptr",

MenuGetHandle("MyMenu"))

Page 912: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;ID.

last_id:=DllCall("GetMenuItemID","ptr",

MenuGetHandle("MyMenu"),"int",item_count-1)

MsgBox,MyMenuhas%item_count%items,andits

lastitemhasID%last_id%.

no:

return

Page 913: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MenuGetName [v1.1.23+]

Win32.

MenuName:=MenuGetName(Handle)

Handle

Win32(HMENU).

.Win32,. Win32.

Menu,MenuGetHandle

Page 914: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox("""").

MsgBox,Text

MsgBox[,Options,Title,Text,Timeout]

,MsgBox"PressOKtocontinue.".,,.

.,`n,.text1`n`ntext2text1text2.

Text, ,.

.,0..

(v1.1.06+), %Options ., Text.

.,().

(),.v1.1.06+,, %mins*60 .

2147483(24.8),2147483. IfMsgBoxTIMEOUT.

Page 915: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:MsgBox"",MsgBox , IfMsgBox

"".

Options().

("") 0 0x0

/ 1 0x1

// 2 0x2

// 3 0x3

/ 4 0x4

/ 5 0x5

Cancel/TryAgain/Continue 6 0x6

""() 16384 0x4000

(/) 16 0x10

32 0x20

48 0x30

() 64 0x40

256 0x100

512 0x200

() 768 0x300

Page 916: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

() 4096 0x1000

8192 0x2000

(WS_EX_TOPMOST)(,)

262144 0x40000

524288 0x80000

/ 1048576 0x100000

,MsgBox.,""""/"", Options256+4

(260).0x100+0x4(0x104).

MsgBox, Text .

MsgBox, IfMsgBox.:

MsgBox,4,,Wouldyouliketocontinue?(press

YesorNo)

IfMsgBoxYes

MsgBoxYoupressedYes.

else

MsgBoxYoupressedNo.

.

:MsgBoxControl-C.MsgBox,AutoHotkey.

Page 917: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUIMsgBox : Gui+OwnDialogsGUI MsgBox.MsgBox

GUI.,.

Gui+OwnDialogs,MsgBox(8192).

"" : Options""(83),,"":

1. MsgBoxGUI Gui+OwnDialogs.

2. WM_HELP(0x53).: OnMessage(0x53,"WM_HELP") .

WM_HELP(),MsgBox.

(MsgBox) :MsgBox, X."", X"".

,""X, X"".

IfMsgBox,InputBox,FileSelectFile,FileSelectFolder,ToolTip,GUI

MsgBoxThisisthe1-parametermethod.Commas(,)

donotneedtobeescaped.

MsgBox,4,,Thisisthe3-parametermethod.

Commas(,)donotneedtobeescaped.

MsgBox,4,,Doyouwanttocontinue?(PressYES

orNO)

IfMsgBoxNo

return

MsgBox,4,,4-parametermethod:thisMsgBoxwill

timeoutin5seconds.Continue?,5

IfMsgBoxTimeout

Page 918: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxYoudidn'tpressYESorNOwithinthe

5-secondperiod.

elseIfMsgBoxNo

return

;"%", .,

;, .

;"."MsgBox:

MsgBox%"Newwidthforobject#".A_Index."

is:".RestrictWidth(ObjectWidth%A_Index%*

ScalingFactor)

;MsgBox().

SplashTextOn,,,AMsgBoxisabouttoappear.

Sleep3000

SplashTextOff

MsgBoxThebackupprocesshascompleted.

Page 919: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnMessage() .

OnMessage(MsgNumber[,Function,MaxThreads])

MsgNumber

,04294967295(0xFFFFFFFF). (0x400),

4096(0x1000).AutoHotkey.

Function

A [v1.1.20+],,(%).

. vs .

MaxThreads() [v1.0.47+]

, .,,., MaxThreads, Critical:

[v1.1.20+]: MsgNumber,., MaxThreads.,

OnMessage(Msg,Fn,-2) Fn Msg, Fn2.

,,,.

vs

OnMessage Function.

Page 920: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(FunctionName)

, MsgNumber--"".

,, MaxThreads.,().

() MsgNumber():

Name:=OnMessage(MsgNumber,"FunctionName")

:

..

,.

,.

, MsgNumber(),:

Name:=OnMessage(MsgNumber,"")

MsgNumber(),:

Name:=OnMessage(MsgNumber)

(FunctionObject)

(functionobjects) ( (normalfunctions) ) MsgNumber.

, :

Page 921: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnMessage(MsgNumber,FuncObj);1

OnMessage(MsgNumber,FuncObj,1);2(MaxThreads

=1)

:

OnMessage(MsgNumber,FuncObj,-1)

, MaxThreads0:

OnMessage(MsgNumber,FuncObj,0)

Function() :

1. ,;

2. 4;

3. v1.0.48.05, ByRef .

v1.1.19.03,()500.

Function,.,.

:

Page 922: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MyMessageMonitor(wParam,lParam,msg,hwnd)

{

......

}

,:

#1:WPARAM.

#2:LPARAM.

#3:,.

#4:HWND(ID).HWND ahk_id.

AutoHotkey.exe3264,WPARAMLPARAM32(0

232-1)64(-2 632 63-1).32,,:

if(A_PtrSize=4&&wParam>0x7FFFFFFF);

A_PtrSize32.

wParam:=-(~wParam)-1

,., MyMsgMonitor(wParam,lParam) ,

MyMsgMonitor() .

,:

A_Gui:GUIA_Gui Gui( GUI );.

A_GuiControl:GUI A_GuiControl;.., ,

WM_LBUTTONDOWN,A_GuiControl.

Page 923: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_GuiX A_GuiY: SendMessage,-2147483648.

PostMessage,()

A_EventInfo:SendMessage,0.PostMessage,

tick-count.

().GUI(), DetectHiddenWindows.:

DetectHiddenWindowsOn

MsgParentWindow:=WinExist();ID.

Return,""(Return),. Exit( ).,.

,WM_LBUTTONDOWN(0x201).(

;,0.

AutoHotkey.exe3264.32( A_PtrSize=4 ),-2 31

2 32-1,64 A_PtrSize=8 -2 632 63-1.

[v1.1.20+]:(messagenumber),,.

, .,, SendMode DetectHiddenWindows. .

(),.,,.

OnMessage ., #SingleInstance.

Page 924: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,( MaxThreads1);.,0x312 Critical.,

ThreadInterrupt,.,CriticalThreadInterrupt0x312

(,v1.0.46+,Critical, ,).6( Critical30

). 0x312. Critical.

0x312( , / ),.,0x312;.

0x312 ThreadInterrupt Critical,.,0x312.

OnMessage 0.,0.

(0x400).,,,.,.

( MsgBox),.,MsgBoxGUI,

WM_LBUTTONDOWN.

PostThreadMessage()API,,( MsgBox).,

GUI.

RegisterCallback(),OnExit,OnClipboardChange,Post/SendMessage,,Windows

,,Critical,DllCall()

;:,GUI.

;: GuiContextMenu

Gui,Add,Text,,Clickanywhereinthiswindow.

Page 925: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Add,Edit,w200vMyEdit

Gui,Show

OnMessage(0x201,"WM_LBUTTONDOWN")

return

WM_LBUTTONDOWN(wParam,lParam)

{

X:=lParam&0xFFFF

Y:=lParam>>16

ifA_GuiControl

Control:="`n(incontrol".A_GuiControl

.")"

ToolTipYouleft-clickedinGuiwindow

#%A_Gui%atclientcoordinates%X%x%Y%.%Control%

}

GuiClose:

ExitApp

;:/

;WindowsVista).

;: OnExit

;DllCall: ().

DllCall("kernel32.dll\SetProcessShutdownParameters

",UInt,0x4FF,UInt,0)

OnMessage(0x11,"WM_QUERYENDSESSION")

return

WM_QUERYENDSESSION(wParam,lParam)

{

ENDSESSION_LOGOFF=0x80000000

if(lParam&ENDSESSION_LOGOFF);.

EventType=Logoff

else;.

EventType=Shutdown

Page 926: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,4,,%EventType%inprogress.Allow

it?

IfMsgBoxYes

returntrue;/.

else

returnfalse;/.

}

;:

;(,).

OnMessage(0x5555,"MsgMonitor")

OnMessage(0x5556,"MsgMonitor")

MsgMonitor(wParam,lParam,msg)

{

;,ToolTip

;MsgBox,:

ToolTipMessage%msg%arrived:`nWPARAM:

%wParam%`nLPARAM:%lParam%

}

;:

SetTitleMatchMode2

DetectHiddenWindowsOn

ifWinExist("NameofReceivingScript.ahk

ahk_classAutoHotkey")

PostMessage,0x5555,11,22;WinExist(),

" ".

DetectHiddenWindowsOff;PostMessage.

;:..

;,,Win+Space

;InputBox.

Page 927: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;" Receiver.ahk",:

#SingleInstance

OnMessage(0x4a,"Receive_WM_COPYDATA");0x4a

WM_COPYDATA

return

Receive_WM_COPYDATA(wParam,lParam)

{

StringAddress:=NumGet(lParam+2*A_PtrSize)

;CopyDataStructlpData.

CopyOfData:=StrGet(StringAddress);.

;MsgBox,ToolTip,:

ToolTip%A_ScriptName%`nReceivedthefollowing

string:`n%CopyOfData%

returntrue;1(true).

}

;" Sender.ahk",.,Win+Space.

TargetScriptTitle=Receiver.ahkahk_class

AutoHotkey

#space::;Win+Space.InputBox.

InputBox,StringToSend,SendtextviaWM_COPYDATA,

EntersometexttoSend:

ifErrorLevel;.

return

result:=Send_WM_COPYDATA(StringToSend,

TargetScriptTitle)

ifresult=FAIL

MsgBoxSendMessagefailed.Doesthefollowing

WinTitleexist?:`n%TargetScriptTitle%

elseifresult=0

MsgBoxMessagesentbutthetargetwindow

respondedwith0,whichmaymeanitignoredit.

return

Send_WM_COPYDATA(ByRefStringToSend,ByRef

Page 928: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TargetScriptTitle);ByRef.

;.

;1,0.

{

VarSetCapacity(CopyDataStruct,3*A_PtrSize,0)

;.

;cbData,:

SizeInBytes:=(StrLen(StringToSend)+1)*

(A_IsUnicode?2:1)

NumPut(SizeInBytes,CopyDataStruct,A_PtrSize)

;.

NumPut(&StringToSend,CopyDataStruct,

2*A_PtrSize);lpData.

Prev_DetectHiddenWindows:=

A_DetectHiddenWindows

Prev_TitleMatchMode:=A_TitleMatchMode

DetectHiddenWindowsOn

SetTitleMatchMode2

TimeOutTime=4000;Optional.Milliseconds

towaitforresponsefromreceiver.ahk.Defaultis

5000

;SendMessagePostMessage.

SendMessage,0x4a,0,&CopyDataStruct,,

%TargetScriptTitle%;0x4aWM_COPYDAT

DetectHiddenWindows%Prev_DetectHiddenWindows%

;.

SetTitleMatchMode%Prev_TitleMatchMode%

;.

returnErrorLevel;SendMessage.

}

;: WinLIRC OnMessage()

;.

Page 929: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Progress/SplashImage.

SplashImage,Off

SplashImage[,ImageFile,Options,SubText,MainText,

WinTitle,FontName]

Progress,Off

Progress,ProgressParam1[,SubText,MainText,

WinTitle,FontName]

ImageFile

OFF,.SHOW,.

,BMP,GIFJPG(PNG,TIFICO, Gui).

[AHK_L59+]:GuiSplashImage.

ImageFile %A_WorkingDir%. ImageFile Options,

, SubText,MainText WinTitle.

, ImageFile,.

[v1.1.23+]:bitmap()icon()handle() .,

HBITMAP:%handle% .

Page 930: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ProgressParam1

: Param1OFF,. Param1SHOW,.

, Param1,. Param1,, SubText,MainText

WinTitle.,,.

:(), Param1.

.

SubText

.,,(`n)., %A_Space%., MainText.

MainText

().,,(`n).

, MainText.,, %A_Space%.,(`n).

MainText,.

WinTitle

.,(). B(),, WinMove.

FontName

MainText SubText. Windows.,GUI.

,,.

Page 931: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,

A: .

B::., B1 B2.

M:().,(), M1.,//, M2.

Pn:, n(00).,: Progress,50 .

Rx-y:, x-y( R,0-100)., R0-1000 01000

R-50-50 -5050 R-10--5 -10-5.

T:/.,.GUI Gui+OwnDialogs.

Hn: n().,/ .

Wn: n.,SplashImage() .,300.

Xn: nx.,.

Yn: ny.,.

Hide:. ProgressShow SplashImageShow .

Page 932: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Cxy::, SubText MainText. x0 SubText.1

. y, MainText(y).: c10 .

ZHn::, n(20).SplashImage, n.-1

ZWn("").,.,0,,.

ZWn:(SplashImage): n.-1ZHn("").,

.

ZXn: n/.SplashImage0,10.

ZYn: n.SplashImage0,5.

:, Gui,:

Gui,Add,Progress,VerticalvMyProgress

Gui,Show

return

;......

GuiControl,,MyProgress,+10;10%.+

.

Page 933: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FMn: n MainText.0,10.>.

FSn: n SubText.0,8.

WMn: n MainText.11000.,600().

WSn: n SubText.11000(700"").,400

().

Page 934: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

6RGB., cw1A00FF 1A,00,FF.

,.: cbRedct900000cwBlue .

CBn:: n16HTML6RGB.,.Default

.

CTn:: n16HTML6RGB.,().

Default.

CWn:(): n16HTML6RGB.,(

Default)., WinSetTransColor.

Colorname RGBvalue

Black 000000

Silver C0C0C0

Gray 808080

White FFFFFF

Maroon 800000

Red FF0000

Purple 800080

Fuchsia FF00FF

Green 008000

Lime 00FF00

Olive 808000

Page 935: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Yellow FFFF00

Navy 000080

Blue 0000FF

Teal 008080

Aqua 00FFFF

Page 936: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OFF,.

1010SplashImage..,1().,.,

2:Off Progress2, 2:75 75%, 2: , 2:B .,

2:Off SplashImage2SplashImage, 2: , 2:C:\My

Images\Picture1.jpg 2SplashImage.

,.

SubText MainText: bzx0zy0 ,.B,.

WindowsXP,,.,,cbBlue.

,().

WinSet WinMove.

GUI Gui+OwnDialogs..,GUI,.

Page 937: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI,SplashTextOn,ToolTip

Page 938: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Progress,bw200,MySubText,MyMainText,My

Title

Progress,50;50%.

Sleep,4000

Progress,Off

;18Courier:

Progress,m2bfs18zh0,ThisistheText.`nThis

isa2ndline.,,,CourierNew

;SplashImage:

SplashImage,C:\MyPictures\CompanyLogo.gif

;SplashImage,:

SplashImage,C:\MyPictures\CompanyLogo.gif,b

fs18,Thisisourcompanylogo.

Sleep,4000

SplashImage,Off

;,

;SplashImage:

IfExist,C:\WINDOWS\system32\ntimage.gif,

SplashImage,%A_WinDir%\system32\ntimage.gif,A,,,

Installation

Loop,%A_WinDir%\system32\*.*

{

Progress,%a_index%,%a_loopfilename%,

Installing...,DraftInstallation

Sleep,50

ifa_index=100

break

}

; GUI .

Page 939: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.

Page 940: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SplashTextOn/SplashTextOff.

SplashTextOff

SplashTextOn[,Width,Height,Title,Text]

Width

.Default200. .

Height

(),.0(). .

..

.. Text, ,.

//, zh0 Progress,.: Progress,zh0fs18,Some

18-pointtexttodisplay .

SplashTextOff.

Page 941: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"",., WinSet,AlwaysOnTop,Off,<inserttitle

ofsplashwindow> .WinSet.

WinMoveSplashText.

Progress,SplashImage,MsgBox,InputBox,FileSelectFile

FileSelectFolder,SplashText.

SplashTextOn,.,,,:

WinSetTitle,<inserttitleofsplashwindow>,,

NewTitle

ControlSetText,Static1,NewText,<inserttitle

ofsplashwindow>

Progress,SplashImage,ToolTip,MsgBox,InputBox,FileSelectFile,

FileSelectFolder,WinMove,WinSet

SplashTextOn,,,Displaysonlyatitlebar.

Sleep,2000

SplashTextOn,400,300,Clipboard,Theclipboard

contains:`n%clipboard%

WinMove,Clipboard,,0,0;.

Msgbox,PressOKtodismisstheSplashText

SplashTextOff

Page 942: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GuiGuiControl

StylesGui/

Text|Edit|UpDown|Picture

Button|Checkbox|Radio|GroupBox

DropDownList|ComboBox

ListBox|ListView|TreeView

DateTime|MonthCal

Slider|Progress|Tab|StatusBar

GUI WS_POPUP,WS_CAPTION,

GUI WS_CLIPSIBLINGS

WS_BORDER 0x800000 +/-Border..

WS_POPUP 0x80000000 . WS_CHILD.

WS_CAPTION 0xC00000 +/-Caption.. WS_BORDER

WS_DISABLED 0x8000000 +/-Disabled..

WS_DLGFRAME 0x400000 .

WS_GROUP 0x20000 +/-Group.."".(),,.

WS_HSCROLL 0x100000 .

WS_MAXIMIZE 0x1000000 .

Page 943: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WS_MAXIMIZEBOX 0x10000 +/-MaximizeBox..WS_EX_CONTEXTHELP.WS_SYSMENU.

WS_MINIMIZE 0x20000000 .

WS_MINIMIZEBOX 0x20000 +/-MinimizeBox..WS_EX_CONTEXTHELP.WS_SYSMENU.

WS_OVERLAPPED 0 ..

WS_OVERLAPPEDWINDOW 0xCF0000 WS_OVERLAPPED,WS_CAPTIONWS_THICKFRAME,WS_MINIMIZEBOXWS_MAXIMIZEBOX.

WS_POPUPWINDOW 0x80880000 WS_BORDER,WS_POPUPWS_CAPTION WS_POPUPWINDOW

WS_SIZEBOX 0x40000 +/-Resize.. WS_THICKFRAME

WS_SYSMENU 0x80000 +/-SysMenu.. WS_CAPTION

WS_TABSTOP 0x10000 +/-Tabstop.TAB.TAB

WS_THICKFRAME 0x40000 . WS_SIZEBOX

WS_VSCROLL 0x200000 .

WS_VISIBLE 0x10000000 .

WS_CHILD 0x40000000 ..

Text

SS_BLACKFRAME 0x7 .

SS_BLACKRECT 0x4 ..

SS_CENTER 0x1 +/-Center..,.

SS_ETCHEDFRAME 0x12 EDGE_ETCHED.

Page 944: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SS_ETCHEDHORZ 0x10 EDGE_ETCHED.

SS_ETCHEDVERT 0x11 EDGE_ETCHED.

SS_GRAYFRAME 0x8 ()..

SS_GRAYRECT 0x5 ..

SS_LEFT 0 +/-Left......

SS_LEFTNOWORDWRAP 0xC +/-Wrap..tab,..

SS_NOPREFIX 0x80 (&).(&).

SS_NOTIFY 0x100 STN_CLICKED.

SS_RIGHT 0x2 +/-Right..

SS_SUNKEN 0x1000 .

SS_WHITEFRAME 0x9 ..

SS_WHITERECT 0x6 ..

Edit

WS_TABSTOPWS_EX_CLIENTEDGE(E0x200)

,11,: WS_VSCROLL,ES_WANTRETURN ES_AUTOVSCROLL

, ES_AUTOHSCROLL.

ES_AUTOHSCROLL 0x80 +/-Wrap,+/-Limit.10.

Page 945: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ENTER,.

ES_AUTOVSCROLL 0x40 ENTER.

ES_CENTER 0x1 +/-Center..

ES_LOWERCASE 0x10 +/-Lowercase..

ES_NOHIDESEL 0x100 .,. ES_NOHIDESEL,.

ES_NUMBER 0x2000 +/-Number..

ES_OEMCONVERT 0x400 .

ES_MULTILINE 0x4 +/-Multi...

ES_PASSWORD 0x20 +/-Password..

ES_READONLY 0x800 +/-ReadOnly..

ES_RIGHT 0x2 +/-Right..

ES_UPPERCASE 0x8 +/-Uppercase..

ES_WANTRETURN 0x1000 +/-WantReturn.,ENTER.,ENTER..

UpDown

UDS_ARROWKEYS,UDS_ALIGNRIGHT UDS_AUTOBUDDY.

UDS_WRAP 0x1 "Wrap".,. Wrap,.

UDS_SETBUDDYINT 0x2 UpDown(WM_SETTEXT).,ListBox,ListBox.

UDS_ALIGNRIGHT 0x4 "Right"().UpDown.

UDS_ALIGNLEFT 0x8 "Left".UpDown.

UDS_AUTOBUDDY 0x10 zUpDown.

Page 946: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

UDS_ARROWKEYS 0x20 UpDownUpDown.

UDS_HORZ 0x40 "Horz"..

UDS_NOTHOUSANDS 0x80 .

UDS_HOTTRACK 0x100 ""..WindowsXP.

()

,:

Gui+LastFound

SendMessage,1133,16,0,

msctls_updown321;1133UDM_SETBASE

,,UpDown.

Picture

SS_ICON.SS_BITMAP.

SS_REALSIZECONTROL 0x40 [WindowsXP].

SS_CENTERIMAGE 0x200.,.,,.

MicrosoftWindowsXP:..

Button,Checkbox,Radio GroupBox

Page 947: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

BS_MULTILINE(GroupBoxCR/LF,)

WS_TABSTOP(GroupBox),WS_TABSTOP.,BS_NOTIFY.

Button():BS_PUSHBUTTONBS_DEFPUSHBUTTONRadio():BS_AUTORADIOBUTTONCheckbox():BS_AUTOCHECKBOXBS_AUTO3STATEGroupBox:BS_GROUPBOX

BS_LEFT 0x100 +/-Left..

BS_PUSHLIKE 0x1000 .

BS_RIGHT 0x200 +/-Right..

BS_RIGHTBUTTON 0x20

+Right(+Right BS_RIGHTBS_RIGHTBUTTON,-RightBS_RIGHT,BS_RIGHTBUTTON)..

BS_BOTTOM 0x800 .

BS_CENTER 0x300 +/-Center..

BS_DEFPUSHBUTTON 0x1 +/-Default..,,ENTER..

BS_MULTILINE 0x2000 +/-Wrap.,.

BS_TOP 0x400 .

BS_VCENTER 0xC00 .

BS_FLAT 0x8000 ;.

Page 948: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DropDownList ComboBox

WS_TABSTOP(+/-Tabstop)DropDownList():WS_VSCROLLComboBox:WS_VSCROLL,CBS_AUTOHSCROLL

DropDownList():CBS_DROPDOWNLISTComboBox():EitherCBS_DROPDOWNCBS_SIMPLE

CBS_AUTOHSCROLL 0x40 +/-Limit..,.

CBS_DISABLENOSCROLL 0x800 ,.,.

CBS_LOWERCASE 0x4000 +/-Lowercase..

CBS_NOINTEGRALHEIGHT 0x400 .,WindowsCE.

CBS_OEMCONVERT 0x80WindowsCEOEM,WindowsCE..CBS_DROPDOWN.

CBS_SIMPLE 0x1 +/-Simple(ComboBox)...

CBS_SORT 0x100 +/-Sort..

CBS_UPPERCASE 0x2000 +/-Uppercase..

ListBox

WS_TABSTOP,LBS_USETABSTOPSWS_EX_CLIENTEDGE(E0x200).

Page 949: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LBS_NOTIFY()

LBS_DISABLENOSCROLL 0x1000 .,.

LBS_NOINTEGRALHEIGHT 0x100 .

LBS_EXTENDEDSEL 0x800 +/-Multi.control-clickshift-click.

LBS_MULTIPLESEL 0x8 ,control-clickshift-click,.

LBS_NOSEL 0x4000 +/-ReadOnly..

LBS_SORT 0x2 +/-Sort..

LBS_USETABSTOPS 0x80 tab.

ListView

WS_TABSTOP,LVS_REPORT

LVS_ALIGNLEFT 0x800 .

LVS_ALIGNTOP 0 ..

LVS_AUTOARRANGE 0x100 .

LVS_EDITLABELS 0x200 +/-ReadOnly. -ReadOnly(+0x200).

LVS_ICON 0 +Icon..

LVS_LIST 0x3 +List..

LVS_NOCOLUMNHEADER 0x4000 +/-Hdr..

LVS_NOLABELWRAP 0x80 .,.

LVS_NOSCROLL 0x2000 .. LVS_LIST LVS_REPORT

LVS_NOSORTHEADER 0x8000 +/-NoSortHdr..,.

LVS_OWNERDATA 0x1000 (AutoHotkey).

Page 950: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LVS_OWNERDRAWFIXED 0x400 WM_DRAWITEM(AutoHotkey).

LVS_REPORT 0x1 +Report..

LVS_SHAREIMAGELISTS 0x40 ..

LVS_SHOWSELALWAYS 0x8 (),.

LVS_SINGLESEL 0x4 +/-Multi..,.

LVS_SMALLICON 0x2 +IconSmall..

LVS_SORTASCENDING 0x10 +/-Sort..

LVS_SORTDESCENDING 0x20 +/-SortDesc.,.

ExtendedListViewstylesrequiretheLVprefixwhenusedwiththeGuicommands.SomeextendedstylesintroducedinWindowsXPorlaterversionsarenotlistedhere.Forafulllist,seeViewStyles.

LVS_EX_BORDERSELECT LV0x8000 ,().

LVS_EX_CHECKBOXES LV0x4+/-Checked..,DrawFrameControl.1,2..

WindowsXP:WindowsXP,.;.

LVS_EX_DOUBLEBUFFER LV0x10000 WindowsXPorlater:Paintsviadouble-buffering,whichreducesflicker.Thisextendedstylealsoenablesalpha-blendedmarqueeselectiononsystemswhereitissupported.

LVS_EX_FLATSB LV0x100 .

LVS_EX_FULLROWSELECT LV0x20 ,. LVS_REPORT.

LVS_EX_GRIDLINES LV0x1 +/-Grid.. LVS_REPORT

LVS_EX_HEADERDRAGDROP LV0x10 . LVS_REPORT.

LVS_EX_INFOTIP LV0x400 LVS_EX_INFOTIP,LVN_GETINFOTIP.

LVS_EX_LABELTIP LV0x4000 ,.,.WindowsXP,InternetExplorer5.0DLL.:Windows,GUI.

LVS_EX_MULTIWORKAREAS LV0x2000 LVS_AUTOARRANGE

Page 951: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LVS_EX_ONECLICKACTIVATE LV0x40 ,LVN_ITEMACTIVATE..,.

LVS_EX_REGIONAL LV0x200 SetWindowRgn..

LVS_EX_SIMPLESELECT LV0x100000 ,..,,.WindowsXP.

LVS_EX_SUBITEMIMAGES LV0x2 . LVS_REPORT.

LVS_EX_TRACKSELECT LV0x8 ..LVM_SETHOVERTIME..SystemParametersInfo.

LVS_EX_TWOCLICKACTIVATE LV0x80 ,LVN_ITEMACTIVATE..,.

LVS_EX_UNDERLINECOLD LV0x1000 . LVS_EX_TWOCLICKACTIVATE

LVS_EX_UNDERLINEHOT LV0x800 . LVS_EX_ONECLICKACTIVATE

TreeView

WS_TABSTOP,TVS_SHOWSELALWAYS

TVS_CHECKBOXES 0x100 +/-Checked..

TVS_DISABLEDRAGDROP 0x10 TVN_BEGINDRAG.

TVS_EDITLABELS 0x8 +/-ReadOnly..

TVS_FULLROWSELECT 0x1000 .,. TVS_HASLINES.

TVS_HASBUTTONS 0x1 +/-Buttons.(+)(-).., TVS_LINESATROOT

TVS_HASLINES 0x2 +/-Lines..

TVS_INFOTIP 0x800 TVN_GETINFOTIP.

TVS_LINESATROOT 0x4 +/-Lines.. TVS_HASLINES,.

TVS_NOHSCROLL 0x8000 +/-HScroll...

TVS_NONEVENHEIGHT 0x4000 TVM_SETITEMHEIGHT.,.

TVS_NOSCROLL 0x2000 ..

TVS_NOTOOLTIPS 0x80 .

Page 952: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TVS_RTLREADING 0x40 (RTL).(LTR).

TVS_SHOWSELALWAYS 0x20 .

TVS_SINGLEEXPAND 0x400 .CTRL,.

TVS_TRACKSELECT 0x200 .

DateTime

DTS_SHORTDATECENTURYFORMAT WS_TABSTOP(+/-Tabstop)

DTS_UPDOWN 0x1 up-down,.

DTS_SHOWNONE 0x2 ,/./, GuiSubmitGuiControlGet().

DTS_SHORTDATEFORMAT 0x0

.,6/1/056/1/2005.,.

DTS_SHORTDATECENTURYFORMAT DTS_SHORTDATEFORMAT

DTS_LONGDATEFORMAT 0x4 "LongDate"..,Wednesday,June01,2005.

DTS_SHORTDATECENTURYFORMAT 0xC/..,6/1/2005.Comctl32.dll5.8,DTS_SHORTDATEFORMAT

DTS_TIMEFORMAT 0x9 "Time".,5:31:42PM.

DTS_APPCANPARSE 0x10 ..F2.DTN_USERSTRING.

DTS_RIGHTALIGN 0x20 +/-Right..

GuiFont c(Color).,:

Page 953: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()

Gui+LastFound

SendMessage,0x1006,

4,0xFFAA99,

SysDateTimePick321

0x1006

DTM_SETMCCOLOR.4

MCSC_MONTHBK().

BGRRGB().

MonthCal

MCS_DAYSTATE 0x1 MCN_GETDAYSTATE.[]

MCS_MULTISELECT 0x2

"Multi". .,366,MCM_SETMAXSELCOUNT.:

Gui+LastFound

SendMessage,0x1004,

7,0,SysMonthCal321

;7.0x1004

MCM_SETMAXSELCOUNT.

MCS_WEEKNUMBERS 0x4 (1-52).Week1.

MCS_NOTODAYCIRCLE 0x8 .

MCS_NOTODAY 0x10 .

GuiFont c(Color).,:

Page 954: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()

Gui+LastFound

SendMessage,0x100A,

5,0xFFAA99,

SysMonthCal321;

0x100A

MCM_SETCOLOR.5

MCSC_TITLETEXT().

BGRRGB().

Slider

WS_TABSTOP(+/-Tabstop)

TBS_VERT 0x2 +/-Vertical..

TBS_LEFT 0x4 +/-Left.( TBS_VERT).TBS_TOP

TBS_TOP 0x4 TBS_LEFT.

TBS_BOTH 0x8 +/-Center..TBS_HORZ, TBS_VERT.

TBS_AUTOTICKS 0x1 .+/-TickInterval.

TBS_ENABLESELRANGE 0x20

.(),( Gui-theme ).

,,5566:

SendMessage,1035,

1,55,

msctls_trackbar321,

WinTitle

Page 955: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendMessage,1036,

1,66,

msctls_trackbar321,

WinTitle

TBS_FIXEDLENGTH 0x40 +/-Thick..

TBS_NOTHUMB 0x80 .

TBS_NOTICKS 0x10 +/-NoTicks..

TBS_TOOLTIPS 0x100 +/-Tooltip..,.TBM_SETTIPSIDE.

TBS_REVERSED 0x200 ,,(,+Invert).,InternetExplorer5.0.

TBS_DOWNISLEFT 0x400 ,,.,InternetExplorer5.01.

Progress

PBS_SMOOTH

PBS_SMOOTH 0x1 +/-Smooth..,WindowsXP.

PBS_VERTICAL 0x4 +/-Vertical.,.

PBS_MARQUEE 0x8

[WindowsXP];..,.

.

Page 956: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tab

WS_TABSTOPTCS_MULTILINE

WS_CLIPSIBLINGSTCS_OWNERDRAWFIXED:/.

TCS_SCROLLOPPOSITE 0x1 ,.

TCS_BOTTOM 0x2 +/-Bottom..

TCS_RIGHT 0x2 TCS_VERTICAL.

TCS_MULTISELECT 0x4 CTRL.TCS_BUTTONS.

TCS_FLATBUTTONS 0x8 ,..

TCS_FORCEICONLEFT 0x10 ..

TCS_FORCELABELLEFT 0x20

;

TCS_FIXEDWIDTH, TCS_FORCEICONLEFT.

TCS_HOTTRACK 0x40 .

TCS_VERTICAL 0x80

+/-Left+/-Right.,.TCS_MULTILINE.,TCS_RIGHT.

,.,-Background/cDefault.

TCS_BUTTONS 0x100 +/-Buttons.,.

TCS_SINGLELINE 0 +/-Wrap....

Page 957: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TCS_MULTILINE 0x200 +/-Wrap.,.

TCS_RIGHTJUSTIFY 0.,.

TCS_MULTILINE.

TCS_FIXEDWIDTH 0x400 .TCS_RIGHTJUSTIFY.

TCS_RAGGEDRIGHT 0x800 ..

TCS_FOCUSONBUTTONDOWN 0x1000 .

TCS_OWNERDRAWFIXED 0x2000 .

TCS_TOOLTIPS 0x4000 .

TCS_FOCUSNEVER 0x8000 .

StatusBar

SBARS_TOOLTIPS SBARS_SIZEGRIP(,).

SBARS_TOOLTIPS 0x800

:1);2).

:

Gui+LastFound

SendMessage,0x410,0,

"Texttodisplay",

msctls_statusbar321

0.,1,2,.:.

Page 958: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SBARS_SIZEGRIP 0x100 .;,.

Page 959: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ToolTip.

ToolTip[,Text,X,Y,WhichToolTip]

,().,.,(`n),Line1`nLine2.

Text, ,.

X,Y

XY( CoordMode,ToolTip ).,.XY .

WhichToolTip

,.,120.,1(). .

X&Y,.

,:

.

TextToolTip.

().

Page 960: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GUI Gui+OwnDialogs..

CoordMode,TrayTip,GUI,Progress,SplashTextOn,MsgBox,InputBox,

FileSelectFile,FileSelectFolder

ToolTip,Multiline`nTooltip,100,150

;

;Sleep():

#Persistent

ToolTip,TimedToolTip`nThiswillbedisplayedfor

5seconds.

SetTimer,RemoveToolTip,5000

return

RemoveToolTip:

SetTimer,RemoveToolTip,Off

ToolTip

return

Page 961: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TrayTip.Windows10,toast.

TrayTip[,Title,Text,Seconds,Options]

Title

,73().

Title,,.

Note:,.

Text

, Title Text265.

,.,Windows10toastitmaybenecessaryto .

(`r)(`n).: Line1`nLine2 .

Text, ,.

Seconds

: WindowsVista.

,.1030(10)(30).,. .

Page 962: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,"(),."( .),, SleepTrayTip, SetTimer.

Options

Options0(),:

1 0x1

2 0x2

3 0x3

WindowsXP:. 16 0x10

WindowsVista:. 32 0x20

0,. Title,.

.

Windows10toast().TrayTip""..:

TrayTip#1,ThisisTrayTip#1

Sleep3000;Letitdisplayfor3seconds.

HideTrayTip()

TrayTip#2,Thisisthesecondnotification.

Sleep3000

;Copythisfunctionintoyourscripttouse

it.

HideTrayTip(){

TrayTip;Attempttohideitthenormal

way.

Page 963: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifSubStr(A_OSVersion,1,3)="10."{

MenuTray,NoIcon

Sleep200;Itmaybenecessaryto

adjustthissleep.

MenuTray,Icon

}

}

( #NoTrayIcon Menu,tray,NoIcon ),.,REG_DWORD

0,TrayTip:

HKCU\Software\Microsoft\Windows\CurrentVersion\

Explorer\Advanced>>EnableBalloonTips

,.: Menu,Tray,Tip,MyNewText .

ToolTip,SetTimer,Menu,SplashTextOn,MsgBox,InputBox,FileSelectFile,

FileSelectFolder

TrayTip,MyTitle,Multiline`nText,20,17

;

;Sleep():

#Persistent

TrayTip,TimedTrayTip,Thiswillbedisplayedfor

5seconds.

SetTimer,HideTrayTip,-5000

Page 964: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

HideTrayTip(){;NOTE:ForWindows10,replace

thisfunctionwiththeonedefinedabove.

TrayTip

}

;,:

;NOTE:Thisprobablywon'tworkwellonWindows

10forreasonsdescribedabove.

#Persistent

SetTimer,RefreshTrayTip,1000

Gosub,RefreshTrayTip;.

return

RefreshTrayTip:

TrayTip,RefreshedTrayTip,Thisisamore

permanentTrayTip.,,16

return

Page 965: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvAdd( - ).: var+=value .

EnvAdd,Var,Value[,TimeUnits]

Var+=Value[,TimeUnits]

Var++

Var

.

, .

TimeUnits

, Value Var: Var YYYYMMDDHH24MISS Value

(). TimeUnitsSeconds,Minutes,HoursDays().

Var,. Var1601 Value, Var.

A_Now YYYYMMDDHH24MISS.

, EnvSub.

Page 966: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: Var+=Value .

Var++ ,Var-- ,++Var --Var 1.

Var Value,0( TimeUnits).

Var Value,, SetFormat.

EnvSub,EnvMult,EnvDiv,SetFormat,,Ifvaris[not]type,SetEnv,

FileGetTime

EnvAdd,MyCount,2

MyCount+=2;

var1=;,.

var1+=31,days

MsgBox,%var1%;31.

Page 967: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvDiv.: Var/=Value .

EnvDiv,Var,Value

Var

.

, .

: Var/=Value .

(),.

Var Value,0( , Var:=X/=Y ).

Var Value,, SetFormat.,(19101).

EnvAdd,EnvSub,EnvMult,SetFormat,,Ifvaris[not]type,SetEnv,

(Transform)

Page 968: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvDiv,MyCount,2

MyCount/=2;

Page 969: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvMult.: Var*=Value .

EnvMult,Var,Value

Var

.

, .

: Var*=Value .

Var Value,0( , Var:=X*=Y ).

Var Value,, SetFormat.

EnvAdd,EnvSub,EnvDiv,SetFormat,,Ifvaris[not]type,SetEnv,

(Transform)

Page 970: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvMult,MyCount,2

MyCount*=2;

Page 971: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvSub( - ).: Var-=Value .

EnvSub,Var,Value[,TimeUnits]

Var-=Value[,TimeUnits]

Var--

Var

.

, ( TimeUnits).

TimeUnits

, Var Value: YYYYMMDDHH24MISS. TimeUnits

Seconds,Minutes,HoursDays(). Value

Var,.

.,1.999,1., TimeUnitsSeconds

60.0,3600.086400.0(,).

Var Value1601, Var.

A_Now YYYYMMDDHH24MISS.

Page 972: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, A_TickCountmethod,.

,,, EnvAdd().

: Var-=Value .

Var++ ,Var-- ,++Var --Var 1.

Var Value,0( TimeUnits).

Var Value,, SetFormat.

EnvAdd,EnvMult,EnvDiv,SetFormat,,Ifvaris[not]type,SetEnv,

FileGetTime

EnvSub,MyCount,2

MyCount-=2;

var1=20050126

var2=20040126

EnvSub,var1,%var2%,days

MsgBox,%var1%;366,2004.

Page 973: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Random.

Random,OutputVar[,Min,Max]

Random,,NewSeed

OutputVar

. SetFormat.

Min

,, .,0.-2147483648,.

Max

,, .,2147483647(,).

NewSeed

NewSeed( ).. NewSeed04294967295

(0xFFFFFFFF)./, NewSeed

,1601111006432.~7.20

4294967295.

Page 974: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,,/.

(,"").

Min Max, SetFormat.,.

:1)4,294,967,296,;2) Max().

SetFormat

Random,rand,1,10

Random,rand,0.0,1.0

MersenneTwister(),MT19937,TakujiNishimuraMakoto

Matsumoto,ShawnCokus,MattheBellewIsakuWada.

..

www.math.keio.ac.jp/~matumoto/emt.html(404)

Copyright(C)1997-2002,MakotoMatsumotoandTakujiNishimura,Allrights

reserved.

Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,

Page 975: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

arepermittedprovidedthatthefollowingconditionsaremet:

1. Redistributionsofsourcecodemustretaintheabovecopyrightnotice,this

listofconditionsandthefollowingdisclaimer.

2. Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,

thislistofconditionsandthefollowingdisclaimerinthedocumentation

and/orothermaterialsprovidedwiththedistribution.

3. Thenamesofitscontributorsmaynotbeusedtoendorseorpromote

productsderivedfromthissoftwarewithoutspecificpriorwritten

permission.

THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSAND

CONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED

WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIED

WARRANTIESOFMERCHANTABILITYANDFITNESSFORA

PARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHE

COPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANY

DIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,OR

CONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,

PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,

DATA,ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVER

CAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN

CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCE

OROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS

SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCH

DAMAGE.

Page 976: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DoNOTuseforCRYPTOGRAPHYwithoutsecurelyhashingseveralreturned

valuestogether,otherwisethegeneratorstatecanbelearnedafterreading624

consecutivevalues.

Whenyouusethis,sendanemailto:[email protected]

appropriatereferencetoyourwork.ItwouldbenicetoCC:

[email protected]@math.washington.eduwhenyouwrite.

AutoHotkey,Random, .

Page 977: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetFormat.

SetFormat,NumberType,Format

NumberType

IntegerFast,FloatFast,IntegerFloat(v1.0.48+; ).

Format

NumberTypeIntegerIntegerFast,HHEX,D.0x

(0xFF). [AHK_L42+]: h A-F, H .

NumberTypeFloatFloatFast, . ( 0.6 ).v1.0.46.11+,"e"

0.6e 0.6E (EE).:AutoHotkey1.x, 1.0e1

1e1 .

0.,( ).

().,,.6.

: ,;., ., ( 06.2 ).

v1.0.48+,IntegerFastInteger,FloatFastFloat.

Page 978: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:,.(,.)

:,SetFormat/( MsgBox).SetFormat(),

., HexValue.=""

"Integer""Float",SetFormat,.

v1.0.48+,15, SetFormatFloat ()., (1.0.48

).,, SetFormat,Float,0.15

SetFormatFloatFast .

,( MsgBox FileAppend), ., SetFormat,

FloatFast,0.15 .

, Var:=Round(Var) ,Var:=Floor(Var) Var:=Ceil(Var) .,

0.0( Var+=0.0 ) MyFloat:=Round(MyInteger,1) .

A_FormatFloat( 0.6 ).

,., SetFormat,IntegerFast,Hex .(),.

.0x( 0xA9 ).., Sleep0xFF Sleep255 ,

SetFormat.

AutoHotkey64,-9223372036854775808(-0x8000000000000000)

9223372036854775807(0x7FFFFFFFFFFFFFFF).

Page 979: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_FormatInteger(HD).

SetFormat,, . =0.6 .( ,)()SetFormat.

( x=%y% )()., AutoTrim( x:=y ).

" ifvarisnumber/integer/float".

,:

Var:="".Var;10.,

.

StringRight,Var,Var,10; Var10.

Var:=SubStr("".Var,-9);.

Format(),(:=) ,EnvAdd,EnvSub,EnvMult,EnvDiv,AutoTrim,ifvaristype

Var=11.333333

SetFormat,float,6.2

Var-=1;6,Var10.33.

SetFormat,float,0.2

Var+=1;Var11.33.

SetFormat,float,06.0

Var+=0;Var000011

Page 980: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

SetFormat,IntegerFast,hex

Var+=0;Var(11)0xb .

Var.="";,.

SetFormat,IntegerFast,d

Page 981: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Transform,ASCII/Unicode.

Transform,OutputVar,Cmd,Value1[,Value2]

OutputVar

Cmd. SetFormat.

Cmd,Value1/2

.

Cmd,Value1,Value2

Cmd,Value1 Value2,.

Unicode[,String]:(AutoHotkeyUnicode) Unicode.:

ClipboardAll,"TransformUnicode".

:

Transform,OutputVar,Unicode;Unicode

UTF-8.

Transform,Clipboard,Unicode,%MyUTF_String%

;Unicode.

Page 982: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,UTF-8%MyUTF_String%.

()UnicodeUTF-8:

^!u::;Control+Alt+U.

MsgBoxCopysomeUnicodetextontothe

clipboard,thenreturntothiswindowandpress

OKtocontinue.

Transform,ClipUTF,Unicode

Transform,Clipboard,Unicode,%ClipUTF%`r`n

MsgBoxTheclipboardnowcontainsthefollowing

linethatyoucanpasteintoyourscript.When

executed,thislinewillcausetheoriginal

Unicodestringyoucopiedtobeplacedontothe

clipboard:`n`n%Clipboard%

return

: Send{U+nnnn} Unicode.

Asc,String: String(1255,Unicode165535).

String, OutputVar.: Transform,OutputVar,Asc,

%VarContainingString% .: Asc(String). Ord(String)Unicode

Chr,Value1: Value1. Value11255(Unicode1

65535), OutputVar.: Transform,OutputVar,Chr,

130 .: Chr(Number).Chr(),Unicode(0x10000

0x10FFFF).

Deref,String: .. OutputVar;, String OutputVar

( String %OutputVar%).,var1"test"var2 "%var1%",

Page 983: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OutputVar"test": Transform,OutputVar,deref,%var2% . ,

String,().

HTML,String[,Flags]:

ANSI: ASCII127HTML StringHTML(

&pound;).,"&<>&quot;&amp;&lt;&gt;.,(`n)<br>`n

(<br>). Flags.

Unicode: , Flags().,1.

1:. �&euro;

2:. �&#8364;

ASCII. Flags=3,.: <>"& `n ().

FromCodePage/ToCodePage:. StrPut()/StrGet().

Mod,Dividend,Divisor: Dividend Divisor. Divisor,

OutputVar. Dividend Divisor. Divisor,.

2:Transform,OutputVar,mod,5,3 .: Mod(Dividend,Divisor).

Pow,Base,Exponent: Base Exponent. Base Exponent.

Exponent, Base Exponent, OutputVar. Base

Exponent1.5; OutputVar.: **.

Exp,N:e(2.71828182845905) N. N.: Exp(N).

Sqrt,Value1:Value1. Value1, OutputVar.:

Page 984: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Sqrt(Number).

Log,Value1: Value1(10). Value1, OutputVar.:

Log(Number).

Ln,Value1: Value1(e). Value1, OutputVar.:

Ln(Number).

Round,Value1[,N]: N, OutputVar Value1. N,

Value1 N. N, Value1 N.,-1,-2,-3.

:.,12.33312.300000.

, SetFormatRound).: Round(Number[,N]).

Ceil,Value1: Value1.: Ceil(Number).

Floor,Value1: Value1.: Floor(Number).

Abs,Value1:Value1, Value1()().: Abs(Number).

Sin,Value1: Value1. Value1.: Sin(Number).

Cos,Value1: Value1. Value1.: Cos(Number).

Tan,Value1: Value1. Value1.: Tan(Number).

ASin,Value1:( Value1). Value1-11, OutputVar.

: ASin(Number).

ACos,Value1:( Value1). Value1-11, OutputVar.

: ACos(Number).

Page 985: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ATan,Value1:( Value1).: ATan(Number).

: .

BitNot,Value1: Value1 OutputVar( Value1,). Value1

04294967295(0xffffffff), 32., 64.

0xfffff0f0(4294963440):Transform,OutputVar,BitNot,0xf0f .

BitAnd,Value1,Value2: Value1 Value2().

0xff00(65280):Transform,OutputVar,BitAnd,0xff0f,

0xfff0 .

BitOr,Value1,Value2: Value1 Value2().

0xf0f0(61680):Transform,OutputVar,BitOr,0xf000,0x00f0 .

BitXOr,Value1,Value2: Value1 Value2().

0xff00(65280):Transform,OutputVar,BitXOr,0xf00f,

0x0f0f .

BitShiftLeft,Value1,Value2: Value1 Value2, Value1"2

Value2"().8: Transform,OutputVar,

BitShiftLeft,1,3 .

BitShiftRight,Value1,Value2: Value1 Value2, Value1"2

Value2",().2: Transform,OutputVar,

BitShiftRight,17,3 .

Page 986: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

Value1 Value2, Cmd:Mod,Pow,RoundAbs. SetFormat.

,180/pi(57.29578).,pi/180(0.01745329252).

pi(3.141592653589793)14.

SetFormat,,EnvMult,EnvDiv,StringLower,ifvaristype

Transform,OutputVar,Asc,A;AASCII.

Page 987: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#HotkeyInterval #MaxHotkeysPerInterval,.

#HotkeyIntervalMilliseconds

Milliseconds

,.

,2000.

, #MaxHotkeysPerInterval.

#MaxHotkeysPerInterval

#HotkeyInterval2000;().

#MaxHotkeysPerInterval200

Page 988: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#HotkeyModifierTimeout:CTRL,ALT,WINSHIFT.

#HotkeyModifierTimeoutMilliseconds

Milliseconds

,.-1,(Send),0().

:

SendInput SendPlay.Send.

("View->Keyhistory" KeyHistory).(ALT/CTRL/WIN/SHIFT),

.

,: ^!a::Send,abc .

Send,CTRLALT,.,CTRLALT().,

.,,.

.,().

:

Page 989: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InstallKeybdHook.

SendInput SendPlay SendEvent.

SendEvent, SetKeyDelay0-1,.

,50.

GetKeyState

#HotkeyModifierTimeout100

Page 990: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Hotstring.

#HotstringNoMouse

#HotstringEndCharsNewChars

#HotstringNewOptions

NoMouse

., (,). #HotstringNoMouse ,.

EndCharsNewChars

EndChars.:

#HotstringEndChars-()[]{}':;"/\,.?!`n`t

EndChars,,EndChars.

100..

tab,`t.,(,).

NewOptions

.: #Hotstringrsk0c0 .

EndChars,#Hotstring.,,:

Page 991: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

::btw::bytheway

#Hotstringrc;"sendraw".

::al::airline

::CEO::ChiefExecutiveOfficer

#Hotstringc0;.

Page 992: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#If [AHK_L]

.().

#If[,Expression]

Expression

.

.:

#IfWinActive("ahk_classNotepad")or

WinActive(MyWindowTitle)

#Space::MsgBoxYoupressedWin+Spacebarin

Notepador%MyWindowTitle%.

#IfWin,#If:.#If#IfWin;#If#IfWin.

,#If#IfWin.:

#If

Page 993: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, #If.

,#If.,#If a&b:: ,( a ),,.

,.

[AHK_L53+]:A_ThisHotkey A_TimeSinceThisHotkey#If.

[v1.0.95.00+]:A_PriorHotkey A_TimeSincePriorHotkey"This".

#IfWin#If.

#IfTimeout.

;1:.

#IfMouseIsOver("ahk_classShell_TrayWnd")

WheelUp::Send{Volume_Up}

WheelDown::Send{Volume_Down}

MouseIsOver(WinTitle){

MouseGetPos,,,Win

returnWinExist(WinTitle."ahk_id".Win)

}

;2:.

#IfActiveControlIsOfClass("Edit")

^BS::Send^+{Left}{Del}

^Del::Send^+{Right}{Del}

Page 994: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ActiveControlIsOfClass(Class){

ControlGetFocus,FocusedControl,A

ControlGet,FocusedControlHwnd,Hwnd,,

%FocusedControl%,A

WinGetClass,FocusedControlClass,ahk_id

%FocusedControlHwnd%

return(FocusedControlClass=Class)

}

;3:.

#If

Esc::ExitApp

;4:. 1.

NumpadAdd::

Hotkey,If,MouseIsOver("ahk_classShell_TrayWnd")

if(doubleup:=!doubleup)

Hotkey,WheelUp,DoubleUp

else

Hotkey,WheelUp,WheelUp

return

DoubleUp:

Send{Volume_Up2}

return

Page 995: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfTimeout [AHK_L8+]

#If.

#IfTimeoutTimeout

Timeout

,.

.,,.

,1000ms.

.DWORD LowLevelHooksTimeout,:

HKEY_CURRENT_USER\ControlPanel\Desktop

,, . .

#If,,..

#If

Page 996: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfTimeout10;10ms.

Page 997: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfWinActive/#IfWinExist.().

#IfWinActive[,WinTitle,WinText]

#IfWinExist[,WinTitle,WinText]

#IfWinNotActive[,WinTitle,WinText]

#IfWinNotExist[,WinTitle,WinText]

#If[,Expression]

WinTitle

. WinTitle.

SetTitleMatchMode.

,. ahk_pid ahk_idID, GroupAdd HotkeyIfWin

#IfWin.

WinText

,(WindowSpy).() DetectHiddenText,

.

ExcludeTitleExcludeText

, WinTitle ahk_groupMyGroup ( MyGroup

GroupAddExcludeTitle/Text).

Page 998: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfWin .:

#IfWinActiveahk_classNotepad

#space::MsgBoxYoupressedWin+Spacebarin

Notepad.

#IfWin:.;.

,#IfWin.:

#IfWinActive

#IfWin(), ( Suspend Hotkey).

#IfWin,,,.:,#IfWin,.

#IfWin,EnterSpace..:

#IfWinActiveRemindersahk_class#32770;

Outlook"".

Enter::Send!o;"Enter".

#IfWinActive

()

#IfWin. .:

#IfWinActiveahk_classNotepad

Page 999: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

^!c::MsgBoxYoupressedControl+Alt+Cin

Notepad.

#IfWinActiveahk_classWordPadClass

^!c::MsgBoxYoupressedControl+Alt+Cin

WordPad.

#IfWinActive

^!c::MsgBoxYoupressedControl+Alt+Cina

windowotherthanNotepad/WordPad.

,.(#IfWin):;,( ).

, ^!+#.: ^!c!^c .,., Esc Escape().,

(*), *F1 F1 .

,,#IfWin.:

#IfWinActiveahk_classNotepad

#z::

#IfWinActiveahk_classWordPadClass

#z::

MsgBoxYoupressedWin+ZineitherNotepador

WordPad.

return

#IfWinActiveahk_groupMyGroup .

(), "HotkeyIfWin".

#IfWin("a&b" "a").,.

Page 1000: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GosubGoto,.

#IfWin, KeyHistory"Type""#"..

,%Var%., `%.,(`,)., GroupAdd

ahk_group.

Hotkey#IfWin.,#IfWinHotkey( "Hotkey

IfWin").

Alt-tab#IfWin:.

#IfWinActive/Exist (#IfWin NotActive/NotExist).:

#IfWinExistahk_classNotepad

#n::WinActivate;#IfWin.

#IfWin/tab, `s`t.

,#IfWin.,.,.

.() DetectHiddenWindows,.

#If,Hotkey,,,Suspend,IfWinActive,IfWinExist,SetTitleMatchMode,

DetectHiddenWindows

Page 1001: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#IfWinActiveahk_classNotepad

^!a::MsgBoxYoupressedCtrl-Alt-AwhileNotepad

isactive.;("").

#c::MsgBoxYoupressedWin-CwhileNotepadis

active.

::btw::Thisreplacementtextfor"btw"willoccur

onlyinNotepad.

#IfWinActive

#c::MsgBoxYoupressedWin-Cinawindowother

thanNotepad.

Page 1002: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InputLevel [v1.1.06+]

.

#InputLevel[,Level]

Level

0100.,0.

SendLevel#InputLevel, SendLevel.

:#InputLevel.#InputLevel,0.

[v1.1.23+]:Hotkey.: Hotkey,#z,my_hotkey_sub,I1

. ,#InputLevel.

v1.1.06AutoHotkey#InputLevel0SendLevel0.

SendLevel,,

Page 1003: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InputLevel1

Numpad0::LButton

#InputLevel0

;Numpad0LButton:

~LButton::MsgboxClicked

Page 1004: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxHotkeysPerInterval #HotkeyInterval,.

#MaxHotkeysPerIntervalValue

#HotkeyInterval,.

,( Send),.

, ^c::Send^c ., $( $^c:: ),Send.

,70.

#HotkeyInterval

#MaxHotkeysPerInterval200

Page 1005: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxThreads.

#MaxThreadsValue

Value

.255255(1.0.48,20).

,().

1,, MsgBox . .

#MaxThreads, : ExitApp,Pause,Edit,Reload,KeyHistory,

ListLines,ListVars ListHotkeys ,,OnClipboardChange GUI.,

OnExit.

#MaxThreadsPerHotkey,.

,10.

#MaxThreadsPerHotkey,,#MaxHotkeysPerInterval,#HotkeyInterval,

Page 1006: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListHotkeys,#MaxMem

#MaxThreads2

Page 1007: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxThreadsBuffer #MaxThreadsPerHotkey,.

#MaxThreadsBufferOn|Off

On|Off

On: #MaxThreadsBufferON #MaxThreadsPerHotkey.

Off:..(1, #MaxThreadsPerHotkey),.

,,OFF.,, 1ON,(,1).

AutoHotkey( ThreadInterrupt Critical

., #MaxThreadsPerHotkey1(),,.,,

50ms,.50ms.

#,().,.

#MaxThreads,#MaxThreadsPerHotkey,Critical,Thread() ,,Hotkey,

#MaxHotkeysPerInterval,#HotkeyInterval,ListHotkeys

Page 1008: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxThreadsBufferon

#x::MsgBox,Thishotkeywillusethistypeof

buffering.

#y::MsgBox,Andthisonetoo.

#MaxThreadsBufferoff

#z::MsgBox,Butnotthisone.

Page 1009: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxThreadsPerHotkey.

#MaxThreadsPerHotkeyValue

/ (20).

"".,1,,..,(),

#MaxThreadsBuffer.

#MaxThreads, .,,.

, ExitApp,Pause,Edit,Reload,KeyHistory,ListLines,ListVars

ListHotkeys.

#MaxThreads,.

,1.

#MaxThreads,#MaxThreadsBuffer,Critical,,Hotkey,#MaxHotkeysPerInterval,

Page 1010: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#HotkeyInterval,ListHotkeys

#MaxThreadsPerHotkey3

Page 1011: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MenuMaskKey [AHK_L38+]

WinAltkeyup.

#MenuMaskKeyKeyName

KeyName

vkNN..

,().

,.WinAlt,.,AutoHotkey""keyup.

38,Ctrl,.

,Ctrl.

.

#MenuMaskKeyvk07;vk07.

#UseHook

Page 1012: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Space::

!Space::

KeyWaitLWin

KeyWaitRWin

KeyWaitAlt

KeyHistory

return

Page 1013: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#UseHook.

#UseHook[On|Off]

On|Off

#UseHook #UseHookOn .

On: #UseHookOFF ().

Off:(RegisterHotkey()).

,windowsAPIRegisterHotkey()., .

ON $.

#, #UseHook ().,.

, Send., Click, . Gosub.: Gosub

#LButton .

[v1.1.06+]:#InputLevel SendLevelSend.

,OFF.

Page 1014: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InstallKeybdHook,#InstallMouseHook,ListHotkeys,#InputLevel

#UseHook;.

#x::MsgBox,Thishotkeywillbeimplementedwith

thehook.

#y::MsgBox,Andthisonetoo.

#UseHookoff

#z::MsgBox,Butnotthisone.

Page 1015: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,,.

Hotkey,KeyName[,Label,Options]

Hotkey,IfWinActive/Exist[,WinTitle,WinText]

Hotkey,If[,Expression]

Hotkey,If,%FunctionObject

KeyName

, ., #c Win+C.

KeyName,.

KeyName(),.

, KeyName.,(EscEscape)., (

^!+#). GetKeyName.

(Hotkey ),, A_ThisHotkey.Hotkey,.

[v1.1.15+]:, KeyName(~).

[v1.1.19+]: ($) ..v1.1.19,,.

Label

Page 1016: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

( ). /.(:::). (

%VarContainingLabelName%), IsLabel(VarContainingLabelName)

.

[v1.1.20+]:,, ., Hotkey%funcobj%,On

Hotkey%funcobj,On ..,. Hotkey.

KeyName,,. Options() .

,,., OptionsON.

:

On:.,.

Off:.,.

Toggle:().

AltTab(): Alt-Tab.

: On,Off,ToggleAltTab()..

Options

,.: UseErrorLevelB0

UseErrorLevel:,, ErrorLevel , .

On:.

Off:..

Page 1017: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

B B0:B #MaxThreadsBuffer.B0(B0).

Pn:P .P,0.

Tn:T, #MaxThreadsPerHotkey.: T5 .

In(:InputLevel) [v1.1.23+]:I(i) inputlevel() .

: I1 .

,.(),., #MaxThreadsBuffer.

#MaxThreadsBuffer,(OFF). #IfWin:#IfWin

"HotkeyIfWin"

IfWinActive

IfWinExist

IfWinNotActive

IfWinNotExist

If,Expression

If,%FunctionObject

. Hotkey,If .

WinTitle

WinText

,(%var%).,IfWin.

#IfWinActive/Exist, WinTitle WinText SetTitleMatchMode

DetectHiddenWindows. #IfWinActive/Exist.

Page 1018: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

If,

[AHK_L4+]: #If.#If.,. #If4 .

: Hotkey,.() ,,. ,;:

Hotkey,If,x="`t"

Hotkey,If,%"x="""A_Tab""""

#Ifx="`t" .

: If and /or ,.,#IfHotkey && /|| .

If,%FunctionObject

[v1.1.25+]: functionobject.. Hotkey,If, , ().

FunctionObject call(). call, .

,().

"" .

ErrorLevel

[v1.1.04+]., .

ErrorLevel:

1)IfWin[Not]Active/Exist,10;

:

2) OptionsUseErrorLevel.

Page 1019: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.25+]:"If",,.ErrorLevel,0.

1 Label.

2 KeyName/.

3 .,( WheelDown&Enter ).

4 KeyName AltTabShiftAltTab ..: RControl&

RShift::AltTab .

5 .

6 ., HotkeyIfWin.

98 1000(, , ).

99 .,.

:UseErrorLevel.:

Hotkey,^!p,,UseErrorLevel

ifErrorLevelin5,6

MsgBoxIfWin.

IfWin Hotkey .

, Hotkey,^!c,Off #IfWinActive/Exist( "Hotkey

IfWinActive/Exist").

Hotkey,().,. INI.

Page 1020: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

., A_ThisHotkey.

,/,( Suspend).

/ .

Hotkey, .:1) ()2)(,,)3) (,).

,, ExitAppExit. #SingleInstance,

#SingleInstanceOff .

Hotkey,If

"HotkeyIf" (, #If #IfWinActive/Exist,).:

Hotkey,IfWinActive,ahk_classNotepad

Hotkey,^!e,MyLabel;.

,"HotkeyIf" .,;,.

(,),if,.: Hotkey,If Hotkey,

IfWinActive .

"HotkeyIf", #If #IfWin().

if,;,,.,,.

()

IfWin,. .:

Page 1021: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,IfWinActive,ahk_classNotepad

Hotkey,^!c,MyLabelForNotepad

Hotkey,IfWinActive,ahk_classWordPadClass

Hotkey,^!c,MyLabelForWordPad

Hotkey,IfWinActive

Hotkey,^!c,MyLabelForAllOtherWindows

,.(IfWin):,.

, ^!+#.: ^!c!^c .,., Esc Escape().

, (*), *F1 F1 .

IfWin, #IfWin.

,#IfWinActive/Exist,#MaxThreadsBuffer,#MaxThreadsPerHotkey,Suspend,

IsLabel(),,Thread,Critical,Gosub,Return,Menu,SetTimer

Hotkey,^!z,MyLabel

return

MyLabel:

MsgBoxYoupressed%A_ThisHotkey%.

return

;:

Hotkey,RCtrl&RShift,AltTab;RCtrl&RShift

Alt-Tab.

Hotkey,#c,On;Win-C.

Page 1022: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,$+#c,Off;Shift-Win-C.

Hotkey,^!a,,T5;5.

Hotkey,IfWinActive,ahk_classNotepad

Hotkey,^!c,MyLabelForNotepad;Ctrl-Alt-C.

;ThisGUIallowsyoutoregisterprimitivethree-

keycombinationhotkeys:

GuiAdd,Text,xm,Prefixkey:

GuiAdd,Edit,ypx100w100vPrefix,Space

GuiAdd,Text,xm,Suffixhotkey:

GuiAdd,Edit,ypx100w100vSuffix,f&j

GuiAdd,Button,Default,Register

GuiShow

return

ButtonRegister(){

global

GuiSubmit,NoHide

localfn

fn:=Func("HotkeyShouldFire").Bind(Prefix)

HotkeyIf,%fn

Hotkey%Suffix,FireHotkey

}

HotkeyShouldFire(prefix,thisHotkey){

returnGetKeyState(prefix)

}

FireHotkey(){

MsgBox%A_ThisHotkey%

}

GuiClose:

GuiEscape:

ExitApp

Page 1023: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListHotkeys,, .

ListHotkeys

View->Hotkeys.

Hotkey,OFFPART("PART" ).

[v1.1.16+]:0#InputLevel,().

,.

,,:

reg:RegisterHotkey().

reg(no):,(, ).

k-hook:.

m-hook:.

2-hooks:.

joypoll:.

#InstallKeybdHook,#InstallMouseHook,#UseHook,KeyHistory,ListLines,

ListVars,#MaxThreadsPerHotkey,#MaxHotkeysPerInterval

Page 1024: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListHotkeys

Page 1025: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InstallKeybdHook.

#InstallKeybdHook

RegisterHotkey() ., Input.

AutoHotkey,500KB.,:1) ;2) ();3)

SetCaps/Scroll/NumlockAlwaysOn/AlwaysOff;4)Input,.

,#InstallKeybdHook, KeyHistory20(),

#HotkeyModifierTimeout.

KeyHistory. ListHotkeys.

, ExitApp.

#InstallMouseHook,#UseHook,Hotkey,Input,#Persistent,KeyHistory,,

GetKeyState,KeyWait

#InstallKeybdHook

Page 1026: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#InstallMouseHook.

#InstallMouseHook

.

AutoHotkey,500KB(,50KB,)., .

, #HotstringNoMouse.

,#InstallMouseHook, KeyHistory.

KeyHistory. ListHotkeys.

, ExitApp.

#InstallKeybdHook,#UseHook,Hotkey,#Persistent,KeyHistory,GetKeyState,

KeyWait

#InstallMouseHook

Page 1027: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#KeyHistory KeyHistory.0.

#KeyHistoryMaxEvents

MaxEvents

KeyHistory(40,500).0.

,().

, KeyHistory ""., #KeyHistory50

KeyHistory,#NoTrayIcon

#KeyHistory0;.

#KeyHistory100;100.

Page 1028: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

BlockInput.

BlockInput,Mode

Mode

1 ::

On:().

Off:.

2 :., BlockInputOn BlockInputOff ,.

Send: Send SendRaw( SendEvent),..

Send,( BlockInputOn ).

Mouse: Click,MouseMove,MouseClick MouseClickDrag(

SendEvent),..,( BlockInputOn ).

SendAndMouse:.

Default: Send Mouse,., BlockInputOn ,

BlockInputDefault .

Page 1029: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

3 (v1.0.43.11+) :., BlockInputOn BlockInput

MouseMove ,.

MouseMove:(DirectInput)., ()., ,

ExitApp., Suspend Hotkey,( #HotstringNoMouse).

MouseMoveOff:.

: BlockInputOn UAC., FAQ.

BlockInput, SendModeInput SendModePlay ,.

BlockInput,;,.BlockInput.

BlockInput,"".BlockInput,:

^!p::

KeyWaitControl;.KeyWait.

KeyWaitAlt

BlockInputOn

;......

BlockInputOff

return

ALT,().

BlockInput,,AutoHotkey.WindowsAPI,Ctrl+Alt+Del

.

Page 1030: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

BlockInput. MButton () LWin&Space ( $# ).

.

SendMode,Send,Click,MouseMove,MouseClick,MouseClickDrag

BlockInput,on

Run,notepad

WinWaitActive,Untitled-Notepad

Send,{F5};

BlockInput,off

Page 1031: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Click [v1.0.43+]

.,.

():

Click() .

Click44,55 44,55( CoordMode).

Clickright44,55 ,.

Click2 ().

Clickdown .

Clickupright .

Click%x%%y% click ,.

Click.,tab/. ClickCount(),.

X,Y:,x/y., CoordMode.,.

: Left(),Right,Middle(),(X1X2).: MouseClick,,.

:WheelUpWU(),WheelDownWD().v1.0.48+,

WheelLeft(WL)WheelRight(WR)(WindowsVista).

ClickCount(),., ClickCount1., Loop:

Loop5

ClickWheelUp

ClickCount:(: Click2 ,Click100,200,2 ).,.,

Page 1032: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ClickCount.(0)(: Click200,0,100 ).

Down Up:,., Down( D)., Up( U).

Relative: Rel RelativeXY.,X()Y

().

Click MouseClick,.

Click SendMode.,Send,: SendEvent{Click,100,

200} .

shift-clickcontrol-click, Send{Click} .:

Send+{Click100,200};Shift+LeftClick

Send^{Click100,200,right};

Control+RightClick

Send, Click(Control,Alt,ShiftWin).,Control, Click

control-click Send{Click} .

SendPlay.,, SetDefaultMouseSpeed( SendEvent

).

BlockInput., SendInput SendPlay,.

( SendInput). SetMouseDelay.

Page 1033: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Send{Click},SendMode,CoordMode,SetDefaultMouseSpeed,

SetMouseDelay,MouseClick,MouseClickDrag,MouseMove,ControlClick,

BlockInput

Click;.

Click100,200;.

Click100,200,0;.

Click100,200right;.

Click2;.

Clickdown;.

Clickupright;.

Page 1034: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlClick.

ControlClick[,Control-or-Pos,WinTitle,WinText,

WhichButton,ClickCount,Options,ExcludeTitle,

ExcludeText]

Control-or-Pos

,().,.

1():XY.XY,tab.: X55Y33 .,

.,(,).:,

2(ClassNN):ClassNN()/,WindowSpy.

/, SetTitleMatchMode.

,21.,ClassNN"XnnnYnnn",2.1,

OptionsPos,: ControlClick,x255y152,

WinTitle,,,,Pos

HWND(), WinTitle ahk_id%ControlHwnd% (

DetectHiddenWindows,).HWND ControlGetHwnd,

MouseGetPos DllCall.

WinTitle

Page 1035: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

WhichButton

:LEFT,RIGHT,MIDDLE().,LEFT.

X1(XButton1:)X2(XButton2:).

WheelUp(WU)WheelDown(WD). ClickCount.

WindowsVista [v1.0.48+]:WheelLeft(WL)WheelRight

(WR)(). ClickCount.

ClickCount

, .,1.

.: dx50y25 .

NA[v1.0.45+]:. .

D:(). D U,().

U:(). D.

Pos: OptionsPos, Control-or-PosX/Y.

Xn: nX.,.

Page 1036: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Yn: nY.,.

X Y.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

,ControlClick,:

1)ControlClick SetControlDelay-1 .,.

2)( Options)NA,:

SetControlDelay-1

ControlClick,Toolbar321,WinTitle,,,,NA

NA ,,().,.

Page 1037: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,1 ClickCount.,,5:

Loop,5

ControlClick,Control,WinTitle,WinText,

WheelUp

. DetectHiddenWindows,.

SetControlDelay,Control,ControlGet,ControlGetText,ControlMove,

ControlGetPos,ControlFocus,ControlSetText,ControlSend,Click

ControlClick,OK,SomeWindowTitle;OK

ControlClick,x55y77,WinTitle;.XY

.

;:

SetControlDelay-1

ControlClick,Toolbar321,WinTitle,,,,NAx192y10

;NA.

Page 1038: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlSend/ControlSendRaw.

ControlSend[,Control,Keys,WinTitle,WinText,

ExcludeTitle,ExcludeText]

ControlSendRaw:.

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

. ahk_parent ,( Winamp).

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

( Send)., (`,). SetKeyDelay.

Send,ControlSend. ControlClick.

WinTitle

. WinTitle.

WinText

Page 1039: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

ControlSendRaw Keys,{Enter}ENTER,^c

Control-C,.

Control,(),..

,(Control,Alt,ShiftWin)Send.,,..

,,ControlSendAlt(Alt).,:

ControlSend,Edit1,{Altdown}f{Altup},

Untitled-Notepad

()(Control/Alt/Shift/Win).

Page 1040: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlSend(), BlockInput.Control.

SetKeyDelay., SetKeyDelay,:

SetKeyDelay,10,10

SetKeyDelay,0,10

SetKeyDelay,-1,0

Edit(),ControlSend:

Control,EditPaste,Thistextwillbeinserted

atthecaretposition.,ControlName,WinTitle

ControlSetText,ControlName,Thistextwill

entirelyreplaceanycurrenttext.,WinTitle

ControlSend., WinMenuSelectItem., .

. DetectHiddenWindows,.

SetKeyDelay,(`%) ,Control,ControlGet,ControlGetText,ControlMove,

ControlGetPos,ControlClick,ControlSetText,ControlFocus,Send,Winamp

ControlSend,Edit1,Thisisalineoftextinthe

notepadwindow.,Untitled

SetTitleMatchMode,2

Page 1041: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlSend,,abc,cmd.exe;.

Page 1042: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CoordMode,.

CoordMode,ToolTip|Pixel|Mouse|Caret|Menu[,

Screen|Window|Client]

Param1

ToolTip: ToolTip.

Pixel: PixelGetColor,PixelSearch ImageSearch.

Mouse: MouseGetPos,Click MouseMove/Click/Drag.

Caret: A_CaretX A_CaretY.

Menu: MenuShow.

Param2

Param2,Screen.

Screen:().

Relative:.

Window[v1.1.05+]: Relative,,.

Page 1043: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Client[v1.1.05+]:,,().Client.

,( WinMove InputBox).

( , ).().

[v1.1.23+]: A_CoordMode.

Click,MouseMove,MouseClick,MouseClickDrag,MouseGetPos,

PixelGetColor,PixelSearch,ToolTip,Menu

CoordMode,ToolTip,Screen;ToolTips:

CoordMode,ToolTip;,"screen".

Page 1044: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetKeyName(key),GetKeyVK(key),GetKeySC(Key) [v1.1.01+]

/,.

String:=GetKeyName(Key)

Number:=GetKeyVK(Key)

Number:=GetKeySC(Key)

Key

VKSC,"vkA2""sc01D",, .,

GetKeyName("vk1B") GetKeyName("Esc") "Escape",

GetKeyVK("Esc") 27.,VKSC.

Format("vk{:x}",vk_code) Format("sc{:x}",

sc_code) .

Key,.

GetKeyState,KeyList,Format

Page 1045: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.

key:="lwin";.

name:=GetKeyName(key)

vk:=GetKeyVK(key)

sc:=GetKeySC(key)

MsgBox,%Format(":`t{}`n:`t{:X}`n:`t{:X}",

name,vk,sc)

Page 1046: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetKeyState/..

GetKeyState,OutputVar,KeyName[,Mode]

KeyIsDown:=GetKeyState("KeyName"[,"Mode"])

OutputVar

,DU(GetKeyState()true(1)false(0)).,

.

:

1)JoyX, OutputVar0100,,. SetFormat

. .

2) KeyNameJoyPOV,035900.POV:

-1:

0:POV

9000(90):POV

27000(270):POV

18000(180):POV

KeyName

,/.:B,5,LWin,RControl,Alt,Enter,Escape,LButton,

Page 1047: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MButton,Joy1.

,,vkFF.,. .

: ,LeftNumpadLeft.

Mode

,.

,.,.

,:

P:()./,(),(). KeyHistory.

#InstallKeybdHook/ #InstallMouseHook.

T:(,Capslock,Numlock,ScrolllockInsert).D,

U(GetKeyState()true(1)false(0)).

/, KeyWaitGetKeyState.

,Capslock. Sleep,.

GetKeyState, .

KeyWait,,,KeyHistory,#InstallKeybdHook,#InstallMouseHook

Page 1048: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

GetKeyState,state,RButton;.

GetKeyState,state,Joy2;.

GetKeyState,state,Shift

ifstate=D

MsgBoxAtleastoneShiftkeyisdown.

else

MsgBoxNeitherShiftkeyisdown.

GetKeyState,state,CapsLock,T;CapsLock

D,U.

state:=GetKeyState("Capslock","T");

CapsLock,.

;(

; ):

;,NumpadAdd,

;NumpadAdd.

;:

*NumpadAdd::

MouseClick,left,,,1,0,D;.

Loop

{

Sleep,10

GetKeyState,state,NumpadAdd,P

ifstate=U;,.

break

;....

}

MouseClick,left,,,1,0,U;.

return

;:.

Page 1049: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

joy2::

GetKeyState,joyx,JoyX

ifjoyx>75

MsgBoxAction#1(buttonpressedwhile

joystickwaspushedtotheright).

elseifjoyx<25

MsgBoxAction#2(buttonpressedwhile

joystickwaspushedtotheleft).

else

MsgBoxAction#3(buttonpressedwhile

joystickwascenteredhorizontally).

return

; .

Page 1050: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

KeyHistory.

KeyHistory

"View->Keyhistory".

,:

#KeyHistory0

#KeyHistory.

. ,().

(WheelDown,WheelUp,WheelLeftWheelRight)(VK)

AutoHotkey.,(1).

,KeyHistory(). ,.,

"View->KeyHistory".,:

#InstallKeybdHook

#InstallMouseHook

Page 1051: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#KeyHistory,#InstallKeybdHook,#InstallMouseHook,ListHotkeys,ListLines,

ListVars,GetKeyState,KeyWait,A_PriorKey

KeyHistory;.

Page 1052: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

KeyWait/.

KeyWait,KeyName[,Options]

KeyName

,/..

, vkFF .,. .

,/., KeyName Send,. ,.

:(,):

D:.

L:,()..

T:( T3 )., ErrorLevel1.,., ErrorLevel0.

(2.5),(0x03).

ErrorLevel

ErrorLevel1,0.

Page 1053: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

/,(),. KeyHistory. #InstallKeybdHook

#InstallMouseHook.

, , .

,KeyWait.:

KeyWaitControl;ControlAlt.

KeyWaitAlt

, Input.

GetKeyState,,Input,KeyHistory,#InstallKeybdHook,#InstallMouseHook,

ClipWait,WinWait

;#1::

KeyWait,a;A.

KeyWait,LButton,D;.

KeyWait,Joy1,DT3;3.

KeyWait,LAlt,L;Alt.

;#2::

Page 1054: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

~Capslock::

KeyWait,Capslock;.

MsgBoxYoupressedandreleasedtheCapslockkey.

return

;#3:(

; ):

;NumpadAdd,

;NumpadAdd.

*NumpadAdd::

MouseClick,left,,,1,0,D;.

KeyWait,NumpadAdd;.

MouseClick,left,,,1,0,U;.

return

;#4:().

;RControl

;KeyWait.

;

;#MaxThreadsPerHotkey1.

;: SetTimer,

;,.

~RControl::

if(A_PriorHotkey<>"~RControl"or

A_TimeSincePriorHotkey>400)

{

;,.

KeyWait,RControl

return

}

Page 1055: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxYoudouble-pressedtherightcontrolkey.

return

Page 1056: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Input.

Input[,OutputVar,Options,EndKeys,MatchList]

OutputVar

(,).

, InputInput ErrorLevelNewInput.,Input

ErrorLevel0,Input1.

OutputVar./.,(PageUpEscape)(

EndKeys).

,TAB(`t).ENTER(`n).

(,):

B:.,.:(),,().

C:., MatchList(1.0.43.03,A-Z,ü/ü

).

I:AutoHotkey, SendEvent.,, SendInput

Page 1057: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendPlay.

L:( L5 ).., ErrorLevelMax, MatchList,

ErrorLevelMatch.,16383,.

M:(Control-AControl-Z)ASCII,.,Control-C:

Transform,CtrlC,Chr,3;Ctrl-C

CtrlC.

Input,OutputVar,L1M

ifOutputVar=%CtrlC%

MsgBox,YoupressedControl-C.

ExitApp

:Ctrl-ACtrl-Z Chr(1) Chr(26)., M(Ctrl-

LeftArrow)Input.

T:( T3 )., ErrorLevelTimeout.Input, OutputVar.,

2.5.

V:.,()..

*:()., MatchList,.,.

E[v1.1.20+]:keycode()..;, @ ,US

Shift+2,Ctrl+Shift+2(E).

EndKeys

,( EndKey OutputVar)., ErrorLevelEndKey

EndKey.: EndKey:. ,EndKey:Escape .

Page 1058: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EndKey Send., {Enter}.{Esc} ENTER,(.)

ESCAPE., {{} /

Control,AltShift,/,., {LControl}

{RControl} {Control} .

Control-C(^c),v1.0.14+shift(,?!:@&{}).

E ,v1.1.20+.

, {vkFF} .,. .

MatchList

,( ErrorLevelMatch).,( *)., tab ,

., MatchList"ABC,XYZ",ABCXYZ.

.,string1:"string1,,,string2".,:"single,,item".

MatchList,.,16383,,., MatchList

%List1%,%List2%,%List3% ,.

ErrorLevel

[v1.1.04+]Input., .

10 ,Input ErrorLevel0,Input1.

NewInput InputInput .

Max MatchList.

Page 1059: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Timeout .

Match MatchList.

EndKey:name

EndKeys., ErrorLevelEndKey,"EndKey:Enter","EndKey:Escape".

name"" EndKeys.,{Esc}{vk1B}"ErrorLevel:Escape". GetKeyName().

E,name().,name.

[v1.1.20],EndKeyVK0x41(A)0x5A(Z),ErrorLevelASCII,.v1.1.20,.AZ,;.

Input,Input ErrorLevelNewInput.(),

Input.

Input, ( ).,Input .Input, .

, ()., , ExitApp., Suspend Hotkey,

.

,Input(Input ).,1.0.44.03,.

, Input.

KeyWait,,InputBox,#InstallKeybdHook,,ifvarin/containsMatchList

Page 1060: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.(

;,),

;.

Input,SingleKey,L1,{LControl}{RControl}{LAlt}

{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}

{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}

{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}

{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}

{Pause}

;.(~)

;,.

;,[btw(

;),

;():

~[::

Input,UserInput,VT5L4C,{enter}.{esc}{tab},

btw,otoh,fl,ahk,ca

if(ErrorLevel="Max")

{

MsgBox,Youentered"%UserInput%",whichis

themaximumlengthoftext.

return

}

if(ErrorLevel="Timeout")

{

MsgBox,Youentered"%UserInput%"atwhich

timetheinputtimedout.

return

Page 1061: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

if(ErrorLevel="NewInput")

return

IfInStr(ErrorLevel,"EndKey:")

{

MsgBox,Youentered"%UserInput%"and

terminatedtheinputwith%ErrorLevel%.

return

}

;,.

if(UserInput="btw")

Send,{backspace4}bytheway

elseif(UserInput="otoh")

Send,{backspace5}ontheotherhand

elseif(UserInput="fl")

Send,{backspace3}Florida

elseif(UserInput="ca")

Send,{backspace3}California

elseif(UserInput="ahk")

Run,https://autohotkey.com

return

Page 1062: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseClick,.: Click.

MouseClick[,WhichButton,X,Y,ClickCount,Speed,

D|U,R]

WhichButton

:Left(),Right,Middle(),(X1X2).: MouseClick,X1 .,

Left.

:WheelUpWU(),WheelDownWD().v1.0.48+,

WheelLeft(WL)WheelRight(WR)(WindowsVista

). ClickCount.

, Click.

X,Y

,x/y, ., CoordMode.,.

ClickCount

, .,.

Speed

,0()100(), .:0.,( SetDefaultMouseSpeed

Page 1063: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,2).

SendInput/Play Speed;( SetMouseDelaySendPlay

).(), SendEvent{Click100,200}

Event ( BlockInput).

D|U

,"""".:

D=().

U=().

R

R,XY.,X()Y().

SendMode.

MouseClick, Click,:

1. .

2. .

shift-clickcontrol-click, Send,:

;#1:

Send,{Controldown}

MouseClick,left,55,233

Send,{Controlup}

Page 1064: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#2:

Send,{Shiftdown}

MouseClick,left,55,233

Send,{Shiftup}

SendPlay.,. SetDefaultMouseSpeed speed(

SendEvent).

ClickCount1., Loop:

Loop,5

MouseClick,WheelUp

BlockInput., SendInput/Play,.

( SendInput). SetMouseDelay.

CoordMode,SendMode,SetDefaultMouseSpeed,SetMouseDelay,Click,

MouseClickDrag,MouseGetPos,MouseMove,ControlClick,BlockInput

;:

MouseClick,left

MouseClick,left

;:

MouseClick,left,,,2

Page 1065: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

MouseClick,right,200,300

;:

#up::MouseClick,WheelUp,,,2;Turnitbytwo

notches.

#down::MouseClick,WheelDown,,,2

Page 1066: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseClickDrag,,.

MouseClickDrag,WhichButton,X1,Y1,X2,Y2[,Speed,

R]

WhichButton

:Left,Right,Middle().X1,X2.: MouseClickDrag,

X1,... .

, Click.

X1,Y1

x/y, ()., CoordMode.,.

X2,Y2

x/y, ., CoordMode.

Speed

,0()100(), .:0.,( SetDefaultMouseSpeed

,2).

SendInput/Play Speed;( SetMouseDelaySendPlay

).(), SendEvent{Click100,200}

Page 1067: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Event ( BlockInput).

R

R,X1Y1.,X1()Y1().

,X2Y2X1Y1.,5,10

: MouseClickDrag,Left,5,5,10,10,,R .

SendMode.

Send,,.:

SendEvent{Click6,52,down}{click45,52,up}

MouseClickDrag,.

SendPlay.,SendPlayRichEdit()WordPad

Metapad,.

. SetDefaultMouseSpeed speed( SendEvent).

BlockInput., SendInput/Play,.

( SendInput).. SetMouseDelay.

Page 1068: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CoordMode,SendMode,SetDefaultMouseSpeed,SetMouseDelay,Click,

MouseClick,MouseGetPos,MouseMove,BlockInput

MouseClickDrag,left,0,200,600,400

;:

Run,mspaint.exe

WinWaitActive,ahk_classMSPaintApp,,2

ifErrorLevel

return

MouseClickDrag,L,150,250,150,150

MouseClickDrag,L,150,150,200,100

MouseClickDrag,L,200,100,250,150

MouseClickDrag,L,250,150,150,150

MouseClickDrag,L,150,150,250,250

MouseClickDrag,L,250,250,250,150

MouseClickDrag,L,250,150,150,250

MouseClickDrag,L,150,250,250,250

Page 1069: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseGetPos().

MouseGetPos,[OutputVarX,OutputVarY,OutputVarWin,

OutputVarControl,1|2|3]

OutputVarX/Y

XY., CoordMode.

OutputVarWin

ID .,.

,..

OutputVarControl

(ClassNN).,.

v1.0.14+WindowSpy(WindowSpy).,

WindowSpy,,.

1|2|3

,0.,:

1: OutputVarControl.(MDI)(SysEditTextPad)/

Page 1070: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,(GroupBox).

2[v1.0.43.06+]: HWND OutputVarControlClassNN.

3[v1.0.43.06+]:12.

,.

CoordMode,WinGet,SetDefaultMouseSpeed,Click

MouseGetPos,xpos,ypos

Msgbox,ThecursorisatX%xpos%Y%ypos%.

;

;:

#Persistent

SetTimer,WatchCursor,100

return

WatchCursor:

MouseGetPos,,,id,control

WinGetTitle,title,ahk_id%id%

WinGetClass,class,ahk_id%id%

ToolTip,ahk_id%id%`nahk_class

%class%`n%title%`nControl:%control%

return

Page 1071: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseMove.

MouseMove,X,Y[,Speed,R]

X,Y

x/y, ., CoordMode.

Speed

,0()100(), .:0.,( SetDefaultMouseSpeed

,2).

SendInput/Play Speed;( SetMouseDelaySendPlay

).(), SendEvent{Click100,200}

Event ( BlockInput).

R

R,XY.,X()Y().

SendMode.

SendPlay.,. SetDefaultMouseSpeed speed(

Page 1072: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendEvent).

BlockInput., SendInput/Play,.

( SendInput). SetMouseDelay.

,:

DllCall("SetCursorPos",int,100,int,400);

XY().

, .

CoordMode,SendMode,SetDefaultMouseSpeed,SetMouseDelay,Click,

MouseClick,MouseClickDrag,MouseGetPos,BlockInput

;:

MouseMove,200,100

;(502)

;2030:

MouseMove,20,30,50,R

Page 1073: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Send/SendRaw/SendInput/SendPlay/SendEvent:.

SendKeys

SendRawKeys

SendInputKeys

SendPlayKeys

SendEventKeys

.,.

:SendRaw,{Enter}ENTER,^cControl-C,.,

,,.SendInput,SendPlaySendEvent,

: SendInput{Raw}abc .

:,():

!:ALT., SendThisistext!a "Thisistext"ALT+a. :

!A!a.!AALT+SHIFT+A!aALT+a.,.

+:SHIFT., Send+abC "AbC", Send!+a

ALT+SHIFT+a.

Page 1074: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

^:CONTROL., Send^!a CTRL+ALT+a, Send

^{Home} CONTROL+HOME. :^A^a.^A

CONTROL+SHIFT+A^aCONTROL+a.,.

#:WIN, Send#e Windows"e".

SendInput SendPlay[v1.0.43+]:SendInputSendPlaySend.,

,. SendModeSendSendInputSendPlay.,

SendInput SendPlay.

SendEvent[v1.0.43+]:SendEvent1.0.43 Send. SetKeyDelay

., Send SendEvent; SendMode SendInput SendPlay

.

KeyNames:():

{F1}-{F24} .:{F12}F12.

{!} !

{#} #

{+} +

{^} ^

{{} {

{}} }

{Enter} ENTER

{Escape}{Esc} ESCAPE

{Space} SPACE(,)

Page 1075: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{Tab} TAB

{Backspace}{BS}

{Delete}{Del} Delete

{Insert}{Ins} Insert

{Up}

{Down}

{Left}

{Right}

{Home} Home

{End} End

{PgUp}

{PgDn}

{CapsLock}CapsLock(2k/XP SetCapsLockState). {CapsLock}SetStoreCapslockModeOff.

{ScrollLock} ScrollLock(: SetScrollLockState)

{NumLock} NumLock(: SetNumLockState)

{Control}{Ctrl} CONTROL(:)

{LControl}{LCtrl} CONTROL(:)

{RControl}{RCtrl} CONTROL

{ControlDown}{CtrlDown}

CONTROL{CtrlUp}.,{RCtrlDown}{RCtrlUp}.

{Alt} ALT(:)

Page 1076: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{LAlt} ALT(:)

{RAlt} ALT(AltGr,)

{AltDown} ALT{AltUp}.,{RAltDown}{RAltUp}.

{Shift} SHIFT(:)

{LShift} SHIFT(:)

{RShift} SHIFT

{ShiftDown} SHIFT{ShiftUp}.,{RShiftDown}{RShiftUp}.

{LWin} Windows

{RWin} Windows

{LWinDown} Windows{LWinUp}

{RWinDown} Windows{RWinUp}

{AppsKey} WindowsAppskey()

{Sleep} SLEEP.

{ASCnnnnn}

ALT+nnnnn,.ASCII,1255.ANSI(),128255,,{Asc0133}.

Unicode,25665535().,.,.

[AHK_L24+]:Unicode, nnnn0x.AutoHotkeyUnicode,

Page 1077: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{U+nnnn} SendControlSendUnicode.

, SendInput() WM_CHAR.

{vkXX}{scYYY}{vkXXscYYY}

XXYYY.: Send

{vkFFsc159} .scvk,.

XXYYY, View->Keyhistory.:

{Numpad0}-{Numpad9} (Numlock).:{Numpad5}5.

{NumpadDot} (Numlock).

{NumpadEnter} Enter

{NumpadMult}

{NumpadDiv}

{NumpadAdd}

{NumpadSub}

{NumpadDel} Delete(Numlock)

{NumpadIns} Insert

{NumpadClear} Clear(Numlock'5').

{NumpadUp}

{NumpadDown}

{NumpadLeft}

{NumpadRight}

{NumpadHome} Home

Page 1078: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{NumpadEnd} End

{NumpadPgUp}

{NumpadPgDn}

{Browser_Back} ""

{Browser_Forward} ""

{Browser_Refresh} ""

{Browser_Stop} ""

{Browser_Search} ""

{Browser_Favorites} ""

{Browser_Home}

{Volume_Mute} /. SoundSet,+1,,mute .

{Volume_Down} . SoundSet-5 .

{Volume_Up} . SoundSet+5 .

{Media_Next}

{Media_Prev}

{Media_Stop}

{Media_Play_Pause} /

{Launch_Mail}

{Launch_Media}

{Launch_App1} 1

{Launch_App2} 2

{PrintScreen} PrintScreen

{CtrlBreak} Ctrl+break

Page 1079: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{Pause} Pause

{Click[]}[v1.0.43+]

Click., {Click} ,{Click100,200} 100,200( CoordMode).,0:100,200,0} . SetMouseDelay( SetKeyDelay).

{WheelDown},{WheelUp},{WheelLeft},{WheelRight},{LButton},{RButton},{MButton},{XButton1},{XButton2}

(, {Click}). SetMouseDelay.WheelLeft/Rightv1.0.48+,WindowsVista.

{Blind}

{Blind},Alt/Control/Shift/Win., +s::Send{Blind}abc ABCabc,Shift.

{Blind} SetStoreCapslockMode;Capslock.,{Blind};:1)LWin/RWin;2)Alt.

Blind.,a::b:1)"a""b";2)AB;3)Control-AControl-B.

SendRaw ControlSendRaw{Blind}., SendPlay,(Control,Alt,ShiftWin).

{Raw}[v1.0.43+]

,{Enter}ENTER, ^c Control-C.{Raw},,.

Page 1080: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:.:

Send{DEL4};4Delete.

Send{S30};30S.

Send+{TAB4};4Shift-Tab.

: Down Up.:

Send{bdown}{bup}

Send{TABdown}{TABup}

Send{Updown};.

Sleep1000;1.

Send{Upup};.

,(/)., Loop.20tab:

Loop20

{

Send{Tabdown};().

Sleep30;( SetKeyDelay).

}

Send{Tabup};.

DownTemp.(Control/Shift/Alt/Win) Down., DownTemp

send,., Send{ControlDownTemp}

,control-A.

Page 1081: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Send.,AutoHotkeyUnicode Alt+nnnnn.

AutoHotkeyUnicodeUnicode,

BlockInputSendInput/SendPlay : BlockInput, SendInput

SendPlay,.BlockInput,SendInput/Play;,.

, .

CTRL-ALT-DELETE, Send^!{Delete} .

, SendWindowsVista ..

Page 1082: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendInput [v1.0.43+]

SendInput,.,SendInput,.SendInput,,.

SendInput.

,SendInput5000()..

: SendInputSetKeyDelay,.,SendInput SendEvent,

SetKeyDelay-1,0 (SendEvent -1,-1 , -1,-1 ).

SendInput SendPlay,SendPlay.

SendInput ,SendInput SendEvent( SendPlay, SendMode

InputThenPlay ).SendInput,SendPlaySendEvent.

,AutoHotkeyv1.0.43SendInput,SendPlay/Event.

SendInput {Click}, CoordModeMouse,Relative (

),.,SendInput(alt-tab),,.

Page 1083: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendPlay [v1.0.43+]

: SendPlayUAC,. FAQ.

SendPlay"playback"., SendPlay .,SendPlay

WindowsVista,.:

http://www.autohotkey.com/forum/topic75595.html.

,SendPlay,.,()( ControlSend,).

SendPlay.

SendInput,SendPlay.,SendPlay,.

SendPlaySendInput, SendEvent( KeyDelay-1).

,SendPlayWindows(LWinRWin).Windows.,

LWinRWin,SendPlay().

SendPlaySetKeyDelaySetMouseDelay.,,:

SetKeyDelay,0,10,Play;0-1

SendPlay.

SetMouseDelay,10,Play

SendPlayCapslock,NumlockScroll-lock.,,

GetKeyState.,/(RControl)(Control).,SendPlay

SendMode.

SendInput SendEvent,Control-Alt-DelControl-Escape

Page 1084: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendPlay.,,SendPlay.

SendPlayLWinRWin,., SendEvent.

, SendEvent#r .

Page 1085: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendMode,SetKeyDelay,SetStoreCapslockMode,(`%) ,ControlSend,

BlockInput,,WinActivate

Page 1086: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendSincerely,{enter}JohnSmith;.

Send!fs;File->Save(Alt+FS).

Send{End}+{Left4};shift.

SendInput{Raw}Alongseriesofrawcharacters

sentviathefastestmethod(SendInput).

Page 1087: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendLevel [v1.1.06+]

.

SendLevel,Level

Level

0100, .

, AutoHotkey.;,.SendLevel #InputLevel.

SendLevel ,#InputLevel.,.

:

SendPlaySendLevel.

SendInputSendLevel,SendInput,.

"reg",SendLevel.,0.

0,.,Send.

,SendLevel..

[v1.1.23+]: A_SendLevel.

.( ),0, .

Page 1088: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendLevel, .

v1.1.06AutoHotkey #InputLevel0 SendLevel0 .

#InputLevel,Send,Click,MouseClick,MouseClickDrag

SendLevel1

Sendbtw{Space};"bytheway".

;:

::btw::bytheway

Page 1089: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SendMode [v1.0.43+]

SendSendInputSendPlay(SendEvent).Click

MouseMove/Click/Drag.

SendModeInput|Play|Event|InputThenPlay

:

Event:. Send,SendRaw,Click MouseMove/Click/Drag

SendEvent.

Input: Send,SendRaw,Click MouseMove/Click/Drag SendInput.

:

WindowsSendInput,Alt+LeftArrow., SendEvent!

{Left} SendInput{Backspace} .

InputThenPlay[v1.0.43.02+]:,SendInput PlayEvent.

SendInputSendInputPlay.

Play: Send,SendRaw,Click MouseMove/Click/Drag SendPlay.

:

(?)., SendEvent.

RichEdit()WordPadMetapad,.,: SendEvent

{Click6,52,down}{Click45,52,up} .

(,).,MSWordNotepad.,: SendEvent

Page 1090: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{WheelDown5} .

() SendModePlay ,. SendPlay.

SendPlayAutoHotkey.

SendMode Click MouseMove/Click/Drag,. {Click}.:

SendEvent{Click100,200};SendEvent.

()SendMode, . SendModePlay , SendPlay.

[v1.1.23+]: A_SendMode.

( , ).().

Send,SetKeyDelay,SetMouseDelay,Click,MouseClick,MouseClickDrag,

MouseMove

SendModeInput

SendModeInputThenPlay

Page 1091: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetDefaultMouseSpeed Click MouseMove/Click/Drag.

SetDefaultMouseSpeed,Speed

Speed

,0()100().:0. .

SendInput/PlaySetDefaultMouseSpeed;(, SetMouseDelay

SendPlay).(), SendEvent{Click100,200}

SendModeEvent ( BlockInput).

,2. A_DefaultMouseSpeed.

MouseClick,MouseMove MouseClickDrag.

Speed, SetMouseDelay,.

( , ).().

SetMouseDelay,SendMode,Click,MouseClick,MouseMove,MouseClickDrag,

Page 1092: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetWinDelay,SetControlDelay,SetKeyDelay,SetKeyDelay

SetDefaultMouseSpeed,0;.

Page 1093: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetKeyDelay Send ControlSend.

SetKeyDelay[,Delay,PressDuration,Play]

Delay

, .-1,0( Play,0-1). Delay.

SetKeyDelay,SendEvent Delay10. SendPlay, Delay

-1. ()-1.

PressDuration

;,,.

-1(),0(, Play,0-1).:,.

.

: PressDuration(CTRL,ALT,SHIFTWIN).

.

Play

[v1.0.43+]

Play SendPlaySendEvent.,SendPlay-1/-1.

Page 1094: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: SetKeyDelay SendInput;. SendModeInput Send.

Send ControlSend.,.

,1015.,WindowsXP110()1015(2k).

Send/SendEvent,0Sleep(0),.,Sleep(0).,

-1.,0-1.

-1, SendEvent., Process,Priority,,High .

,. Send,().,.

A_KeyDelaySend/SendEvent Delay. [v1.1.23+]:

A_KeyDuration PressDuration, A_KeyDelayPlay

A_KeyDurationPlay SendPlay.

( , ).().

Send,ControlSend,SendMode,SetMouseDelay,SetControlDelay,

SetWinDelay,SetBatchLines,Click

SetKeyDelay,0

Page 1095: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetMouseDelay.

SetMouseDelay,Delay[,Play]

Delay

, .-1,0( Play,0-1).,

SendEvent10 SendPlay-1.

Play

[v1.0.43+]

Play SendPlaySendEvent.,SendPlay-1.

Click MouseMove/Click/Drag( SendInput).,.

,1015.,WindowsXP110()1015(2k).

0Sleep(0),.,Sleep(0).,-1.

A_MouseDelaySend/SendEvent. [v1.1.23+]:A_MouseDelayPlay

SendPlay.

( , ).().

Page 1096: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetDefaultMouseSpeed,Click,MouseMove,MouseClick,MouseClickDrag,

SendMode,SetKeyDelay,SetControlDelay,SetWinDelay,SetBatchLines

SetMouseDelay,0

Page 1097: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetCapsLockState/SetNumLockState/SetScrollLockStateCapslock/NumLock/ScrollLock..

SetCapsLockState[,State]

SetNumLockState[,State]

SetScrollLockState[,State]

State

,AlwaysOn/Off().,:

On:AlwaysOn/Off().

Off:AlwaysOn/Off().

AlwaysOn:.

AlwaysOff:.

Send,: Send{Capslock} .

AlwaysOn AlwaysOff ,.

Page 1098: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetStoreCapslockMode,GetKeyState

SetNumlockState,on

SetScrollLockState,AlwaysOff

Page 1099: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetStoreCapslockMode SendCapsLock.

SetStoreCapslockMode,On|Off

On|Off

On:, SendCapsLock,.

Off:CapsLock., SendCapslock,.

Send ControlSendCapslock.,.

,.

[v1.1.23+]: A_StoreCapslockMode.

( , ).().

SetCaps/Num/ScrollLockState,Send,ControlSend

Page 1100: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetStoreCapslockMode,off

Page 1101: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoTrim Var1=%Var2% Var2tab.

AutoTrim,On|Off

On|Off

On: Var1=%Var2% , Var2 Var1tab..

Off:tab.

,tab.v1.1.06,`ttab.,AutoTrimOff

, Var=`t v1.1.06tab,.

,ON.

A_AutoTrim(OnOff).

A_Space A_Tabtab.

AutoTrim Var:="string" .,tab.

( , ).().

Page 1102: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetEnv

AutoTrim,off

NewVar1=%OldVar%;OldVar,NewVar.

NewVar2=%A_Space%;AutoTrimoff,.

Var1:="`t".Var2."";AutoTrim,

Page 1103: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Edit.

Edit

Edit"edit"().,(),.

.

,AutoHotkey__., AutoHotkey., ISense.

,.

Reload

Edit;.

;,

;ahk:

;

;Editor.exe"Fullpathofscript.ahk"

;

;,

;.

;

FileSelectFileEditor,2,,Selectyoureditor,

Page 1104: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Programs(*.exe)

ifErrorLevel

ExitApp

RegWriteREG_SZ,HKCR,

AutoHotkeyScript\Shell\Edit\Command,,"%Editor%"

"`%1"

AutoHotkey

SciTE4AutoHotkeySciTE,AutoHotkey.:

()

AutoHotkey

SciTE4AutoHotkey: http://fincs.ahk4.net/scite4ahk/

AutoHotkey :

AHKStudioAutoHotKey.: https://autohotkey.com/boards/viewtopic.php?

t=300

AutoGUIGUIAutoHotKey,:

https://autohotkey.com/boards/viewtopic.php?f=6&t=10157

AutoHotKey:

Page 1105: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AkelPad-http://www.autohotkey.com/forum/topic23586.html

CrimsonEditor-http://www.autohotkey.com/forum/topic5506.html

Eclipse,FARmanagerColorertake5-

http://www.autohotkey.com/forum/topic10378.html

Emacs-https://github.com/tinku99/ahk-org-mode

Notepad++-http://www.autohotkey.com/forum/topic58792.html

Notepad2-http://www.autohotkey.com/forum/viewtopic.php?t=37652

PSPad-http://www.autohotkey.com/forum/topic9294.html

SciTEScintilla-

http://www.autohotkey.com/forum/topic9656.html

SublimeTextEditor-http://www.autohotkey.com/forum/viewtopic.php?

p=368326#368326

TotalCommanderSynplus-

http://www.autohotkey.com/forum/topic7278.html

,AutoHotkeyBasic( http://www.autohotkey.com/download/1.0/)zip.

,,:

ConTEXT

EditPlus

EmEditor

jEdit

MED

TextPad

UltraEdit

Vim

Page 1107: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Func(FunctionName) [v1.1.00+]

.

FunctionReference:=Func(FunctionName)

FunctionName

. FunctionName.

FunctionName . FunctionName0.( #Include .)

,.

,

;"StrLen".

fn:=Func("StrLen")

Page 1108: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;.

MsgBox%fn.Name"()"(fn.IsBuiltIn?".":

".")

Page 1109: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsByRef(UnquotedVarName) [v1.1.01+]

UnquotedVarNameByRefparameter().

TrueOrFalse:=IsByRef(UnquotedVarName)

UnquotedVarName

( ).: IsByRef(MyVar) .

UnquotedVarName ByRefparameter() 1; UnquotedVarName

0.

ByRefparameters()

MsgBox,%Function(MyVar)

Function(ByRefParam)

{

returnIsByRef(Param)

}

Page 1110: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsFunc(FunctionName) [v1.0.48+]

.

MinParamsPlus1:=IsFunc(FunctionName)

FunctionName

. FunctionName. [v1.1.00+], FunctionName .

(1,2,). FunctionName0.( #Include )

,,,Func(),A_ThisFunc

count:=IsFunc("RegExReplace");.

ifcount

MsgBox,%""count-1"."

else

MsgBox,%"."

Page 1111: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsLabel(LabelName).

TrueOrFalse:=IsLabel(LabelName)

LabelName

,, ()( LabelName).

LabelName,0(false).

, Gosub,,, Gui.

Labels

ifIsLabel("Label")

MsgBox,

else

Page 1112: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,

Label:

return

ifIsLabel("^#h")

MsgBox,

else

MsgBox,

^#h::return

ifIsLabel("::btw")

MsgBox,

else

MsgBox,

::btw::bytheway

Page 1113: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsObject(ObjectValue) [v1.0.90+]

ObjectValue.

TrueOrFalse:=IsObject(ObjectValue)

ObjectValue

, .

(1:.)

(2:,:isObject({})1).

ObjectValue1,0.

object:={key:"value"}

ifIsObject(object)

MsgBox,.

else

Page 1114: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,.

Page 1115: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListLines.

ListLines[,On|Off]

On|Off

,.v1.0.48.01+,,OnOff. ,:

On:..

Off:.

ListLines()"View->Linesmostrecentlyexecuted". .

ListLinesOff/On ,(). ListLinesOff .

( , ).().

"A_ListLines",:

ListLines(PassTrueToTurnOnOrFalseToTurnOff);

ListLines().

{

staticsListLines:=true;"ListLines

Page 1116: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

On".

ListLines%

PassTrueToTurnOnOrFalseToTurnOff?"On":"Off"

;ListLines.

ListLines_prev:=sListLines

sListLines:=

PassTrueToTurnOnOrFalseToTurnOff

returnListLines_prev

}

;:

prev_ListLines:=ListLines(false);

ListLines.

;...

ListLines(prev_ListLines);ListLines.

, A_LineNumber A_LineFile.

KeyHistory,ListHotkeys,ListVars

ListLines

ListLinesOff

Page 1117: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ListVars:.

ListVars

,,,.( `r`n ), `r`n .

( ):

VarName[LengthofCapacity]:String

;v1.1.26+

VarName:TypeNameobject{Info}

;Priortov1.1.26:

VarName[Object]:Address

VarName[Object]:Address<=ComObject(VarType,

Value)

Capacity ,.

String60.

Info.

, ().

: ()10,000,;.

Page 1118: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

KeyHistory,ListHotkeys,ListLines

DebugVars.

ListVars

Page 1119: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OutputDebug().

OutputDebug,Text

.(`n)., .

,.,.

DebugView, www.sysinternals.com.

:

FileAppend,

OutputDebug,%A_Now%:Becausethewindow

"%TargetWindowTitle%"didnotexist,theprocess

wasaborted.

Page 1120: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

UrlDownloadToFile.

UrlDownloadToFile,URL,Filename

URL

URL.,http://someorg.org.

Filename

:, %A_WorkingDir%. .

:.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

,.. Filename.

InternetExplorer3,..,.

Page 1121: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

v1.0.44.07+,URL(InternetExplorer).,URL

*0: *0http://someorg.org .dwFlags;,

www.microsoft.comInternetOpenUrl.

1.0.44.07,.,URL.

: http://www.someorg.org/doc.html?fakeParam=42 .:,

.

:InternetExplorer,UrlDownloadToFileInternet.

FTPGopher :v1.0.48.04+FTPGopherURL.:

UrlDownloadToFile,ftp://example.com/home/My

File.zip,C:\MyFolder\MyFile.zip;.

UrlDownloadToFile,

ftp://user:[email protected]:21/home/My

File.zip,C:\MyFolder\MyFile.zip;.

UrlDownloadToFile,

ftp://user:[email protected]/MyDirectory,

C:\DirListing.html;HTML.

FileRead,FileCopy

UrlDownloadToFile,

https://autohotkey.com/download/1.1/version.txt,

Page 1122: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

C:\AutoHotkeyLatestVersion.txt

UrlDownloadToFile,http://someorg.org/archive.zip,

C:\SomeOrg'sArchive.zip

;::

whr:=ComObjCreate("WinHttp.WinHttpRequest.5.1")

whr.Open("GET",

"https://autohotkey.com/download/1.1/version.txt",

true)

whr.Send()

;Using'true'aboveandthecallbelowallowsthe

scripttoremainresponsive.

whr.WaitForResponse()

version:=whr.ResponseText

MsgBox%version

;Example:MakeanasynchronousHTTPrequest.

req:=ComObjCreate("Msxml2.XMLHTTP")

;Openarequestwithasyncenabled.

req.open("GET",

"https://autohotkey.com/download/1.1/version.txt",

true)

;Setourcallbackfunction(v1.1.17+).

req.onreadystatechange:=Func("Ready")

;Sendtherequest.Ready()willbecalledwhen

it'scomplete.

req.send()

/*

;Ifyou'regoingtowait,there'snoneedfor

onreadystatechange.

;Settingasync=trueandwaitinglikethisallows

thescripttoremain

;responsivewhilethedownloadistakingplace,

whereasasync=false

Page 1123: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;willmakethescriptunresponsive.

whilereq.readyState!=4

sleep100

*/

#Persistent

Ready(){

globalreq

if(req.readyState!=4);Notdoneyet.

return

if(req.status==200);OK.

MsgBox%"LatestAutoHotkeyversion:"

req.responseText

else

MsgBox16,,%"Status"req.status

ExitApp

}

Page 1124: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-AutoHotkey, . {} ,[] ,Object() Array() :

InsertAt/RemoveAt

Push/Pop

Delete

MinIndex/MaxIndex/Length

SetCapacity/GetCapacity

GetAddress

_NewEnum

HasKey

Clone

ObjRawSet()

():

Insert

Remove

obj(:"obj","obj"), --obj.

"Obj". :

array:=[1,2,3]

MsgBox%ObjMaxIndex(array)"="

array.MaxIndex()

"obj",.

Page 1125: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 1126: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

InsertAt [v1.1.21+]

.

Object.InsertAt(Pos,Value1[,Value2,...ValueN])

Pos

Value1.Pos+1,Pos+2,.

Value1...

., theArray* .

InsertAt RemoveAt.

, Pos Value1. Pos,().:

x:=[]

x.InsertAt(1,"A","B");=>["A","B"]

x.InsertAt(2,"C");=>["A","C","B"]

;()/:

x:=["A",,"C"]

x.InsertAt(2,"B");=>["A","B",,

"C"]

x:=["C"]

x.InsertAt(1,,"B");=>[,"B","C"]

Page 1127: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

InsertAt.,ID()handles(),InsertAt.:

x:=[],handleX:=0x4321,handleY:=0x1234

x.InsertAt(handleX,"A")

MsgBox%x[handleX];A-

x.InsertAt(handleY,"B")

MsgBox%x[handleX];

MsgBox%x[handleX+1];"B"""

InsertAt,.

Page 1128: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RemoveAt [v1.1.21+]

.

Object.RemoveAt(Pos[,Length])

Pos

.

Length

. Pos Pos+Length-1 .Pos.

Length, Pos()., Length,0 Length

(0).

RemoveAt InsertAt.

Pos Length(1),.:

x:=["A","B"]

MsgBox%x.RemoveAt(1);A

MsgBox%x[1];B

x:=["A",,"C"]

MsgBox%x.RemoveAt(1,2);1

MsgBox%x[1];C

Page 1129: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RemoveAt.,ID()handles(),RemoveAt.:

x:={0x4321:"A",0x1234:"B"}

MsgBox%x.RemoveAt(0x1234);B

MsgBox%x[0x4321];Empty

MsgBox%x[0x4321-1];A

RemoveAt,.

Page 1130: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Push [v1.1.21+]

.

Object.Push([Value,Value2,...,ValueN])

Value...

., theArray* .

()..

,()1.

, Object.MaxIndex()+1 ,.,

Object.InsertAt(Object.Length()+1,...) .

Page 1131: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Pop [v1.1.21+]

.

Value:=Object.Pop()

,.,:

Value:=Object.RemoveAt(Object.Length())

Page 1132: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Delete [v1.1.21+]

-.

Object.Delete(Key)

Object.Delete(FirstKey,LastKey)

Key

.

FirstKey,LastKey

, FirstKey<=LastKey..

,()..

RemoveAt,Delete-(:,).:

x:=["A","B"]

MsgBox%x.RemoveAt(1);A

MsgBox%x[1];B

x:=["A","B"]

MsgBox%x.Delete(1);A

MsgBox%x[1];

Page 1133: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MinIndex/MaxIndex [AHK_L31+]

MinIndex:=Object.MinIndex()

MaxIndex:=Object.MaxIndex()

,MinIndexMaxIndex. .

Page 1134: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Length [v1.1.21+]

Length:=Object.Length()

1;,,0.

MsgBox%["A","B","C"].Length();3

MsgBox%["A",,"C"].Length();3

MsgBox%{-10:0,10:0}.Length();10

MsgBox%{-10:0,-1:0}.Length();0

Page 1135: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetCapacity [AHK_L31+]

.

Object.SetCapacity(MaxItems)

Object.SetCapacity(Key,ByteSize)

MaxItems .,.

Key .

ByteSize ,,.,. ByteSize,. ByteSize,;.

,.

Page 1136: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetCapacity [AHK_L31+]

MaxItems:=Object.GetCapacity()

ByteSize:=Object.GetCapacity(Key)

.

Page 1137: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GetAddress [AHK_L31+]

Ptr:=Object.GetAddress(Key)

,.

Page 1138: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

NewEnum [AHK_L49+]

Enum:=Object._NewEnum()

., for.

Page 1139: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

HasKey [AHK_L53+]

Object.HasKey(Key)

Object Key("")()true,false.

Page 1140: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Clone [AHK_L60+]

Clone:=Object.Clone()

().

Page 1141: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ObjRawSet

.

ObjRawSet(Object,Key,Value)

__Set .,().: Object[Key]:=Value

,,().(),__Call.

Page 1142: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Insert [AHK_L31+]

Deprecated:Insert. InsertAt,Push,ObjRawSet.

,,.

Object.Insert(Pos,Value1[,Value2,...ValueN])

Object.Insert(Value)

Object.Insert(StringOrObjectKey,Value)

Insert::

,Insert InsertAt.

,Insert ObjRawSet.

,Insert Push.

Insert true.v1.1.21,..

Page 1143: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Remove [AHK_L31+]

Deprecated:Remove. RemoveAt,DeleteorPop.

.

Object.Remove(FirstKey,LastKey)

Remove:

Object.Remove(Integer)

Object.RemoveAt(Integer) .

Object.Remove(Integer,"")

Object.Delete(Integer) .

Object.Remove(Integer1,Integer2)

Object.RemoveAt(Integer1,Integer2-Integer1+

1) .

Object.Remove() Object.Pop() .

, Delete.

Page 1144: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[AHK_L49+]

.

Page 1145: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Next

.

Enum.Next(OutputVar1[,OutputVar2,...])

OutputVar1,OutputVar2

.

... ,.

,,.

ObjNewEnum(),:

OutputVar1 .

OutputVar2 OutputVar1 .

.,.,.

For,Object.NewEnum()

;.

obj:=Object("red",0xFF0000,"blue",0x0000FF,

"green",0x00FF00)

Page 1146: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;!

enum:=obj._NewEnum()

Whileenum[k,v]

t.=k"="v"`n"

MsgBox%t

;AHK_L59+

Fork,vinobj

s.=k"="v"`n"

MsgBox%s

Page 1147: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[AHK_L42+]

/. FileOpen.

Page 1148: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Read

.

String:=File.Read([Characters])

Characters .,.File(),.

.

Page 1149: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Write

.

File.Write(String)

String .

().

Page 1150: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ReadLine

.

Line:=File.ReadLine()

. `n ,`r`n `r ,EOL.

Page 1151: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WriteLine

`n `r`n ,..

File.WriteLine([String])

String .

().

Page 1152: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ReadNum

.

Num:=File.ReadNumType()

NumType :UInt,Int,Int64,Short,UShort,Char,UChar,DoubleFloat.

,.

Try.,, NumType.0.

Page 1153: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WriteNum

.

File.WriteNumType(Num)

NumType :UInt,Int,Int64,Short,UShort,Char,UChar,DoubleFloat.

Num .

.,WriteUInt4.

Page 1154: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RawRead

.,.

File.RawRead(VarOrAddress,Bytes)

VarOrAddress . NumGet.

Bytes .

.

Try, Bytes,,., AtEOF.

Page 1155: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RawWrite

.

File.RawWrite(VarOrAddress,Bytes)

VarOrAddress . NumPut.

Bytes .

.

Page 1156: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Seek

.

File.Seek(Distance[,Origin=0])

File.Position:=Distance

File.Pos:=Distance

Distance ,..

Origin .:

0(SEEK_SET):. Distance.1(SEEK_CUR):.2(SEEK_END):. Distance.

,Distance OriginSEEK_END,SEEK_SET.

,.

Page 1157: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tell

Pos:=File.Tell()

Pos:=File.Position

Pos:=File.Pos

,0.

Page 1158: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Length

.

FileSize:=File.Length

File.Length:=NewSize

NewSize ,.

,.

.File,,.

Page 1159: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AtEOF

IsAtEOF:=File.AtEOF

,.

.File(),,"".

Page 1160: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Close

,.,.

File.Close()

.

Page 1161: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Encoding

.

Encoding:=File.Encoding

File.Encoding:=Encoding

Encoding ( MSDN):

UTF-8 :UnicodeUTF-8,CP65001.UnicodeUTF-16CP1200.CPnnn : nnn.

Encoding -RAW ,(BOM). EncodingBOM,BOM.

v1.1.15.04+, Encoding UTF-8-RAW UTF-

16-RAW , -RAW ., UTF-8-RAW UTF-16-RAW 8,ASCII, File.Encoding ,FileOpen().

Page 1162: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

__Handle

File.__Handle

DllCall. CreateFile.

.,., File.Pos .

Page 1163: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Func [v1.1.00+]

.

, Function.

Func .,Func,:

;"StrLen".

fn:=Func("StrLen")

;.

MsgBox%fn.Name"()is"(fn.IsBuiltIn?

"built-in.":"user-defined.")

Page 1164: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Call

.

Func.Call(Parameters);v1.1.19+

Func.(Parameters);-

.

[v1.1.07+]:%Func%() ,__Call . Func.() .

Page 1165: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Bind [v1.1.20+]

BoundFunc.

BoundFunc:=Func.Bind(Parameters)

Parameters.

, BoundFuncobject.

Page 1166: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Name

.

Func.Name

Page 1167: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsBuiltIn

true, false.

Func.IsBuiltIn

Page 1168: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsVariadic

true, false.

Func.IsVariadic

Page 1169: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MinParams

.

Func.MinParams

Page 1170: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MaxParams

,.

Func.MaxParams

,"variadic*".

Page 1171: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsByRef()

ByRef().

Func.IsByRef(ParamIndex)

ParamIndex :1.,ByRef.

ParamIndex;ByRef.

Page 1172: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IsOptional()

.

Func.IsOptional(ParamIndex)

ParamIndex :1.,.

ParamIndex;(true/false).

,..

Page 1173: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"":

, ;

."".

,, ,,COMJavaScript.

:

GUI(G)

Hotkey

OnClipboardChange()

OnExit()

OnMessage()

SetTimer

Page 1174: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

classYourClassName{

Call(a,b){;, * .

;...

}

__Call(method,args*){

if(method=""); %fn%()fn.()

returnthis.Call(args*)

if(IsObject(method));.

returnthis.Call(method,args*)

}

;...

}

,:

%this%()this.() ,, method ().

, IsObject(method) , method .: x.ythis , x.y() →

this[x]() →this.__Call(x) →this.Call(x) .

[v1.1.20+]:,OnMessageSetTimer,Call.

__Call,__CallCallV2, %this%()CALL.

Page 1175: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.20+]

,.

:

Func.Bind(),

ObjBindMethod(),.

..,,,.:

fn:=Func("RealFn").Bind(1)

%fn%(2);"1,2"

fn.Call(3);"1,3"

RealFn(a,b){

MsgBox%a%,%b%

}

ObjBindMethod().:

file:=FileOpen(A_ScriptFullPath,"r")

getLine:=ObjBindMethod(file,"ReadLine")

MsgBox%%getLine%();.

, SetTimer.

Page 1176: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Process:.

Process,Cmd,PID-or-Name[,Param3]

Cmd

:

Exist: ErrorLevelID(PID),0. PID-or-Name,

PID.PID PID:=

DllCall("GetCurrentProcessId") .

Close:, ErrorLevelID(PID).()0.(),

WinClose.

List: List, DllCall.

Priority:(Windows) Param3 ErrorLevelID

(PID). PID-or-Name,.,ErrorLevel0.

Param3:L(Low),B(BelowNormal),N(Normal),A(

AboveNormal),H(High),R(Realtime).:Realtime.

Wait: Param3(). Param3,., ErrorLevel

ID(PID).,ErrorLevel0.

Page 1177: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WaitClose: Param3(). Param3,.,

ErrorLevel0.,ErrorLevelID(PID).

PID-or-Name

(PID)..

PID:ID,().PID Run.,PID

WinGet.ProcessPID.

Name:,(),notepad.exewinword.exe.,..

Param3

Cmd.

ErrorLevel

Cmd.

Wait WaitClose:100;,.,, ErrorLevel,.,,

, .

Run,WinGet,WinClose,WinKill,WinWait,WinWaitClose,IfWinExist

Page 1178: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;#1:

RunNotepad.exe,,,NewPID

Process,priority,%NewPID%,High

MsgBoxThenewlylaunchednotepad'sPIDis

%NewPID%.

;#2:

Process,wait,Notepad.exe,5.5

NewPID=%ErrorLevel%;ErrorLevel,.

ifNewPID=0

{

MsgBoxThespecifiedprocessdidnotappear

within5.5seconds.

return

}

;:

MsgBoxAmatchingprocesshasappeared(ProcessID

is%NewPID%).

Process,priority,%NewPID%,Low

Process,priority,,High;.

WinCloseUntitled-Notepad

Process,WaitClose,%NewPID%,5

ifErrorLevel;PID.

MsgBoxTheprocessdidnotclosewithin5

seconds.

;#3::

Page 1179: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#z::;Win+Zhotkey

WinGet,active_pid,PID,A

WinGetTitle,active_title,A

Gui,5:Add,Text,,PressESCAPEtocancel,or

double-clickanew`nprioritylevelforthe

followingwindow:`n%active_title%

Gui,5:Add,ListBox,vMyListBoxgMyListBoxr5,

Normal|High|Low|BelowNormal|AboveNormal

Gui,5:Add,Button,default,OK

Gui,5:Show,,SetPriority

return

5GuiEscape:

5GuiClose:

Gui,Destroy

return

MyListBox:

ifA_GuiEvent<>DoubleClick

return

;:

5ButtonOK:

GuiControlGet,MyListBox

Gui,Destroy

Process,Priority,%active_pid%,%MyListBox%

ifErrorLevel

MsgBoxSuccess:Itsprioritywaschangedto

"%MyListBox%".

else

MsgBoxError:Itsprioritycouldnotbe

changedto"%MyListBox%".

return

;#4:DllCallMsgBox.

Page 1180: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

d:="|";

s:=4096;(4KB)

Process,Exist;ErrorLevelPID

;PROCESS_QUERY_INFORMATION(0x0400)

h:=DllCall("OpenProcess","UInt",0x0400,"Int",

false,"UInt",ErrorLevel,"Ptr")

;(TOKEN_ADJUST_PRIVILEGES=32)

DllCall("Advapi32.dll\OpenProcessToken","Ptr",h,

"UInt",32,"PtrP",t)

VarSetCapacity(ti,16,0);

NumPut(1,ti,0,"UInt");...

;:

DllCall("Advapi32.dll\LookupPrivilegeValue",

"Ptr",0,"Str","SeDebugPrivilege","Int64P",

luid)

NumPut(luid,ti,4,"Int64")

NumPut(2,ti,12,"UInt");:

SE_PRIVILEGE_ENABLED=2

;:

r:=DllCall("Advapi32.dll\AdjustTokenPrivileges",

"Ptr",t,"Int",false,"Ptr",&ti,"UInt",0,

"Ptr",0,"Ptr",0)

DllCall("CloseHandle","Ptr",t);

DllCall("CloseHandle","Ptr",h);

hModule:=DllCall("LoadLibrary","Str",

"Psapi.dll");

s:=VarSetCapacity(a,s);:

c:=0;

DllCall("Psapi.dll\EnumProcesses","Ptr",&a,

"UInt",s,"UIntP",r)

Loop,%r//4;DWORD(32):

{

id:=NumGet(a,A_Index*4,"UInt")

;:PROCESS_VM_READ(0x0010)|

Page 1181: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PROCESS_QUERY_INFORMATION(0x0400)

h:=DllCall("OpenProcess","UInt",0x0010|

0x0400,"Int",false,"UInt",id,"Ptr")

if!h

continue

VarSetCapacity(n,s,0);:

e:=DllCall("Psapi.dll\GetModuleBaseName",

"Ptr",h,"Ptr",0,"Str",n,"UInt",A_IsUnicode

?s//2:s)

if!e;6432:

ife:=

DllCall("Psapi.dll\GetProcessImageFileName",

"Ptr",h,"Str",n,"UInt",A_IsUnicode?s//2:

s)

SplitPathn,n

DllCall("CloseHandle","Ptr",h);

if(n&&e);,:

l.=n.d,c++

}

DllCall("FreeLibrary","Ptr",hModule);

;Sort,l,C;

MsgBox,0,%c%Processes,%l%

;#5:COM.

Gui,Add,ListView,x2y0w400h500,Process

Name|CommandLine

forprocessin

ComObjGet("winmgmts:").ExecQuery("Select*from

Win32_Process")

LV_Add("",process.Name,process.CommandLine)

Gui,Show,,ProcessList

;Win32_Process:http://msdn.microsoft.com/en-

Page 1182: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

us/library/aa394372.aspx

Page 1183: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Run/RunWait.Run,RunWait.

Run,Target[,WorkingDir,

Max|Min|Hide|UseErrorLevel,OutputVarPID]

RunWait,Target[,WorkingDir,

Max|Min|Hide|UseErrorLevel,OutputVarPID]

Target

,URL,(.exe,.com,.bat,),(.lnk) (). Target,

A_WorkingDir.,(""),PATH.

,.,().

WorkingDir

.,.,( A_WorkingDir).

Max|Min|Hide

UseErrorLevel

, Target.,:

Max:

Min:

Page 1184: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hide:()

:(Calc.exe),Max/Min/Hide.

UseErrorLevel:UseErrorLevel().,,

ErrorLevelERROR, .,RunWait ErrorLevel,

Run0.

UseErrorLevel, A_LastErrorGetLastError().

A_LastError04294967295().(0),.(,

www.microsoft.com"systemerrorcodes"). ErrorLevel

,A_LastError, .,A_LastError DllCall

OutputVarPID

, ID(PID) .PID,,.RunWait,

OuputVarPID (,PID,RunWait).

RunPID,., WinWaitahk_pid

%OutputVarPID% .

ErrorLevel

[v1.1.04+]., .

Run:UseErrorLevel ErrorLevel,ErrorLevelERROR0.

RunWait:ErrorLevel(32).UseErrorLevel,ERROR.

Page 1185: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Run,RunWait Target, ErrorLevel(32).;.

Target, ,:

Runrundll32.exeshell32.dll`,Control_RunDLL

desk.cpl`,`,3;>>

Comspec(cmd.exe)(),,.,,:

Run%comspec%/c""C:\MyUtility.exe""param1"

"secondparam">"C:\MyFile.txt""

,,,3 UseErrorLevel,Try/Catch.

Target, Run,C:\Windows\Notepad.exe"C:\My

Documents\Test.txt" Run,C:\MyDocuments\Test.txt .

Run CLSID.:

Run::{20d04fe0-3aea-1069-a2d8-08002b30309d};

"".

Run::{645ff040-5081-101b-9f08-00aa002f954e};

.

.,("").,.:

*[AHK_L57+]:.: Run*Compile

%A_ScriptFullPath%

WindowsVista, *RunAs .

properties()

.: Run,properties"C:\MyFile.txt"

:., WinWait,

Page 1186: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

find() .: Run,findD:\

explore() .: Run,explore%A_ProgramFiles% .

edit() ."edit",.: Run,edit"C:\My

File.txt"

open (,).: Run,open"MyFile.txt" .

print ,.: Run,print"MyFile.txt"

RunWait, , .

() [AHK_L57+]:

, *RunAs .,:

full_command_line:=DllCall("GetCommandLine",

"str")

ifnot(A_IsAdminor

RegExMatch(full_command_line,"

/restart(?!\S)"))

{

try

{

ifA_IsCompiled

Run*RunAs"%A_ScriptFullPath%"

/restart

else

Run*RunAs"%A_AhkPath%"/restart

"%A_ScriptFullPath%"

}

ExitApp

}

Page 1187: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxA_IsAdmin:%A_IsAdmin%`nCommandline:

%full_command_line%

UAC,.

/restart,ExitApp, singleinstance.

UAC, *RunAs. /restart . /restart , .

:

A_IsAdmin *RunAs(UAC).

,UAC,ExitApptry.

,(),ExitAppRunWaitRun., /restart .

,RunWait.

[v1.0.92.01+]:UAC,AutoHotkey .ahk RunAs, Run

*RunAsscript.ahk .

RunAs,Process,Exit,CLSID,DllCall

Run,Notepad.exe,C:\MyDocuments,max

Run,mailto:[email protected]?subject=Thisisthe

subjectline&body=Thisisthemessagebody'stext.

Page 1188: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Run,ReadMe.doc,,MaxUseErrorLevel;,.

ifErrorLevel=ERROR

MsgBoxThedocumentcouldnotbelaunched.

RunWait,%comspec%/cdirc:\>>c:\DirTest.txt,,

min

Run,c:\DirTest.txt

Run,propertiesc:\DirTest.txt

Run,http://www.google.com;.

Run,mailto:[email protected];.

Run::{20d04fe0-3aea-1069-a2d8-08002b30309d};

"".

Run::{645ff040-5081-101b-9f08-00aa002f954e};

.

;,"&&":

Run,%comspec%/cdir/b>C:\list.txt&&type

C:\list.txt&&pause

;:

MsgBox%RunWaitOne("dir"A_ScriptDir)

;...:

MsgBox%RunWaitMany("

(

echo,

echo,

echo.

)")

RunWaitOne(command){

;WshShell: http://msdn.microsoft.com/en-

us/library/aew9yb99

shell:=ComObjCreate("WScript.Shell")

Page 1189: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;cmd.exe

exec:=shell.Exec(ComSpec"/C"command)

;

returnexec.StdOut.ReadAll()

}

RunWaitMany(commands){

shell:=ComObjCreate("WScript.Shell")

;cmd.exe

exec:=shell.Exec(ComSpec"/Q/Kechooff")

;,

exec.StdIn.WriteLine(commands"`nexit");!

;

returnexec.StdOut.ReadAll()

}

;ExecScript:AutoHotkey.

ExecScript(Script,Wait:=true)

{

shell:=ComObjCreate("WScript.Shell")

exec:=shell.Exec("AutoHotkey.exe

/ErrorStdOut*")

exec.StdIn.Write(script)

exec.StdIn.Close()

ifWait

returnexec.StdOut.ReadAll()

}

;:

InputBoxexpr,,,.,,,,,,,,Asc("*")

result:=ExecScript("FileAppend%("expr"),*")

MsgBox%"Result:"result

Page 1190: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RunAs Run RunWait.

RunAs[,User,Password,Domain]

User

,RunAs, Run RunWait.,.

Password

User.

Domain

User.,.,@YourComputerName.

,,RunAs. Run*RunAsRunAs.

AutoHotkey Run RunWait().

ErrorLevel.User,PasswordDomain, RunRunWait( UseErrorLevel).

RunAs, Run RunWait,URL.,.

"SecondaryLogon",().

Page 1191: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Run,RunWait

RunAs,Administrator,MyPassword

Run,RegEdit.exe

RunAs;.

Page 1192: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Shutdown,.

Shutdown,Code

Code

.

:

logoff 0

Shutdown 1

2

4

8

/ DllCall.

PostMessage.

., 9(+=1+8=9)., ,1+8.

""(4).,.

Page 1193: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"".

, OnExit.

Run,ExitApp,OnExit

;(+=2+4=6):

Shutdown,6

;WindowsAPI"SetSuspendState".

;#1:10.

;#2:10.

;#3:10.

DllCall("PowrProf\SetSuspendState","int",0,

"int",0,"int",0)

Page 1194: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegDelete.

RegDelete,RootKey\SubKey[,ValueName];v1.1.21+

RegDelete,RootKey,SubKey[,ValueName]

RootKey

HKEY_LOCAL_MACHINE,HKEY_USERS,

HKEY_CURRENT_USER,HKEY_CLASSES_ROOT

HKEY_CURRENT_CONFIG(,HKLM).,(

v1.1.21+,/),: \\workstation01:HKEY_LOCAL_MACHINE

SubKey

(Software\SomeApplication).

RootKey\SubKey[v1.1.21+]

RootKey( \ ),RootKeySubKey.

ValueName

. , SubKey. Subkey("()"), AHK_DEFAULT .

ErrorLevel

[v1.1.04+]., .

Page 1195: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

A_LastErrorGetLastError().

,!

, .

, .

3264, SetRegView.

RegRead,RegWrite,,SetRegView,IniDelete

RegDelete,HKEY_LOCAL_MACHINE,

Software\SomeApplication,TestValue

RegDelete,

HKEY_LOCAL_MACHINE\Software\SomeApplication,

TestValue;Requiresv1.1.21+

Page 1196: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegRead.

RegRead,OutputVar,RootKey\SubKey[,ValueName];

v1.1.21+

RegRead,OutputVar,RootKey,SubKey[,ValueName]

OutputVar

., ErrorLevel1.

RootKey

HKEY_LOCAL_MACHINE,HKEY_USERS,

HKEY_CURRENT_USER,HKEY_CLASSES_ROOT

HKEY_CURRENT_CONFIG(,HKLM).,(

v1.1.21+/),: \\workstation01:HKEY_LOCAL_MACHINE

SubKey

(Software\SomeApplication).

RootKey\SubKey[v1.1.21+]

RootKey( \ ),RootKey SubKey.

ValueName

Page 1197: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

., Subkey,"()".(""),

OutputVarErrorLevel1.

ErrorLevel

[v1.1.04+]., .

() ErrorLevel1,0.

A_LastErrorGetLastError().

:REG_SZ,REG_EXPAND_SZ,REG_MULTI_SZ,REG_DWORD

REG_BINARY.

REG_DWORD.

REG_BINARY,.,REG_BINARY01,a9,ff,77

01A9FF77.

REG_MULTI_SZ,(`n)., OutputVar. FileSelectFile

OutputVar.

64KREG_BINARYv1.1.10.01.

, .

, .

Page 1198: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

3264, SetRegView.

RegDelete,RegWrite,,SetRegView,IniRead

;:ProgramFiles.

;646464ProgramFiles.

SetRegView64;v1.1.08+

RegRead,OutputVar,HKEY_LOCAL_MACHINE,

SOFTWARE\Microsoft\Windows\CurrentVersion,

ProgramFilesDir

MsgBox,Programfilesarein:%OutputVar%

;(v1.1.21+):

RegRead,OutputVar,

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr

entVersion,ProgramFilesDir

MsgBox,Programfilesarein:%OutputVar%

;ProgramFiles:

EnvGetOutputVar,%A_Is64bitOS?"ProgramW6432":

"ProgramFiles"

MsgBox,Programfilesarein:%OutputVar%

;(REG_SZREG_DWORD).

MsgBox%RegKeyType("HKCU","Environment","TEMP")

Page 1199: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

RegKeyType(RootKey,SubKey,ValueName);.

{

Loop,%RootKey%,%SubKey%

if(A_LoopRegName=ValueName)

returnA_LoopRegType

return"Error"

}

Page 1200: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegWrite.

RegWrite,ValueType,RootKey\SubKey[,ValueName,

Value];v1.1.21+

RegWrite,ValueType,RootKey,SubKey[,ValueName,

Value]

ValueType

REG_SZ,REG_EXPAND_SZ,REG_MULTI_SZ,REG_DWORD

REG_BINARY.

RootKey

HKEY_LOCAL_MACHINE,HKEY_USERS,

HKEY_CURRENT_USER,HKEY_CLASSES_ROOT

HKEY_CURRENT_CONFIG(,HKLM).,(

v1.1.21+,/),:

\\workstation01:HKEY_LOCAL_MACHINE

SubKey

(Software\SomeApplication). SubKey,(). SubKey

, RootKey(HKEY_CURRENT_USER).

RootKey\SubKey[v1.1.21+]

Page 1201: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfRootKeyisfollowedimmediatelybyaslash(\ ),RootKeyandSubKey

aremergedintoasingleparameter.

ValueName

., Subkey,"()".

., ValueType0., ,.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

A_LastErrorGetLastError().

ValueTypeREG_DWORD, Value-21474836484294967295

(0xFFFFFFFF).

REG_BINARY,,REG_BINARY01,a9,ff,7701A9FF77.

REG_MULTI_SZ,(`n)...,(`n`n),.

v1.1.10.0164KREG_BINARYREG_MULTI_SZ.,64K.

, .

Page 1202: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .

3264, SetRegView.

RegDelete,RegRead,,SetRegView,IniWrite

RegWrite,REG_SZ,HKEY_LOCAL_MACHINE,

SOFTWARE\TestKey,MyValueName,TestValue

RegWrite,REG_BINARY,HKEY_CURRENT_USER,

Software\TEST_APP,TEST_NAME,01A9FF77

RegWrite,REG_MULTI_SZ,HKEY_CURRENT_USER,

Software\TEST_APP,TEST_NAME,Line1`nLine2

;Alternativesyntax(requiresv1.1.21+):

RegWrite,REG_SZ,

HKEY_LOCAL_MACHINE\SOFTWARE\TestKey,MyValueName,

TestValue

RegWrite,REG_BINARY,

HKEY_CURRENT_USER\Software\TEST_APP,TEST_NAME,

01A9FF77

RegWrite,REG_MULTI_SZ,

HKEY_CURRENT_USER\Software\TEST_APP,TEST_NAME,

Line1`nLine2

Page 1203: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetRegView [v1.1.08+]

RegRead,RegWrite,RegDelete.

SetRegView,RegView

RegView

3232, 6464.

Default.

64Windows.32Windows.

64,32 WOW64Windows., .,32

, HKLM\SOFTWARE\AutoHotkey

HKLM\SOFTWARE\Wow6432Node\AutoHotkey .SetRegView32

64,.

A_RegView. ( ,).().

RegRead,RegWrite,RegDelete,Loop()

Page 1204: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.

;32.

SetRegView32

RegWriteREG_SZ,HKLM,SOFTWARE\Test.ahk,

Value,123

;64.

SetRegView64

RegReadvalue,HKLM,

SOFTWARE\Wow6432Node\Test.ahk,Value

RegDeleteHKLM,SOFTWARE\Wow6432Node\Test.ahk

MsgBoxReadvalue'%value%'viaWow6432Node.

;,

;3264.

SetRegViewDefault

;...

2EXE.

if(A_PtrSize=8)

script_is:="64-bit"

else;if(A_PtrSize=4)

script_is:="32-bit"

if(A_Is64bitOS)

OS_is:="64-bit"

else

OS_is:="32-bit,whichhasonlyasingle

registryview"

Page 1205: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxThisscriptis%script_is%,andtheOS

is%OS_is%.

Page 1206: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ImageSearch.

ImageSearch,OutputVarX,OutputVarY,X1,Y1,X2,Y2,

ImageFile

OutputVarX/Y

XY(,)., CoordMode.

,ErrorLevel().

X1,Y1

XY, ., CoordMode.

X2,Y2

XY, ., CoordMode.

ImageFile

, %A_WorkingDir%.GIF,JPG,BMP,ICO,CURANI

(BMP16).:EXE,DLL,CPL,SCR.WindowsXP

,,PNG,TIF,Exif,WMFEMF.XPGDI+DLL

AutoHotkey.exe( ,DLL).DLL,

www.microsoft.com:gdiredistributable

Page 1207: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:.tab.: *2*w100*h-1C:\MainLogo.bmp .

*IconN:, *Icon ., *Icon2 .

*n(): n0255(),//., *2 .

ImageFile(GIFJPG).255,.0.

*TransN:,.PNG,GIFTIF(,,).GIF

, *TransWhite .PNGTIF, *TransBlack ., N

RGB( PixelGetColorRGB).

: *TransBlack ,*TransFFFFAA ,*Trans0xFFFFAA .

*wn *hn:(.ICO).,ICO,DLLEXE,16X16(

*w0*h0 /)..,-1., *w200*h-1 200

.

[v1.1.23+]:bitmap()icon()handle() .,

HBITMAP:*%handle% .

ErrorLevel

[v1.1.04+]., .

, ErrorLevel0,1,()2.

ImageSearch.,,,., Click.

Page 1208: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

..:

1. Alt+PrintScreen..

2. ,Paint.

3. ().

4. .

5. .

6. ImageSearch.

, ImageFile.

;,.,.,.

,,.

.,.

ImageSearch8(256).

(GIFJPG).,,.(*n).

,ImageSearch.,(*n) WinSet,Transparent,Off .

PixelSearch,PixelGetColor,CoordMode,MouseGetPos

ImageSearch,FoundX,FoundY,40,40,300,300,

Page 1209: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

C:\MyImages\test.bmp

CoordModePixel;.

ImageSearch,FoundX,FoundY,0,0,A_ScreenWidth,

A_ScreenHeight,*Icon3

%A_ProgramFiles%\SomeApp\SomeApp.exe

ifErrorLevel=2

MsgBoxCouldnotconductthesearch.

elseifErrorLevel=1

MsgBoxIconcouldnotbefoundonthescreen.

else

MsgBoxTheiconwasfoundat

%FoundX%x%FoundY%.

Page 1210: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PixelGetColorx,y.

PixelGetColor,OutputVar,X,Y[,Alt|Slow|RGB]

OutputVar

(BGR)ID.,ID0x800080,80,00.

X,Y

XY, ., CoordMode.

Alt|Slow|RGB

.,( AltRGB ).

Alt[v1.0.43.10+]:,,.10%.

Slow[v1.0.43.10+]:,,..: Slow Alt, Alt.

RGB:RGBBGR.. WinSet,Gui,Progress

SplashImage.

ErrorLevel

[v1.1.04+]., .

Page 1211: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

;,.,.,.

WindowSpy().

:

( TransColor)().

PixelGetColor., Alt Slow.

PixelSearch,ImageSearch,CoordMode,MouseGetPos

^!z::;Control+Alt+Z.

MouseGetPos,MouseX,MouseY

PixelGetColor,color,%MouseX%,%MouseY%

MsgBoxThecoloratthecurrentcursorpositionis

%color%.

return

Page 1212: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PixelSearch.

PixelSearch,OutputVarX,OutputVarY,X1,Y1,X2,Y2,

ColorID[,Variation,Fast|RGB]

OutputVarX/Y

ColorIDXY(,)., CoordMode.

,ErrorLevel().

X1,Y1

XY, ., CoordMode.

X2,Y2

XY, ., CoordMode.

ColorID

ID,(BGR), .IDWindowSpy()

PixelGetColor.: 0x9d6346 .

Variation

0255(),//( )..255,.0.

Page 1213: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Fast|RGB

Fast,RGB(; FastRGB).

Fast:,CPU.8(256),2432.16

, Variation.,().,,.

RGB: ColorIDRGBBGR..

ErrorLevel

[v1.1.04+]., .

, ErrorLevel0,1,2.

;,.,.,.

:,.,,. X1 X2,., X1 X2,,

X1., Y1 Y2,.,,CPU.,.

PixelGetColor,ImageSearch,CoordMode,MouseGetPos

PixelSearch,Px,Py,200,200,300,300,0x9d6346,

3,Fast

Page 1214: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifErrorLevel

MsgBox,Thatcolorwasnotfoundinthe

specifiedregion.

else

MsgBox,Acolorwithin3shadesofvariation

wasfoundatX%Px%Y%Py%.

Page 1215: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundBeepPC.

SoundBeep[,Frequency,Duration]

Frequency

, .3732767.,523.

Duration

,( ).,150.

.,.

,PC.

PC, SoundPlay.

SoundPlay

Page 1216: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundBeep;.

SoundBeep,750,500;.

Page 1217: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundGet(,).

SoundGet,OutputVar[,ComponentType,ControlType,

DeviceNumber]

OutputVar

,0100()ONOFF( ONOFF,MUTE,MONO,

LOUDNESS,STEREOENHBASSBOOST).,.(

) SetFormat.

ComponentType

,MASTER.,:MASTER(SPEAKERS),DIGITAL,

LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,

WAVE,AUX,ANALOG,HEADPHONESN/A. ,ErrorLevel

.

AuxiliaryANALOGAUX.

(LINE),,.,.: Analog:2

analog.

ControlType

,VOLUME.,:VOLUME(VOL),ONOFF,MUTE,

Page 1218: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,

QSOUNDPAN,BASS,TREBLE,EQUALIZER(

ErrorLevel.

: VOLUME(VOL)MUTE,Windows.

DeviceNumber

1.,1(),WindowsVista. ..

ErrorLevel

[v1.1.04+]., .

ErrorLevel0.,:

InvalidControlTypeorComponentType

Can'tOpenSpecifiedMixer

MixerDoesn'tSupportThisComponentType

MixerDoesn'tHaveThatManyofThatComponentType

ComponentDoesn'tSupportThisControlType

Can'tGetCurrentSetting

v1.1.10WindowsVista.

()(), .

, VA .

Page 1219: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundSet.

SoundSet,SoundGetWaveVolume,SoundSetWaveVolume,SoundPlay

SoundGet,master_volume

MsgBox,Mastervolumeis%master_volume%percent.

SoundGet,master_mute,,mute

MsgBox,MasterMuteiscurrently%master_mute%.

SoundGet,bass_level,Master,bass

ifErrorLevel

MsgBox,ErrorDescription:%ErrorLevel%

else

MsgBox,TheBASSlevelforMASTERis

%bass_level%percent.

SoundGet,microphone_mute,Microphone,mute

ifmicrophone_mute=Off

MsgBox,Themicrophoneisnotmuted.

Page 1220: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundGetWaveVolume.

SoundGetWaveVolume,OutputVar[,DeviceNumber]

OutputVar

,0100().,.() SetFormat.

DeviceNumber

,1(),.1.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

SoundSetWaveVolume.(,,,,) SoundSet

SoundGet.

WindowsVista(v1.1.10+): ComponentType Wave ControlType

Volume SoundGet.

Page 1221: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundSetWaveVolume,SoundSet,SoundGet,SoundPlay

SoundGetWaveVolume,OutputVar

MsgBox,Thecurrentwaveoutputvolumelevelis

%OutputVar%`%.

Page 1222: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundPlay,.

SoundPlay,Filename[,wait]

Filename

, %A_WorkingDir%.

,.: wait.

*-1:.,..

*16:(/)

*32:

*48:

*64:()

wait

, .,1WAIT,., , .

:WAIT,"",().

ErrorLevel

[v1.1.04+]., .

Page 1223: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

Windows.wav.,,(.mp3,.avi,etc.).

,.,,.

,SoundPlay,: SoundPlay,Nonexistent.avi .

,.

SoundBeep,SoundGet,SoundSet,SoundGetWaveVolume,

SoundSetWaveVolume,MsgBox,

SoundPlay,%A_WinDir%\Media\ding.wav

SoundPlay*-1;.,..

Page 1224: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundSet(,).

SoundSet,NewSetting[,ComponentType,ControlType,

DeviceNumber]

NewSetting

-100100()( )., ., NewSetting.

(ONOFF,MUTE,MONO,LOUDNESS,STEREOENH

BASSBOOST),,0.,,().

ComponentType

,MASTER.,:MASTER(SPEAKERS),DIGITAL,

LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,

WAVE,AUX,ANALOG,HEADPHONESN/A. ,ErrorLevel

.

AuxiliaryANALOGAUX.

(LINE),,.,.: Analog:2

analog.

ControlType

Page 1225: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,VOLUME.,:VOLUME(VOL),ONOFF,MUTE,

MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,

QSOUNDPAN,BASS,TREBLE,EQUALIZER(

ErrorLevel.

: VOLUME(VOL)MUTE,Windows.

DeviceNumber

1.,1(),WindowsVista. ..

ErrorLevel

[v1.1.04+]., .

ErrorLevel0.,:

InvalidControlTypeorComponentType

Can'tOpenSpecifiedMixer

MixerDoesn'tSupportThisComponentType

MixerDoesn'tHaveThatManyofThatComponentType

ComponentDoesn'tSupportThisControlType

Can'tGetCurrentSetting

Can'tChangeSetting

v1.1.10WindowsVista.

Page 1226: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, VA .

,:

Send{Volume_Up};1(5%).

Send{Volume_Down3};3.

Send{Volume_Mute};/.

()(), .

Windows2000/XP/2003:SoundSet,().,.

SoundSetWaveVolumeWAVE,.

WindowsVista(v1.1.10+):SoundSet.

SoundGet.

SoundGet,SoundGetWaveVolume,SoundSetWaveVolume,SoundPlay

;:

SoundSet,50;50%

SoundSet+10;10%

SoundSet-10;10%

SoundSet,1,Microphone,mute;

SoundSet,+1,,mute;()

SoundSet,+20,Master,bass;20%.

ifErrorLevel

Page 1227: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,TheBASSsettingisnotsupportedfor

MASTER.

().ListView.WindowsVista,(

): http://www.autohotkey.com/board/topic/90877-/

SetBatchLines-1

SplashTextOn,,,GatheringSoundcardInfo...

;,.;(

):CUSTOM,BOOLEANMETER,SIGNEDMETER,PEAKMETER,

;

UNSIGNEDMETER,BOOLEAN,BUTTON,DECIBELS,SIGNED,UNSIG

NED,PERCENT,SLIDER,FADER,SINGLESELECT,MUX,

;MULTIPLESELECT,MIXER,MICROTIME,MILLITIME

ControlTypes=

VOLUME,ONOFF,MUTE,MONO,LOUDNESS,STEREOENH,BASSBOOS

T,PAN,QSOUNDPAN,BASS,TREBLE,EQUALIZER,0x00000000,

0x10010000,0x10020000,0x10020001,0x10030000,0x2001

0000,0x21010000,0x30040000,0x30020000,0x30030000,0

x30050000,0x40020000,0x50030000,0x70010000,0x70010

001,0x71010000,0x71010001,0x60030000,0x61030000

ComponentTypes=

MASTER,HEADPHONES,DIGITAL,LINE,MICROPHONE,SYNTH,CD

,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A

;ListView,:

Gui,Add,Listview,w400h400vMyListView,

ComponentType|ControlType|Setting|Mixer

LV_ModifyCol(4,"Integer")

SetFormat,Float,0.2;.

Page 1228: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop;,.

{

CurrMixer:=A_Index

SoundGet,Setting,,,%CurrMixer%

ifErrorLevel=Can'tOpenSpecifiedMixer;

.

break

;,:

Loop,parse,ComponentTypes,`,

{

CurrComponent:=A_LoopField

;:

SoundGet,Setting,%CurrComponent%,,

%CurrMixer%

ifErrorLevel=MixerDoesn'tSupportThis

ComponentType

continue;.

Loop;,.

{

CurrInstance:=A_Index

;:

SoundGet,Setting,

%CurrComponent%:%CurrInstance%,,%CurrMixer%

;:

ifErrorLevelinMixerDoesn'tHave

ThatManyofThatComponentType,InvalidControl

TypeorComponentType

break;.

;:

Loop,parse,ControlTypes,`,

{

CurrControl:=A_LoopField

SoundGet,Setting,

%CurrComponent%:%CurrInstance%,%CurrControl%,

%CurrMixer%

;:

Page 1229: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifErrorLevelinComponentDoesn't

SupportThisControlType,InvalidControlTypeor

ComponentType

continue

ifErrorLevel;,,.

Setting:=ErrorLevel

ComponentString:=CurrComponent

ifCurrInstance>1

ComponentString=

%ComponentString%:%CurrInstance%

LV_Add("",ComponentString,

CurrControl,Setting,CurrMixer)

};.

};.

};.

};.

Loop%LV_GetCount("Col");.

LV_ModifyCol(A_Index,"AutoHdr")

SplashTextOff

Gui,Show

return

GuiClose:

ExitApp

Page 1230: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundSetWaveVolume.

SoundSetWaveVolume,Percent[,DeviceNumber]

Percent

-100100()( )., ., Percent.

DeviceNumber

,1(),.1.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

SoundGetWaveVolume.(,,,,) SoundSet

SoundGet.

WindowsVista(v1.1.10+): ComponentType Wave ControlType

Volume SoundSet..

Page 1231: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Windows2000/XP/2003: SoundSet,().

SoundGetWaveVolume,SoundSet,SoundGet,SoundPlay

SoundSetWaveVolume,50;.

SoundSetWaveVolume,-10;10(8070).

SoundSetWaveVolume,+20;20.

Page 1232: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Asc(String)StringUTF-16.

Number:=Asc(String)

String

.

,(ANSI)0255(Unicode)00xFFFF, Unicodevs

ANSI. String0.

Transform,OutputVar,Asc .

Unicodesupplementarycharacters(Unicode), Ord(String).

Transform,Ord(),Chr()

Page 1233: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;116,.

MsgBox,%Asc("t")

MsgBox,%Asc("test")

Page 1234: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Chr(Number)Number().

String:=Chr(Number)

Number

Unicode, Number00x10FFFF( [v1.1.21]0xFFFF);

ANSI,0255.

Number. Number.

Transform,OutputVar,Chr.

127 stringencoding() , UnicodeorANSI.

9(tab),10(linefeed),13(carriagereturn),32(space),48-

57(thedigits0-90-9),65-90(uppercaseA-ZA-Z),97-122

(lowercasea-za-z).

Page 1235: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Transform,Ord(),Asc()

MsgBox,%Chr(116);"t".

Page 1236: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Format [v1.1.17+]

,.

String:=Format(FormatStr[,Values...])

FormatStr

{Index:Format} .

Index.,1.

Format,.

index()., "{2:i}{:i}" . Index, Format : .

: {}

{{} {}} ,

,

Values

,.,1.

arr:=[13,240]

MsgBox%Format("{2:x}{1:02x}",arr*)

Page 1237: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FormatSpecifiers()

():

FlagsWidth.PrecisionULTType

Flags: - + 0 #

Width:..,, - () 0 (0)

.Precision:.,;,(Type),().

f ,e ,E :Precision,6

g ,G :Precision.6.

s :Precision,.

( d ,i ,u ,x ,X ,o ), 0 Width,1.

ULT[v1.1.20+]:-- Upper,Lower Title(,,),ULT s ,

{:U} {:.20Ts} ,LT l t , u

Type:, s .

- ()

+ ,(+-) (-)

0 width0,0. 0 - ,. 0 (i,u,x,X,o,d)(:{:04.d} ),0.

Page 1238: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,. + , .

#

#o,xX, 0 ,0x 0X .

#e,E,f,a,A,.

#gG,0.

#c,d,i,us.

d

i

u

x

X

; x "abcdef""ABCDEF", # , 0x , {:#x} . SetFormat,0x{:x} .

o

f [-] dddd.dddd, dddd.,.

e[-] d.dddde[]dd[d], d, dddd,dd[d],, +-.

E e ,Ee

g f e , g ,-4 e ;0,.

G g ,eE(e).

a[?]0x h.hhhhp±dd, h.hhhh(), dd,, ?,-

A a ,pP,dddd.

p .

Page 1239: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

s ., Width Precision .

c , Chr(n) ..

printf,Format().64-bit(64).

SetFormat,FormatTime

;

s.=Format("{2},{1}!`r`n","World","Hello")

;

s.=Format("|{:-10}|`r`n|{:10}|`r`n","Left",

"Right")

;

s.=Format("{1:#x}{2:X}0x{3:x}`r`n",

3735928559,195948557,0)

;

s.=Format("{1:0.3f}{1:.10f}",4*atan(1))

ListVars;AutoHotkey.

WinWaitActiveahk_classAutoHotkey

ControlSetTextEdit1,%s%

WinWaitClose

Page 1240: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FormatTime YYYYMMDDHH24MISS/.

FormatTime,OutputVar[,YYYYMMDDHH24MISS,Format]

OutputVar

.

YYYYMMDD...

., YYYYMMDDHH24MISS./(29),

OutputVar.16019999,,.

Format

,,.:4:55PMSaturday,November27,2004

,-(;).,M:M/d/yyyyh:mmtt

()

d (1-31)

dd (01–31)

ddd (Mon)

ddd (Monday)

M (1–12)

Page 1241: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MM (01–12)

MMM (Jan)

MMMM (January)

y ,(0–99)

yy ,(00-99)

yyyy .:2005

gg /()

()

h ;(1-12)

hh ;(01-12)

H ;(0-23)

HH ;(00-23)

m (0–59)

mm (00–59)

s (0–59)

ss (00–59)

t ,AP()

tt ,AMPM()

; Format..

() Format.,:4:55PMSaturday,November27,2004

Time ,5:26PM

Page 1242: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ShortDate ,02/29/04

LongDate ,Friday,April23,2004

YearMonth ,February,2004

YDay (1–366)

YDay0 (001–366)

WDay (1–7).1.

YWeek ISO8601.:200453.11,.,,.,14.

YYYYMMDDHH24MISS(,).,.

FormatTime,OutputVar,20040228LSysD1D4

R:.( Format).

Ln: ,.,LSys.,L(LCID).LCID,

www.microsoft.com:LocaleIdentifiers

Dn:. n:

0:..

1:( Format;28).

2:( Format;18).

4:().

8:-( Format;12).

0x10:.

Page 1243: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

0x20:.

0x80000000:.

0x40000000:ANSI.

Tn:. n:

0:..

1:.

2:.

4:(AM/PM).

8:.

12:.

0x80000000:.

0x40000000:ANSI.

Note:DnTn,: FormatTime,OutputVar,20040228D2D4

T1T8

Format OutputVar,,: 'Date:'MM/dd/yy'Time:'

hh:mm:sstt .

,(,tab,(`n),,,).:,(''''),.

Format,.,:,.,"hhyyyymm",.

Format(ddd)(MMMM),().

Page 1244: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Format2000, OutputVar.

, EnvAdd EnvSub.

( / YYYYMMDDHH24MISS),

www.autohotkey.com/forum/topic20405.html

: GuiDateTime,SetFormat,Transform,,FileGetTime

FormatTime,TimeString

MsgBoxThecurrenttimeanddate(timefirst)is

%TimeString%.

FormatTime,TimeString,R

MsgBoxThecurrenttimeanddate(datefirst)is

%TimeString%.

FormatTime,TimeString,,Time

MsgBoxThecurrenttimeis%TimeString%.

FormatTime,TimeString,T12,Time

MsgBoxThecurrent24-hourtimeis%TimeString%.

FormatTime,TimeString,,LongDate

MsgBoxThecurrentdate(longformat)is

%TimeString%.

FormatTime,TimeString,20050423220133,ddddMMMM

d,yyyyhh:mm:sstt

Page 1245: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxThespecifieddateandtime,when

formatted,is%TimeString%.

FormatTime,TimeString,200504,'MonthName':

MMMM`n'DayName':dddd

MsgBox%TimeString%

FormatTime,YearWeek,20050101,YWeek

MsgBoxJanuary1stof2005isinthefollowingISO

yearandweeknumber:%YearWeek%

;-:

FileSelectFile,FileName,3,,Pickafile

ifFileName=;.

return

FileGetTime,FileTime,%FileName%

FormatTime,FileTime,%FileTime%;,.

MsgBoxTheselectedfilewaslastmodifiedat

%FileTime%.

;

;,(hh:mm:ss).

MsgBox%FormatSeconds(7384);7384=2+3

+4.:2:03:04

FormatSeconds(NumberOfSeconds);hh:mm:ss.

{

time=19990101;**.

time+=%NumberOfSeconds%,seconds

FormatTime,mmss,%time%,mm:ss

returnNumberOfSeconds//3600":"mmss

/*

;,24:

FormatTime,hmmss,%time%,h:mm:ss

Page 1246: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

returnhmmss

*/

}

Page 1247: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

InStr().

FoundPos:=InStr(Haystack,Needle[,CaseSensitive=

false,StartingPos=1,Occurrence=1])

Parameters

Haystack

.

Needle

.

CaseSensitive

CaseSensitivefalse,( StringCaseSense);.

StartingPos

StartingPos1(Haystack1).,2,3,.

StartingPos Haystack0. [AHK_L57+]: StartingPos0

().

StartingPos, Haystack.,"abc""123abc789"4.

Occurrence[AHK_L57+]

Page 1248: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Occurrence Needle Haystack. Occurrence2,3,

.

Needle Haystack.1;0"false","".

IfInString StringGetPos, RegExMatch().

, RegExMatch().

RegExMatch(),StringGetPos,IfInString,StringCaseSense,ifvarin/contains

MatchList,ifvarbetween,ifvaristype

;1

MsgBox%InStr("123abc789","abc");4

;2

Haystack:="TheQuickBrownFoxJumpsOverthe

LazyDog"

Needle:="Fox"

IfInStr(Haystack,Needle)

MsgBox,Thestringwasfound.

Else

MsgBox,Thestringwasnotfound.

Page 1249: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;3

Haystack:="TheQuickBrownFoxJumpsOverthe

LazyDog"

Needle:="the"

MsgBox%InStr(Haystack,Needle,false,1,2);

,

MsgBox%InStr(Haystack,Needle,true);,,

Page 1250: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Ord(String) [v1.1.21+]

String.

Number:=Ord(String)

String

.

String, String0. StringUnicode,Unicode

(0x100000x10FFFF).0255(ANSI)00xFFFF

(Unicode). UnicodevsANSI.

Unicode Asc(),.

Asc(),Chr()

Page 1251: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;116,.

MsgBox,%Ord("t")

MsgBox,%Ord("test")

Page 1252: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:, ., abc abc123,123abc123 abcxyz., .

:(abc123)., \.*?+[{|()^$., \. \\.\Q...\E

.:\QLiteralText\E.

:,."i"., i)abc"abc"..

Page 1253: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()

,.," im)abc" abc(,).,(),.,,

.

i ,AZ.

m

. Haystack().,:

1)(^), Haystack( Haystack ).

2)($) Haystack().

," m)^abc$""m" Haystack"xyz`r`nabc".

"m""D".

s DotAll.(.)(,).,CRLF(`r`n),().,([^a]).

x ,.`n`tPCRE,/(,\n\t,PCRE). x#()..,;,(?(,.

A ; Haystack(,).,"^".

D ($) Haystack, Haystack.,$(,).:"m".

J ..:,,.

U . *+?{},."U",.,

X PCRE_EXTRA.PerlPCRE.,ErrorLevel..,(\ggg).,(\//).

P .RegExMatch(). UnquotedOutputVar.

S .().PCRE,,(S,,).(,5,3,"",.)

Page 1254: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

C . .

`n (`r`n)(`n),UNIX. (^$)

`r (`r`n)(`r).

`a

v1.0.46.06,`a,`r,`n,`r`n,`v/VT/verticaltab/chr(0xB),`f/FF/formfeed/chr(0xC)NEL/next-line/chr(0x85).v1.0.47.05,CR,LFCRLF,()(*ANYCRLF); im)(*ANYCRLF)^abc$ .

:tab.

Page 1255: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. ,(`r`n), DotAll(s),(`n) ,(`r) ,`a(*ANYCRLF)., ab. abc abz ab_.

*

, ., a* ab aaab."a".

: .*, (:`r`n)., abc.*123abcAnything123, abc123.

? , .""., colou?r color colour,"u".

+ , . a+ ab aaab. a* a?, a+"a".

{min,max} min max, ., a{1,2} ab aaaba.

,{3}3,{3 ,}3.:65536,.

[...]

: ()., [abc]"a,bc".;, [a-z]"az()".;".

*,?,+{min,max}., [0-9]+;xyz 123abcxyz.

[[:xxx:]]POSIX,xxx:alnum,alpha,ascii(0-127),blank(spacetab),cntrl(),digit(0-9),xdigit(),print,graph(),punct,lower,upper,space(),word( \w).

,; [\^a],[a\-b],[a\]] [\\a].

[^...] ., [^/]* , http://., [^0-9xyz]x,

Page 1256: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

yz.

\d ( [0-9]).\D" ". ;, [\d.-]",".

\s ,,tab(`r`n).\S" ".

\w "",,. [a-zA-Z0-9_].\W" ".

^$

(^)($) ,;,.

^., ^abc abc123123abc.

$., abc$123 abcabc123.

., ^abc$ abc().

, "m"., m)^abc$123`r`n abc`r`n789."m".

\b\b"",,. (\w) ,.., \bcat\bcatfish, cat.\B: .

| . ,., gray|grey gray grey.,gr(a|e)y.

(...)

:

., (Sun|Mon|Tues|Wednes|Thurs|Fri|Satur)day

. *,?,+ {min,max} ., (abc)+"abc"; abcabc123ab123bc123.. abc(.*)xyz. RegExMatch(), outputarray(). RegExReplace(), ($1). , ?:,: (?:.*):

Page 1257: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegExReplace("abc123efg555",

"abc(.*)efg(.*)","pre$1sub");

pre123sub

RegExReplace("abc123efg555",

"abc(?:.*)efg(.*)","pre$1sub");

pre555sub

., (?im)()., (?-im).DPS`r`n`a.

\t\r.

. \t(tab),\r() \n().AutoHotkey,(`)

.\xhh, hh00FFANSI.

v1.0.46.06+, \R"", `a(,\R "R").v1.0.47.05+, \RCR,LFCRLF,()(*BSR_ANYCRLF); im)(*BSR_ANYCRLF)abc\Rxyz

\p{xx}\P{xx}\X

[AHK_L61+]:Unicode.ANSI. \p{xx}xx\P{xx} xx., \pL \p{Lu}. \XUnicode.

, www.pcre.org/pcre.txt"\p{xx}".

(*UCP)[AHK_L61+]:,\d,\D,\s,\S,\w,\W,\b\BASCII,Unicode. (*UCP),Unicode.,\w [\p{L}\p{N}_]\d \p{Nd}.

:, *,?,+ {min,max}, .

,., <.+>():"<,,>".

<em>text</em>,: <.+?>.'>', <em>.

: (?=...),(?!...),(?<=...) (?<!...),.

Page 1258: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: abc(?=.*xyz),abcxyz(,).

(?=...) ,.

(?!...) , .

, (?<=...) (?<!...) , .

,, *,? +.

\K,., foo\Kbar"foobar""bar".

:RegExMatch(),RegExReplace() SetTitleMatchMode.

:,,.PCRE www.pcre.org/pcre.txt

Page 1259: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegExMatch() [v1.0.45+]

().

FoundPos:=RegExMatch(Haystack,NeedleRegEx[,

UnquotedOutputVar="",StartingPosition=1])

Haystack

.

NeedleRegEx

,Perl(PCRE). ().," i)abc.*123""abc",,

"123".,")";,")abc""abc".

UnquotedOutputVar

1(): OutputVar Haystack.(0),.

NeedleRegEx, OutputVar., Match, Match1,

Match2,. :.,"(?P<Year>\d{4})" MatchYear.(

),.

,, (Match). ,.,, .

2(): P(" P)abc.*123"), OutputVar(0). ,

:OutputVarPos OutputVarLen., Match,(1) MatchPos1,

Page 1260: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MatchLen1(0). :( MatchPosYear MatchLenYear).

3() [v1.1.05+]:O(" O)abc.*123"),

UnquotedOutputVar.(),.

StartingPosition

StartingPosition,1( Haystack).,2,3,.

StartingPosition Haystack, Haystack().

StartingPosition1, Haystack.,0-1.

StartingPosition Haystack, Haystack.

StartingPosition, Haystack.,"abc""123abc789"

4.

NeedleRegEx Haystack.1.0.( NeedleRegEx

),ErrorLevel 0.

ErrorLevel

[v1.1.04+]("",,"")., .

ErrorLevel:

0,.

: CompileerrorNatoffsetM:description., NPCRE, M,

description.

Page 1261: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, .,,""(-22),""(-21)""(-8).,

,*?,+{0,3}.

," i)abc","abc".

v1.1.05+

O, UnquotedOutputVar.:

Match.Pos(N):.

Match.Len(N):.

Match.Value(N):.

Match.Name(N):().

Match.Count():.

Match.Mark(): (*MARK:NAME) NAME.

Match[N]: N0, Match.Value(N) ., N.,

Match["Pos"] Match.Pos Match.Pos() ,"Pos",

Match.Value("Pos") .

Match.N:, N.

, N:

Page 1262: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

0.

,.

.

N,[].

, InStr()RegExMatch().

,100().

(), (S) .

,"(?P<Year>\d{4})" Year.32."O"():(\1), ().

,"Year", OutputVarYear, OutputVar1().,"Year" ,

OutputVar2, OutputVar1.

(abc123)., \.*?+[{|()^$., \. \\.\Q...\E.

: \QLiteralText\E .

,()(`)(\)., x`t\t.

(), .

AutoHotkey www.pcre.orgPerl(PCRE).

Page 1263: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegExReplace(),,,InStr(),IfInString,StringGetPos,SubStr(),

SetTitleMatchModeRegEx,Grep()

: FileRead,UrlDownloadToFile,Clipboard,GUIEdit

FoundPos:=RegExMatch("xxxabc123xyz","abc.*xyz")

;4,.

FoundPos:=RegExMatch("abc123123","123$");

7,$.

FoundPos:=RegExMatch("abc123","i)^ABC");

1,.

FoundPos:=RegExMatch("abcXYZ123","abc(.*)123",

SubPat);1,"XYZ"SubPat1.

FoundPos:=RegExMatch("abc123abc456","abc\d+",

"",2);71,StartingPosition21.

;, .

Page 1264: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegExReplace() [v1.0.45+]

().

NewStr:=RegExReplace(Haystack,NeedleRegEx[,

Replacement="",OutputVarCount="",Limit=-1,

StartingPosition=1])

Haystack

.

NeedleRegEx

,Perl(PCRE). ().," i)abc.*123""abc",,

"123".,")";,")abc""abc".

Replacement

,().$1, Haystack .$0$9,$0

,$1,$2,.9(9,),;${10},

${11},. ,;${SubpatternName}.$,$$(;

).

,$:Uu(),Ll(),Tt(,,).,$U1

$U{1}.

Haystack,"(abc)|(xyz)",.

Page 1265: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OutputVarCount

(0)().

Limit

Limit,-1, Haystack .,. Haystack.

StartingPosition

StartingPosition,1( Haystack).,2,3,.

StartingPosition Haystack, Haystack().

StartingPosition1, Haystack.,0-1.

StartingPosition Haystack, Haystack.

StartingPosition, Haystack, StartingPosition1

.

Haystack., Haystack.( NeedleRegEx),

Haystack(1.0.46.06,"")ErrorLevel 0.

ErrorLevel

[v1.1.04+]("",,"")., .

ErrorLevel:

0,.

Page 1266: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: CompileerrorNatoffsetM:description., NPCRE, M,

description.

, .,,""(-22),""(-21)""(-8).,

,*?,+{0,3}.

," i)abc","abc".

, StringReplace,RegExReplace().

, Limit,().,,1.

,100().

(), (S) .

(abc123)., \.*?+[{|()^$., \. \\.\Q...\E.

: \QLiteralText\E .

,()(`)(\).,`t\t.

(), .

Page 1267: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegExMatch(),,,StringReplace,InStr()

: FileRead,UrlDownloadToFile,Clipboard,GUIEdit

NewStr:=RegExReplace("abc123123","123$","xyz")

;"abc123xyz",$.

NewStr:=RegExReplace("abc123","i)^ABC");

"123",.

NewStr:=RegExReplace("abcXYZ123","abc(.*)123",

"aaa$1zzz");"aaaXYZzzz", $1 .

NewStr:=RegExReplace("abc123abc456","abc\d+",

"",ReplacementCount);""2

ReplacementCount.

;, .

Page 1268: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetEnv(Var=Value).

SetEnv,Var,Value

Var=Value

Var

Value .

., ,.

, Value Vartab., AutoTrimOff.

"SetEnv",AutoItv2.AutoItv2,AutoHotkey.32KB

. EnvSetSetEnv .

, Var= .

OutputVar. OuputVar, array%i%=123 ..

Page 1269: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoTrim,EnvSet,EnvAdd,EnvSub,EnvMult,EnvDiv,If,

Var1=Thisisastring.

Color2=450

Color3=%Var1%

Array%i%=%A_TICKCOUNT%

Page 1270: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Sort,().

Sort,VarName[,Options]

VarName

.

.

(,):

C:( N). C CL,A-Z.

CL[v1.0.43.03+]:.,A-ZANSI?ü."",

"coop""co-op".,18.

Dx: x, VarName., x(`n), VarNameLF(`n)

CR+LF(`r`n).

FMyFunction[v1.0.47+]: MyFunction()."F"/tab,

..,;,0,"";.,(0.80).,/

Page 1271: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()().,Sort( StringCaseSense

: F D,Z U(, N,C CL ).,:1);2)

;3) ByRef.

N::(,,23340).(0xF1)..64,(

).

Pn: n( n)., n1,. n. n,. N

(),,.

R:().

Random:. D,Z U(, N,C CL).:

Sort,MyVar,Random

Sort,MyVar,RandomZD|

U:. ErrorLevel(0). C,. N,22.0.

Pn \(),,. Random FFunction,(:"F

Function",).,"A|B|A",A.

Z:,RED`nGREEN`nBLUE`n. Z,(`n),. Z,

`n(),().

\:.,.(),,AAA.txtBBB.txt,:

C:\BBB\AAA.txt

C:\AAA\BBB.txt

Page 1272: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:, N P.

,(`n). FileRead.

VarName Clipboard(),.,.

U ErrorLevel.

#MaxMem.

,, MyVar= .

FileRead,,,StringSplit,RegisterCallback(),,#MaxMem

MyVar=5,3,7,9,1,13,999,-4

SortMyVar,ND,;,.

MsgBox%MyVar%;-4,1,3,5,7,9,13,999

;:

FileRead,Contents,C:\AddressList.txt

ifnotErrorLevel;.

{

Sort,Contents

FileDelete,C:\AddressList(alphabetical).txt

FileAppend,%Contents%,C:\AddressList

(alphabetical).txt

Page 1273: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Contents=;.

}

;Win+C

;,:

#c::

Clipboard=;.

Send^c

ClipWait2

ifErrorLevel

return

SortClipboard

MsgBoxReadytobepasted:`n%Clipboard%

return

;.

MyVar=def`nabc`nmno`nFGH`nco-

op`ncoop`ncop`ncon`n

Sort,MyVar,FStringSort

StringSort(a1,a2)

{

returna1>a2?1:a1<a2?-1:0;

StringCaseSense.

}

MyVar=5,3,7,9,1,13,999,-4

Sort,MyVar,FIntegerSortD,

IntegerSort(a1,a2)

{

returna1-a2;.64.

}

MyVar=1,2,3,4

Sort,MyVar,FReverseDirectionD,;,

4,3,2,1

ReverseDirection(a1,a2,offset)

{

Page 1274: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

returnoffset;a2a1;.

}

Page 1275: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringCaseSense("").

StringCaseSense,On|Off|Locale

On|Off|Locale

On:. (=) InStr() locale.

Off():A-Z.,(, Locale Off18).

>Locale[v1.0.43.03+]: ,.,,A-Z,

ANSI,?ü.

:

(==)., (=) , StringCaseSense On Locale

, InStr().

IfInString,StringGetPos InStr().,InStr() CaseSensitive true

.

StringReplace

ifvarin/containsMatchList,ifvarbetween IfEqual.

[AHK_L42+]:ifvaris[not]type Locale.

Page 1276: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

A_StringCaseSense(On,OffLocale).

( , ).().

IfEqual,IfInString,ifvarbetween,StringReplace,StringGetPos

StringCaseSenseLocale

Page 1277: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringGetPos.

StringGetPos,OutputVar,InputVar,SearchText[,

L#|R#,Offset]

Position:=InStr(Haystack,Needle[,CaseSensitive?,

StartingPos]); InStr() .

OutputVar

InputVar.StringGetPos0, InStr()1.

InputVar

., .

SearchText

. StringCaseSense,.

L#|R#

SearchText InputVar,., InputVar,.1

R, InputVar,.

,LR.,,r4.:,.

Offset

Page 1278: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

().0.,: StringGetPos,OutputVar,

InputVar,abc,,9 . .

ErrorLevel

InputVar SearchText ErrorLevel1,0.

StringMid InStr(),StringGetPos0.

InputVar, L#|R#/ Offset.,123abc789"abc",

3,.

SearchText InputVar, OutputVar-1 ErrorLevel1.

SplitPath,.

%A_Space% %A_Tab%tab.tab SearchTexttab,

.

InStr(),RegExMatch(),IfInString,ifvarin/containsMatchList,

StringCaseSense,StringReplace,SplitPath,StringLeft,StringRight,StringMid,

StringTrimLeft,StringTrimRight,StringLen,StringLower,StringUpper,ifvaris

type

Page 1279: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Haystack=abcdefghijklmnopqrs

Needle=def

StringGetPos,pos,Haystack,%Needle%

ifpos>=0

MsgBox,Thestringwasfoundatposition

%pos%.

;#2:

;.

; StringSplit

; ,.

FileSelectFile,file,,,Pickafilenameina

deeplynestedfolder:

iffile<>

{

StringLen,pos_prev,file

pos_prev+=1;.

Loop

{

;N:

StringGetPos,pos,file,\,R%A_Index%

ifErrorLevel

break

length:=pos_prev-pos-1

pos_prev:=pos

pos+=2;StringMid.

StringMid,path_component,file,%pos%,

%length%

MsgBoxPathcomponent#%a_index%(fromthe

right)is:`n%path_component%

}

}

Page 1280: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringLeft/StringRight.

StringLeft,OutputVar,InputVar,Count

StringRight,OutputVar,InputVar,Count

NewStr:=SubStr(String,StartPos[,Length]);

SubStr()function.

OutputVar

InputVar.

InputVar

., .

Count

, . Count, OutputVar. Count InputVar

, OutputVar InputVar.

, OutputVar InputVar.

Page 1281: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SubStr(),StringMid,StringTrimLeft,StringTrimRight,IfInString,StringGetPos,

StringLen,StringLower,StringUpper,StringReplace

String=Thisisatest.

StringLeft,OutputVar,String,4;"This"

OutputVar.

StringRight,OutputVar,String,5;"test."

OutputVar.

Page 1282: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StrLen/StringLen.

OutputVar:=StrLen(InputVar)

StringLen,OutputVar,InputVar

OutputVar

.

InputVar

., .

InputVar ClipboardAll,StringLen.

IfInString,StringGetPos,StringMid,StringTrimLeft,StringTrimRight,

StringLeft,StringRight,StringLower,StringUpper,StringReplace

InputVar:="TheQuickBrownFoxJumpsOverthe

Page 1283: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LazyDog"

MsgBox%"ThelengthofInputVaris".

StrLen(InputVar);:43

StringLen,length,InputVar

MsgBox,ThelengthofInputVaris%length%.

Page 1284: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringLower/StringUpper.

StringLower,OutputVar,InputVar[,T]

StringUpper,OutputVar,InputVar[,T]

OutputVar

.

InputVar

., .

T

T,.,"GONEwiththeWIND""GoneWithTheWind".

, "ifvaris[not]upper/lower".

, OutputVar InputVar.

[v1.1.20+]:Format(),:

MsgBox%Format("{:U},{:L}and{:T}","upper",

"LOWER","title")

Page 1285: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Format(),IfInString,StringGetPos,StringMid,StringTrimLeft,StringTrimRight,

StringLeft,StringRight,StringLen,StringReplace

StringUpper,String1,String1;.

StringLower,String2,String2

Page 1286: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringMid.

StringMid,OutputVar,InputVar,StartChar[,Count,

L]

NewStr:=SubStr(String,StartPos[,Length]);

SubStr()function.

OutputVar

InputVar.

InputVar

., .

StartChar

, . StringGetPos,1. StartChar1,1.

StartChar, OutputVar.

Count

v1.0.43.10+,,.

,, . Count, OutputVar. Count

InputVar StartChar, OutputVar InputVar StartChar

.

Page 1287: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

L

L StartChar., OutputVar Red:

InputVar=TheRedFox

StringMid,OutputVar,InputVar,7,3,L

L StartChar1, OutputVar. StartChar InputVar

, Count., OutputVar Fox:

InputVar=TheRedFox

StringMid,OutputVar,InputVar,14,6,L

, OutputVar InputVar.

SubStr(),StringLeft,StringRight,StringTrimLeft,StringTrimRight,IfInString,

StringGetPos,StringLen,StringLower,StringUpper,StringReplace

Source=Hellothisisatest.

StringMid,the_word_this,Source,7,4

Page 1288: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringReplace.

OutputVar:=StrReplace(Haystack,SearchText[,

ReplaceText,OutputVarCount,Limit:=-1]);

v1.1.21+

StringReplace,OutputVar,InputVar,SearchText[,

ReplaceText,ReplaceAll?]

OutputVar

.

InputVarorHaystack

., .

StrReplace(), Haystack.

SearchText

. StringCaseSense,.

ReplaceText

SearchText., SearchText., OutputVar.

OutputVarCount(StrReplace)

Page 1289: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(0).

Limit(StrReplace)

Limit,-1, Haystack.,, Haystack.

ReplaceAll?(StringReplace)

, SearchText.1,AAll,.

UseErrorLevelErrorLevel(0).UseErrorLevel"All".

ErrorLevel

StrReplace:ErrorLevel.

UseErrorLevel, ErrorLevel(0)., InputVar SearchText

ErrorLevel1,0.

, OutputVar InputVar.

%A_Space% %A_Tab%tab.tab SearchTexttab,

.

v1.0.45,,AllSlow.,.

RegExReplace(),IfInString,StringCaseSense,StringLeft,StringRight,

Page 1290: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringMid,StringTrimLeft,StringTrimRight,StringLen,StringLower,

StringUpper,StringGetPos,ifvaristype

;CR+LF:

StringReplace,clipboard,clipboard,`r`n,,All

;:

StringReplace,NewStr,OldStr,%A_SPACE%,+,All

;:

Loop

{

StringReplace,MyString,MyString,`r`n`r`n,

`r`n,UseErrorLevel

ifErrorLevel=0;.

break

}

Page 1291: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringSplit/StrSplit().

StringSplit,OutputArray,InputVar[,Delimiters,

OmitChars]

Array:=StrSplit(String[,Delimiters,OmitChars])

;[v1.1.13+]

StringSplit

OutputArray

InputVar.,MyArray,MyArray0(0),

MyArray1,MyArray2.

,, MyArray0( ,).,, .: Functions.

InputVar

., .: InputVar OutputArray.

, InputVar.

, Delimiters(), InputVar., OutputArray.,

InputVar,.

Page 1292: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: `, ().,%A_Tab%%A_Space% InputVartab.

, StringReplace.,<br>:

StringReplace,NewHTML,HTMLString,<br>,

``,All;<br>.

StringSplit,MyArray,NewHTML,``;.

StrSplit()[v1.1.13+]

Array()

()

().

String

.

,.

, Delimiters,.,.,,.

: "," ., [A_Tab,A_Space] tab.

OmitChars

(),. OmitChars %A_Space%%A_Tab% (StringSplit)"

`t" (StrSplit),()tab.

Page 1293: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Delimiters, OmitChars.

,StringSplit OmitChars(`,).

,StringSplitN,N InputVar.N.,

(MyArray0).

tab, OmitChars. Trimtab.: MyArray1:=

Trim(MyArray1) .

CSV(), CSV.

, Sort.

, , InputVar.:

Colors=red,green,blue

Loop,parse,Colors,`,

MsgBoxColornumber%A_Index%is

%A_LoopField%.

,Arrays,Sort,SplitPath,IfInString,StringGetPos,StringMid,StringTrimLeft,

StringTrimRight,StringLen,StringLower,StringUpper,StringReplace

Page 1294: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TestString=Thisisatest.

StringSplit,word_array,TestString,%A_Space%,.

;.

MsgBox,The4thwordis%word_array4%.

Colors=red,green,blue

StringSplit,ColorArray,Colors,`,

Loop,%ColorArray0%

{

this_color:=ColorArray%a_index%

MsgBox,Colornumber%a_index%is

%this_color%.

}

TestString:="Thisisatest."

word_array:=StrSplit(TestString,A_Space,".")

;.

MsgBox%"The4thwordis"word_array[4]

Colors:="red,green,blue"

ColorArray:=StrSplit(Colors,",")

Loop%ColorArray.MaxIndex()

{

this_color:=ColorArray[a_index]

MsgBox,Colornumber%a_index%is

%this_color%.

}

Page 1295: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringTrimLeft/StringTrimRight.

StringTrimLeft,OutputVar,InputVar,Count

StringTrimRight,OutputVar,InputVar,Count

NewStr:=SubStr(String,StartPos[,Length]);

SubStr()function.

OutputVar

InputVar.

InputVar

., .

Count

, . Count, OutputVar InputVar. Count

InputVar, OutputVar.

, OutputVar InputVar.

Page 1296: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SubStr(),StringMid,StringLeft,StringRight,IfInString,StringGetPos,

StringLen,StringLower,StringUpper,StringReplace

String=Thisisatest.

StringTrimLeft,OutputVar,String,5;"isa

test."OutputVar.

StringTrimRight,OutputVar,String,6;"This

isa"OutputVar.

Page 1297: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Trim [AHK_L31+]

/.

Result:=Trim(String,OmitChars="`t")

Result:=LTrim(String,OmitChars="`t")

Result:=RTrim(String,OmitChars="`t")

String

..

OmitChars

(), String/.,tab.

text:="text"

MsgBox%"Notrim:`t'"text"'"

."`nTrim:`t'"Trim(text)"'"

."`nLTrim:`t'"LTrim(text)"'"

."`nRTrim:`t'"RTrim(text)"'"

MsgBox%LTrim("00000123","0")

Page 1298: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Control.

Control,Cmd[,Value,Control,WinTitle,WinText,

ExcludeTitle,ExcludeText]

Cmd,Value

.

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

Page 1299: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

ExcludeText

.

Cmd,Value

Cmd Value,.

Check:().

Uncheck:.

Enable:.

Disable:"".

Show:.

Hide:.(), ControlDisable .

Style,NExStyle,N:. N, N.(^),N.,

N./ ErrorLevel1.

WinSetRedraw., .:

Control,Style,^0x800000,Edit1,WinTitle;

WS_BORDER.

ShowDropDown:(ComboBox),.

Page 1300: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

HideDropDown:.

TabLeft[,Count] TabRight[,Count]:SysTabControl32. Count

,1.,51.,0,1,:

SendMessage,0x1330,5,,SysTabControl321,

WinTitle;0x1330TCM_SETCURFOCUS.

Sleep0;.

SendMessage,0x130C,5,,SysTabControl321,

WinTitle;0x130CTCM_SETCURSEL.

Add,String: String(ListBox)(ComboBox)().

Delete,N:(ListBox)(ComboBox)N. N1,2,.

Choose,N:(ListBox)(ComboBox)N. N1,2,. ,

:

PostMessage,0x185,1,-1,ListBox1,WinTitle

;.0x185LB_SETSEL.

ChooseString,String: String..,(ListBox)/(ComboBox)

"UNIXText",unix().

EditPaste,String:(Editcontrol)/ String( ).

ErrorLevel

[v1.1.04+]., .

Page 1301: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

,( Style ExStyle). SetControlDelay.

ClassNNHWND, MouseGetPos.

. DetectHiddenWindows,.

SetControlDelay,ControlGet,GuiControl,ControlGetText,ControlSetText,

ControlMove,ControlGetPos,ControlClick,ControlFocus,ControlSend,WinSet

Control,HideDropDown,,ComboBox1,SomeWindow

Title

Page 1302: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlFocus.

ControlFocus[,Control,WinTitle,WinText,

ExcludeTitle,ExcludeText]

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

Page 1303: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

,.

,. SetControlDelay.

ClassNNHWND, MouseGetPos.

. DetectHiddenWindows,.

SetControlDelay,ControlGetFocus,Control,ControlGet,ControlMove,

ControlGetPos,ControlClick,ControlGetText,ControlSetText,ControlSend

ControlFocus,OK,SomeWindowTitle;OK

Page 1304: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlGet.

ControlGet,OutputVar,Cmd[,Value,Control,

WinTitle,WinText,ExcludeTitle,ExcludeText]

OutputVar

Cmd.

Cmd,Value

.

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

WinTitle

. WinTitle.

WinText

Page 1305: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Cmd,Value

Cmd Value,.

List:,,.

ListView::

ControlGet,OutputVar,List,Options,

SysListView321,WinTitle,WinText

Options,.(`n).,()tab(`t).

Options,tab:

Selected:()., OutputVar. Focused:., OutputVar

.

Col4:()(4).

Count:(). CountSelected:(). CountFocused:()(

0). CountCol:(-1).

Page 1306: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:,.,ErrorLevel0(). #MaxMem.

,ErrorLevel0.,1 OutputVar.:1)2)

SysListView323),4)

, ,:

ControlGet,List,List,Selected,

SysListView321,WinTitle

Loop,Parse,List,`n;(`n).

{

RowNumber:=A_Index

Loop,Parse,A_LoopField,%A_Tab%;()

tab(A_Tab).

MsgBoxRow#%RowNumber%Col#%A_Index%

is%A_LoopField%.

}

, SendMessage,:

SendMessage,4126,0,80,SysListView321,

WinTitle;4126LVM_SETCOLUMNWIDTH.

;,0(1,2,.),80.

;80-1.-2,.

ListBox,ComboBox,DropDownList:(, CountSelected).

(`n)., ,:

ControlGet,List,List,,ComboBox1,WinTitle

Loop,Parse,List,`n

MsgBoxItemnumber%A_Index%is

Page 1307: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%A_LoopField%.

Checked:, OutputVar1;0.

Enabled: Control, OutputVar1;0.

Visible: Control, OutputVar1;0.

Tab: OutputVarSysTabControl32.1,2,.(),

:

SendMessage,0x1304,,,SysTabControl321,

WinTitle;0x1304TCM_GETITEMCOUNT.

TabCount=%ErrorLevel%

FindString,String: OutputVar String.1,2,.,

OutputVarErrorLevel1.

Choice:OutputVar.,():

SendMessage,0x188,0,0,ListBox1,WinTitle;

0x188LB_GETCURSEL().

SendMessage,0x147,0,0,ComboBox1,WinTitle

;0x147CB_GETCURSEL().

ChoicePos=%ErrorLevel%;,-1.

ChoicePos+=1;01,1,0.

LineCount: OutputVar.,.

CurrentLine: OutputVar().1., OutputVar.

Page 1308: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CurrentCol: OutputVar().1., OutputVar.

Line,N: OutputVar N.1., OutputVar(`r)(`r`n)

., ErrorLevel1 OutputVar.

Selected: OutputVar.,OutputVarErrorLevel0().

,RichEdit20A,(Metapad).

Style:8. .

ExStyle:8.

Hwnd[v1.0.43.06+]:(HWND).: ControlGet,OutputVar,

Hwnd,,Edit1,WinTitle .HWND PostMessage,SendMessage

DllCall., MouseGetPosHWND.,HWND ahk_id

WinTitle( DetectHiddenWindows,).

ErrorLevel

[v1.1.04+]., .

, ErrorLevel0.,, ErrorLevel1 OutputVar.

,ControlGet;, SetControlDelay.

ClassNNHWND, MouseGetPos., WinGetControlList.

. DetectHiddenWindows,.

Page 1309: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Control,GuiControlGet,ControlMove,ControlGetText,ControlSetText,

ControlGetPos,ControlClick,ControlFocus,ControlSend,WinGet

ControlGet,OutputVar,Line,1,Edit1,SomeWindow

Title

ControlGet,WhichTab,Tab,,SysTabControl321,

SomeWindowTitle

ifErrorLevel

MsgBoxTherewasaproblem.

else

MsgBoxTab#%WhichTab%isactive.

Page 1310: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlGetFocus,.

ControlGetFocus,OutputVar[,WinTitle,WinText,

ExcludeTitle,ExcludeText]

OutputVar

,,Button12.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

Page 1311: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, ErrorLevel0.()1.

,.

,., OutputVar.

v1.1.19.03,ControlGetFocus(500ms),..

WinTitle()WinText(). DetectHiddenWindowson,.

ControlFocus,ControlMove,ControlClick,ControlGetText,ControlSetText,

ControlSend

ControlGetFocus,OutputVar,Untitled-Notepad

ifErrorLevel

MsgBox,Thetargetwindowdoesn'texistor

noneofitscontrolshasinputfocus.

else

MsgBox,Controlwithfocus=%OutputVar%

Page 1312: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlGetPos.

ControlGetPos[,X,Y,Width,Height,Control,

WinTitle,WinText,ExcludeTitle,ExcludeText]

X,Y

ControlXY()., ControlMove.

XY,.

Width/Height

Control().,.

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

WinTitle

. WinTitle.

Page 1313: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

,.

,ControlGetPos( SetControlDelay).

ClassNNHWND, MouseGetPos., WinGet.

. DetectHiddenWindows,.

ControlMove,WinGetPos,Control,ControlGet,ControlGetText,

ControlSetText,ControlClick,ControlFocus,ControlSend

;

;:

Loop

Page 1314: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

Sleep,100

MouseGetPos,,,WhichWindow,WhichControl

ControlGetPos,x,y,w,h,%WhichControl%,

ahk_id%WhichWindow%

ToolTip,%WhichControl%`nX%X%`tY%Y%`nW%W%`t%H%

}

Page 1315: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlGetText.

ControlGetText,OutputVar[,Control,WinTitle,

WinText,ExcludeTitle,ExcludeText]

OutputVar

.

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

Page 1316: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

:,, ControlGetList.

(),ControlGetText VarSetCapacity(OutputVar,55) [55

].WM_GETTEXTLENGTH,AutoHotkey.

( #MaxMem).,(),.,, OutputVar= .

(`r`n)(`n).

SetTitleMatchModeSlow ,ControlGetText().

, WinGetControlList.

. DetectHiddenWindows,.

Page 1317: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlSetText,WinGetText,Control,ControlGet,ControlMove,ControlFocus,

ControlClick,ControlSend,#MaxMem

ControlGetText,OutputVar,Edit1,Untitled-

Page 1318: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlMove.

ControlMove,Control,X,Y,Width,Height[,

WinTitle,WinText,ExcludeTitle,ExcludeText]

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

X,Y

ControlXY(), ., Control. Control

; ControlGetPosWindowSpy.

Width,Height

Control(), ., Control.

WinTitle

. WinTitle.

Page 1319: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

,. SetControlDelay.

. DetectHiddenWindows,.

ControlGetPos,WinMove,SetControlDelay,Control,ControlGet,

ControlGetText,ControlSetText,ControlClick,ControlFocus,ControlSend

SetTimer,ControlMoveTimer

Page 1320: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

InputBox,OutputVar,MyInputBox

return

ControlMoveTimer:

IfWinNotExist,MyInputBox

return

;"":

SetTimer,ControlMoveTimer,off

WinActivate

ControlMove,OK,10,,200;OK.

return

Page 1321: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlSetText.

ControlSetText[,Control,NewText,WinTitle,

WinText,ExcludeTitle,ExcludeText]

Control

ClassNN(),WindowSpy., SetTitleMatchMode.,

.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

ControlGetHwnd,MouseGetPos DllCall.

NewText

.,.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

Page 1322: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

(`r`n)(`n).`n,:

StringReplace,MyVar,MyVar,`n,`r`n,All

,. SetControlDelay.

. DetectHiddenWindows,.

SetControlDelay,ControlGetFocus,ControlGetText,ControlGet,Control,

ControlMove,ControlGetPos,ControlClick,ControlFocus,ControlSend

ControlSetText,Edit1,NewTextHere,Untitled-

Page 1323: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 1324: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PostMessage/SendMessage(SendMessage).

PostMessage,Msg[,wParam,lParam,Control,

WinTitle,WinText,ExcludeTitle,ExcludeText]

SendMessage,Msg[,wParam,lParam,Control,

WinTitle,WinText,ExcludeTitle,ExcludeText,

Timeout]

Msg

, . .

wParam

, .,0.

lParam

, .,0.

Control

,.ClassNN(),WindowSpy.,

SetTitleMatchMode.

HWND(), Control WinTitle ahk_id

%ControlHwnd% ( DetectHiddenWindows,).HWND

Page 1325: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ControlGetHwnd,MouseGetPos DllCall.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Timeout

[AHK_L42+]:.,5000(),AutoHotkey.,ErrorLevel

FAIL. .

ErrorLevel

[v1.1.04+]., .

PostMessage:() ErrorLevel1.0.

SendMessage:, ErrorLevelFAIL.,,"".

AutoHotkey.32AutoHotkey,32,3204294967295

.64AutoHotkey64,64-9223372036854775808

Page 1326: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

9223372036854775807.

32(-21474836482147483648),32,:

MsgReply:=ErrorLevel<<32>>32

AutoHotkey64,,32zero-extended().,AutoHotkey

,32-10xFFFFFFFF,32AutoHotkey64-1

0xFFFFFFFF,64AutoHotkey-1.

,()..

PostMessage..,SendMessage.

wParam lParam.AutoHotkey32-bit,low32bits(32)

;, -2147483648and4294967295(0xFFFFFFFF).

AutoHotkey64-bit, AutoHotkey.AutoHotkey,0x

.,0xFF255.

wParam lParam(). (&) :

SendMessage,0xC,0,&MyVar,ClassNN,WinTitle

;0XCWM_SETTEXT

v1.0.43.06+,MyVar.,(&);, 5+&MyVar ,

&MyVar &MyVar+5 .

Page 1327: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(),(&):

RunNotepad

WinWaitUntitled-Notepad

SendMessage,0xC,0,"NewNotepadTitle";0XC

WM_SETTEXT

,, WinTitle ahk_id0xFFFF (0xFFFF

HWND_BROADCAST).,:

SendMessage,0x1A,,,,ahk_id0xFFFF;0x1A

WM_SETTINGCHANGE

, OnMessage().

.

. DetectHiddenWindows,.

,,OnMessage(),Winamp ,DllCall,ControlSend,WinMenuSelectItem

#o::;Win+O.

Sleep1000;().

;:

SendMessage,0x112,0xF170,2,,ProgramManager;

0x112isWM_SYSCOMMAND,0xF170isSC_MONITORPOWER.

;:-12.

Page 1328: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;12.

return

;:

SendMessage,0x112,0xF140,0,,ProgramManager;

0x112isWM_SYSCOMMAND,and0xF140is

SC_SCREENSAVE.

;():

ControlGetFocus,control,A

SendMessage,0x115,0,0,%control%,A

;:

ControlGetFocus,control,A

SendMessage,0x115,1,0,%control%,A

;/:

PostMessage,0x50,0,0x4090409,,A;0x50is

WM_INPUTLANGCHANGEREQUEST.

;Winamp:

SetTitleMatchMode,2

SendMessage,1024,0,120,-Winamp

ifErrorLevel<>FAIL

{

ErrorLevel++;Winamp"0",1.

MsgBox,Track#%ErrorLevel%isactiveor

playing.

}

; Winamp .

;AHKID(" WinGetPID"):

SetTitleMatchMode,2

DetectHiddenWindows,on

SendMessage,0x44,0x405,0,,SomeOtherScript.ahk

-AutoHotkeyv

MsgBox%ErrorLevel%istheprocessid.

Page 1329: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 1330: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetControlDelay.

SetControlDelay,Delay

Delay

, .-1,0.,20.

,(), Control,ControlMove,ControlClick,ControlFocus

ControlSetText(ControlSend, SetKeyDelay).,"".,

.

-1(),0,CPU.

0Sleep(0),.,Sleep(0).

CPU,.

A_ControlDelay.

( , ).().

Page 1331: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Control,ControlMove,ControlClick,ControlFocus,ControlSetText,

SetWinDelay,SetKeyDelay,SetMouseDelay,SetBatchLines

SetControlDelay,0

Page 1332: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinMenuSelectItem.

WinMenuSelectItem,WinTitle,WinText,Menu[,

SubMenu1,SubMenu2,SubMenu3,SubMenu4,SubMenu5,

SubMenu6,ExcludeTitle,ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

Menu

,File,Edit,View.,1&,2&.

SubMenu1

().

SubMenu2

SubMenu1,.

SubMenu3

.

Page 1333: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SubMenu4

.

SubMenu5

.

SubMenu6

.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0.

,., .

.MicrosoftOutlookOutlookExpress,., ControlSend

PostMessage,.

Page 1334: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(File->Savefile->save),(&)(&FileFile).

.().1&(File),2&(Edit).,

.

. DetectHiddenWindows,.

ControlSend,PostMessage

;->:

WinMenuSelectItem,Untitled-Notepad,,File,

Open

;,:

WinMenuSelectItem,Untitled-Notepad,,1&,2&

Page 1335: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupActivate GroupAdd.

GroupActivate,GroupName[,R]

GroupName

, GroupAdd.

R

,.,.R,(),."R". GroupActivate,

GroupDeactivate GroupClose,.

ErrorLevel [AHK_L54+]

ErrorLevel1,0.

.,.,.

,()., #WinActivateForce.

GroupAdd.

Page 1336: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupAdd,GroupDeactivate,GroupClose,#WinActivateForce

GroupActivate,MyGroup,R

Page 1337: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupAdd,.

GroupAdd,GroupName[,WinTitle,WinText,Label,

ExcludeTitle,ExcludeText]

GroupName

.,..

WinTitle

. WinTitle.

WinText

,(WindowSpy). GroupActivate,GroupDeactivate

GroupClose DetectHiddenTextON,.

GroupActivate,(AHK_L54 ). Gosub.,

.

ExcludeTitle

.

ExcludeText

Page 1338: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

.,. GroupActivate,.,.

SetTitleMatchMode DetectHiddenWindows,( GroupActivate

GroupClose). WinTitleahk_group.

,.,, GroupActivate(),alt-tab.

,()..

(ProgramManager),:

GroupAdd,AllWindows

WinTitle ahk_groupMyGroupName ,. WinMinimize,

WinMaximize,WinRestore,WinHide,WinShow,WinClose WinKill

.,:

WinHide%"ahk_id".WinExist("ahk_group

MyGroup")

,( WinActivate IfWinExist).

GroupActivate,GroupDeactivate,GroupClose

Page 1339: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

GroupAdd,MSIE,ahk_classIEFrame;Internet

Explorer.

return;.

;,

;MSIE,

;().

Numpad1::GroupActivate,MSIE,r

;MSOutlook2002.;:

SetTitleMatchMode,2

GroupAdd,mail,Message-MicrosoftWord;

GroupAdd,mail,-Message(;

;:

GroupAdd,mail,AdvancedFind,Sear&chforthe

word(s)

GroupAdd,mail,,Recurrence:

GroupAdd,mail,Reminder

GroupAdd,mail,-MicrosoftOutlook

return;.

Numpad5::GroupActivate,mail;Outlook().

Page 1340: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupClose GroupActivate GroupDeactivate...

GroupClose,GroupName[,A|R]

GroupName

, GroupAdd.

A|R

A,. WinCloseahk_groupGroupName .

,..,.R,(),."R". GroupActivate,

GroupDeactivate GroupClose,.

A|R"A", GroupName GroupActivate GroupDeactivate.

GroupDeactivate, (). GroupActivate, ().

GroupClose GroupName GroupActivate GroupDeactivate.

GroupAdd.

Page 1341: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupAdd,GroupActivate,GroupDeactivate

GroupClose,MyGroup,R

Page 1342: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupDeactivate GroupActivate,.

GroupDeactivate,GroupName[,R]

GroupName

, GroupAdd.

R

,.,.R,(),."R". GroupActivate,

GroupDeactivate GroupClose,.

GroupDeactivate .GroupDeactivate.GroupDeactivate

,.

.,GroupDeactivate.,.

GroupAdd.

GroupAdd,GroupActivate,GroupClose

Page 1343: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GroupDeactivate,MyFavoriteWindows;.

Page 1344: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinTitle & WinTitle..

Aahk_classahk_id ID/HWNDahk_pid IDahk_exe ,ahk_group()

Page 1345: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetTitleMatchMode., WinTitle. ahk_class.

DetectHiddenWindows, WinShow.

WinTitle,.,,., (),.

Page 1346: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(A)

WinTitle A (WinText,ExcludeTitle ExcludeText),.

;ID/HWND

id:=WinExist("A")

MsgBox%id

;Win+↑

#Up::WinMaximize,A

Page 1347: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ahk_class

., .,WindowSpy ahk_classExactClassName .

WinGetClass ExactClassName.

,ahk_class .

;(cmd.exe)

WinActivate,ahk_classConsoleWindowClass

Page 1348: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ahk_idID/HWND

ID,HWND().ID.ID WinExist() WinGet.ID

ControlGetHwnd,MouseGetPos DllCall.,ahk_id

, DetectHiddenWindows.

WinActivate,ahk_id%VarContainingID%

Page 1349: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ahk_pidID

ahk_pid.(PID) WinGet,Run Process.

WinActivate,ahk_pid%VarContainingPID%

Page 1350: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ahk_exe, [v1.1.01+]

ahk_exe.

ahk_pid,ahk_exe. ,ahk_exe ,.,ahk_exe

, ahk_exenotepad.exe ahk_exe

C:\Windows\Notepad.exe ,ahk_exe

C:\Windows\System32\Notepad.exe .

;notepad.exe

ifWinExist("ahk_exenotepad.exe")

WinActivate,ahk_exenotepad.exe

else

Run,notepad.exe

SetTitleMatchModeRegEx

WinActivateahk_exei)\\notepad\.exe$;Match

thenamepartofthefullpath.

Page 1351: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ahk_group

ahk_group .

WinMinimize,WinMaximize,WinRestore,WinHide,WinShow,WinClose

WinKill.,( WinActivate IfWinExist).

;:Windows

GroupAdd,Explorer,ahk_classExploreWClass;

Vista

GroupAdd,Explorer,ahk_classCabinetWClass

;

WinActivate,ahk_groupExplorer

Page 1352: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ahk_group(),WinTitle., MyFile.txt Notepad:

WinWaitMyFile.txtahk_classNotepad

WinActivate;.

,(),.tab(tab).

ahk_id,.

MouseGetPos,,,id

ifWinExist("ahk_classNotepadahk_id"id)

MsgBoxThemouseisoverNotepad.

Page 1353: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

""

IfWin[Not]Exist,WinExist(),IfWin[Not]Active,WinActive(),WinWait[Not]Active

WinWait.,WinTitleWinText.,,.

"" WinWait,WinActivateBottom GroupAdd.,(WinTitle,

WinText,ExcludeTitleExcludeText).

"", ,"",.

Gui, DetectHiddenWindowsOff. Gui+LastFound

.

RunNotepad

WinWaitUntitled-Notepad

WinActivate;.

IfWinExist,Untitled-Notepad

{

WinActivate;.

WinMaximize;

Send,Sometext.{Enter}

return

}

IfWinNotExist,Calculator

return

else

{

WinActivate;"IfWinNotExist""".

WinMove,40,40;.

Page 1354: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

}

Page 1355: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#WinActivateForce.

#WinActivateForce

,, WinActivate,WinActivateBottom GroupActivate,""

.

,.

WinActivate,WinActivateBottom,GroupActivate

#WinActivateForce

Page 1356: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DetectHiddenText"".IfWinExistWinActivate.

DetectHiddenText,On|Off

On|Off

On:..

Off:.

""."".,DetectHiddenText.WindowSpy.

WinText, WinActivate,IfWinActive,WinWait IfWinExist.

A_DetectHiddenText(OnOff).

( , ).().

DetectHiddenWindows

Page 1357: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DetectHiddenText,off

Page 1358: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DetectHiddenWindows"".

DetectHiddenWindows,On|Off

On|Off

On:.

Off:. WinShow,.

DetectHiddenWindows,.., WinShow,.

WinShow, WinActivate,IfWinActive,WinWait,IfWinExist.,

, WinShow.

ahk_id ,DetectHiddenWindows. Gui+LastFound

GUI,.

A_DetectHiddenWindows(OnOff).

( , ).().

Page 1359: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DetectHiddenText

DetectHiddenWindows,on

Page 1360: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetTitleMatchMode WinWaitWinTitle.

SetTitleMatchMode,MatchMode

SetTitleMatchMode,Fast|Slow

MatchMode

RegEx:

1: WinTitle.

2: WinTitle

3: WinTitle.

RegEx(v1.0.45+): WinTitle,WinText,ExcludeTitle, ExcludeText

.,.: WinActivateUntitled.*Notepad .

Note:

RegEx ahk_class ahk_exe;, ahk_classIEFrame

IEFrame(, ).

WinTitle,., i)^untitledahk_class

i)^notepad$ahk_pid%mypid% ,i)^untitled

i)^notepad$ , %mypid% ().

WinText,(:).

Page 1361: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ExcludeTitle WinTitle.,3 ExcludeTitle.

Fast|Slow

OneofthefollowingwordstospecifyhowtheWinTextandExcludeText

parametersshouldbematched:

Fast:. Slow, WinText.

Slow:, WinText.WindowSpy().

, WinExist WinActivate.WinGetTextisaffectedinthesamewayas

othercommands,butitalwaysusestheSlowmethodtoretrievetext.

,TitleMatchMode1 fast.

,.

, ."".

AutoHotkeyWindowSpy slowTitleMatchMode, .

,,:

SetTitleMatchMode,2

SetTitleMatchMode,slow

A_TitleMatchMode A_TitleMatchModeSpeed.

Page 1362: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

TitleMatchMode, WinTitle,WinText,ExcludeTitle ExcludeText.

RegEx;: i)untitled-notepad .

( , ).().

SetWinDelay,IfWinExist,WinActivate,RegExMatch()

SetTitleMatchMode2

;:

SetTitleMatchModeRegEx

SetTitleMatchModeSlow;Slow/Fast.

Page 1363: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetWinDelay( WinActivate).

SetWinDelay,Delay

Delay

, .-1,0.,100.

IfWinActive IfWinExist.,,"".,.

-1(),0,CPU.

0Sleep(0),.,Sleep(0).

CPU,.

A_WinDelay.

( , ).().

SetControlDelay,SetKeyDelay,SetMouseDelay,SetBatchLines,SendMode

Page 1364: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetWinDelay,10

Page 1365: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StatusBarGetText.

StatusBarGetText,OutputVar[,Part#,WinTitle,

WinText,ExcludeTitle,ExcludeText]

OutputVar

.

Part#

, .1,.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Page 1366: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel

[v1.1.04+]., .

ErrorLevel1,0., OutputVar.

(:msctls_statusbar32).,.

, StatusBarWait,StatusBarGetText.

. DetectHiddenWindows,.

StatusBarWait,WinGetTitle,WinGetText,ControlGetText

StatusBarGetText,RetrievedText,1,SearchResults

IfInString,RetrievedText,found,MsgBox,Search

resultshavebeenfound.

Page 1367: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StatusBarWait.

StatusBarWait[,BarText,Seconds,Part#,WinTitle,

WinText,Interval,ExcludeTitle,ExcludeText]

BarText

.,., SetTitleMatchMode, WinTitle.

, StatusBarGetText,RegEx.

( ), ErrorLevel1.,.00.5.

Part#

, .1,.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

Interval

Page 1368: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(), .50.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+],., .

, ErrorLevel1.,2.0.

StatusBarWait(msctls_statusbar32)...

, StatusBarGetText,StatusBarWait, StatusBarGetText.

StatusBarWait.,,WinTitleWinText.

, , .

. DetectHiddenWindows,.

StatusBarGetText,WinGetTitle,WinGetText,ControlGetText

Page 1369: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;/.

IfWinExist,SearchResults;.

{

WinActivate

Send,{tab2}!o*.txt{enter};,.

Sleep,400;,"Searching".

StatusBarWait,found,30

ifErrorLevel

MsgBox,Thecommandtimedoutortherewas

aproblem.

else

MsgBox,Thesearchsuccessfullycompleted.

}

; .v1.0.46.06+.

SetTitleMatchModeRegEx

IfWinExistA;().

{

StatusBarGetText,OrigText

StatusBarWait,^(?!^\Q%OrigText%\E$);.

}

Page 1370: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinActivate().

WinActivate[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

,.v1.1.20,,.

60ms,.,WinActivate WinWaitActive IfWinNotActive.

,,.,,(). WinActivateBottom().

Page 1371: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[v1.1.20+]: DetectHiddenWindowsOFF,.,,.

,()., #WinActivateForce.

. DetectHiddenWindows,.

: ,,WinActivate., ControlSend ControlClick./:

;HKCUHKLM,.

RegWriteREG_DWORD,HKCU,

Software\Microsoft\TerminalServerClient

,RemoteDesktop_SuppressWhenMinimized,2

WinActivateBottom,#WinActivateForce,SetTitleMatchMode,

DetectHiddenWindows,,IfWinExist,IfWinActive,WinWaitActive,WinWait,

WinWaitClose,WinClose,GroupActivate,WinSet

IfWinExist,Untitled-Notepad

WinActivate;

else

WinActivate,Calculator

Page 1372: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinActivateBottom WinActivate,().

WinActivateBottom[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

,WinActivateBottom WinActivate.

,.

,.

Page 1373: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

60ms,., WinWaitActive.

WinActivate, ,.,.

,()., #WinActivateForce.

. DetectHiddenWindows,.

WinActivate,#WinActivateForce,SetTitleMatchMode,DetectHiddenWindows,

IfWinExist,IfWinActive,WinWaitActive,WinWait,WinWaitClose,

GroupActivate

;:

#i::

SetTitleMatchMode,2

WinActivateBottom,-MicrosoftInternetExplorer

return

Page 1374: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinClose.

WinClose[,WinTitle,WinText,SecondsToWait,

ExcludeTitle,ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

SecondsToWait

,.0,500ms.,( ).,.

ErrorLevel, IfWinExist WinWaitClose

ExcludeTitle

.

ExcludeText

.

Page 1375: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.().

,.,,().

, WinTitle ahk_groupGroupName,.

WinCloseWM_CLOSE,..,Alt-F4:

PostMessage,0x112,0xF060,,,WinTitle,WinText

;0x112=WM_SYSCOMMAND,0xF060=SC_CLOSE

WinClose, WinKill.

. DetectHiddenWindows,.

WinKill,WinWaitClose,Process,WinActivate,SetTitleMatchMode,

DetectHiddenWindows,,IfWinExist,IfWinActive,WinWaitActive,WinWait,

GroupActivate

IfWinExist,Untitled-Notepad

WinClose;

else

WinClose,Calculator

Page 1376: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetID,ID,..

WinGet,OutputVar[,Cmd,WinTitle,WinText,

ExcludeTitle,ExcludeText]

OutputVar

Cmd.

Cmd

.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Page 1377: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Cmd, ID.:

ID:ID(HWND/)., OutputVar. WinExist()

WinActive()ID, WinExist("A") ID.HWND(

Post/SendMessage DllCall), ControlGetHwnd MouseGetPos.

IDLast:,,/ID., ID. WinActivateBottom.

PID: ID(PID) .

ProcessName:(notepad.exe)., OutputVar.

ProcessPath[v1.1.01+]: ProcessName,.

Count: WinTitle,WinText,ExcludeTitle ExcludeText(0).,

/. DetectHiddenWindows.

List: WinTitle,WinText,ExcludeTitle ExcludeTextID(,/

).ID OutputVar( ), OutputVar(0)., OutputVar

MyArray,MyArray1ID,MyArray2ID,MyArray2.

(). DetectHiddenWindows

, .

MinMax:/., OuputVar;,:

-1:( WinRestore).

1:( WinRestore).

0:.

ControlList:., OutputVar.,(ClassNN),

Page 1378: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WindowSpy.

(`n)., ,.

Z,TABTAB.

MouseGetPos.

ControlListHwnd[v1.0.43.06+]:, (HWND) ClassNN.

Transparent:( WinSet). OutputVar:1)WindowsXP;

2);3);4)(),,/.,0255,0

255.:

MouseGetPos,,,MouseWin

WinGet,Transparent,Transparent,ahk_id

%MouseWin%;.

TransColor:( WinSet). OutputVar:1)WindowsXP;

2);3);4)(),,/.,RGB,

0x00CC99.:

MouseGetPos,,,MouseWin

WinGet,TransColor,TransColor,ahk_id

%MouseWin%;.

Style ExStyle:8., OutputVar.WS_DISABLED

:

WinGet,Style,Style,MyWindowTitle

Page 1379: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

if(Style&0x8000000);0x8000000

WS_DISABLED.

...,.

WS_EX_TOPMOST():

WinGet,ExStyle,ExStyle,MyWindowTitle

if(ExStyle&0x8);0x8WS_EX_TOPMOST.

...,.

.

ID.,,ID.

ID("ahk_id"), SetFormat.

ID MouseGetPos.

ID32,64.,,.

. DetectHiddenWindows,.

WinGetClass,Process,WinGetTitle,MouseGetPos,ControlGet,ControlFocus,

GroupAdd

Page 1380: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Example#1:ID:

WinGet,active_id,ID,A

WinMaximize,ahk_id%active_id%

MsgBox,Theactivewindow'sIDis"%active_id%".

;Example#2::

WinGet,id,list,,,ProgramManager

Loop,%id%

{

this_id:=id%A_Index%

WinActivate,ahk_id%this_id%

WinGetClass,this_class,ahk_id%this_id%

WinGetTitle,this_title,ahk_id%this_id%

MsgBox,4,,VisitingAllWindows`n%a_index%

of%id%`nahk_id%this_id%`nahk_class

%this_class%`n%this_title%`n`nContinue?

IfMsgBox,NO,break

}

;Example#3:ControlList:

WinGet,ActiveControlList,ControlList,A

Loop,Parse,ActiveControlList,`n

{

MsgBox,4,,Control#%a_index%is

"%A_LoopField%".Continue?

IfMsgBox,No

break

}

;Example#4::

#Persistent

SetTimer,WatchActiveWindow,200

return

WatchActiveWindow:

WinGet,ControlList,ControlList,A

ToolTip,%ControlList%

Page 1381: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

Page 1382: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetActiveStats WinGetActiveTitle WinGetPos.

WinGetActiveStats,Title,Width,Height,X,Y

.

Width/Height

.

X,Y

XY.

,.

:

WinGetTitle,Title,A

WinGetPos,X,Y,Width,Height,A

DetectHiddenWindows(), WinShow"".,.

Page 1383: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetPos,WinGetActiveTitle,WinGetTitle,WinGetClass,WinGetText,

ControlGetText

WinGetActiveStats,Title,Width,Height,X,Y

MsgBox,Theactivewindow"%Title%"is%Width%

wide`,%Height%tall`,andpositionedat%X%`,%Y%.

Page 1384: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetActiveTitle.

WinGetActiveTitle,OutputVar

OutputVar

.

: WinGetTitle,OutputVar,A .

WinGetPos,WinGetActiveStats,WinGetTitle,WinGetClass,WinGetText,

ControlGetText

WinGetActiveTitle,Title

MsgBox,Theactivewindowis"%Title%".

Page 1385: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetClass.

WinGetClass,OutputVar[,WinTitle,WinText,

ExcludeTitle,ExcludeText]

OutputVar

.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

( OutputVar"ahk_class").

Page 1386: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. DetectHiddenWindows,.

WinGet,WinGetTitle

WinGetClass,class,A

MsgBox,Theactivewindow'sclassis"%class%".

Page 1387: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetPos.

WinGetPos[,X,Y,Width,Height,WinTitle,WinText,

ExcludeTitle,ExcludeText]

X,Y

XY.,.

Width/Height

.,.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Page 1388: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.

WinTitle"ProgramManager",,.

..

, MouseGetPos.

. DetectHiddenWindows,.

WinMove,ControlGetPos,WinGetActiveStats,WinGetActiveTitle,

WinGetTitle,WinGetText,ControlGetText

WinGetPos,X,Y,Width,Height,Calculator

MsgBox,Calculatorisat%X%`,%Y%

WinGetPos,X,Y,,,A;"A".

MsgBox,Theactivewindowisat%X%`,%Y%

IfWinExist,Untitled-Notepad

{

WinGetPos,Xpos,Ypos;.

MsgBox,Notepadisat%Xpos%`,%Ypos%

}

Page 1389: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetText.

WinGetText,OutputVar[,WinTitle,WinText,

ExcludeTitle,ExcludeText]

OutputVar

.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

ErrorLevel

[v1.1.04+]., .

Page 1390: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

WindowSpy., DetectHiddenText, OutputVar.

(CR+LF),`r`n., StringGetPos StringMid. .

(),WinGetText VarSetCapacity(OutputVar,55) [55

].WM_GETTEXTLENGTH,AutoHotkey.

( #MaxMem).,(),., ControlGetText.,,

OutputVar= .

,: WinGet,OutputVar,ControlList,WinTitle

. DetectHiddenWindows,.

ControlGetText,WinGetActiveStats,WinGetActiveTitle,WinGetTitle,

WinGetPos,#MaxMem

Run,Calc.exe

WinWait,Calculator

WinGetText,text;.

MsgBox,Thetextis:`n%text%

Page 1391: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinGetTitle.

WinGetTitle,OutputVar[,WinTitle,WinText,

ExcludeTitle,ExcludeText]

OutputVar

.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

, MouseGetPos.

Page 1392: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

. DetectHiddenWindows,.

WinGetActiveStats,WinGetActiveTitle,WinGetClass,WinGet,WinGetText,

ControlGetText,WinGetPos

WinGetTitle,Title,A

MsgBox,Theactivewindowis"%Title%".

Page 1393: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinHide.

WinHide[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

WinShow( DetectHiddenWindowsOnOff).

, WinTitle ahk_groupGroupName,.

/:

Page 1394: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinHideahk_classShell_TrayWnd

WinShowahk_classShell_TrayWnd

WinShow,SetTitleMatchMode,DetectHiddenWindows,,WinSet

Run,notepad.exe

WinWait,Untitled-Notepad

Sleep,500

WinHide;

Sleep,1000

WinShow

Page 1395: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinKill.

WinKill[,WinTitle,WinText,SecondsToWait,

ExcludeTitle,ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

SecondsToWait

,.0,500ms.,( ).,.

ErrorLevel, IfWinExist WinWaitClose

ExcludeTitle

.

ExcludeText

.

Page 1396: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,.

,.,,().

, WinTitle ahk_groupGroupName,.

. DetectHiddenWindows,.

WinClose,WinWaitClose,Process,WinActivate,SetTitleMatchMode,

DetectHiddenWindows,,IfWinExist,IfWinActive,WinWaitActive,WinWait,

GroupActivate

IfWinExist,Untitled-Notepad

WinKill;

else

WinKill,Calculator

Page 1397: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinMaximize.

WinMaximize[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

WinRestore WinMinimize.

WinMaximize,:

Page 1398: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PostMessage,0x112,0xF030,,,WinTitle,WinText

;0x112=WM_SYSCOMMAND,0xF030=SC_MAXIMIZE

, WinTitle ahk_groupGroupName,.

. DetectHiddenWindows,.

WinRestore,WinMinimize

Run,notepad.exe

WinWait,Untitled-Notepad

WinMaximize;

^Up::WinMaximize,A;.

Page 1399: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinMinimize.

WinMinimize[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

WinRestore WinMaximize.

WinMinimize,:

Page 1400: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

PostMessage,0x112,0xF020,,,WinTitle,WinText

;0x112=WM_SYSCOMMAND,0xF020=SC_MINIMIZE

, WinTitle ahk_groupGroupName,.

. DetectHiddenWindows,.

WinRestore,WinMaximize,WinMinimizeAll

Run,notepad.exe

WinWait,Untitled-Notepad

WinMinimize;

^Down::WinMinimize,A;.

Page 1401: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinMinimizeAll/WinMinimizeAllUndo.

WinMinimizeAll

WinMinimizeAllUndo

,Win-MWin-D.

WinMinimize,GroupAdd

WinMinimizeAll

WinMinimizeAllUndo

Page 1402: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinMove/.

WinMove,X,Y

WinMove,WinTitle,WinText,X,Y[,Width,Height,

ExcludeTitle,ExcludeText]

X,Y

XY(), .0,0.

, .

X/Y,.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

Width,Height

(), .,DEFAULT,.

ExcludeTitle

Page 1403: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.

ExcludeText

.

Width Height(),112x27(,). Width Height

,12.

xy,.

WinMove, DetectHiddenWindows.

WinMove SetWinDelay.

. DetectHiddenWindows,.

ControlMove,WinGetPos,WinHide,WinMinimize,WinMaximize,WinSet

Run,calc.exe

WinWait,Calculator

WinMove,0,0;WinWait.

SplashTextOn,400,300,Clipboard,Theclipboard

contains:`n%clipboard%

WinMove,Clipboard,,0,0;.

Page 1404: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Msgbox,PressOKtodismisstheSplashText

SplashTextOff

; :

CenterWindow(WinTitle)

{

WinGetPos,,,Width,Height,%WinTitle%

WinMove,%WinTitle%,,(A_ScreenWidth/2)-

(Width/2),(A_ScreenHeight/2)-(Height/2)

}

Page 1405: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinRestore,.

WinRestore[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

WinRestore,:

PostMessage,0x112,0xF120,,,WinTitle,WinText

;0x112=WM_SYSCOMMAND,0xF120=SC_RESTORE

Page 1406: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, WinTitle ahk_groupGroupName,.

. DetectHiddenWindows,.

WinMinimize,WinMaximize

WinRestore,Untitled-Notepad

Page 1407: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinSet,"".

WinSet,Attribute,Value[,WinTitle,WinText,

ExcludeTitle,ExcludeText]

Attribute,Value

.

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Attribute,Value

AlwaysOnTop,[On|Off|Toggle]:.ON,OFF,TOGGLE

Page 1408: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,TOGGLE.TopmostAlwaysOnTop.

Bottom:;.Alt-Escape.: WinSet,Bottom,,WinTitle .

Top: .,.,,(). AlwaysOnTop,

AlwaysOnTop.

Disable Enable:.,.,alt-tab.

Redraw:/., WinMove.,:

WinHide,WinTitle

WinShow,WinTitle

Style,NorExStyle,N:. N, N.(^),N., N.

, ErrorLevel1,0..

, WinSetRedraw ()., .:

WinSet,Style,-0xC00000,A;(WS_CAPTION).

WinSet,ExStyle,^0x80,WinTitle;

WS_EX_TOOLWINDOW,/alt-tab.

WinSet,Region[,Options,WinTitle,...]

,. Options,.,,:

Wn:.: w200 .

Hn:.: h300 .

Page 1409: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

X-Y:X/Y., 200-0 X200,Y0.

E:. W H.

R[w-h]:., R30-30 30x30. w-h,30-30. R W

H.

: W H,,() X-Y., E,.: WinSet,Region,

50-0W200H250E,WinTitle .

: W H, X-Y().,,.., Options Wind

.

, ErrorLevel1,0.:1);2) Options;3)2000;

4).

.

WinSet,Transparent,N,WinTitle

. N0255:0,255.OFF.255,.

Transparent TransColor:

""255., Redraw.

TransColor,.

v1.1.24.04,caption() .v1.1.24.05.

:, WinSet,Transparent,150,ahk_classShell_TrayWnd .

,,:

Page 1410: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DetectHiddenWindows,on

WinSet,Transparent,150,ahk_classBaseBar;

,.

,.,:

#Persistent

SetTimer,WatchForMenu,5

return;.

WatchForMenu:

DetectHiddenWindows,on;.

IfWinExist,ahk_class#32768

WinSet,Transparent,150;.

return

WinSet,TransColor,Color[N],WinTitle

,.,"". ColorRGB( PixelGetColorRGB

).,,()(0-255).:

EEAA99150,WinTitle .

TransColor(OSD). Gui .

OFF.:

WinSet,Transparent,Off,WinTitle

WinSet,TransColor,Off,WinTitle

: .

Page 1411: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, ErrorLevel.

Windows2000/XP,WindowsXP( WinGet).

SplashText:

WinSet,AlwaysOnTop,Off,MySplashWindow

Title

. DetectHiddenWindows,.

WinGet,WinHide,WinSetTitle,WinMove,WinActivate,Control

WinSet,Transparent,200,Untitled-Notepad;.

WinSet,TransColor,White,Untitled-Notepad;

.

WinSet,AlwaysOnTop,toggle,Calculator;.

;:

;"Transparent"

;"TransColor".:TransColor

;,

;!,Win+G

;WindowsXP,

;Windows2000:

Page 1412: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#t::;Win+T.

MouseGetPos,MouseX,MouseY,MouseWin

PixelGetColor,MouseRGB,%MouseX%,%MouseY%,RGB

;:

WinSet,TransColor,Off,ahk_id%MouseWin%

WinSet,TransColor,%MouseRGB%220,ahk_id

%MouseWin%

return

#o::;Win+O.

MouseGetPos,,,MouseWin

WinSet,TransColor,Off,ahk_id%MouseWin%

return

#g::;Win+G.

MouseGetPos,,,MouseWin

WinGet,Transparent,Transparent,ahk_id

%MouseWin%

WinGet,TransColor,TransColor,ahk_id%MouseWin%

ToolTip

Translucency:`t%Transparent%`nTransColor:`t%TransC

olor%

return

;"WinSetRegion":

WinSet,Region,50-0W200H250,WinTitle;.

WinSet,Region,50-0W200H250R40-40,WinTitle;

,40x40.

WinSet,Region,50-0W200H250E,WinTitle;

WinSet,Region,50-0250-0150-250,WinTitle;

.

WinSet,Region,,WinTitle;.

;..

;:,5

;X/Y,"".

WinSet,Region,0-0300-0300-3000-3000-0100-

Page 1413: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

100200-100200-200100-200100-100,WinTitle

Page 1414: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinSetTitle.

WinSetTitle,NewTitle

WinSetTitle,WinTitle,WinText,NewTitle[,

ExcludeTitle,ExcludeText]

NewTitle

., .

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

Page 1415: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,.

. DetectHiddenWindows,.

WinMove,WinGetActiveStats,WinGetActiveTitle,WinGetText,

ControlGetText,WinGetPos,WinSet

WinSetTitle,Untitled-Notepad,,Thisisanew

title

;:

Run,notepad.exe

WinWaitActive,Untitled-Notepad

WinSetTitle,Thisisanewtitle;

WinWaitActive

Page 1416: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinShow.

WinShow[,WinTitle,WinText,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

ExcludeTitle

.

ExcludeText

.

,WinShow. DetectHiddenWindows.

, WinTitle ahk_groupGroupName,.

Page 1417: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinHide,SetTitleMatchMode,DetectHiddenWindows,

Run,notepad.exe

WinWait,Untitled-Notepad

Sleep,500

WinHide;, .

Sleep,1000

WinShow

Page 1418: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinWait.

WinWait[,WinTitle,WinText,Seconds,ExcludeTitle,

ExcludeText]

WinTitle

. WinTitle.

WinTitle WinText,ExcludeTitle ExcludeText.

WinText

,(WindowSpy). DetectHiddenTextON,.

. ErrorLevel1..00.5. .

ExcludeTitle

.

ExcludeText

.

ErrorLevel

Page 1419: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

, Seconds., ErrorLevel0, .

, , .

,,.

. DetectHiddenWindows,.

WinWaitActive,WinWaitClose,IfWinExist,IfWinActive,Process,

SetTitleMatchMode,DetectHiddenWindows

Run,notepad.exe

WinWait,Untitled-Notepad,,3

ifErrorLevel

{

MsgBox,WinWaittimedout.

return

}

else

WinMinimize;WinWait.

Page 1420: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinWaitActive/WinWaitNotActive.

WinWaitActive[,WinTitle,WinText,Seconds,

ExcludeTitle,ExcludeText]

WinWaitNotActive[,WinTitle,WinText,Seconds,

ExcludeTitle,ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

. ErrorLevel1..00.5. .

ExcludeTitle

.

ExcludeText

.

ErrorLevel

Page 1421: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel1,0.

, Seconds., ErrorLevel0.

WinWaitActiveWinWaitNotActive, .,WinWaitActive

,.

, , .

,,.

. DetectHiddenWindows,.

WinWait,WinWaitClose,IfWinExist,IfWinActive,SetTitleMatchMode,

DetectHiddenWindows

Run,notepad.exe

WinWaitActive,Untitled-Notepad,,2

ifErrorLevel

{

MsgBox,WinWaittimedout.

return

}

else

WinMinimize;WinWaitActive.

Page 1422: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinWaitClose.

WinWaitClose[,WinTitle,WinText,Seconds,

ExcludeTitle,ExcludeText]

WinTitle

. WinTitle.

WinText

,(WindowSpy). DetectHiddenTextON,.

. ErrorLevel1..00.5. .

ExcludeTitle

.

ExcludeText

.

ErrorLevel

ErrorLevel1,0.

Page 1423: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, Seconds., ErrorLevel0.

, , .

,,.

. DetectHiddenWindows,.

WinClose,WinWait,WinWaitActive,IfWinExist,IfWinActive,Process,

SetTitleMatchMode,DetectHiddenWindows

Run,notepad.exe

WinWait,Untitled-Notepad

WinWaitClose;WinWait.

MsgBox,Notepadisnowclosed.

Page 1424: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#AllowSameLineCommentsv1.1.09: AutoIt.

AutoItv2(.aut):.

#AllowSameLineComments

AutoItv2(.aut) ,.,.

#AllowSameLineComments

Sleep,1;.

Page 1425: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#ClipboardTimeout.

#ClipboardTimeoutMilliseconds

Milliseconds

,.-1.0.1000ms.

,.,.

,: Var=%Clipboard% Clipboard=NewText .

, ., , GUI,;,.

, .v1.1.16,,.

Clipboard,Thread

#ClipboardTimeout2000

Page 1426: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#CommentFlag.

#CommentFlagNewString

NewString

.15.

(;).

(,).

,tab,.:

MsgBox,Test1;.

MsgBox,Test2;Thisisnotacommentandwill

bedisplayedbyMsgBox.

#EscapeChar

Page 1427: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#CommentFlag//;C++.

Page 1428: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#ErrorStdOut stderr().

#ErrorStdOut

[AHK_L42+]:stderr()stdout()..v1.1.19.01.

Textpad,SciTE,CrimsonEditPlus.#ErrorStdOut

/ErrorStdOut.()

(stdout),.,.:

"C:\ProgramFiles\AutoHotkey\AutoHotkey.exe"

/ErrorStdOut"MyScript.ahk"|more

"C:\ProgramFiles\AutoHotkey\AutoHotkey.exe"

/ErrorStdOut"MyScript.ahk">"Syntax-Error

Log.txt"

, cb.zip(4KB):

"C:\ProgramFiles\AutoHotkey\AutoHotkey.exe"

/ErrorStdOut"MyScript.ahk"|cb.exe

: 2>&1 stderrstdout, 2>Filename .

:

EditPlus:

Page 1429: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tools()>ConfigureUserTools.()

:AddTool()>Program()

MenuText():

Command()(AutoHotkey.exe):C:\Program

Files\AutoHotkey\AutoHotkey.exe

Argument():/ErrorStdOut"$(FilePath)"

Initialdirectory():$(FileDir)

Captureoutput():Yes

TextPad:

Configure>Preferences(>).

Tools().

Add"Program"().

(cmd.exe): C:\Windows\System32\cmd.exe--OK.

(cmd.exe)(LaunchScript).

Apply().

,:

Command():cmd.exe()

Parameters(AutoHotkey.exe):/c""C:\Program

Files\AutoHotkey\AutoHotkey.exe"/ErrorStdOut"$File""

:$FileDir

: 1)Runminimized();2)Captureoutput().

OKTools.

Page 1430: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileAppend(stdout)

#ErrorStdOut

Page 1431: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#EscapeChar()().

#EscapeCharNewChar

NewChar

.

.

(`).

()

`, ,(). : ,. MsgBox,.

`% %()

`` `(;)

`; ;(). : tab.,.

`:: ::().v1.0.40+,.

`n (/LF)

`r (CR)

Page 1432: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

`b

`t tab()

`v tab--Ascii11.Control+K.

`a ()--Ascii7.Control+G.

`f --Ascii12.Control+L.

Send () Send ,{}^!+#.,,.: Send{^}{!}{{} .

"" ,.: Var:="Thecolor""red""was

found." .

;:

#DerefChar#;%.

#Delimiter/;.

#EscapeChar\;(`).

Page 1433: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#MaxMem.

#MaxMemMegabytes

Megabytes

.40954095.11.

,64.

.,( WinGetText ControlGetText,#MaxMem).

,().

. VarSetCapacity.

VarSetCapacity,,Sort,WinGetText,ControlGetText,#MaxThreads

#MaxMem256;256MB.

Page 1434: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#NoEnv [v1.0.43.08+]

().

#NoEnv

#NoEnv .:

#NoEnv

MsgBox%WinDir%

"WinDir"( WinDir:=A_WinDir ).

#NoEnv ,:

1. ,. DllCall(int"int").

2. .

3. AutoHotkeyv2.

#NoEnv, Comspec ProgramFiles..

#NoEnv, EnvGet, A_WinDir.

EnvGet,Comspec,ProgramFiles,A_WinDir

Page 1435: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#NoTrayIcon.

#NoTrayIcon

(EXE).

, ExitApp.,().: #x::ExitApp .

Menu,Tray,Icon Menu,Tray,NoIcon . Menu,

Tray,NoIcon .,#NoTrayIcon.

, A_IconHidden1,0.

Menu,ExitApp

#NoTrayIcon

Page 1436: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Persistent( ExitApp).

#Persistent

,(). / , OnMessage() Gui.

, Exit ExitApp. Exit; .

v1.0.16+,., #SingleInstance.

#SingleInstance,SetTimer,Menu,Exit,ExitApp

#Persistent

Page 1437: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#SingleInstance.

#SingleInstance[force|ignore|off]

force|ignore|off

,:

FORCE, Reload.

IGNORE.,.

OFF.

,,.

,,#Persistent,OnMessage() Gui()...

Reload,#Persistent

Page 1438: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#SingleInstanceforce

#SingleInstanceignore

#SingleInstanceoff

Page 1439: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Warn [v1.0.95.00+]

,.

#Warn[,WarningType,WarningMode]

WarningType

., All.

UseUnsetLocal UseUnsetGlobal: VarSetCapacity.,.

,,,.,,.

#Warn

;y:="";.

x:=y;y.

UseEnv:.., #NoEnv().

#Warn

;#NoEnv;"temp".

;EnvGettemp,TEMP;.

temp:="";,temp.

MsgBox%temp;"TEMP".

LocalSameAsGlobal:, .., localx staticy .

Page 1440: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

#Warn

g:=1

ShowG(){;.

;globalg;<--.

MsgBox%g;,"g".

}

All: WarningMode.

WarningMode

., MsgBox.

MsgBox:.,.

StdOut[v1.1.04+]: stdout().SciTE,.

OutputDebug:.,., OutputDebug.

Off: WarningType.

,.

,.,(#,#Warn).

,#Warn:.,UseEnv:

#WarnAll

#WarnUseEnv,Off

Page 1441: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EnvSetEnvVar,1

x:=EnvVar;#NoEnv,.

x:=NotAnEnvVar;.

#WarnAll,Off;..

#Warn;.

#WarnUseUnsetLocal,OutputDebug;

OutputDebug.

Page 1442: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoftwareLicense

GNUGENERALPUBLICLICENSE

Version2,June1991

Copyright(C)1989,1991FreeSoftware

Foundation,Inc.

51FranklinStreet,FifthFloor,Boston,MA

02110-1301,USA

Everyoneispermittedtocopyanddistribute

verbatimcopies

ofthislicensedocument,butchangingitis

notallowed.

Preamble

Thelicensesformostsoftwarearedesignedtotakeawayyourfreedomtoshare

andchangeit.Bycontrast,theGNUGeneralPublicLicenseisintendedto

guaranteeyourfreedomtoshareandchangefreesoftware--tomakesurethe

softwareisfreeforallitsusers.ThisGeneralPublicLicenseappliestomostof

theFreeSoftwareFoundation'ssoftwareandtoanyotherprogramwhose

authorscommittousingit.(SomeotherFreeSoftwareFoundationsoftwareis

coveredbytheGNULesserGeneralPublicLicenseinstead.)Youcanapplyitto

yourprograms,too.

Whenwespeakoffreesoftware,wearereferringtofreedom,notprice.Our

GeneralPublicLicensesaredesignedtomakesurethatyouhavethefreedomto

Page 1443: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

distributecopiesoffreesoftware(andchargeforthisserviceifyouwish),that

youreceivesourcecodeorcangetitifyouwantit,thatyoucanchangethe

softwareorusepiecesofitinnewfreeprograms;andthatyouknowyoucando

thesethings.

Toprotectyourrights,weneedtomakerestrictionsthatforbidanyonetodeny

youtheserightsortoaskyoutosurrendertherights.Theserestrictionstranslate

tocertainresponsibilitiesforyouifyoudistributecopiesofthesoftware,orif

youmodifyit.

Forexample,ifyoudistributecopiesofsuchaprogram,whethergratisorfora

fee,youmustgivetherecipientsalltherightsthatyouhave.Youmustmake

surethatthey,too,receiveorcangetthesourcecode.Andyoumustshowthem

thesetermssotheyknowtheirrights.

Weprotectyourrightswithtwosteps:(1)copyrightthesoftware,and(2)offer

youthislicensewhichgivesyoulegalpermissiontocopy,distributeand/or

modifythesoftware.

Also,foreachauthor'sprotectionandours,wewanttomakecertainthat

everyoneunderstandsthatthereisnowarrantyforthisfreesoftware.Ifthe

softwareismodifiedbysomeoneelseandpassedon,wewantitsrecipientsto

knowthatwhattheyhaveisnottheoriginal,sothatanyproblemsintroducedby

otherswillnotreflectontheoriginalauthors'reputations.

Finally,anyfreeprogramisthreatenedconstantlybysoftwarepatents.Wewish

toavoidthedangerthatredistributorsofafreeprogramwillindividuallyobtain

Page 1444: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

patentlicenses,ineffectmakingtheprogramproprietary.Topreventthis,we

havemadeitclearthatanypatentmustbelicensedforeveryone'sfreeuseornot

licensedatall.

Theprecisetermsandconditionsforcopying,distributionandmodification

follow.

TERMSANDCONDITIONSFORCOPYING,DISTRIBUTION

ANDMODIFICATION

0.ThisLicenseappliestoanyprogramorotherworkwhichcontainsanotice

placedbythecopyrightholdersayingitmaybedistributedunderthetermsof

thisGeneralPublicLicense.The"Program",below,referstoanysuchprogram

orwork,anda"workbasedontheProgram"meanseithertheProgramorany

derivativeworkundercopyrightlaw:thatistosay,aworkcontainingthe

Programoraportionofit,eitherverbatimorwithmodificationsand/or

translatedintoanotherlanguage.(Hereinafter,translationisincludedwithout

limitationintheterm"modification".)Eachlicenseeisaddressedas"you".

Activitiesotherthancopying,distributionandmodificationarenotcoveredby

thisLicense;theyareoutsideitsscope.TheactofrunningtheProgramisnot

restricted,andtheoutputfromtheProgramiscoveredonlyifitscontents

constituteaworkbasedontheProgram(independentofhavingbeenmadeby

runningtheProgram).WhetherthatistruedependsonwhattheProgramdoes.

1.YoumaycopyanddistributeverbatimcopiesoftheProgram'ssourcecodeas

youreceiveit,inanymedium,providedthatyouconspicuouslyand

Page 1445: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

appropriatelypublishoneachcopyanappropriatecopyrightnoticeand

disclaimerofwarranty;keepintactallthenoticesthatrefertothisLicenseandto

theabsenceofanywarranty;andgiveanyotherrecipientsoftheProgramacopy

ofthisLicensealongwiththeProgram.

Youmaychargeafeeforthephysicalactoftransferringacopy,andyoumayat

youroptionofferwarrantyprotectioninexchangeforafee.

2.YoumaymodifyyourcopyorcopiesoftheProgramoranyportionofit,thus

formingaworkbasedontheProgram,andcopyanddistributesuch

modificationsorworkunderthetermsofSection1above,providedthatyoualso

meetalloftheseconditions:

a)Youmustcausethemodifiedfilestocarryprominentnoticesstating

thatyouchangedthefilesandthedateofanychange.

b)Youmustcauseanyworkthatyoudistributeorpublish,thatinwhole

orinpartcontainsorisderivedfromtheProgramoranypartthereof,to

belicensedasawholeatnochargetoallthirdpartiesunderthetermsof

thisLicense.

c)Ifthemodifiedprogramnormallyreadscommandsinteractivelywhen

run,youmustcauseit,whenstartedrunningforsuchinteractiveusein

themostordinaryway,toprintordisplayanannouncementincludingan

appropriatecopyrightnoticeandanoticethatthereisnowarranty(or

else,sayingthatyouprovideawarranty)andthatusersmayredistribute

theprogramundertheseconditions,andtellingtheuserhowtoviewa

Page 1446: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

copyofthisLicense.(Exception:iftheProgramitselfisinteractivebut

doesnotnormallyprintsuchanannouncement,yourworkbasedonthe

Programisnotrequiredtoprintanannouncement.)

Theserequirementsapplytothemodifiedworkasawhole.Ifidentifiable

sectionsofthatworkarenotderivedfromtheProgram,andcanbereasonably

consideredindependentandseparateworksinthemselves,thenthisLicense,and

itsterms,donotapplytothosesectionswhenyoudistributethemasseparate

works.Butwhenyoudistributethesamesectionsaspartofawholewhichisa

workbasedontheProgram,thedistributionofthewholemustbeonthetermsof

thisLicense,whosepermissionsforotherlicenseesextendtotheentirewhole,

andthustoeachandeverypartregardlessofwhowroteit.

Thus,itisnottheintentofthissectiontoclaimrightsorcontestyourrightsto

workwrittenentirelybyyou;rather,theintentistoexercisetherighttocontrol

thedistributionofderivativeorcollectiveworksbasedontheProgram.

Inaddition,mereaggregationofanotherworknotbasedontheProgramwiththe

Program(orwithaworkbasedontheProgram)onavolumeofastorageor

distributionmediumdoesnotbringtheotherworkunderthescopeofthis

License.

3.YoumaycopyanddistributetheProgram(oraworkbasedonit,under

Section2)inobjectcodeorexecutableformunderthetermsofSections1and2

aboveprovidedthatyoualsodooneofthefollowing:

a)Accompanyitwiththecompletecorrespondingmachine-readable

Page 1447: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

sourcecode,whichmustbedistributedunderthetermsofSections1and

2aboveonamediumcustomarilyusedforsoftwareinterchange;or,

b)Accompanyitwithawrittenoffer,validforatleastthreeyears,togive

anythirdparty,forachargenomorethanyourcostofphysically

performingsourcedistribution,acompletemachine-readablecopyofthe

correspondingsourcecode,tobedistributedunderthetermsofSections1

and2aboveonamediumcustomarilyusedforsoftwareinterchange;or,

c)Accompanyitwiththeinformationyoureceivedastotheofferto

distributecorrespondingsourcecode.(Thisalternativeisallowedonlyfor

noncommercialdistributionandonlyifyoureceivedtheprogramin

objectcodeorexecutableformwithsuchanoffer,inaccordwith

Subsectionbabove.)

Thesourcecodeforaworkmeansthepreferredformoftheworkformaking

modificationstoit.Foranexecutablework,completesourcecodemeansallthe

sourcecodeforallmodulesitcontains,plusanyassociatedinterfacedefinition

files,plusthescriptsusedtocontrolcompilationandinstallationofthe

executable.However,asaspecialexception,thesourcecodedistributedneednot

includeanythingthatisnormallydistributed(ineithersourceorbinaryform)

withthemajorcomponents(compiler,kernel,andsoon)oftheoperatingsystem

onwhichtheexecutableruns,unlessthatcomponentitselfaccompaniesthe

executable.

Ifdistributionofexecutableorobjectcodeismadebyofferingaccesstocopy

fromadesignatedplace,thenofferingequivalentaccesstocopythesourcecode

Page 1448: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

fromthesameplacecountsasdistributionofthesourcecode,eventhoughthird

partiesarenotcompelledtocopythesourcealongwiththeobjectcode.

4.Youmaynotcopy,modify,sublicense,ordistributetheProgramexceptas

expresslyprovidedunderthisLicense.Anyattemptotherwisetocopy,modify,

sublicenseordistributetheProgramisvoid,andwillautomaticallyterminate

yourrightsunderthisLicense.However,partieswhohavereceivedcopies,or

rights,fromyouunderthisLicensewillnothavetheirlicensesterminatedso

longassuchpartiesremaininfullcompliance.

5.YouarenotrequiredtoacceptthisLicense,sinceyouhavenotsignedit.

However,nothingelsegrantsyoupermissiontomodifyordistributetheProgram

oritsderivativeworks.Theseactionsareprohibitedbylawifyoudonotaccept

thisLicense.Therefore,bymodifyingordistributingtheProgram(oranywork

basedontheProgram),youindicateyouracceptanceofthisLicensetodoso,

andallitstermsandconditionsforcopying,distributingormodifyingthe

Programorworksbasedonit.

6.EachtimeyouredistributetheProgram(oranyworkbasedontheProgram),

therecipientautomaticallyreceivesalicensefromtheoriginallicensortocopy,

distributeormodifytheProgramsubjecttothesetermsandconditions.Youmay

notimposeanyfurtherrestrictionsontherecipients'exerciseoftherights

grantedherein.Youarenotresponsibleforenforcingcompliancebythirdparties

tothisLicense.

7.If,asaconsequenceofacourtjudgmentorallegationofpatentinfringement

orforanyotherreason(notlimitedtopatentissues),conditionsareimposedon

Page 1449: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

you(whetherbycourtorder,agreementorotherwise)thatcontradictthe

conditionsofthisLicense,theydonotexcuseyoufromtheconditionsofthis

License.Ifyoucannotdistributesoastosatisfysimultaneouslyyourobligations

underthisLicenseandanyotherpertinentobligations,thenasaconsequence

youmaynotdistributetheProgramatall.Forexample,ifapatentlicensewould

notpermitroyalty-freeredistributionoftheProgrambyallthosewhoreceive

copiesdirectlyorindirectlythroughyou,thentheonlywayyoucouldsatisfy

bothitandthisLicensewouldbetorefrainentirelyfromdistributionofthe

Program.

Ifanyportionofthissectionisheldinvalidorunenforceableunderany

particularcircumstance,thebalanceofthesectionisintendedtoapplyandthe

sectionasawholeisintendedtoapplyinothercircumstances.

Itisnotthepurposeofthissectiontoinduceyoutoinfringeanypatentsorother

propertyrightclaimsortocontestvalidityofanysuchclaims;thissectionhas

thesolepurposeofprotectingtheintegrityofthefreesoftwaredistribution

system,whichisimplementedbypubliclicensepractices.Manypeoplehave

madegenerouscontributionstothewiderangeofsoftwaredistributedthrough

thatsysteminrelianceonconsistentapplicationofthatsystem;itisuptothe

author/donortodecideifheorsheiswillingtodistributesoftwarethroughany

othersystemandalicenseecannotimposethatchoice.

Thissectionisintendedtomakethoroughlyclearwhatisbelievedtobea

consequenceoftherestofthisLicense.

8.Ifthedistributionand/oruseoftheProgramisrestrictedincertaincountries

Page 1450: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

eitherbypatentsorbycopyrightedinterfaces,theoriginalcopyrightholderwho

placestheProgramunderthisLicensemayaddanexplicitgeographical

distributionlimitationexcludingthosecountries,sothatdistributionispermitted

onlyinoramongcountriesnotthusexcluded.Insuchcase,thisLicense

incorporatesthelimitationasifwritteninthebodyofthisLicense.

9.TheFreeSoftwareFoundationmaypublishrevisedand/ornewversionsofthe

GeneralPublicLicensefromtimetotime.Suchnewversionswillbesimilarin

spirittothepresentversion,butmaydifferindetailtoaddressnewproblemsor

concerns.

Eachversionisgivenadistinguishingversionnumber.IftheProgramspecifiesa

versionnumberofthisLicensewhichappliestoitand"anylaterversion",you

havetheoptionoffollowingthetermsandconditionseitherofthatversionorof

anylaterversionpublishedbytheFreeSoftwareFoundation.IftheProgram

doesnotspecifyaversionnumberofthisLicense,youmaychooseanyversion

everpublishedbytheFreeSoftwareFoundation.

10.IfyouwishtoincorporatepartsoftheProgramintootherfreeprograms

whosedistributionconditionsaredifferent,writetotheauthortoaskfor

permission.ForsoftwarewhichiscopyrightedbytheFreeSoftwareFoundation,

writetotheFreeSoftwareFoundation;wesometimesmakeexceptionsforthis.

Ourdecisionwillbeguidedbythetwogoalsofpreservingthefreestatusofall

derivativesofourfreesoftwareandofpromotingthesharingandreuseof

softwaregenerally.

NOWARRANTY

Page 1451: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

11.BECAUSETHEPROGRAMISLICENSEDFREEOFCHARGE,THERE

ISNOWARRANTYFORTHEPROGRAM,TOTHEEXTENTPERMITTED

BYAPPLICABLELAW.EXCEPTWHENOTHERWISESTATEDIN

WRITINGTHECOPYRIGHTHOLDERSAND/OROTHERPARTIES

PROVIDETHEPROGRAM"ASIS"WITHOUTWARRANTYOFANY

KIND,EITHEREXPRESSEDORIMPLIED,INCLUDING,BUTNOT

LIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITY

ANDFITNESSFORAPARTICULARPURPOSE.THEENTIRERISKASTO

THEQUALITYANDPERFORMANCEOFTHEPROGRAMISWITHYOU.

SHOULDTHEPROGRAMPROVEDEFECTIVE,YOUASSUMETHE

COSTOFALLNECESSARYSERVICING,REPAIRORCORRECTION.

12.INNOEVENTUNLESSREQUIREDBYAPPLICABLELAWOR

AGREEDTOINWRITINGWILLANYCOPYRIGHTHOLDER,ORANY

OTHERPARTYWHOMAYMODIFYAND/ORREDISTRIBUTETHE

PROGRAMASPERMITTEDABOVE,BELIABLETOYOUFOR

DAMAGES,INCLUDINGANYGENERAL,SPECIAL,INCIDENTALOR

CONSEQUENTIALDAMAGESARISINGOUTOFTHEUSEOR

INABILITYTOUSETHEPROGRAM(INCLUDINGBUTNOTLIMITED

TOLOSSOFDATAORDATABEINGRENDEREDINACCURATEOR

LOSSESSUSTAINEDBYYOUORTHIRDPARTIESORAFAILUREOF

THEPROGRAMTOOPERATEWITHANYOTHERPROGRAMS),EVEN

IFSUCHHOLDEROROTHERPARTYHASBEENADVISEDOFTHE

POSSIBILITYOFSUCHDAMAGES.

ENDOFTERMSANDCONDITIONS

Page 1452: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoIt,:

RobertYaklin:,, :)

JasonPayamAhdoot:.

JayD.Novak:Send,CapslockWin9x;,,.

Rajat:AHK;;TextPad;AutoItv2;

SmartGUICreator;.

Beardboy:GetKeyStateSendNT4;;.

GregoryF.HoggofHogg'sSoftware: SysGet.

AurelianMaga: ImageSearch PixelSearch.

JoostMulders: .

LaszloHars:,.

MarcusSonntag(Ultra):,, DllCall.

GenaShimanovich:;.

EricMorin(numEric):; OnMessage,;.

PhilipHazel: Perl(PCRE) .

Page 1453: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Titan/polyethene:autohotkey.net,,JavaScript,.

PhilippeLhoste(PhiLho):,RegEx,.

JohnBiederman:.

JonathanRennison(JGR): RegisterCallback().

SteveGray(Lexikos):;;.

AutoHotkey_L:

jackeiku:Unicode.

fincs:64try/catch/throw,,.

Sean:COMCOM.

TheGood:.

ac:#Warn.

RussellDavis:A_PriorKey,ahk_path(WinTitleahk_exe),

#InputLevelSendLevel.

ChristianSander:SysLink.

:!

Page 1454: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Var:=expression .

Var:=expression

Var

.

Expression

.

:=,=,:

x:=y;x=%y%

x:=5;x=5.

x:="literalstring";x=literalstring

.

true false 10.,:

CaseSensitive:=false

ContinueSearch:=true

Page 1455: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OutputVar. OuputVar, Array%i%:=Var/100+5 ..

,IF() ,,SetEnv,EnvSet,EnvAdd,EnvSub,EnvMult,EnvDiv,If,

Var:=3

Var:="literalstring"

Var:=Price*(1-Discount/100)

Finished:=notDoneorA_Index>100

ifnotFinished

{

FileAppend,%NewText%`n,%TargetFile%

return

}

else

ExitApp

Page 1456: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

__:RajatCtrl+2()AutoHotkey.,.

||

;

;(ControlGet).

;,,

;.

$^2::

;.

;,

;:

SetWinDelay10

SetKeyDelay0

AutoTrim,On

ifA_OSType=WIN32_WINDOWS;Windows9x

Sleep,500;.

C_ClipboardPrev=%clipboard%

clipboard=

;,(

;):

Send,^c

ClipWait,0.1

ifErrorLevel<>0

{

;,:

Send,{home}+{end}^c

ClipWait,0.2

ifErrorLevel<>0;,.

{

Page 1457: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

clipboard=%C_ClipboardPrev%

return

}

}

C_Cmd=%clipboard%;tab.

clipboard=%C_ClipboardPrev%;.

Loop,parse,C_Cmd,%A_Space%`,;.

{

C_Cmd=%A_LoopField%

break;.

}

IfWinNotExist,AutoHotkeyHelp

{

;AutoHotkey:

RegRead,ahk_dir,HKEY_LOCAL_MACHINE,

SOFTWARE\AutoHotkey,InstallDir

ifErrorLevel;,.

{

ifA_AhkPath

SplitPath,A_AhkPath,,ahk_dir

elseIfExist..\..\AutoHotkey.chm

ahk_dir=..\..

elseIfExist

%A_ProgramFiles%\AutoHotkey\AutoHotkey.chm

ahk_dir=%A_ProgramFiles%\AutoHotkey

else

{

MsgBoxCouldnotfindtheAutoHotkey

folder.

return

}

}

Run%ahk_dir%\AutoHotkey.chm

WinWaitAutoHotkeyHelp

}

;"":

WinActivate

Page 1458: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinWaitActive

StringReplace,C_Cmd,C_Cmd,#,{#}

send,!n{home}+{end}%C_Cmd%{enter}

return

Page 1459: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinampWinamp.Winamp2.78c,..

Ctrl+Alt+PWinamp/:

^!p::

IfWinNotExistahk_classWinampv1.x

return

;,"".

ControlSend,ahk_parent,c;/

return

Winamp2.x().:

c /

x //

v

+v

^v

b

z

{left} 5

{right} 5

{up}

{down}

Page 1460: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Winamp:

SendMessage,1024,0,120,ahk_classWinamp

v1.x

ifErrorLevel<>FAIL

{

ErrorLevel+=1;Winamp0,1.

MsgBox,Track#%ErrorLevel%isactiveor

playing.

}

Page 1461: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBox,MsgBox.,IfMsgBox.

||

#SingleInstance

SetTimer,ChangeButtonNames,50

MsgBox,4,AddorDelete,Chooseabutton:

IfMsgBox,YES

MsgBox,YouchoseAdd.

else

MsgBox,YouchoseDelete.

return

ChangeButtonNames:

IfWinNotExist,AddorDelete

return;Keepwaiting.

SetTimer,ChangeButtonNames,off

WinActivate

ControlSetText,Button1,&Add

ControlSetText,Button2,&Delete

return

Page 1462: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,Win+LWin+UWindows(,):

HKEY_CURRENT_USER\Software\Microsoft\Windows\Cu

rrentVersion\Policies\Explorer

NoWinKeysREG_DWORD0x00000001(1)

,.

.Windows.,Win+E(WindowsExplorer),:

#e::

MsgBoxThishotkeyisnowownedbythescript.

return

,Win+R:

#r::return

,Windows,:

Lwin::return

Rwin::return

(),,Control+P(),:

$^p::

IfWinActiveahk_classNotepad

Page 1463: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return;,Control-P.

Send^p

return

,$,""().: .

:("Override.ahk"),.

Page 1464: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

000000.Youcanchangetheactionbyreplacingthe Send,= linewith

line(s)ofyourchoice.

||

#MaxThreadsPerHotkey5;Allowmultiplethreads

forthishotkey.

$Numpad0::

#MaxThreadsPerHotkey1

;Above:Usethe$toforcethehooktobeused,

whichpreventsan

;infiniteloopsincethissubroutineitselfsends

Numpad0,which

;wouldotherwiseresultinarecursivecallto

itself.

SetBatchLines,100;Makeitrunalittlefaster

inthiscase.

DelayBetweenKeys=30;Adjustthisvalueifit

doesn'twork.

ifA_PriorHotkey=%A_ThisHotkey%

{

ifA_TimeSincePriorHotkey<%DelayBetweenKeys%

{

ifNumpad0Count=

Numpad0Count=2;i.e.Thisoneplus

thepriorone.

elseifNumpad0Count=0

Numpad0Count=2

else

{

;Sincewe'rehere,Numpad0Countmust

be2assetby

Page 1465: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;priorcalls,whichmeansthisisthe

thirdtimethe

;thekeyhasbeenpressed.Thus,the

hotkeysequence

;shouldfire:

Numpad0Count=0

Send,=;*******Thisistheaction

forthe000key

}

;Inalltheabovecases,wereturn

withoutfurtheraction:

CalledReentrantly=y

return

}

}

;Otherwise,thisNumpad0eventiseitherthe

firstintheseries

;orithappenedtoolongafterthefirstone

(e.g.perhapsthe

;userisholdingdowntheNumpad0keytoauto-

repeatit,which

;wewanttoallow).Therefore,afterashort

delay--during

;whichanotherNumpad0hotkeyeventmayre-

entrantlycallthis

;subroutine--we'llsendthekeyonthroughif

noreentrant

;callsoccurred:

Numpad0Count=0

CalledReentrantly=n

;Duringthissleep,thissubroutinemaybe

reentrantlycalled

;(i.e.asimultaneous"thread"whichrunsin

paralleltothe

;callwe'reinnow):

Sleep,%DelayBetweenKeys%

ifCalledReentrantly=y;Another"thread"

Page 1466: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

changedthevalue.

{

;Sinceitwascalledreentrantly,thiskey

eventwasthefirstin

;thesequencesoshouldbesuppressed(hidden

fromthesystem):

CalledReentrantly=n

return

}

;Otherwiseit'snotpartofthesequencesowe

senditthroughnormally.

;Inotherwords,the*real*Numpad0keyhasbeen

pressed,sowewantit

;tohaveitsnormaleffect:

Send,{Numpad0}

return

Page 1467: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:

:

Abs-

Ceil-

Exp-

Floor-

Log-

Ln-

Mod-()

Round-

Sqrt-

:

Sin-

Cos-

Tan-

ASin-

ACos-

ATan-

Page 1468: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 1469: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Abs

Value:=Abs(Number)

Number.

Number().

MsgBox,%Abs(-1.2);1.2

Page 1470: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Ceil

Value:=Ceil(Number)

Number(.00).

MsgBox,%Ceil(1.2);2

MsgBox,%Ceil(-1.2);-1

Page 1471: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Exp

Value:=Exp(N)

e(2.71828182845905) N.

N. e, **.

MsgBox,%Exp(1.2);3.320117

Page 1472: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Floor

Value:=Floor(Number)

Number(.00).

MsgBox,%Floor(1.2);1

MsgBox,%Floor(-1.2);-2

Page 1473: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Log

Value:=Log(Number)

Number.

. Number.

MsgBox,%Log(1.2);0.079181

Page 1474: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Ln

Value:=Ln(Number)

Numbere.

. Number.

MsgBox,%Ln(1.2);0.182322

Page 1475: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Mod ()

Value:=Mod(Dividend,Divisor)

Dividend Divisor.

Dividend(Divisor),,mod(5,3)mod(5,-3)2,mod(-5,

3)mod(-5,-3)-2.,,,mod(5.0,3)2.0mod(5,3.5)

1.5.Divisor,().

MsgBox,%Mod(7.5,2);1.5,7.5=2x3+

1.5

Page 1476: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Round

Value:=Round(Number[,N])

Number N.

NN0, Number:

MsgBox,%Round(3.14);3

N, Number N,:

MsgBox,%Round(3.14,1);3.1

N, Number N,:

MsgBox,%Round(345,-1);350,-15,

.

MsgBox,%Round(345,-2);300,-24,

.

TransformRound, N1,.000.

v1.0.44.01+, N0, N SetFormat.,

Round();: Round(3.333,1)+0 .

Page 1477: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Sqrt

Value:=Sqrt(Number)

Number.

. Number().

MsgBox,%Sqrt(16);4

Page 1478: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:,180/pi(57.29578).,pi/180(

0.01745329252).pi(3.141592653589793)41.(pi=4*ATan(1)).

Page 1479: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Sin

Value:=Sin(Number)

Number.

Number.

MsgBox,%Sin(1.2);0.932039

Page 1480: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Cos

Value:=Cos(Number)

Number.

Number.

MsgBox,%Cos(1.2);0.362358

Page 1481: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Tan

Value:=Tan(Number)

Number.

Number.

MsgBox,%Tan(1.2);2.572152

Page 1482: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ASin

Value:=ASin(Number)

( Number).

Number-11,().

MsgBox,%ASin(0.2);0.201358

Page 1483: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ACos

Value:=ACos(Number)

( Number).

Number-11,().

MsgBox,%ACos(0.2);1.369438

Page 1484: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ATan

Value:=ATan(Number)

( Number).

MsgBox,%ATan(1.2);0.876058

Page 1485: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

().

Abs Mod.,., Round("1.0foo") 1.v2.0

.

Page 1486: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Clipboard ClipboardAllClipboard ,Windows., ClipboardAll,.

Clipboard(CR+LF), `r`n .(Control-C):

Clipboard,().,:

Loop,parse,clipboard,`n,`r

{

MsgBox,4,,Filenumber%A_Index%is

%A_LoopField%.`n`nContinue?

IfMsgBox,No,break

}

, Sort., FileAppend,%clipboard%`r`n,C:\My

File.txt .,, #ClipboardTimeOut.

:

clipboard=mytext;.

clipboard=;.

clipboard=%clipboard%;,HTML.

clipboard=%clipboard%Texttoappend.;.

StringReplace,clipboard,clipboard,ABC,DEF,

All;ABCDEF().

ClipWait:

clipboard=;,ClipWait.

Send^c

ClipWait;.

Page 1487: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MsgBoxControl-Ccopiedthefollowingcontents

totheclipboard:`n`n%clipboard%

Page 1488: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ClipboardAll ()

ClipboardAll().,.,,:

ClipSaved:=ClipboardAll;.

;..., TransformUnicodeUnicode

...

Clipboard:=ClipSaved;. Clipboard

ClipboardAll).

ClipSaved=;.

ClipboardAll(,FileAppend):

FileAppend,%ClipboardAll%,C:\Company

Logo.clip;.

(),:

FileRead,Clipboard,*cC:\CompanyLogo.clip;

*c.

ClipboardAll,., ClipboardAll, ClipSaved:=

ClipboardAll .

ClipboardAll, MsgBox.,( StringReplace),

.v1.0.46+, ( ByRef

Page 1489: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ClipboardAll(),.

,: ClipSaved2:=ClipSaved

ClipWait().

StrLen/StringLen ClipboardAll.,AutoHotkeyUnicode,

2. A_IsUnicodeANSIUnicode,: size:=

StrLen(ClipSaved)*(A_IsUnicode?2:1) .

ClipboardAll<>=( ClipboardAll).,.,:

ifClipSaved1<>%ClipSaved2%; IF,

.

MsgBoxThetwosavedclipboardsare

different.

ClipboardAll, #MaxMem.

,.(),,.0.

:MicrosoftExcel ClipboardAllExcel"".

AutoHotkey:

DeluxeClipboard:,,,.

www.autohotkey.com/forum/topic2665.html

ClipStep:Ctrl-X-C-V.

www.autohotkey.com/forum/topic4836.html

Page 1490: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

OnClipboardChange

OnClipboardChange.

Page 1491: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ObjBindMethod() [v1.1.20+]

,.

BoundFunc:=ObjBindMethod(Obj,Method,Params)

Obj

.

Method

.

Params

.

, .

Page 1492: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SubStr() [v1.0.46+]

.

NewStr:=SubStr(String,StartingPos[,Length])

String

.

StartingPos

1,2( StartingPos String,). StartingPos

1,.,0-1(

Length

(),"".,(). Length().

String.

SubStr StringMid.,SubStr,StringMid,.

Page 1493: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RegExMatch(),StringMid,StringLeft/Right,StringTrimLeft/Right

;1

MsgBox%SubStr("123abc789",4,3);abc

;2

String:="TheQuickBrownFoxJumpsOvertheLazy

Dog"

MsgBox%SubStr(String,1,19);"TheQuick

BrownFox"

MsgBox%SubStr(String,-7);"LazyDog"

Page 1494: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

--:deguix."",().README.

(17KBZip) ||

Page 1495: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(XP/2k/NT)..,CapsLock,.

||

;:Capslock

;.

;v1.0.25+.

~MButton&LButton::

CapsLock&LButton::

CoordMode,Mouse;/.

MouseGetPos,EWD_MouseStartX,EWD_MouseStartY,

EWD_MouseWin

WinGetPos,EWD_OriginalPosX,EWD_OriginalPosY,,,

ahk_id%EWD_MouseWin%

WinGet,EWD_WinState,MinMax,ahk_id

%EWD_MouseWin%

ifEWD_WinState=0;

SetTimer,EWD_WatchMouse,10;.

return

EWD_WatchMouse:

GetKeyState,EWD_LButtonState,LButton,P

ifEWD_LButtonState=U;,.

{

SetTimer,EWD_WatchMouse,off

return

}

GetKeyState,EWD_EscapeState,Escape,P

ifEWD_EscapeState=D;Escape,.

{

SetTimer,EWD_WatchMouse,off

WinMove,ahk_id%EWD_MouseWin%,,

Page 1496: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%EWD_OriginalPosX%,%EWD_OriginalPosY%

return

}

;,

;:

CoordMode,Mouse

MouseGetPos,EWD_MouseX,EWD_MouseY

WinGetPos,EWD_WinX,EWD_WinY,,,ahk_id

%EWD_MouseWin%

SetWinDelay,-1;/.

WinMove,ahk_id%EWD_MouseWin%,,EWD_WinX+

EWD_MouseX-EWD_MouseStartX,EWD_WinY+

EWD_MouseY-EWD_MouseStartY

EWD_MouseStartX:=EWD_MouseX;.

EWD_MouseStartY:=EWD_MouseY

return

Page 1497: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

__KDE(XP/2k/NT)__:Jonny:1)ALT;2)ALT;3)ALT,,,.

||

;

;.ck,thinkstorm,Chris,

;aurelian.

;:

;2006.11.07:!RButton,courtesyof

bluedawn.

;2006.02.05:double-alt(~Alt)AHK.

;Alt

;Alt,.,

;.

;

;:

;Alt+LeftButton:.

;Alt+RightButton:.

;Double-Alt+LeftButton:.

;Double-Alt+RightButton:/.

;Double-Alt+MiddleButton:.

;

;Alt

;.

If(A_AhkVersion<"1.0.39.00")

{

MsgBox,20,,Thisscriptmaynotworkproperly

withyourversionofAutoHotkey.Continue?

IfMsgBox,No

ExitApp

Page 1498: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

;

;.CPU

;,.

SetWinDelay,2

CoordMode,Mouse

return

!LButton::

IfDoubleAlt

{

MouseGetPos,,,KDE_id

;WinMinimize,

;PSPad.

PostMessage,0x112,0xf020,,,ahk_id%KDE_id%

DoubleAlt:=false

return

}

;id,

;.

MouseGetPos,KDE_X1,KDE_Y1,KDE_id

WinGet,KDE_Win,MinMax,ahk_id%KDE_id%

IfKDE_Win

return

;.

WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id%KDE_id%

Loop

{

GetKeyState,KDE_Button,LButton,P;.

IfKDE_Button=U

break

MouseGetPos,KDE_X2,KDE_Y2;.

KDE_X2-=KDE_X1;.

KDE_Y2-=KDE_Y1

Page 1499: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

KDE_WinX2:=(KDE_WinX1+KDE_X2);.

KDE_WinY2:=(KDE_WinY1+KDE_Y2)

WinMove,ahk_id

%KDE_id%,,%KDE_WinX2%,%KDE_WinY2%;.

}

return

!RButton::

IfDoubleAlt

{

MouseGetPos,,,KDE_id

;.

WinGet,KDE_Win,MinMax,ahk_id%KDE_id%

IfKDE_Win

WinRestore,ahk_id%KDE_id%

Else

WinMaximize,ahk_id%KDE_id%

DoubleAlt:=false

return

}

;id,

;.

MouseGetPos,KDE_X1,KDE_Y1,KDE_id

WinGet,KDE_Win,MinMax,ahk_id%KDE_id%

IfKDE_Win

return

;.

WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ah

k_id%KDE_id%

;.

;,,.

If(KDE_X1<KDE_WinX1+KDE_WinW/2)

KDE_WinLeft:=1

Else

KDE_WinLeft:=-1

If(KDE_Y1<KDE_WinY1+KDE_WinH/2)

KDE_WinUp:=1

Page 1500: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Else

KDE_WinUp:=-1

Loop

{

GetKeyState,KDE_Button,RButton,P;.

IfKDE_Button=U

break

MouseGetPos,KDE_X2,KDE_Y2;.

;.

WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ah

k_id%KDE_id%

KDE_X2-=KDE_X1;.

KDE_Y2-=KDE_Y1

;.

WinMove,ahk_id%KDE_id%,,KDE_WinX1+

(KDE_WinLeft+1)/2*KDE_X2;X

,KDE_WinY1+

(KDE_WinUp+1)/2*KDE_Y2;Y

,KDE_WinW-

KDE_WinLeft*KDE_X2;W()

,KDE_WinH-

KDE_WinUp*KDE_Y2;H()

KDE_X1:=(KDE_X2+KDE_X1);.

KDE_Y1:=(KDE_Y2+KDE_Y1)

}

return

;"Alt+MButton",

;

;.

!MButton::

IfDoubleAlt

{

MouseGetPos,,,KDE_id

WinClose,ahk_id%KDE_id%

DoubleAlt:=false

Page 1501: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

}

return

;alt.

~Alt::

DoubleAlt:=A_PriorHotKey="~Alt"AND

A_TimeSincePriorHotkey<400

Sleep0

KeyWaitAlt;.

return

Page 1502: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

__:Savage,.,.:1);2);3)().,.

||

;Note:InWindowsExplorer,if"View>Toolbars>

AddressBar"is

;notenabled,themenuwillnotbeshownifthe

hotkeychosenbelow

;hasatilde.Ifitdoeshaveatilde,themenu

willbeshown

;butthefavoritewillbeopenedinanew

Explorerwindowrather

;thanswitchingtheactiveExplorerwindowto

thatfolder.

;CONFIG:CHOOSEYOURHOTKEY

;Ifyourmousehasmorethan3buttons,youcould

tryusing

;XButton1(the4th)orXButton2(the5th)instead

ofMButton.

;Youcouldalsouseamodifiedmousebutton(such

as^MButton)or

;akeyboardhotkey.InthecaseofMButton,the

tilde(~)prefix

;isusedsothatMButton'snormalfunctionality

isnotlostwhen

;youclickinotherwindowtypes,suchasa

browser.Thepresence

;ofatildetellsthescripttoavoidshowingthe

menufor

;unsupportedwindowtypes.Inotherwords,if

thereisnotilde,

;thehotkeywillalwaysdisplaythemenu;and

Page 1503: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

uponselectinga

;favoritewhileanunsupportedwindowtypeis

active,anew

;Explorerwindowwillbeopenedtodisplaythe

contentsofthat

;folder.

f_Hotkey=~MButton

;CONFIG:CHOOSEYOURFAVORITES

;Updatethespecialcommentedsectionbelowto

listyourfavorite

;folders.Specifythenameofthemenuitem

first,followedbya

;semicolon,followedbythenameoftheactual

pathofthefavorite.

;Useablanklinetocreateaseparatorline.

/*

ITEMSINFAVORITESMENU<--Donotchangethis

string.

Desktop;%A_Desktop%

Favorites;%A_Desktop%\..\Favorites

MyDocuments;%A_MyDocuments%

ProgramFiles;%A_ProgramFiles%

*/

;ENDOFCONFIGURATIONSECTION

;Donotmakechangesbelowthispointunlessyou

wanttochange

;thebasicfunctionalityofthescript.

#SingleInstance;Neededsincethehotkeyis

dynamicallycreated.

Hotkey,%f_Hotkey%,f_DisplayMenu

Page 1504: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

StringLeft,f_HotkeyFirstChar,f_Hotkey,1

iff_HotkeyFirstChar=~;Showmenuonlyfor

certainwindowtypes.

f_AlwaysShowMenu=n

else

f_AlwaysShowMenu=y

;Usedtoreliablydeterminewhetherscriptis

compiled:

SplitPath,A_ScriptName,,,f_FileExt

iff_FileExt=Exe;Readthemenuitemsfroman

externalfile.

f_FavoritesFile=%A_ScriptDir%\Favorites.ini

else;Readthemenuitemsdirectlyfromthis

scriptfile.

f_FavoritesFile=%A_ScriptFullPath%

;----Readtheconfigurationfile.

f_AtStartingPos=n

f_MenuItemCount=0

Loop,Read,%f_FavoritesFile%

{

iff_FileExt<>Exe

{

;Sincethemenuitemsarebeingread

directlyfromthis

;script,skipoveralllinesuntilthe

startinglineis

;arrivedat.

iff_AtStartingPos=n

{

IfInString,A_LoopReadLine,ITEMSIN

FAVORITESMENU

f_AtStartingPos=y

continue;.

}

;,.

Page 1505: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifA_LoopReadLine=*/

break;

}

;

;withA_ThisMenuItemPos:

f_MenuItemCount++

ifA_LoopReadLine=;.

Menu,Favorites,Add

else

{

StringSplit,f_line,A_LoopReadLine,`;

f_line1=%f_line1%;,..

f_line2=%f_line2%;,.

;Resolveanyreferencestovariables

withineitherfield,and

;createanewarrayelementcontaining

thepathofthisfavorite:

Transform,f_path%f_MenuItemCount%,deref,

%f_line2%

Transform,f_line1,deref,%f_line1%

Menu,Favorites,Add,%f_line1%,

f_OpenFavorite

}

}

return;----Endofauto-executesection.

;----Opentheselectedfavorite

f_OpenFavorite:

;Fetchthearrayelementthatcorrespondstothe

selectedmenuitem:

StringTrimLeft,f_path,f_path%A_ThisMenuItemPos%,

0

iff_path=

return

iff_class=#32770;It'sadialog.

{

Page 1506: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

iff_Edit1Pos<>;AndithasanEdit1

control.

{

;Activatethewindowsothatiftheuser

ismiddle-clicking

;outsidethedialog,subsequentclicks

willalsowork:

WinActivateahk_id%f_window_id%

;Retrieveanyfilenamethatmightalready

beinthefieldso

;thatitcanberestoredaftertheswitch

tothenewfolder:

ControlGetText,f_text,Edit1,ahk_id

%f_window_id%

ControlSetText,Edit1,%f_path%,ahk_id

%f_window_id%

ControlSend,Edit1,{Enter},ahk_id

%f_window_id%

Sleep,100;Itneedsextratimeonsome

dialogsorinsomecases.

ControlSetText,Edit1,%f_text%,ahk_id

%f_window_id%

return

}

;elsefallthroughtothebottomofthe

subroutinetotakestandardaction.

}

elseiff_classinExploreWClass,CabinetWClass;

InExplorer,switchfolders.

{

iff_Edit1Pos<>;AndithasanEdit1

control.

{

ControlSetText,Edit1,%f_path%,ahk_id

%f_window_id%

;Teklreportedthefollowing:"IfIwant

tochangetoFolderL:\folder

Page 1507: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;thentheaddressbarshows

http://www.L:\folder.com.Tosolvethis,

;Iaddeda{right}before{Enter}":

ControlSend,Edit1,{Right}{Enter},ahk_id

%f_window_id%

return

}

;elsefallthroughtothebottomofthe

subroutinetotakestandardaction.

}

elseiff_class=ConsoleWindowClass;Ina

consolewindow,CDtothatdirectory

{

WinActivate,ahk_id%f_window_id%;Because

sometimesthemclickdeactivatesit.

SetKeyDelay,0;Thiswillbeineffectonly

forthedurationofthisthread.

IfInString,f_path,:;Itcontainsadrive

letter

{

StringLeft,f_path_drive,f_path,1

Send%f_path_drive%:{enter}

}

Send,cd%f_path%{Enter}

return

}

;Sincetheabovedidn'treturn,oneofthe

followingistrue:

;1)It'sanunsupportedwindowtypebut

f_AlwaysShowMenuisy(yes).

;2)It'sasupportedtypebutitlacksanEdit1

controltofacilitatethecustom

;action,soinsteaddothedefaultaction

below.

Run,Explorer%f_path%;Mightworkonmore

systemswithoutdoublequotes.

return

Page 1508: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;----Displaythemenu

f_DisplayMenu:

;Thesefirstfewvariablesaresethereandused

byf_OpenFavorite:

WinGet,f_window_id,ID,A

WinGetClass,f_class,ahk_id%f_window_id%

iff_classin#32770,ExploreWClass,CabinetWClass

;DialogorExplorer.

ControlGetPos,f_Edit1Pos,,,,Edit1,ahk_id

%f_window_id%

iff_AlwaysShowMenu=n;Themenushouldbe

shownonlyselectively.

{

iff_classin

#32770,ExploreWClass,CabinetWClass;Dialogor

Explorer.

{

iff_Edit1Pos=;Thecontroldoesn't

exist,sodon'tdisplaythemenu

return

}

elseiff_class<>ConsoleWindowClass

return;Sinceit'ssomeotherwindow

type,don'tdisplaymenu.

}

;Otherwise,themenushouldbepresentedforthis

typeofwindow:

Menu,Favorites,show

return

Page 1509: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

--:Rajat(XP/2k/NT)AutoHotkey.,.,Ctrl+F1().,Escape

Enter.

||

;Requiresv1.0.41+

;CONFIGURATIONSECTION:Customizethescriptwith

thefollowingvariables.

;Thehotkeybelowispressedtodisplaythe

currentcommand'spageinthe

;helpfile:

I_HelpHotkey=^F1

;Thestringbelowmustexistsomewhereinthe

activewindow'stitlefor

;IntelliSensetobeineffectwhileyou're

typing.Makeitblanktohave

;IntelliSenseoperateinallwindows.Makeit

Padtohaveitoperatein

;editorssuchasMetapad,Notepad,andTextpad.

Makeit.ahktohaveit

;operateonlywhena.ahkfileisopenin

Notepad,Metapad,etc.

I_Editor=pad

;Ifyouwishtohaveadifferenticonforthis

scripttodistinguishitfrom

;otherscriptsinthetray,providethefilename

below(leaveblanktohave

;noicon).Forexample:

Page 1510: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

E:\stuff\Pics\icons\GeoIcons\Information.ico

I_Icon=

;ENDOFCONFIGURATIONSECTION(donotmake

changesbelowthispointunless

;youwanttochangethebasicfunctionalityof

thescript).

SetKeyDelay,0

#SingleInstance

ifI_HelpHotkey<>

Hotkey,%I_HelpHotkey%,I_HelpHotkey

;Changetrayicon(ifonewasspecifiedinthe

configurationsectionabove):

ifI_Icon<>

IfExist,%I_Icon%

Menu,Tray,Icon,%I_Icon%

;DetermineAutoHotkey'slocation:

RegRead,ahk_dir,HKEY_LOCAL_MACHINE,

SOFTWARE\AutoHotkey,InstallDir

ifErrorLevel;Notfound,solookforitinsome

othercommonlocations.

{

ifA_AhkPath

SplitPath,A_AhkPath,,ahk_dir

elseIfExist..\..\AutoHotkey.chm

ahk_dir=..\..

elseIfExist

%A_ProgramFiles%\AutoHotkey\AutoHotkey.chm

ahk_dir=%A_ProgramFiles%\AutoHotkey

else

{

MsgBoxCouldnotfindtheAutoHotkey

folder.

Page 1511: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ExitApp

}

}

ahk_help_file=%ahk_dir%\AutoHotkey.chm

;Readcommandsyntaxes:

Loop,Read,

%ahk_dir%\Extras\Editors\Syntax\Commands.txt

{

I_FullCmd=%A_LoopReadLine%

;Directiveshaveafirstspaceinsteadofa

firstcomma.

;Sousewhichevercomesfirstastheendof

thecommandname:

StringGetPos,I_cPos,I_FullCmd,`,

StringGetPos,I_sPos,I_FullCmd,%A_Space%

if(I_cPos=-1or(I_cPos>I_sPosandI_sPos

<>-1))

I_EndPos:=I_sPos

else

I_EndPos:=I_cPos

ifI_EndPos<>-1

StringLeft,I_CurrCmd,I_FullCmd,

%I_EndPos%

else;Thisisadirective/commandwithno

parameters.

I_CurrCmd=%A_LoopReadLine%

StringReplace,I_CurrCmd,I_CurrCmd,[,,All

StringReplace,I_CurrCmd,I_CurrCmd,

%A_Space%,,All

StringReplace,I_FullCmd,I_FullCmd,``n,`n,

All

StringReplace,I_FullCmd,I_FullCmd,``t,`t,

Page 1512: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

All

;Makearraysofcommandnamesandfullcmd

syntaxes:

I_Cmd%A_Index%=%I_CurrCmd%

I_FullCmd%A_Index%=%I_FullCmd%

}

;UsetheInputcommandtowatchforcommandsthat

theusertypes:

Loop

{

;Editorwindowcheck:

WinGetTitle,ActiveTitle,A

IfNotInString,ActiveTitle,%I_Editor%

{

ToolTip

Sleep,500

Continue

}

;Getallkeystillendkey:

Input,I_Word,V,{enter}{escape}{space}`,

I_EndKey=%ErrorLevel%

;Tooltipishiddeninthesecases:

ifI_EndKeyinEndKey:Enter,EndKey:Escape

{

ToolTip

Continue

}

;Editorwindowcheckagain!

WinGetActiveTitle,ActiveTitle

IfNotInString,ActiveTitle,%I_Editor%

{

ToolTip

Page 1513: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Continue

}

;Compensateforanyindentationthatis

present:

StringReplace,I_Word,I_Word,%A_Space%,,All

StringReplace,I_Word,I_Word,%A_Tab%,,All

ifI_Word=

Continue

;Checkforcommentedline:

StringLeft,I_Check,I_Word,1

if(I_Check=";"orI_Word="If");"If"

seemsalittletooannoyingtoshowtooltipfor.

Continue

;Matchwordwithcommand:

I_Index=

Loop

{

;Ithelpsperformancetoresolvedynamic

variablesonlyonce.

;Inaddition,thevalueputinto

I_ThisCmdisalsousedbythe

;I_HelpHotkeysubroutine:

I_ThisCmd:=I_Cmd%A_Index%

ifI_ThisCmd=

break

if(I_Word=I_ThisCmd)

{

I_Index:=A_Index

I_HelpOn=%I_ThisCmd%

break

}

}

;Ifnomatchthenresumewatchinguserinput:

Page 1514: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ifI_Index=

Continue

;Showmatchedcommandtoguidetheuser:

I_ThisFullCmd:=I_FullCmd%I_Index%

ToolTip,%I_ThisFullCmd%,A_CaretX,A_CaretY+

20

}

I_HelpHotkey:

WinGetTitle,ActiveTitle,A

IfNotInString,ActiveTitle,%I_Editor%,Return

ToolTip;Turnoffsyntaxhelpersincethereis

noneedforitnow.

SetTitleMatchMode,1;Incaseit's3.This

settingisineffectonlyforthisthread.

IfWinNotExist,AutoHotkeyHelp

{

IfNotExist,%ahk_help_file%

{

MsgBox,Couldnotfindthehelpfile:

%ahk_help_file%.

return

}

Run,%ahk_help_file%

WinWait,AutoHotkeyHelp

}

ifI_ThisCmd=;Instead,usewhatwasmost

recentlytyped.

I_ThisCmd:=I_Word

;Theabovehassetthe"lastfound"windowwhich

Page 1515: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

weusebelow:

WinActivate

WinWaitActive

StringReplace,I_ThisCmd,I_ThisCmd,#,{#};

Replaceleading#,ifany.

Send,!n{home}+{end}%I_HelpOn%{enter}

return

Page 1516: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.,CPU.,,..

||

;Increasethefollowingvaluetomakethemouse

cursormovefaster:

JoyMultiplier=0.30

;Decreasethefollowingvaluetorequireless

joystickdisplacement-from-center

;tostartmovingthemouse.However,youmay

needtocalibrateyourjoystick

;--ensuringit'sproperlycentered--toavoid

cursordrift.Aperfectlytight

;andcenteredjoystickcoulduseavalueof1:

JoyThreshold=3

;ChangethefollowingtotruetoinverttheY-

axis,whichcausesthemouseto

;moveverticallyinthedirectionoppositethe

stick:

InvertYAxis:=false

;Changethesevaluestousejoystickbutton

numbersotherthan1,2,and3for

;theleft,right,andmiddlemousebuttons.

Availablenumbersare1through32.

;UsetheJoystickTestScripttofindoutyour

joystick'snumbersmoreeasily.

ButtonLeft=1

ButtonRight=2

ButtonMiddle=3

Page 1517: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;IfyourjoystickhasaPOVcontrol,youcanuse

itasamousewheel.The

;followingvalueisthenumberofmilliseconds

betweenturnsofthewheel.

;Decreaseittohavethewheelturnfaster:

WheelDelay=250

;Ifyoursystemhasmorethanonejoystick,

increasethisvaluetouseajoystick

;otherthanthefirst:

JoystickNumber=1

;ENDOFCONFIGSECTION--Don'tchangeanything

belowthispointunlessyouwant

;toalterthebasicnatureofthescript.

#SingleInstance

JoystickPrefix=%JoystickNumber%Joy

Hotkey,%JoystickPrefix%%ButtonLeft%,ButtonLeft

Hotkey,%JoystickPrefix%%ButtonRight%,ButtonRight

Hotkey,%JoystickPrefix%%ButtonMiddle%,

ButtonMiddle

;Calculatetheaxisdisplacementsthatareneeded

tostartmovingthecursor:

JoyThresholdUpper:=50+JoyThreshold

JoyThresholdLower:=50-JoyThreshold

ifInvertYAxis

YAxisMultiplier=-1

else

YAxisMultiplier=1

SetTimer,WatchJoystick,10;Monitorthe

movementofthejoystick.

GetKeyState,JoyInfo,%JoystickNumber%JoyInfo

Page 1518: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfInString,JoyInfo,P;JoystickhasPOV

control,souseitasamousewheel.

SetTimer,MouseWheel,%WheelDelay%

return;Endofauto-executesection.

;ThesubroutinesbelowdonotuseKeyWaitbecause

thatwouldsometimestrapthe

;WatchJoystickquasi-threadbeneaththewait-for-

button-upthread,whichwould

;effectivelypreventmouse-draggingwiththe

joystick.

ButtonLeft:

SetMouseDelay,-1;Makesmovementsmoother.

MouseClick,left,,,1,0,D;Holddowntheleft

mousebutton.

SetTimer,WaitForLeftButtonUp,10

return

ButtonRight:

SetMouseDelay,-1;Makesmovementsmoother.

MouseClick,right,,,1,0,D;Holddownthe

rightmousebutton.

SetTimer,WaitForRightButtonUp,10

return

ButtonMiddle:

SetMouseDelay,-1;Makesmovementsmoother.

MouseClick,middle,,,1,0,D;Holddownthe

rightmousebutton.

SetTimer,WaitForMiddleButtonUp,10

return

WaitForLeftButtonUp:

ifGetKeyState(JoystickPrefix.ButtonLeft)

Page 1519: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return;Thebuttonisstill,down,sokeep

waiting.

;Otherwise,thebuttonhasbeenreleased.

SetTimer,WaitForLeftButtonUp,off

SetMouseDelay,-1;Makesmovementsmoother.

MouseClick,left,,,1,0,U;Releasethemouse

button.

return

WaitForRightButtonUp:

ifGetKeyState(JoystickPrefix.ButtonRight)

return;Thebuttonisstill,down,sokeep

waiting.

;Otherwise,thebuttonhasbeenreleased.

SetTimer,WaitForRightButtonUp,off

MouseClick,right,,,1,0,U;Releasethemouse

button.

return

WaitForMiddleButtonUp:

ifGetKeyState(JoystickPrefix.ButtonMiddle)

return;Thebuttonisstill,down,sokeep

waiting.

;Otherwise,thebuttonhasbeenreleased.

SetTimer,WaitForMiddleButtonUp,off

MouseClick,middle,,,1,0,U;Releasethemouse

button.

return

WatchJoystick:

MouseNeedsToBeMoved:=false;Setdefault.

SetFormat,float,03

GetKeyState,joyx,%JoystickNumber%JoyX

GetKeyState,joyy,%JoystickNumber%JoyY

ifjoyx>%JoyThresholdUpper%

{

MouseNeedsToBeMoved:=true

Page 1520: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DeltaX:=joyx-JoyThresholdUpper

}

elseifjoyx<%JoyThresholdLower%

{

MouseNeedsToBeMoved:=true

DeltaX:=joyx-JoyThresholdLower

}

else

DeltaX=0

ifjoyy>%JoyThresholdUpper%

{

MouseNeedsToBeMoved:=true

DeltaY:=joyy-JoyThresholdUpper

}

elseifjoyy<%JoyThresholdLower%

{

MouseNeedsToBeMoved:=true

DeltaY:=joyy-JoyThresholdLower

}

else

DeltaY=0

ifMouseNeedsToBeMoved

{

SetMouseDelay,-1;Makesmovementsmoother.

MouseMove,DeltaX*JoyMultiplier,DeltaY*

JoyMultiplier*YAxisMultiplier,0,R

}

return

MouseWheel:

GetKeyState,JoyPOV,%JoystickNumber%JoyPOV

ifJoyPOV=-1;Noangle.

return

if(JoyPOV>31500orJoyPOV<4500);Forward

Send{WheelUp}

elseifJoyPOVbetween13500and22500;Back

Send{WheelDown}

Page 1521: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

Page 1522: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.;,.,.

||

;July6,2005:Addedauto-detectionofjoystick

number.

;May8,2005:Fixed:JoyAxesisnolonger

queriedasameansof

;detectingwhetherthejoystickisconnected.

Somejoysticksare

;gamepadsanddon'thaveevenasingleaxis.

;Ifyouwanttounconditionallyuseaspecific

joysticknumber,change

;thefollowingvaluefrom0tothenumberofthe

joystick(1-16).

;Avalueof0causesthejoysticknumbertobe

auto-detected:

JoystickNumber=0

;ENDOFCONFIGSECTION.Donotmakechangesbelow

thispointunless

;youwishtoalterthebasicfunctionalityofthe

script.

;Auto-detectthejoysticknumberifcalledfor:

ifJoystickNumber<=0

{

Loop16;Queryeachjoysticknumbertofind

outwhichonesexist.

{

GetKeyState,JoyName,%A_Index%JoyName

ifJoyName<>

Page 1523: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

JoystickNumber=%A_Index%

break

}

}

ifJoystickNumber<=0

{

MsgBoxThesystemdoesnotappeartohave

anyjoysticks.

ExitApp

}

}

#SingleInstance

SetFormat,float,03;Omitdecimalpointfrom

axispositionpercentages.

GetKeyState,joy_buttons,

%JoystickNumber%JoyButtons

GetKeyState,joy_name,%JoystickNumber%JoyName

GetKeyState,joy_info,%JoystickNumber%JoyInfo

Loop

{

buttons_down=

Loop,%joy_buttons%

{

GetKeyState,joy%a_index%,

%JoystickNumber%joy%a_index%

ifjoy%a_index%=D

buttons_down=

%buttons_down%%a_space%%a_index%

}

GetKeyState,joyx,%JoystickNumber%JoyX

axis_info=X%joyx%

GetKeyState,joyy,%JoystickNumber%JoyY

axis_info=

%axis_info%%a_space%%a_space%Y%joyy%

IfInString,joy_info,Z

Page 1524: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

GetKeyState,joyz,%JoystickNumber%JoyZ

axis_info=

%axis_info%%a_space%%a_space%Z%joyz%

}

IfInString,joy_info,R

{

GetKeyState,joyr,%JoystickNumber%JoyR

axis_info=

%axis_info%%a_space%%a_space%R%joyr%

}

IfInString,joy_info,U

{

GetKeyState,joyu,%JoystickNumber%JoyU

axis_info=

%axis_info%%a_space%%a_space%U%joyu%

}

IfInString,joy_info,V

{

GetKeyState,joyv,%JoystickNumber%JoyV

axis_info=

%axis_info%%a_space%%a_space%V%joyv%

}

IfInString,joy_info,P

{

GetKeyState,joyp,%JoystickNumber%JoyPOV

axis_info=

%axis_info%%a_space%%a_space%POV%joyp%

}

ToolTip,%joy_name%

(#%JoystickNumber%):`n%axis_info%`nButtonsDown:

%buttons_down%`n`n(right-clickthetrayiconto

exit)

Sleep,100

}

return

Page 1525: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(XP/2k/NT)--:Jon.()..,.

||

;----ConfigurationSection:Customizethesizeof

theon-screenkeyboardand

;otheroptionshere.

;Changingthisfontsizewillmaketheentireon-

screenkeyboardget

;largerorsmaller:

k_FontSize=10

k_FontName=Verdana;Thiscanbeblanktouse

thesystem'sdefaultfont.

k_FontStyle=Bold;Exampleofanalternative:

ItalicUnderline

;Namesforthetraymenuitems:

k_MenuItemHide=Hideon-screen&keyboard

k_MenuItemShow=Showon-screen&keyboard

;Tohavethekeyboardappearonamonitorother

thantheprimary,specify

;anumbersuchas2forthefollowingvariable.

Leaveitblanktouse

;theprimary:

k_Monitor=

;----Endofconfigurationsection.Don'tchange

anythingbelowthispoint

;unlessyouwanttoalterthebasicnatureofthe

script.

Page 1526: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;----Alterthetrayiconmenu:

Menu,Tray,Add,%k_MenuItemHide%,k_ShowHide

Menu,Tray,Add,&Exit,k_MenuExit

Menu,Tray,Default,%k_MenuItemHide%

Menu,Tray,NoStandard

;----Calculateobjectdimensionsbasedonchosen

fontsize:

k_KeyWidth=%k_FontSize%

k_KeyWidth*=3

k_KeyHeight=%k_FontSize%

k_KeyHeight*=3

k_KeyMargin=%k_FontSize%

k_KeyMargin/=6

k_SpacebarWidth=%k_FontSize%

k_SpacebarWidth*=25

k_KeyWidthHalf=%k_KeyWidth%

k_KeyWidthHalf/=2

k_KeySize=w%k_KeyWidth%h%k_KeyHeight%

k_Position=x+%k_KeyMargin%%k_KeySize%

;----CreateaGUIwindowfortheon-screen

keyboard:

Gui,Font,s%k_FontSize%%k_FontStyle%,

%k_FontName%

Gui,-Caption+E0x200+ToolWindow

TransColor=F1ECED

Gui,Color,%TransColor%;Thiscolorwillbe

madetransparentlaterbelow.

;----Addabuttonforeachkey.Positionthe

firstbuttonwithabsolute

;coordinatessothatallotherbuttonscanbe

positionedrelativetoit:

Gui,Add,Button,section%k_KeySize%

Page 1527: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

xm+%k_KeyWidth%,1

Gui,Add,Button,%k_Position%,2

Gui,Add,Button,%k_Position%,3

Gui,Add,Button,%k_Position%,4

Gui,Add,Button,%k_Position%,5

Gui,Add,Button,%k_Position%,6

Gui,Add,Button,%k_Position%,7

Gui,Add,Button,%k_Position%,8

Gui,Add,Button,%k_Position%,9

Gui,Add,Button,%k_Position%,0

Gui,Add,Button,%k_Position%,-

Gui,Add,Button,%k_Position%,=

Gui,Add,Button,%k_Position%,Bk

Gui,Add,Button,xmy+%k_KeyMargin%

h%k_KeyHeight%,Tab;Auto-width.

Gui,Add,Button,%k_Position%,Q

Gui,Add,Button,%k_Position%,W

Gui,Add,Button,%k_Position%,E

Gui,Add,Button,%k_Position%,R

Gui,Add,Button,%k_Position%,T

Gui,Add,Button,%k_Position%,Y

Gui,Add,Button,%k_Position%,U

Gui,Add,Button,%k_Position%,I

Gui,Add,Button,%k_Position%,O

Gui,Add,Button,%k_Position%,P

Gui,Add,Button,%k_Position%,[

Gui,Add,Button,%k_Position%,]

Gui,Add,Button,%k_Position%,\

Gui,Add,Button,xs+%k_KeyWidthHalf%

y+%k_KeyMargin%%k_KeySize%,A

Gui,Add,Button,%k_Position%,S

Gui,Add,Button,%k_Position%,D

Gui,Add,Button,%k_Position%,F

Gui,Add,Button,%k_Position%,G

Gui,Add,Button,%k_Position%,H

Page 1528: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,Add,Button,%k_Position%,J

Gui,Add,Button,%k_Position%,K

Gui,Add,Button,%k_Position%,L

Gui,Add,Button,%k_Position%,`;

Gui,Add,Button,%k_Position%,'

Gui,Add,Button,x+%k_KeyMargin%h%k_KeyHeight%,

Enter;Auto-width.

;Thefirstbuttonbelowadds%A_Space%attheend

towidenitalittle,

;makingthelayoutofkeysnexttoitmore

accuratelyreflectarealkeyboard:

Gui,Add,Button,xmy+%k_KeyMargin%

h%k_KeyHeight%,Shift%A_Space%%A_Space%

Gui,Add,Button,%k_Position%,Z

Gui,Add,Button,%k_Position%,X

Gui,Add,Button,%k_Position%,C

Gui,Add,Button,%k_Position%,V

Gui,Add,Button,%k_Position%,B

Gui,Add,Button,%k_Position%,N

Gui,Add,Button,%k_Position%,M

Gui,Add,Button,%k_Position%,`,

Gui,Add,Button,%k_Position%,.

Gui,Add,Button,%k_Position%,/

Gui,Add,Button,xmy+%k_KeyMargin%

h%k_KeyHeight%,Ctrl;Auto-width.

Gui,Add,Button,h%k_KeyHeight%x+%k_KeyMargin%,

Win;Auto-width.

Gui,Add,Button,h%k_KeyHeight%x+%k_KeyMargin%,

Alt;Auto-width.

Gui,Add,Button,h%k_KeyHeight%x+%k_KeyMargin%

w%k_SpacebarWidth%,Space

;----Showthewindow:

Gui,Show

Page 1529: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

k_IsVisible=y

WinGet,k_ID,ID,A;GetitswindowID.

WinGetPos,,,k_WindowWidth,k_WindowHeight,A

;----Positionthekeyboardatthebottomofthe

screen(takingintoaccount

;thepositionofthetaskbar):

SysGet,k_WorkArea,MonitorWorkArea,%k_Monitor%

;Calculatewindow'sX-position:

k_WindowX=%k_WorkAreaRight%

k_WindowX-=%k_WorkAreaLeft%;Nowk_WindowX

containsthewidthofthismonitor.

k_WindowX-=%k_WindowWidth%

k_WindowX/=2;Calculatepositiontocenterit

horizontally.

;Thefollowingisdoneincasethewindowwillbe

onanon-primarymonitor

;orifthetaskbarisanchoredontheleftside

ofthescreen:

k_WindowX+=%k_WorkAreaLeft%

;Calculatewindow'sY-position:

k_WindowY=%k_WorkAreaBottom%

k_WindowY-=%k_WindowHeight%

WinMove,A,,%k_WindowX%,%k_WindowY%

WinSet,AlwaysOnTop,On,ahk_id%k_ID%

WinSet,TransColor,%TransColor%220,ahk_id

%k_ID%

;----Setallkeysashotkeys.See

www.asciitable.com

k_n=1

k_ASCII=45

Page 1530: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Loop

{

Transform,k_char,Chr,%k_ASCII%

StringUpper,k_char,k_char

ifk_charnotin<,>,^,~,?,`,

Hotkey,~*%k_char%,k_KeyPress

;Intheabove,theasteriskprefixallows

thekeytobedetectedregardless

;ofwhethertheuserisholdingdown

modifierkeyssuchasControlandShift.

ifk_ASCII=93

break

k_ASCII++

}

return;Endofauto-executesection.

;----Whenakeyispressedbytheuser,clickthe

correspondingbuttonon-screen:

~*Backspace::

ControlClick,Bk,ahk_id%k_ID%,,LEFT,1,D

KeyWait,Backspace

ControlClick,Bk,ahk_id%k_ID%,,LEFT,1,U

return

;LShiftandRShiftareusedratherthan"Shift"

becausewhenusedasahotkey,

;"Shift"woulddefaulttofiringuponreleaseof

thekey(inolderAHKversions):

~*LShift::

~*RShift::

~*LCtrl::;MustuseCtrlnotControltomatch

buttonnames.

Page 1531: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

~*RCtrl::

~*LAlt::

~*RAlt::

~*LWin::

~*RWin::

StringTrimLeft,k_ThisHotkey,A_ThisHotkey,3

ControlClick,%k_ThisHotkey%,ahk_id%k_ID%,,

LEFT,1,D

KeyWait,%k_ThisHotkey%

ControlClick,%k_ThisHotkey%,ahk_id%k_ID%,,

LEFT,1,U

return

~*,::

~*'::

~*Space::

~*Enter::

~*Tab::

k_KeyPress:

StringReplace,k_ThisHotkey,A_ThisHotkey,~

StringReplace,k_ThisHotkey,k_ThisHotkey,*

SetTitleMatchMode,3;PreventstheTandBkeys

frombeingconfusedwithTabandBackspace.

ControlClick,%k_ThisHotkey%,ahk_id%k_ID%,,

LEFT,1,D

KeyWait,%k_ThisHotkey%

ControlClick,%k_ThisHotkey%,ahk_id%k_ID%,,

LEFT,1,U

Return

k_ShowHide:

ifk_IsVisible=y

{

Gui,Cancel

Menu,Tray,Rename,%k_MenuItemHide%,

Page 1532: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

%k_MenuItemShow%

k_IsVisible=n

}

else

{

Gui,Show

Menu,Tray,Rename,%k_MenuItemShow%,

%k_MenuItemHide%

k_IsVisible=y

}

return

GuiClose:

k_MenuExit:

ExitApp

Page 1533: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,..,.

||

;CHANGES:

;July22,2005(changesprovidedbyegilmour):

;-Addednewhotkeytounhidethelasthidden

window(Win+U)

;

;November3,2004(changesprovidedbytrogdor):

;-Programmanagerispreventedfrombeing

hidden.

;-Ifthereisnoactivewindow,theminimize-to-

trayhotkeywillhave

;noeffectratherthanwaitingindefinitely.

;

;October23,2004:

;-Thetaskbarispreventedfrombeinghidden.

;-Somepossibleproblemswithlongwindowtitles

havebeenfixed.

;-Windowswithoutatitlecanbehiddenwithout

causingproblems.

;-IfthescriptisrunningunderAHKv1.0.22or

greater,the

;maximumlengthofeachmenuitemisincreased

from100to260.

;CONFIGURATIONSECTION:Changethebelowvalues

asdesired.

;Thisisthemaximumnumberofwindowstoallow

tobehidden(havinga

;limithelpsperformance):

Page 1534: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

mwt_MaxWindows=50

;Thisisthehotkeyusedtohidetheactive

window:

mwt_Hotkey=#h;Win+H

;Thisisthehotkeyusedtounhidethelast

hiddenwindow:

mwt_UnHotkey=#u;Win+U

;Ifyouprefertohavethetraymenuemptyofall

thestandarditems,

;suchasHelpandPause,useN.Otherwise,use

Y:

mwt_StandardMenu=N

;Thesenextfewperformancesettingshelptokeep

theactionwithinthe

;#HotkeyModifierTimeoutperiod,andthusavoid

theneedtoreleaseand

;pressdownthehotkey'smodifierifyouwantto

hidemorethanone

;windowinarow.Thesesettingsarenotneeded

youchoosetohavethe

;scriptusethekeyboardhookvia

#InstallKeybdHookorothermeans:

#HotkeyModifierTimeout100

SetWinDelay10

SetKeyDelay0

#SingleInstance;Allowonlyoneinstanceofthis

scripttoberunning.

;ENDOFCONFIGURATIONSECTION(donotmake

changesbelowthispoint

;unlessyouwanttochangethebasic

functionalityofthescript).

Page 1535: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,%mwt_Hotkey%,mwt_Minimize

Hotkey,%mwt_UnHotkey%,mwt_UnMinimize

;Iftheuserterminatesthescriptbyanymeans,

unhideallthe

;windowsfirst:

OnExit,mwt_RestoreAllThenExit

ifmwt_StandardMenu=Y

Menu,Tray,Add

else

{

Menu,Tray,NoStandard

Menu,Tray,Add,E&xitandUnhideAll,

mwt_RestoreAllThenExit

}

Menu,Tray,Add,&UnhideAllHiddenWindows,

mwt_RestoreAll

Menu,Tray,Add;Anotherseparatorlinetomake

theabovemorespecial.

ifa_AhkVersion=;Sinceit'sblank,versionis

olderthan1.0.22.

mwt_MaxLength=100

else

mwt_MaxLength=260;Reducethistorestrict

thewidthofthemenu.

return;Endofauto-executesection.

mwt_Minimize:

ifmwt_WindowCount>=%mwt_MaxWindows%

{

MsgBoxNomorethan%mwt_MaxWindows%maybe

hiddensimultaneously.

Page 1536: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

}

;Setthe"lastfoundwindow"tosimplifyandhelp

performance.

;Sinceincertaincasesitispossibleforthere

tobenoactivewindow,

;atimeouthasbeenadded:

WinWait,A,,2

ifErrorLevel<>0;Ittimedout,sodonothing.

return

;Otherwise,the"lastfoundwindow"hasbeenset

andcannowbeused:

WinGet,mwt_ActiveID,ID

WinGetTitle,mwt_ActiveTitle

WinGetClass,mwt_ActiveClass

ifmwt_ActiveClassinShell_TrayWnd,Progman

{

MsgBoxThedesktopandtaskbarcannotbe

hidden.

return

}

;Becausehidingthewindowwon'tdeactivateit,

activatethewindow

;beneaththisone(ifany).Itriedotherways,

buttheywoundup

;activatingthetaskbar.Thiswaysendsthe

activewindow(whichis

;abouttobehidden)tothebackofthestack,

whichseemsbest:

Send,!{esc}

;HideitonlynowthatWinGetTitle/WinGetClass

abovehavebeenrun(since

;bydefault,thosecommandscannotdetecthidden

windows):

WinHide

Page 1537: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Ifthetitleisblank,usetheclassinstead.

Thisservestwopurposes:

;1)Amoremeaningfulnameisusedasthemenu

name.

;2)Allowsthemenuitemtobecreated

(otherwise,blankitemswouldn't

;behandledcorrectlybythevariousroutines

below).

ifmwt_ActiveTitle=

mwt_ActiveTitle=ahk_class%mwt_ActiveClass%

;Ensurethetitleisshortenoughtofit.

mwt_ActiveTitlealsoservesto

;uniquelyidentifythisparticularmenuitem.

StringLeft,mwt_ActiveTitle,mwt_ActiveTitle,

%mwt_MaxLength%

;Inadditiontothetraymenurequiringthateach

menuitemnamebe

;unique,itmustalsobeuniquesothatwecan

reliablylookitupin

;thearraywhenthewindowislaterunhidden.So

makeituniqueifit

;isn'talready:

Loop,%mwt_MaxWindows%

{

ifmwt_WindowTitle%a_index%=

%mwt_ActiveTitle%

{

;Matchfound,soit'snotunique.

;Firstremovethe0xfromthehexnumber

toconservemenuspace:

StringTrimLeft,mwt_ActiveIDShort,

mwt_ActiveID,2

StringLen,mwt_ActiveIDShortLength,

mwt_ActiveIDShort

StringLen,mwt_ActiveTitleLength,

Page 1538: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

mwt_ActiveTitle

mwt_ActiveTitleLength+=

%mwt_ActiveIDShortLength%

mwt_ActiveTitleLength+=1;+1the1

spacebetweentitle&ID.

ifmwt_ActiveTitleLength>%mwt_MaxLength%

{

;Sincemenuitemnamesarelimtedin

length,trimthetitle

;downtoallowjustenoughroomfor

theWindow'sShortIDat

;theendofitsname:

TrimCount=%mwt_ActiveTitleLength%

TrimCount-=%mwt_MaxLength%

StringTrimRight,mwt_ActiveTitle,

mwt_ActiveTitle,%TrimCount%

}

;Builduniquetitle:

mwt_ActiveTitle=%mwt_ActiveTitle%

%mwt_ActiveIDShort%

break

}

}

;First,ensurethatthisIDdoesn'talreadyexist

inthelist,whichcan

;happenifaparticularwindowwasexternally

unhidden(oritsappunhid

;it)andnowit'sabouttobere-hidden:

mwt_AlreadyExists=n

Loop,%mwt_MaxWindows%

{

ifmwt_WindowID%a_index%=%mwt_ActiveID%

{

mwt_AlreadyExists=y

break

}

Page 1539: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

;Addtheitemtothearrayandtothemenu:

ifmwt_AlreadyExists=n

{

Menu,Tray,add,%mwt_ActiveTitle%,

RestoreFromTrayMenu

mwt_WindowCount+=1

Loop,%mwt_MaxWindows%;Searchforafree

slot.

{

;Itshouldalwaysfindafreeslotif

thingsaredesignedright.

ifmwt_WindowID%a_index%=;Anempty

slotwasfound.

{

mwt_WindowID%a_index%=%mwt_ActiveID%

mwt_WindowTitle%a_index%=

%mwt_ActiveTitle%

break

}

}

}

return

RestoreFromTrayMenu:

Menu,Tray,delete,%A_ThisMenuItem%

;Findwindowbasedonitsuniquetitlestoredas

themenuitemname:

Loop,%mwt_MaxWindows%

{

ifmwt_WindowTitle%a_index%=%A_ThisMenuItem%

;Matchfound.

{

StringTrimRight,IDToRestore,

mwt_WindowID%a_index%,0

Page 1540: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinShow,ahk_id%IDToRestore%

WinActivateahk_id%IDToRestore%;

Sometimesneeded.

mwt_WindowID%a_index%=;Makeitblank

tofreeupaslot.

mwt_WindowTitle%a_index%=

mwt_WindowCount-=1

break

}

}

return

;;Thiswillpopthelastminimizedwindowoffthe

stackandunhideit.

mwt_UnMinimize:

;;Makesurethere'ssomethingtounhide.

ifmwt_WindowCount>0

{

;;Gettheidofthelastwindowminimizedand

unhideit

StringTrimRight,IDToRestore,

mwt_WindowID%mwt_WindowCount%,0

WinShow,ahk_id%IDToRestore%

WinActivateahk_id%IDToRestore%

;;Getthemenunameofthelastwindow

minimizedandremoveit

StringTrimRight,MenuToRemove,

mwt_WindowTitle%mwt_WindowCount%,0

Menu,Tray,delete,%MenuToRemove%

;;cleanupour'arrays'anddecrementthe

windowcount

mwt_WindowID%mwt_WindowCount%=

mwt_WindowTitle%mwt_WindowCount%=

mwt_WindowCount-=1

Page 1541: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

return

mwt_RestoreAllThenExit:

Gosub,mwt_RestoreAll

ExitApp;Doatrueexit.

mwt_RestoreAll:

Loop,%mwt_MaxWindows%

{

ifmwt_WindowID%a_index%<>

{

StringTrimRight,IDToRestore,

mwt_WindowID%a_index%,0

WinShow,ahk_id%IDToRestore%

WinActivateahk_id%IDToRestore%;

Sometimesneeded.

;Doitthiswayvs.DeleteAllsothatthe

sep.lineandfirst

;itemareretained:

StringTrimRight,MenuToRemove,

mwt_WindowTitle%a_index%,0

Menu,Tray,delete,%MenuToRemove%

mwt_WindowID%a_index%=;Makeitblank

tofreeupaslot.

mwt_WindowTitle%a_index%=

mwt_WindowCount-=1

}

ifmwt_WindowCount=0

break

}

return

Page 1542: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

--:deguix,()..,"".

||

/*

o-------------------------------------------------

-----------o

|UsingKeyboardNumpadasaMouse

|

(-------------------------------------------------

-----------)

|Bydeguix/AScriptfilefor

AutoHotkey1.0.22+|

|-----------------------------

-----------|

|

|

|Thisscriptisanexampleofuseof

AutoHotkey.Ituses|

|theremappingofnumpadkeysofakeyboardto

transformit|

|intoamouse.Somefeaturesaretheacceleration

which|

|enablesyoutoincreasethemousemovementwhen

holding|

|akeyforalongtime,andtherotationwhich

makesthe|

|numpadmouseto"turn".I.e.NumPadDownas

NumPadUp|

|andvice-versa.Seethelistofkeysusedbelow:

|

|

|

Page 1543: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

|-------------------------------------------------

-----------|

|Keys|Description

|

|-------------------------------------------------

-----------|

|ScrollLock(toggleon)|Activatesnumpadmouse

mode.|

|-----------------------|-------------------------

-----------|

|NumPad0|Leftmousebuttonclick.

|

|NumPad5|Middlemousebutton

click.|

|NumPadDot|Rightmousebutton

click.|

|NumPadDiv/NumPadMult|X1/X2mousebutton

click.(Win2k+)|

|NumPadSub/NumPadAdd|Movesup/downthemouse

wheel.|

||

|

|-----------------------|-------------------------

-----------|

|NumLock(toggledoff)|Activatesmousemovement

mode.|

|-----------------------|-------------------------

-----------|

|NumPadEnd/Down/PgDn/|Mousemovement.

|

|/Left/Right/Home/Up/|

|

|/PgUp|

|

||

|

|-----------------------|-------------------------

Page 1544: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

-----------|

|NumLock(toggledon)|Activatesmousespeed

adj.mode.|

|-----------------------|-------------------------

-----------|

|NumPad7/NumPad1|Inc./dec.acceleration

per|

||buttonpress.

|

|NumPad8/NumPad2|Inc./dec.initialspeed

per|

||buttonpress.

|

|NumPad9/NumPad3|Inc./dec.maximumspeed

per|

||buttonpress.

|

|^NumPad7/^NumPad1|Inc./dec.wheel

accelerationper|

||buttonpress*.

|

|^NumPad8/^NumPad2|Inc./dec.wheelinitial

speedper|

||buttonpress*.

|

|^NumPad9/^NumPad3|Inc./dec.wheelmaximum

speedper|

||buttonpress*.

|

|NumPad4/NumPad6|Inc./dec.rotationangle

to|

||rightindegrees.(i.e.

180°=|

||=inversedcontrols).

|

|-------------------------------------------------

-----------|

Page 1545: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

|*=Theseoptionsareaffectedbythemouse

wheelspeed|

|adjustedonControlPanel.Ifyoudon'thavea

mousewith|

|wheel,thedefaultis3+/-linesperoption

buttonpress.|

o-------------------------------------------------

-----------o

*/

;STARTOFCONFIGSECTION

#SingleInstanceforce

#MaxHotkeysPerInterval500

;UsingthekeyboardhooktoimplementtheNumpad

hotkeysprevents

;themfrominterferingwiththegenerationof

ANSIcharacterssuch

;asà.ThisisbecauseAutoHotkeygeneratessuch

characters

;byholdingdownALTandsendingaseriesof

Numpadkeystrokes.

;Hookhotkeysaresmartenoughtoignoresuch

keystrokes.

#UseHook

MouseSpeed=1

MouseAccelerationSpeed=1

MouseMaxSpeed=5

;MousewheelspeedisalsosetonControlPanel.

Asthat

;willaffectthenormalmousebehavior,thereal

speedof

;thesethreebelowaretimesthenormalmouse

wheelspeed.

Page 1546: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseWheelSpeed=1

MouseWheelAccelerationSpeed=1

MouseWheelMaxSpeed=5

MouseRotationAngle=0

;ENDOFCONFIGSECTION

;Thisisneededorkeypresseswouldfaultysend

theirnatural

;actions.LikeNumPadDivwouldsendsometimes"/"

tothe

;screen.

#InstallKeybdHook

Temp=0

Temp2=0

MouseRotationAnglePart=%MouseRotationAngle%

;Divideby45obecauseMouseMoveonlysupports

wholenumbers,

;andchangingthemouserotationtoanumber

lesserthan45o

;couldmakestrangemovements.

;

;Forexample:22.5owhenpressingNumPadUp:

;Firstitwouldmoveupwardsuntilthespeed

;tothesidereaches1.

MouseRotationAnglePart/=45

MouseCurrentAccelerationSpeed=0

MouseCurrentSpeed=%MouseSpeed%

MouseWheelCurrentAccelerationSpeed=0

MouseWheelCurrentSpeed=%MouseSpeed%

SetKeyDelay,-1

Page 1547: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetMouseDelay,-1

Hotkey,*NumPad0,ButtonLeftClick

Hotkey,*NumpadIns,ButtonLeftClickIns

Hotkey,*NumPad5,ButtonMiddleClick

Hotkey,*NumpadClear,ButtonMiddleClickClear

Hotkey,*NumPadDot,ButtonRightClick

Hotkey,*NumPadDel,ButtonRightClickDel

Hotkey,*NumPadDiv,ButtonX1Click

Hotkey,*NumPadMult,ButtonX2Click

Hotkey,*NumpadSub,ButtonWheelUp

Hotkey,*NumpadAdd,ButtonWheelDown

Hotkey,*NumPadUp,ButtonUp

Hotkey,*NumPadDown,ButtonDown

Hotkey,*NumPadLeft,ButtonLeft

Hotkey,*NumPadRight,ButtonRight

Hotkey,*NumPadHome,ButtonUpLeft

Hotkey,*NumPadEnd,ButtonUpRight

Hotkey,*NumPadPgUp,ButtonDownLeft

Hotkey,*NumPadPgDn,ButtonDownRight

Hotkey,Numpad8,ButtonSpeedUp

Hotkey,Numpad2,ButtonSpeedDown

Hotkey,Numpad7,ButtonAccelerationSpeedUp

Hotkey,Numpad1,ButtonAccelerationSpeedDown

Hotkey,Numpad9,ButtonMaxSpeedUp

Hotkey,Numpad3,ButtonMaxSpeedDown

Hotkey,Numpad6,ButtonRotationAngleUp

Hotkey,Numpad4,ButtonRotationAngleDown

Hotkey,!Numpad8,ButtonWheelSpeedUp

Hotkey,!Numpad2,ButtonWheelSpeedDown

Hotkey,!Numpad7,ButtonWheelAccelerationSpeedUp

Hotkey,!Numpad1,ButtonWheelAccelerationSpeedDown

Page 1548: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,!Numpad9,ButtonWheelMaxSpeedUp

Hotkey,!Numpad3,ButtonWheelMaxSpeedDown

Gosub,~ScrollLock;Initializebasedoncurrent

ScrollLockstate.

return

;Keyactivationsupport

~ScrollLock::

;Waitforittobereleasedbecauseotherwisethe

hookstategetsreset

;whilethekeyisdown,whichcausestheup-event

togetsuppressed,

;whichinturnpreventstogglingofthe

ScrollLockstate/light:

KeyWait,ScrollLock

GetKeyState,ScrollLockState,ScrollLock,T

IfScrollLockState=D

{

Hotkey,*NumPad0,on

Hotkey,*NumpadIns,on

Hotkey,*NumPad5,on

Hotkey,*NumPadDot,on

Hotkey,*NumPadDel,on

Hotkey,*NumPadDiv,on

Hotkey,*NumPadMult,on

Hotkey,*NumpadSub,on

Hotkey,*NumpadAdd,on

Hotkey,*NumPadUp,on

Hotkey,*NumPadDown,on

Hotkey,*NumPadLeft,on

Hotkey,*NumPadRight,on

Hotkey,*NumPadHome,on

Hotkey,*NumPadEnd,on

Page 1549: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,*NumPadPgUp,on

Hotkey,*NumPadPgDn,on

Hotkey,Numpad8,on

Hotkey,Numpad2,on

Hotkey,Numpad7,on

Hotkey,Numpad1,on

Hotkey,Numpad9,on

Hotkey,Numpad3,on

Hotkey,Numpad6,on

Hotkey,Numpad4,on

Hotkey,!Numpad8,on

Hotkey,!Numpad2,on

Hotkey,!Numpad7,on

Hotkey,!Numpad1,on

Hotkey,!Numpad9,on

Hotkey,!Numpad3,on

}

else

{

Hotkey,*NumPad0,off

Hotkey,*NumpadIns,off

Hotkey,*NumPad5,off

Hotkey,*NumPadDot,off

Hotkey,*NumPadDel,off

Hotkey,*NumPadDiv,off

Hotkey,*NumPadMult,off

Hotkey,*NumpadSub,off

Hotkey,*NumpadAdd,off

Hotkey,*NumPadUp,off

Hotkey,*NumPadDown,off

Hotkey,*NumPadLeft,off

Hotkey,*NumPadRight,off

Page 1550: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Hotkey,*NumPadHome,off

Hotkey,*NumPadEnd,off

Hotkey,*NumPadPgUp,off

Hotkey,*NumPadPgDn,off

Hotkey,Numpad8,off

Hotkey,Numpad2,off

Hotkey,Numpad7,off

Hotkey,Numpad1,off

Hotkey,Numpad9,off

Hotkey,Numpad3,off

Hotkey,Numpad6,off

Hotkey,Numpad4,off

Hotkey,!Numpad8,off

Hotkey,!Numpad2,off

Hotkey,!Numpad7,off

Hotkey,!Numpad1,off

Hotkey,!Numpad9,off

Hotkey,!Numpad3,off

}

return

;Mouseclicksupport

ButtonLeftClick:

GetKeyState,already_down_state,LButton

Ifalready_down_state=D

return

Button2=NumPad0

ButtonClick=Left

GotoButtonClickStart

ButtonLeftClickIns:

GetKeyState,already_down_state,LButton

Ifalready_down_state=D

return

Page 1551: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Button2=NumPadIns

ButtonClick=Left

GotoButtonClickStart

ButtonMiddleClick:

GetKeyState,already_down_state,MButton

Ifalready_down_state=D

return

Button2=NumPad5

ButtonClick=Middle

GotoButtonClickStart

ButtonMiddleClickClear:

GetKeyState,already_down_state,MButton

Ifalready_down_state=D

return

Button2=NumPadClear

ButtonClick=Middle

GotoButtonClickStart

ButtonRightClick:

GetKeyState,already_down_state,RButton

Ifalready_down_state=D

return

Button2=NumPadDot

ButtonClick=Right

GotoButtonClickStart

ButtonRightClickDel:

GetKeyState,already_down_state,RButton

Ifalready_down_state=D

return

Button2=NumPadDel

ButtonClick=Right

GotoButtonClickStart

ButtonX1Click:

GetKeyState,already_down_state,XButton1

Ifalready_down_state=D

Page 1552: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

Button2=NumPadDiv

ButtonClick=X1

GotoButtonClickStart

ButtonX2Click:

GetKeyState,already_down_state,XButton2

Ifalready_down_state=D

return

Button2=NumPadMult

ButtonClick=X2

GotoButtonClickStart

ButtonClickStart:

MouseClick,%ButtonClick%,,,1,0,D

SetTimer,ButtonClickEnd,10

return

ButtonClickEnd:

GetKeyState,kclickstate,%Button2%,P

ifkclickstate=D

return

SetTimer,ButtonClickEnd,off

MouseClick,%ButtonClick%,,,1,0,U

return

;Mousemovementsupport

ButtonSpeedUp:

MouseSpeed++

ToolTip,Mousespeed:%MouseSpeed%pixels

SetTimer,RemoveToolTip,1000

return

ButtonSpeedDown:

IfMouseSpeed>1

MouseSpeed--

Page 1553: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfMouseSpeed=1

ToolTip,Mousespeed:%MouseSpeed%pixel

else

ToolTip,Mousespeed:%MouseSpeed%pixels

SetTimer,RemoveToolTip,1000

return

ButtonAccelerationSpeedUp:

MouseAccelerationSpeed++

ToolTip,Mouseaccelerationspeed:

%MouseAccelerationSpeed%pixels

SetTimer,RemoveToolTip,1000

return

ButtonAccelerationSpeedDown:

IfMouseAccelerationSpeed>1

MouseAccelerationSpeed--

IfMouseAccelerationSpeed=1

ToolTip,Mouseaccelerationspeed:

%MouseAccelerationSpeed%pixel

else

ToolTip,Mouseaccelerationspeed:

%MouseAccelerationSpeed%pixels

SetTimer,RemoveToolTip,1000

return

ButtonMaxSpeedUp:

MouseMaxSpeed++

ToolTip,Mousemaximumspeed:%MouseMaxSpeed%

pixels

SetTimer,RemoveToolTip,1000

return

ButtonMaxSpeedDown:

IfMouseMaxSpeed>1

MouseMaxSpeed--

IfMouseMaxSpeed=1

ToolTip,Mousemaximumspeed:%MouseMaxSpeed%

pixel

else

Page 1554: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ToolTip,Mousemaximumspeed:%MouseMaxSpeed%

pixels

SetTimer,RemoveToolTip,1000

return

ButtonRotationAngleUp:

MouseRotationAnglePart++

IfMouseRotationAnglePart>=8

MouseRotationAnglePart=0

MouseRotationAngle=%MouseRotationAnglePart%

MouseRotationAngle*=45

ToolTip,Mouserotationangle:

%MouseRotationAngle%°

SetTimer,RemoveToolTip,1000

return

ButtonRotationAngleDown:

MouseRotationAnglePart--

IfMouseRotationAnglePart<0

MouseRotationAnglePart=7

MouseRotationAngle=%MouseRotationAnglePart%

MouseRotationAngle*=45

ToolTip,Mouserotationangle:

%MouseRotationAngle%°

SetTimer,RemoveToolTip,1000

return

ButtonUp:

ButtonDown:

ButtonLeft:

ButtonRight:

ButtonUpLeft:

ButtonUpRight:

ButtonDownLeft:

ButtonDownRight:

IfButton<>0

{

IfNotInString,A_ThisHotkey,%Button%

Page 1555: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

MouseCurrentAccelerationSpeed=0

MouseCurrentSpeed=%MouseSpeed%

}

}

StringReplace,Button,A_ThisHotkey,*

ButtonAccelerationStart:

IfMouseAccelerationSpeed>=1

{

IfMouseMaxSpeed>%MouseCurrentSpeed%

{

Temp=0.001

Temp*=%MouseAccelerationSpeed%

MouseCurrentAccelerationSpeed+=%Temp%

MouseCurrentSpeed+=

%MouseCurrentAccelerationSpeed%

}

}

;MouseRotationAngleconvertiontospeedofbutton

direction

{

MouseCurrentSpeedToDirection=

%MouseRotationAngle%

MouseCurrentSpeedToDirection/=90.0

Temp=%MouseCurrentSpeedToDirection%

ifTemp>=0

{

ifTemp<1

{

MouseCurrentSpeedToDirection=1

MouseCurrentSpeedToDirection-=%Temp%

Goto

EndMouseCurrentSpeedToDirectionCalculation

}

Page 1556: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

ifTemp>=1

{

ifTemp<2

{

MouseCurrentSpeedToDirection=0

Temp-=1

MouseCurrentSpeedToDirection-=%Temp%

Goto

EndMouseCurrentSpeedToDirectionCalculation

}

}

ifTemp>=2

{

ifTemp<3

{

MouseCurrentSpeedToDirection=-1

Temp-=2

MouseCurrentSpeedToDirection+=%Temp%

Goto

EndMouseCurrentSpeedToDirectionCalculation

}

}

ifTemp>=3

{

ifTemp<4

{

MouseCurrentSpeedToDirection=0

Temp-=3

MouseCurrentSpeedToDirection+=%Temp%

Goto

EndMouseCurrentSpeedToDirectionCalculation

}

}

}

EndMouseCurrentSpeedToDirectionCalculation:

Page 1557: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;MouseRotationAngleconvertiontospeedof90

degreestoright

{

MouseCurrentSpeedToSide=%MouseRotationAngle%

MouseCurrentSpeedToSide/=90.0

Temp=%MouseCurrentSpeedToSide%

Transform,Temp,mod,%Temp%,4

ifTemp>=0

{

ifTemp<1

{

MouseCurrentSpeedToSide=0

MouseCurrentSpeedToSide+=%Temp%

Goto

EndMouseCurrentSpeedToSideCalculation

}

}

ifTemp>=1

{

ifTemp<2

{

MouseCurrentSpeedToSide=1

Temp-=1

MouseCurrentSpeedToSide-=%Temp%

Goto

EndMouseCurrentSpeedToSideCalculation

}

}

ifTemp>=2

{

ifTemp<3

{

MouseCurrentSpeedToSide=0

Temp-=2

MouseCurrentSpeedToSide-=%Temp%

Goto

Page 1558: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

EndMouseCurrentSpeedToSideCalculation

}

}

ifTemp>=3

{

ifTemp<4

{

MouseCurrentSpeedToSide=-1

Temp-=3

MouseCurrentSpeedToSide+=%Temp%

Goto

EndMouseCurrentSpeedToSideCalculation

}

}

}

EndMouseCurrentSpeedToSideCalculation:

MouseCurrentSpeedToDirection*=

%MouseCurrentSpeed%

MouseCurrentSpeedToSide*=%MouseCurrentSpeed%

Temp=%MouseRotationAnglePart%

Transform,Temp,Mod,%Temp%,2

IfButton=NumPadUp

{

ifTemp=1

{

MouseCurrentSpeedToSide*=2

MouseCurrentSpeedToDirection*=2

}

MouseCurrentSpeedToDirection*=-1

MouseMove,%MouseCurrentSpeedToSide%,

%MouseCurrentSpeedToDirection%,0,R

}

elseifButton=NumPadDown

Page 1559: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

ifTemp=1

{

MouseCurrentSpeedToSide*=2

MouseCurrentSpeedToDirection*=2

}

MouseCurrentSpeedToSide*=-1

MouseMove,%MouseCurrentSpeedToSide%,

%MouseCurrentSpeedToDirection%,0,R

}

elseifButton=NumPadLeft

{

ifTemp=1

{

MouseCurrentSpeedToSide*=2

MouseCurrentSpeedToDirection*=2

}

MouseCurrentSpeedToSide*=-1

MouseCurrentSpeedToDirection*=-1

MouseMove,%MouseCurrentSpeedToDirection%,

%MouseCurrentSpeedToSide%,0,R

}

elseifButton=NumPadRight

{

ifTemp=1

{

MouseCurrentSpeedToSide*=2

MouseCurrentSpeedToDirection*=2

}

MouseMove,%MouseCurrentSpeedToDirection%,

%MouseCurrentSpeedToSide%,0,R

}

elseifButton=NumPadHome

Page 1560: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

{

Temp=%MouseCurrentSpeedToDirection%

Temp-=%MouseCurrentSpeedToSide%

Temp*=-1

Temp2=%MouseCurrentSpeedToDirection%

Temp2+=%MouseCurrentSpeedToSide%

Temp2*=-1

MouseMove,%Temp%,%Temp2%,0,R

}

elseifButton=NumPadPgUp

{

Temp=%MouseCurrentSpeedToDirection%

Temp+=%MouseCurrentSpeedToSide%

Temp2=%MouseCurrentSpeedToDirection%

Temp2-=%MouseCurrentSpeedToSide%

Temp2*=-1

MouseMove,%Temp%,%Temp2%,0,R

}

elseifButton=NumPadEnd

{

Temp=%MouseCurrentSpeedToDirection%

Temp+=%MouseCurrentSpeedToSide%

Temp*=-1

Temp2=%MouseCurrentSpeedToDirection%

Temp2-=%MouseCurrentSpeedToSide%

MouseMove,%Temp%,%Temp2%,0,R

}

elseifButton=NumPadPgDn

{

Temp=%MouseCurrentSpeedToDirection%

Temp-=%MouseCurrentSpeedToSide%

Temp2*=-1

Temp2=%MouseCurrentSpeedToDirection%

Temp2+=%MouseCurrentSpeedToSide%

MouseMove,%Temp%,%Temp2%,0,R

}

Page 1561: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SetTimer,ButtonAccelerationEnd,10

return

ButtonAccelerationEnd:

GetKeyState,kstate,%Button%,P

ifkstate=D

GotoButtonAccelerationStart

SetTimer,ButtonAccelerationEnd,off

MouseCurrentAccelerationSpeed=0

MouseCurrentSpeed=%MouseSpeed%

Button=0

return

;Mousewheelmovementsupport

ButtonWheelSpeedUp:

MouseWheelSpeed++

RegRead,MouseWheelSpeedMultiplier,HKCU,Control

Panel\Desktop,WheelScrollLines

IfMouseWheelSpeedMultiplier<=0

MouseWheelSpeedMultiplier=1

MouseWheelSpeedReal=%MouseWheelSpeed%

MouseWheelSpeedReal*=%MouseWheelSpeedMultiplier%

ToolTip,Mousewheelspeed:%MouseWheelSpeedReal%

lines

SetTimer,RemoveToolTip,1000

return

ButtonWheelSpeedDown:

RegRead,MouseWheelSpeedMultiplier,HKCU,Control

Panel\Desktop,WheelScrollLines

IfMouseWheelSpeedMultiplier<=0

MouseWheelSpeedMultiplier=1

IfMouseWheelSpeedReal>

%MouseWheelSpeedMultiplier%

{

MouseWheelSpeed--

Page 1562: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseWheelSpeedReal=%MouseWheelSpeed%

MouseWheelSpeedReal*=

%MouseWheelSpeedMultiplier%

}

IfMouseWheelSpeedReal=1

ToolTip,Mousewheelspeed:

%MouseWheelSpeedReal%line

else

ToolTip,Mousewheelspeed:

%MouseWheelSpeedReal%lines

SetTimer,RemoveToolTip,1000

return

ButtonWheelAccelerationSpeedUp:

MouseWheelAccelerationSpeed++

RegRead,MouseWheelSpeedMultiplier,HKCU,Control

Panel\Desktop,WheelScrollLines

IfMouseWheelSpeedMultiplier<=0

MouseWheelSpeedMultiplier=1

MouseWheelAccelerationSpeedReal=

%MouseWheelAccelerationSpeed%

MouseWheelAccelerationSpeedReal*=

%MouseWheelSpeedMultiplier%

ToolTip,Mousewheelaccelerationspeed:

%MouseWheelAccelerationSpeedReal%lines

SetTimer,RemoveToolTip,1000

return

ButtonWheelAccelerationSpeedDown:

RegRead,MouseWheelSpeedMultiplier,HKCU,Control

Panel\Desktop,WheelScrollLines

IfMouseWheelSpeedMultiplier<=0

MouseWheelSpeedMultiplier=1

IfMouseWheelAccelerationSpeed>1

{

MouseWheelAccelerationSpeed--

MouseWheelAccelerationSpeedReal=

%MouseWheelAccelerationSpeed%

Page 1563: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MouseWheelAccelerationSpeedReal*=

%MouseWheelSpeedMultiplier%

}

IfMouseWheelAccelerationSpeedReal=1

ToolTip,Mousewheelaccelerationspeed:

%MouseWheelAccelerationSpeedReal%line

else

ToolTip,Mousewheelaccelerationspeed:

%MouseWheelAccelerationSpeedReal%lines

SetTimer,RemoveToolTip,1000

return

ButtonWheelMaxSpeedUp:

MouseWheelMaxSpeed++

RegRead,MouseWheelSpeedMultiplier,HKCU,Control

Panel\Desktop,WheelScrollLines

IfMouseWheelSpeedMultiplier<=0

MouseWheelSpeedMultiplier=1

MouseWheelMaxSpeedReal=%MouseWheelMaxSpeed%

MouseWheelMaxSpeedReal*=

%MouseWheelSpeedMultiplier%

ToolTip,Mousewheelmaximumspeed:

%MouseWheelMaxSpeedReal%lines

SetTimer,RemoveToolTip,1000

return

ButtonWheelMaxSpeedDown:

RegRead,MouseWheelSpeedMultiplier,HKCU,Control

Panel\Desktop,WheelScrollLines

IfMouseWheelSpeedMultiplier<=0

MouseWheelSpeedMultiplier=1

IfMouseWheelMaxSpeed>1

{

MouseWheelMaxSpeed--

MouseWheelMaxSpeedReal=%MouseWheelMaxSpeed%

MouseWheelMaxSpeedReal*=

%MouseWheelSpeedMultiplier%

}

Page 1564: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfMouseWheelMaxSpeedReal=1

ToolTip,Mousewheelmaximumspeed:

%MouseWheelMaxSpeedReal%line

else

ToolTip,Mousewheelmaximumspeed:

%MouseWheelMaxSpeedReal%lines

SetTimer,RemoveToolTip,1000

return

ButtonWheelUp:

ButtonWheelDown:

IfButton<>0

{

IfButton<>%A_ThisHotkey%

{

MouseWheelCurrentAccelerationSpeed=0

MouseWheelCurrentSpeed=%MouseWheelSpeed%

}

}

StringReplace,Button,A_ThisHotkey,*

ButtonWheelAccelerationStart:

IfMouseWheelAccelerationSpeed>=1

{

IfMouseWheelMaxSpeed>

%MouseWheelCurrentSpeed%

{

Temp=0.001

Temp*=%MouseWheelAccelerationSpeed%

MouseWheelCurrentAccelerationSpeed+=

%Temp%

MouseWheelCurrentSpeed+=

%MouseWheelCurrentAccelerationSpeed%

}

}

Page 1565: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfButton=NumPadSub

MouseClick,wheelup,,,

%MouseWheelCurrentSpeed%,0,D

elseifButton=NumPadAdd

MouseClick,wheeldown,,,

%MouseWheelCurrentSpeed%,0,D

SetTimer,ButtonWheelAccelerationEnd,100

return

ButtonWheelAccelerationEnd:

GetKeyState,kstate,%Button%,P

ifkstate=D

GotoButtonWheelAccelerationStart

MouseWheelCurrentAccelerationSpeed=0

MouseWheelCurrentSpeed=%MouseWheelSpeed%

Button=0

return

RemoveToolTip:

SetTimer,RemoveToolTip,Off

ToolTip

return

Page 1566: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

--:Phi,.'Seek'/,,..

||

;*************************************************

****************

;

;Program:Seek

;Coder:Phi

;Updated:MonJan3110:08:372005

;

;Whatdoyouseek,myfriend?

;

;*************************************************

****************

;

;Ihavealotoffuncodingthis,andhopeyou

will

;enjoyusingittoo.Feelfreetodropmean

emailwith

;yourcommentsandfeedbackat:phi1618(*a.t*)

gmail

;:D0T:com.

;

;Options:

;-cacheUsethecacheddirectory-listingif

available

;(thisisthedefaultmodewhenno

optionisspecified)

;-scanForceadirectoryscantoretrievethe

latest

;directorylisting

;-scexScan&exit(thisisusefulfor

Page 1567: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

schedulingthe

;potentiallytime-consumingdirectory-

scanningas

;abackgroundjob)

;-helpShowthishelp

;

;*************************************************

****************

;

;HOWTO'SEEK':

;

;1.'Seek'isanAutoHotkeyscript.Youcan

eitherrunit

;asSeek.ahk(originalscript)orSeek.exe

(compiled

;executable).

;

;ToobtainSeek.exe,youcandownloadSeek.zip

(includes

;boththesourcecodeandthecompiledbinary)

from

;http://home.ripway.com/2004-10/188589/

;Otherwise,youcancompileSeek.ahkonyour

ownby

;usingAutoHotkey'sAhk2Exe.execompiler,or

youcan

;askmeforacopyviaemail.Thefilesizeis

smallat

;about200kbytes.Icanbereachedat:

phi1618(*a.t*)

;gmail:D0T:com.

;

;TouseSeek.ahk,first,you'llneedto

install

;AutoHotkeyv1.0.25orhigheronyourPC

(downloadfrom

;http://www.autohotkey.com).Next,runthe

Page 1568: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

command:

;

;X:\myTools\AutoHotkey\AutoHotkey.exe

Y:\myAHK\Seek.ahk

;

;RemembertoreplaceX:\myToolsandY:\myAHK

with

;theproperdirectorynamesonyourPC.

;

;2.YoucanplacetheexecutableSeek.exe

anywhereyou

;want.Thereisnoinstallationrequired,it

doesn't

;writeanythingtoyourregistry,andit

doesn't

;accesstheInternetatall(nophoninghome).

To

;uninstall,simplydeleteSeek.exe.

;

;Theonly2files'Seek'createsareplacedin

your

;TMPdirectory:

;

;a._Seek.key(cachefileforlastquery

string)

;b._Seek.list(cachefilefordirectory

listing)

;

;Ifyou'reapurist,youcandeletethem

manually

;whenyoudecidetoremove'Seek'fromyour

system.

;

;3.Themostconvenientwaytorun'Seek'isvia

a

;shortcut/hotkey.Ifyouarenotalreadyusing

any

Page 1569: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;hotkeymanagementprogramonyourPC,I

highly

;recommendAutoHotkey.Ifyoudon'tintendto

install

;anyhotkeymanagementprogramatthemoment,

youcan

;makeuseofWindowsshortcutfeatureandbind

a

;shortcutkey(e.g.ALT-F1)tolaunch'Seek'.

Thisis

;importantsothatyoucanrun'Seek'at

anytimeand

;anywhere.

;

;4.Whenyourun'Seek'forthefirsttime,it'll

scan

;yourStartMenu,andsavethedirectory

listinginto

;acachefile.

;

;Thefollowingdirectoriesareincludedinthe

scanning:

;-%A_StartMenu%

;-%A_StartMenuCommon%

;

;Bydefault,subsequentrunswillreadfrom

the

;cachefilesoastoreducetheloadingtime.

For

;moreinfoonoptions,run'Seek.exe-help'.

Ifyou

;thinkyourStartMenudoesn'tcontaintoo

many

;programs,youcanchoosenottousethecache

and

;instruct'Seek'toalwaysdoadirectoryscan

(via

Page 1570: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;option-scan).Thatway,youwillalwaysget

the

;latestlisting.

;

;5.Whenyourun'Seek',awindowwillappear,

waiting

;foryoutoenterakeyword/phrase.Afteryou

have

;enteredaquerystring,alistofmatching

records

;willbedisplayed.Next,youneedto

highlightan

;entryandpress<Enter>orclickonthe

'Open'

;buttontoruntheselectedprogramoropen

the

;selecteddirectory.

;

;*************************************************

****************

;

;TECHNICALNOTES:

;

;-'Seek'requiresChrisMallett'sAutoHotkey

v1.0.25

;orhigherversion(http://www.autohotkey.com).

;ThankstoChrisforhisgreatworkon

AutoHotkey.:)

;

;-Thefollowingenvironmentvariablesmustbe

valid:

;a.TMP

;

;*************************************************

****************

;

;KNOWNPROBLEMS:

Page 1571: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;

;-Nil

;

;*************************************************

****************

;

;IMPLEMENTEDSUGGESTIONS:

;

;-Highlight1stmatchingrecordbydefaultso

that

;usercanjusthit<Enter>torunit.

;(SuggestedbyYihYeong)

;

;-Enabledouble-clickonthelistingofthe

search

;resultstolaunchtheprogram.

;(SuggestedbyYihYeong&Jack)

;

;-Autoreal-timeincrementalsearch.

;(SuggestedbyRajat)

;

;-Fuzzysearchwhenuserentersmultiplequery

strings,

;separatedbyspace.

;(SuggestedbyRajat)

;

;*************************************************

****************

;

;SUGGESTEDFEATURES(MAYORMAYNOTBE

IMPLEMENTED):

;

;-Logthelaunchhistory.Listthemost

frequently

;usedprogramsatthetopofthesearch

results.

;(SuggestedbyYihYeong)

Page 1572: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;

;-Insteadofusinglistbox,canitdisplaya

series

;ofapplicationiconssothathoveringthe

cursor

;overtheiconwilldisplayatooltip

containingthe

;programinformation(path,etc).

;(SuggestedbyYihYeong)

;

;-Insteadofmatchingtextinthemiddle,match

only

;thoseprogram/directorynamesthatbeginwith

the

;querystring.

;(SuggestedbyStefan)

;

;-Addfavoritesmanagement.Launchgroupof

programs

;inasinglerun.

;(SuggestedbyAtomhrt)

;

;-IntegrateSeekintotheWindows

taskbar/toolbarsothat

;itisalwaysavailableandthereisnoneedto

binda

;hotkeytolaunchSeek.

;(SuggestedbyDenizAkay)

;

;-Searchbywildcards/regex.

;(SuggestedbySteve)

;

;*************************************************

****************

;

;CHANGEHISTORY:

;

Page 1573: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;*v1.1.0

;-Initialrelease.

;

;*v1.1.1

;-Removedmaximise-windowoptionsincesome

programsdon't

;functionwellwithit.

;-Addeddouble-clickdetectiontotrigger'Open'

function.

;

;*v2.0.0

;-Integratedthe'Seek'popupwindowintothe

outputscreen

;sothatusercanre-enterthequerystringto

searchfor

;somethingelsewithouthavingtoexitandrun

Seekagain.

;-Added'ScanStart-Menu'button.

;-Addedreal-timeincrementalsearchwhichwill

auto

;filterformatchingrecordswhileyoutype

away,

;withoutwaitingforyoutopress<Enter>.

;-Addedinternalswitch(TrackKeyPhrase)to

tracksearch-string.

;-Addedinternalswitch(ToolTipFilename)to

showfilename

;usingtooltip.

;

;*v2.0.1

;-AddedhorizontalscrollbartoListBoxsothat

very

;longrecordswillnotbecut-offinthe

middle.

;

;*v2.0.2

;-Allowedusertoaddtheirowncustomisedlist

Page 1574: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ofdirectories

;tobeincludedinthescanning.Userjust

needstocreatea

;textfile'Seek.dir'inthesamedirectoryas

Seek.exeor

;Seek.ahk,andspecifythefullpathofthe

directorytobe

;added,onedirectoryperline.Donotenclose

thepathin

;quotesordouble-quotes.

;

;*v2.0.3

;-Added/onoptiontoDIR-commandtosortby

name.

;-Fuzzysearchwhenuserentersmultiplequery

strings,

;separatedbyspace,fore.g."medpla".It'sa

match

;whenallthestrings("med"&"pla")are

found.This

;willmatch"MediaPlayer","MacromediaFlash

Player",

;"PlayMedievalKing","medpla","plamed".

;-Correctedtab-movementsequencebyaddingall

buttons

;rightfromthestart,butdisablethemuntil

theycan

;beused.

;-Addedstatusbartoreplacetooltip-feedback.

;-Removedobsoleteinternalswitch

(ToolTipFilename).

;-Replacedtheuseof"dir"commandwith

AutoHotkey's

;own"Loop"commandforscanningdirectory

contents.

;"dir"cannothandleextendedcharactersetand

thus

Page 1575: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;non-English(e.gGerman)directoryand

filenameare

;capturedwrongly.(ThanksWolfgangBujattiand

;SietseFliegefortestingthismodification)

;-Addedinternalswitch(ScanMode)todefine

whether

;filesand/ordirectoriesaretobeincludedin

scan.

;-ReplacedhardcodeddirectorypathsofStart

Menuwith

;built-invariablesA_StartMenu,

A_StartMenuCommon.

;Withthis,Seeknowworksfordifferent

localeswith

;differentnamingconventionoftheStartMenu.

;(ThanksWolfgangBujattiandSietseFliegefor

help

;intestinganothermethodbeforethesenew

variables

;areavailable.)

;-Addedthepre-selectionofthelast-run

program

;recordsothataquickdouble-<ENTER>willrun

it.

;

;*************************************************

****************

;**************************

;<---BEGINOFPROGRAM--->

;**************************

;====YourCustomisation

===================================

;Specifywhichprogramtousewhenopeninga

directory.

Page 1576: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Iftheprogramcannotbefoundorisnot

specified

;(i.e.variableisunassignedorassignedanull

value),

;thedefaultExplorerwillbeused.

dirExplorer=E:\utl\xplorer2_lite\xplorer2.exe

;User'scustomisedlistofadditionaldirectories

tobe

;includedinthescanning.Thefullpathmustnot

be

;enclosedbyquotesordouble-quotes.Ifthis

fileis

;missing,onlythedefaultdirectorieswillbe

scanned.

SeekMyDir=%A_ScriptDir%\Seek.dir

;Specifythefilenameanddirectorylocationto

save

;thecacheddirectory/programlisting.Thereis

no

;needtochangethisunlessyouwantto.

dirListing=%A_Temp%\_Seek.list

;Specifythefilenameanddirectorylocationto

save

;thecachedkeyword/phraseoflastsearch.There

is

;noneedtochangethisunlessyouwantto.

keyPhrase=%A_Temp%\_Seek.key

;Tracksearchstring(ON/OFF)

;IfON,thelast-usedquerystringwillbere-

usedas

;thedefaultquerystringthenexttimeyourun

Seek.

;IfOFF,thelast-usedquerystringwillnotbe

Page 1577: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

tracked

;andtherewillnotbeadefaultquerystring

valuethe

;nexttimeyourunSeek.

TrackKeyPhrase=ON

;Specifywhatshouldbeincludedinscan.

;0:Directoriesareexcluded(onlyfiles).

;1:Allfilesanddirectoriesareincluded.

;2:Onlydirectoriesareincluded(nofiles).

ScanMode=1

;.................................................

..........

;INIT

;#NoTrayIcon

StringCaseSense,Off

version=Seekv2.0.3

;DISPLAYHELPINSTRUCTIONS

If1in--help,-help,/h,-h,/?,-?

{

MsgBox,,%version%,NavigatingtheStartMenu

canbeahassle,especiallyifyouhaveinstalled

manyprogramsovertime.'Seek'/,,.This

eliminatesthedrudgeryofsearchingand

traversingtheStartMenu.`n`nIhavealotoffun

codingthis,andhopeyouwillenjoyusingittoo.

Feelfreetodropmeanemailwithyourcomments

andfeedbackat:phi1618(*a.t*)gmail:D0T:

com.`n`nOptions:`n-cache`tUsethecached

directory-listingifavailable(thisisthe

defaultmodewhennooptionisspecified)`n-

scan`tForceadirectoryscantoretrievethe

latestdirectorylisting`n-scex`tScan&exit

(thisisusefulforschedulingthepotentially

Page 1578: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

time-consumingdirectory-scanningasabackground

job)`n-help`tShowthishelp

GotoQuitNoSave

}

;CHECKTHATTHEMANDATORYENVIRONMENTVARIABLES

EXISTANDAREVALID

;*TMP*

IfNotExist,%A_Temp%;PATHDOESNOTEXIST

{

MsgBoxThismandatoryenvironmentvariableis

eithernotdefinedorinvalid:`n`nTMP=

%A_Temp%`n`nPleasefixitbeforerunningSeek.

GotoQuitNoSave

}

;IFNOTSCAN-AND-EXIT

IfNotEqual1,-scex

{

;RETRIEVETHELASTUSEDKEY-PHRASEFROMCACHE

FILE

;TOBEUSEDASTHEDEFAULTQUERYSTRING

IfTrackKeyPhrase=ON

{

FileReadLine,PrevKeyPhrase,%keyPhrase%,

1

FileReadLine,PrevOpenTarget,%keyPhrase%,

2

}

NewKeyPhrase=%PrevKeyPhrase%

NewOpenTarget=%PrevOpenTarget%

;ADDTHETEXTBOXFORUSERTOENTERTHEQUERY

STRING

Gui,1:Add,Edit,vFilenameW600,

%NewKeyPhrase%

Page 1579: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;ADDMYFAVTAGLINE

Gui,1:Add,Text,X625Y10,Whatdoyouseek,

myfriend?

;ADDTHESTATUSBARFORPROVIDINGFEEDBACKTO

USER

Gui,1:Add,Text,vStatusBarX10Y31R1W764

;ADDTHESELECTIONLISTBOXFORDISPLAYING

SEARCHRESULTS

Gui,1:Add,ListBox,vOpenTarget

gTargetSelectionX10Y53R28W764HScroll

Disabled,%List%

;ADDTHESEBUTTONS,BUTDISABLETHEMFORNOW

Gui,1:Add,Button,gButtonOPENvButtonOPEN

DefaultX10Y446Disabled,Open

Gui,1:Add,Button,gButtonOPENDIR

vButtonOPENDIRX59Y446Disabled,OpenDirectory

Gui,1:Add,Button,gButtonSCANSTARTMENU

vButtonSCANSTARTMENUX340Y446Disabled,Scan

Start-Menu

;ADDTHEEXITBUTTON

Gui,1:Add,Button,gButtonEXITX743Y446,

Exit

;POP-UPTHEQUERYWINDOW

Gui,1:Show,Center,%version%

}

;ENABLERE-SCANNINGOFLATESTDIRECTORYLISTING

If1in-scan,-scex

rescan=Y

;CHECKWHETHERTHEDIRECTORYLISTINGCACHEFILE

ALREADYEXISTS.IFNOT,DOARE-SCAN.

ElseIfNotExist,%dirListing%

Page 1580: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

rescan=Y

Ifrescan=Y;DOARE-SCAN

{

;SHOWSTATUSUNLESSUSERSPECIFIESSCAN-AND-

EXITOPTION

IfNotEqual1,-scex

GuiControl,,StatusBar,Scanningdirectory

listing...

;SCANSTART-MENUANDSTOREDIRECTORY/PROGRAM

LISTINGSINCACHEFILE

GosubScanStartMenu

;QUITIFUSERSPECIFIESSCAN-AND-EXITOPTION

IfEqual1,-scex,Goto,QuitNoSave

}

GuiControl,,StatusBar,Retrievinglastquery

result...

;RETRIEVETHEMATCHINGLISTFORTHELASTUSED

KEY-PHRASE

GosubSilentFindMatches

;REMOVETHESTATUSTEXT

GuiControl,,StatusBar,

;DIRECTORYLISTINGISNOWLOADED.ENABLETHE

OTHERBUTTONS.

;THESEBUTTONSAREDISABLEDEARLIERBECAUSETHEY

SHOULDNOT

;BEFUNCTIONALUNTILTHISPARTOFTHESCRIPT.

GuiControl,1:Enable,ButtonOPEN

GuiControl,1:Enable,ButtonOPENDIR

GuiControl,1:Enable,ButtonSCANSTARTMENU

Page 1581: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;TURNONINCREMENTALSEARCH

SetTimer,tIncrementalSearch,500

;REFRESHTHEGUI

GosubEnterQuery

Return

;*************************************************

**********

;

*

;ENDOFMAINPROGRAM

*

;

*

;*************************************************

**********

;===BEGINButtonSCANSTARTMENUEVENT

=======================

ButtonSCANSTARTMENU:

Gui,1:Submit,NoHide

GuiControl,,StatusBar,Scanningdirectory

listing...

;DISABLELISTBOXWHILESCANNINGISINPROGRESS

GuiControl,1:Disable,OpenTarget

GuiControl,1:Disable,ButtonEXIT

GuiControl,1:Disable,ButtonOPEN

GuiControl,1:Disable,ButtonOPENDIR

GuiControl,1:Disable,ButtonSCANSTARTMENU

;DOTHESCANNING

Page 1582: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GosubScanStartMenu

;INFORMUSERTHATSCANNINGHASCOMPLETED

IfFilename=

{

;IFQUERYSTRINGISEMPTY...

GuiControl,1:Enable,ButtonEXIT

GuiControl,1:Enable,ButtonOPEN

GuiControl,1:Enable,ButtonSCANSTARTMENU

GuiControl,,StatusBar,Scancompleted.

GosubEnterQuery

}

Else

{

;IFQUERYSTRINGEXISTS...

;FILTERFORSEARCHSTRINGWITHTHENEW

LISTING

NewKeyPhrase=

GosubFindMatches

}

Return

;...ENDButtonSCANSTARTMENUEVENT

.........................

;===BEGINScanStartMenuSUBROUTINE

========================

;SCANTHESTART-MENUANDSTORETHE

DIRECTORY/PROGRAM

;LISTINGSINACACHEFILE

ScanStartMenu:

;DEFINETHEDIRECTORYPATHSTORETRIEVE.

;THEPATHMUSTNOTBEENCLOSEDBYQUOTESOR

DOUBLE-QUOTES.

;

Page 1583: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;FORENGLISHVERSIONOFWINDOWS

scanPath=%A_StartMenu%|%A_StartMenuCommon%

;INCLUDEADDITIONALUSER-DEFINEDPATHSFOR

SCANNING

IfExist,%SeekMyDir%

{

Loop,read,%SeekMyDir%

{

IfNotExist,%A_LoopReadLine%

MsgBox,8192,%version%,Processing

yourcustomiseddirectory

list...`n`n"%A_LoopReadLine%"doesnotexistand

willbeexcludedfromthescanning.`nPleaseupdate

[%SeekMyDir%].

Else

scanPath=%scanPath%|%A_LoopReadLine%

}

}

;DELETEEXISTINGFILEBEFORECREATINGANEW

VERSION

FileDelete,%dirListing%

;SCANDIRECTORYLISTING(DELIMITER=|)BY

RECURSING

;EACHDIRECTORYTORETRIEVETHECONTENTS.HIDDEN

FILES

;AREEXCLUDED.

Loop,parse,scanPath,|

{

Loop,%A_LoopField%\*,%ScanMode%,1

{

FileGetAttrib,fileAttrib,

%A_LoopFileFullPath%

IfNotInString,fileAttrib,H;EXCLUDE

HIDDENFILE

Page 1584: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FileAppend,%A_LoopFileFullPath%`n,

%dirListing%

}

}

Return

;...ENDScanStartMenuSUBROUTINE

..........................

;===BEGINFindMatchesSUBROUTINE

==========================

;SEARCHANDDISPLAYALLMATCHINGRECORDSINTHE

LISTBOX

FindMatches:

Gui,1:Submit,NoHide

CurFilename=%Filename%

GuiControl,,StatusBar,

;CHECKFOREMPTYQUERYSTRING

IfCurFilename=

{

MsgBox,8192,%version%,Pleaseenterthekey

word/phrasetosearchfor.

GotoEnterQuery

}

;tIncrementalSearchISBEINGINTERRUPTED.LETIT

FINISHES.

IfNewKeyPhrase<>%CurFilename%

{

;INFORMUSERTHATPATIENCEISAVIRTUE

GuiControl,,StatusBar,Seeking...

ResumeFindMatches=TRUE

Return

Page 1585: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

IfList=|

{

;NOTEVENASINGLEMATCHINGRECORDISFOUND.

;LETUSERMODIFYTHEQUERYSTRINGANDTRY

AGAIN.

MsgBox,8192,%version%,Thequerystring

"%CurFilename%"doesnotmatchanyrecord.Try

again.

GuiControl,1:Disable,ButtonOPENDIR

GuiControl,1:Enable,ButtonSCANSTARTMENU

GotoEnterQuery

}

Else

{

;SELECTTHEFIRSTRECORDIFNOOTHERRECORD

HASBEENSELECTED

Gui,1:Submit,NoHide

GuiControl,1:Enable,OpenTarget

GuiControl,1:Enable,ButtonOPEN

GuiControl,1:Enable,ButtonOPENDIR

GuiControl,1:Enable,ButtonSCANSTARTMENU

GuiControl,Focus,OpenTarget

IfOpenTarget=

GuiControl,1:Choose,OpenTarget,|1

}

;REFRESHGUI

Gui,1:Show,Center,%version%

Return

;...ENDFindMatchesSUBROUTINE

............................

Page 1586: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;===BEGINSilentFindMatchesSUBROUTINE

====================

SilentFindMatches:

Gui,1:Submit,NoHide

sfmFilename=%Filename%

;FILTERMATCHINGRECORDSBASEDONUSERQUERY

STRING

List=|

IfsfmFilename<>

{

Loop,read,%dirListing%

{

Gui,1:Submit,NoHide

tFilename=%Filename%

IfsfmFilename<>%tFilename%

{

;USERHASCHANGEDTHESEARCHSTRING.

THEREISNOPOINT

;TOCONTINUESEARCHINGUSINGTHEOLD

STRING,SOABORT.

Return

}

Else

{

;APPENDMATCHINGRECORDSINTOTHE

LIST

SplitPath,A_LoopReadLine,name,dir,

ext,name_no_ext,drive

MatchFound=Y

Loop,parse,sfmFilename,%A_Space%

{

IfNotInString,name,%A_LoopField%

{

MatchFound=N

Page 1587: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Break

}

}

IfEqual,MatchFound,Y

{

;ADDRECORDTOLIST

List=%List%%A_LoopReadLine%|

;PRE-SELECTIFTHISMATCHESTHE

LAST-RUNPROGRAM

If(A_LoopReadLine=

PrevOpenTarget&&sfmFilename=PrevKeyPhrase)

List=%List%|

}

}

}

}

;REFRESHLISTWITHSEARCHRESULTS

GuiControl,1:,OpenTarget,%List%

IfList=|

{

;NOMATCHINGRECORDISFOUND

;DISABLELISTBOX

GuiControl,1:Disable,OpenTarget

GuiControl,1:Disable,ButtonOPENDIR

}

Else

{

;MATCHINGRECORDSAREFOUND

;ENABLELISTBOX

GuiControl,1:Enable,OpenTarget

GuiControl,1:Enable,ButtonOPENDIR

}

;REFRESHGUI

Page 1588: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Gui,1:Show,Center,%version%

Return

;...ENDSilentFindMatchesSUBROUTINE

......................

;===BEGINEnterQuerySUBROUTINE

===========================

;REFRESHGUIANDLETUSERENTERSSEARCHSTRING

EnterQuery:

GuiControl,Focus,Filename

GuiControl,1:Enable,ButtonOPEN

Gui,1:Show,Center,%version%

Return

;...ENDEnterQuerySUBROUTINE

.............................

;===BEGINTargetSelectionEVENT

===========================

TargetSelection:

Gui,1:Submit,NoHide

;DOUBLE-CLICKDETECTIONTOLAUNCHPROGRAM

IfA_GuiControlEvent=DoubleClick

{

GosubButtonOPEN

}

Else

{

;STUB-FORFUTUREUSE

IfA_GuiControlEvent=Normal

{

;DONOTHINGFORNOW

Page 1589: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

}

Return

;...ENDTargetSelectionEVENT

.............................

;===BEGINButtonOPENEVENT

================================

;USERCLICKEDON'OPEN'BUTTONORPRESSED<ENTER>

ButtonOPEN:

Gui,1:Submit,NoHide

;FINDOUTWHERETHEKEYBOARDFOCUSWAS.IFIT'S

THE

;TEXTFIELD,RUNTHEQUERYTOFINDMATCHES.ELSE,

IT

;MUSTBEFROMTHELISTBOX.

GuiControlGet,focusControl,1:Focus

IffocusControl=Edit1

{

GuiControl,Focus,OpenTarget

GuiControl,1:Disable,OpenTarget

GuiControl,1:Disable,ButtonOPENDIR

GuiControl,1:Disable,ButtonSCANSTARTMENU

GotoFindMatches

}

;NORECORDFROMTHELISTBOXISSELECTED

IfOpenTarget=

{

MsgBox,8192,%version%,Pleasemakea

selectionbeforehitting<Enter>.`nPress<Esc>to

exit.

Page 1590: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GotoEnterQuery

}

;SELECTEDRECORDDOESNOTEXIST(FILEOR

DIRECTORYNOTFOUND)

IfNotExist,%OpenTarget%

{

MsgBox,8192,%version%,%OpenTarget%doesnot

exist.Thismeansthatthedirectorycacheis

outdated.Youmayclickonthe'ScanStart-Menu'

buttonbelowtoupdatethedirectorycachewith

yourlatestdirectorylistingnow.

GotoEnterQuery

}

;CHECKWHETHERTHESELECTEDRECORDISAFILEOR

DIRECTORY

FileGetAttrib,fileAttrib,%OpenTarget%

IfInString,fileAttrib,D;ISDIRECTORY

{

GosubsOpenDir

}

ElseIffileAttrib<>;ISFILE

{

Run,%OpenTarget%

}

Else

{

MsgBox%OpenTarget%isneitheraDIRECTORYor

aFILE.Thisshouldn'thappen.Seekcannot

proceed.Quitting...

}

GotoQuit

;...ENDButtonOPENEVENT

..................................

Page 1591: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;===BEGINButtonOPENDIREVENT

=============================

;USERCLICKEDON'OPENDIRECTORY'BUTTON

ButtonOPENDIR:

Gui,1:Submit,NoHide

;CHECKTHATUSERHASSELECTEDARECORDALREADY

IfOpenTarget=

{

MsgBox,8192,%version%,Pleasemakea

selectionfirst.

GotoEnterQuery

}

;RUNSUBROUTINETOOPENADIRECTORY

GosubsOpenDir

GotoQuit

;...ENDButtonOPENDIREVENT

...............................

;===BEGINsOpenDirSUBROUTINE

=============================

sOpenDir:

;IFUSERSELECTEDAFILE-RECORDINSTEADOFA

DIRECTORY-RECORD,

;EXTRACTTHEDIRECTORYPATH.(I'MUSINGDriveGet

INSTEADOF

;FileGetAttribTOALLOWTHESCENARIOWHEREBY

OpenTargetIS

Page 1592: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;INVALIDBUTTHEDIRECTORYPATHOFOpenTargetIS

VALID.

DriveGet,status,status,%OpenTarget%

Ifstatus<>Ready;NOTADIRECTORY

{

SplitPath,OpenTarget,name,dir,ext,

name_no_ext,drive

OpenTarget=%dir%

}

;CHECKWHETHERDIRECTORYEXISTS

IfNotExist,%OpenTarget%

{

MsgBox,8192,%version%,%OpenTarget%doesnot

exist.Thismeansthatthedirectorycacheis

outdated.Youmayclickonthe'ScanStart-Menu'

buttonbelowtoupdatethedirectorycachewith

yourlatestdirectorylistingnow.

GotoEnterQuery

}

;OPENTHEDIRECTORY

IfExist,%dirExplorer%

{

Run,"%dirExplorer%""%OpenTarget%",,Max;

OPENWITHCUSTOMISEDFILEEXPLORER

}

Else

{

Run,%OpenTarget%,,Max;OPENWITHDEFAULT

WINDOWSFILEEXPLORER

}

Return

;...ENDsOpenDirSUBROUTINE

...............................

Page 1593: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;===BEGINtIncrementalSearchEVENT

========================

;AUTOMATICALLYCONDUCTREAL-TIMEINCREMENTAL

SEARCH

;TOFINDMATCHINGRECORDSWITHOUTWAITINGFOR

USER

;TOPRESS<ENTER>

tIncrementalSearch:

Loop

;REPEATSEARCHINGUNTILUSERHASSTOPPEDCHANGING

THEQUERYSTRING

{

Gui,1:Submit,NoHide

CurFilename=%Filename%

IfNewKeyPhrase<>%CurFilename%

{

OpenTarget=

GosubSilentFindMatches

NewKeyPhrase=%CurFilename%

Sleep,100;DON'THOGTHECPU!

}

Else

{

;QUERYSTRINGHASSTOPPEDCHANGING

Break

}

}

;USERHASHIT<ENTER>TOLOOKFORMATCHING

RECORDS.

;RUNFindMatchesNOW.

IfResumeFindMatches=TRUE

{

ResumeFindMatches=FALSE

GosubFindMatches

Page 1594: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

;CONTINUEMONITORINGFORCHANGES

SetTimer,tIncrementalSearch,500

Return

;...ENDtIncrementalSearchEVENT

..........................

;===BEGINQuitSUBROUTINE

=================================

Quit:

ButtonEXIT:

GuiClose:

GuiEscape:

Gui,1:Submit,NoHide

;SAVETHEKEYWORD/PHRASEFORNEXTRUNIFITHAS

CHANGED

IfTrackKeyPhrase=ON

{

If(PrevKeyPhrase<>Filename||

PrevOpenTarget<>OpenTarget)

{

FileDelete,%keyPhrase%

FileAppend,%Filename%`n,%keyPhrase%

FileAppend,%OpenTarget%`n,%keyPhrase%

}

}

QuitNoSave:

ExitApp;JOBDONE.G'DAY!

Page 1595: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;...ENDQuitSUBROUTINE

...................................

;************************

;<---ENDOFPROGRAM--->

;************************

;/*vim:setnoexpandtabshiftwidth=4:*/

Page 1596: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(XP/2k/NT)--:Rajat...(Word).

||

;Youcansetanytitlehereforthemenu:

MenuTitle=-=-=-=-=-=-=-=-

;Thisishowlongthemousebuttonmustbeheld

tocausethemenutoappear:

UMDelay=20

SetFormat,float,0.0

SetBatchLines,10ms

SetTitleMatchMode,2

#SingleInstance

;___________________________________________

;_____MenuDefinitions______________________

;Create/EditMenuItemshere.

;Youcan'tusespacesinkeys/values/section

names.

;Don'tworryabouttheorder,themenuwillbe

sorted.

MenuItems=Notepad/Calculator/Section3/Section

4/Section5

;___________________________________________

;______Dynamicmenuitemshere_______________

Page 1597: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Syntax:

;Dyn#=MenuItem|Windowtitle

Dyn1=MSWord|-MicrosoftWord

Dyn2=NotepadII|-Notepad

;___________________________________________

Exit

;___________________________________________

;_____MenuSections_________________________

;Create/EditMenuSectionshere.

Notepad:

Run,Notepad.exe

Return

Calculator:

Run,Calc

Return

Section3:

MsgBox,Youselected3

Return

Section4:

MsgBox,Youselected4

Return

Section5:

MsgBox,Youselected5

Return

Page 1598: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MSWord:

msgbox,thisisadynamicentry(word)

Return

NotepadII:

msgbox,thisisadynamicentry(notepad)

Return

;___________________________________________

;_____HotkeySection________________________

~MButton::

HowLong=0

Loop

{

HowLong++

Sleep,10

GetKeyState,MButton,MButton,P

IfEqual,MButton,U,Break

}

IfLess,HowLong,%UMDelay%,Return

;preparesdynamicmenu

DynMenu=

Loop

{

IfEqual,Dyn%a_index%,,Break

StringGetPos,ppos,dyn%a_index%,|

StringLeft,item,dyn%a_index%,%ppos%

ppos+=2

StringMid,win,dyn%a_index%,%ppos%,1000

IfWinActive,%win%,

DynMenu=%DynMenu%/%item%

Page 1599: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

}

;Joinssortedmainmenuanddynamicmenu

Sort,MenuItems,D/

TempMenu=%MenuItems%%DynMenu%

;clearsearlierentries

Loop

{

IfEqual,MenuItem%a_index%,,Break

MenuItem%a_index%=

}

;createsnewentries

Loop,Parse,TempMenu,/

{

MenuItem%a_index%=%a_loopfield%

}

;createsthemenu

Menu=%MenuTitle%

Loop

{

IfEqual,MenuItem%a_index%,,Break

numItems++

StringTrimLeft,MenuText,MenuItem%a_index%,0

Menu=%Menu%`n%MenuText%

}

MouseGetPos,mX,mY

HotKey,~LButton,MenuClick

HotKey,~LButton,On

ToolTip,%Menu%,%mX%,%mY%

WinActivate,%MenuTitle%

Return

Page 1600: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MenuClick:

HotKey,~LButton,Off

IfWinNotActive,%MenuTitle%

{

ToolTip

Return

}

MouseGetPos,mX,mY

ToolTip

mY-=3;spaceafterwhichfirstline

starts

mY/=13;spacetakenbyeachline

IfLess,mY,1,Return

IfGreater,mY,%numItems%,Return

StringTrimLeft,TargetSection,MenuItem%mY%,0

StringReplace,TargetSection,TargetSection,

%a_space%,,A

Gosub,%TargetSection%

Return

Page 1601: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

(OSD)--:Rajat/..

||

;_________________________________________________

;_______UserSettings_____________________________

;Makecustomisationonlyinthisareaorhotkey

areaonly!!

;Thepercentagebywhichtoraiseorlowerthe

volumeeachtime:

vol_Step=4

;Howlongtodisplaythevolumelevelbargraphs:

vol_DisplayTime=2000

;MasterVolumeBarcolor(seethehelpfileto

usemore

;preciseshades):

vol_CBM=Red

;WaveVolumeBarcolor

vol_CBW=Blue

;Backgroundcolor

vol_CW=Silver

;Bar'sscreenposition.Use-1tocenterthebar

inthatdimension:

vol_PosX=-1

vol_PosY=-1

Page 1602: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

vol_Width=150;widthofbar

vol_Thick=12;thicknessofbar

;Ifyourkeyboardhasmultimediabuttonsfor

Volume,youcan

;trychangingthebelowhotkeystousethemby

specifying

;Volume_Up,^Volume_Up,Volume_Down,and

^Volume_Down:

HotKey,#Up,vol_MasterUp;Win+UpArrow

HotKey,#Down,vol_MasterDown

HotKey,+#Up,vol_WaveUp;Shift+Win+UpArrow

HotKey,+#Down,vol_WaveDown

;___________________________________________

;_____AutoExecuteSection__________________

;DON'TCHANGEANYTHINGHERE(unlessyouknowwhat

you'redoing).

vol_BarOptionsMaster=1:BZH%vol_Thick%ZX0ZY0

W%vol_Width%CB%vol_CBM%CW%vol_CW%

vol_BarOptionsWave=2:BZH%vol_Thick%ZX0ZY0

W%vol_Width%CB%vol_CBW%CW%vol_CW%

;IftheXpositionhasbeenspecified,additto

theoptions.

;Otherwise,omitittocenterthebar

horizontally:

ifvol_PosX>=0

{

vol_BarOptionsMaster=%vol_BarOptionsMaster%

X%vol_PosX%

vol_BarOptionsWave=%vol_BarOptionsWave%

X%vol_PosX%

}

Page 1603: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;IftheYpositionhasbeenspecified,additto

theoptions.

;Otherwise,omitittohaveitcalculatedlater:

ifvol_PosY>=0

{

vol_BarOptionsMaster=%vol_BarOptionsMaster%

Y%vol_PosY%

vol_PosY_wave=%vol_PosY%

vol_PosY_wave+=%vol_Thick%

vol_BarOptionsWave=%vol_BarOptionsWave%

Y%vol_PosY_wave%

}

#SingleInstance

SetBatchLines,10ms

Return

;___________________________________________

vol_WaveUp:

SoundSet,+%vol_Step%,Wave

Gosub,vol_ShowBars

return

vol_WaveDown:

SoundSet,-%vol_Step%,Wave

Gosub,vol_ShowBars

return

vol_MasterUp:

SoundSet,+%vol_Step%

Gosub,vol_ShowBars

return

vol_MasterDown:

Page 1604: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SoundSet,-%vol_Step%

Gosub,vol_ShowBars

return

vol_ShowBars:

;Topreventthe"flashing"effect,onlycreate

thebarwindowifit

;doesn'talreadyexist:

IfWinNotExist,vol_Wave

Progress,%vol_BarOptionsWave%,,,vol_Wave

IfWinNotExist,vol_Master

{

;Calculatepositionhereincasescreen

resolutionchangeswhile

;thescriptisrunning:

ifvol_PosY<0

{

;CreatetheWavebarjustabovethe

Masterbar:

WinGetPos,,vol_Wave_Posy,,,vol_Wave

vol_Wave_Posy-=%vol_Thick%

Progress,%vol_BarOptionsMaster%

Y%vol_Wave_Posy%,,,vol_Master

}

else

Progress,%vol_BarOptionsMaster%,,,

vol_Master

}

;Getbothvolumesincasetheuseroranexternal

programchangedthem:

SoundGet,vol_Master,Master

SoundGet,vol_Wave,Wave

Progress,1:%vol_Master%

Progress,2:%vol_Wave%

SetTimer,vol_BarOff,%vol_DisplayTime%

return

Page 1605: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

vol_BarOff:

SetTimer,vol_BarOff,off

Progress,1:Off

Progress,2:Off

return

Page 1606: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()--byRajat,.().,"".

||

;Settheheightofarolledupwindowhere.The

operatingsystem

;probablywon'tallowthetitlebartobehidden

regardlessof

;howlowthisnumberis:

ws_MinHeight=25

;Thislinewillunrollanyrolledupwindowsif

thescriptexits

;foranyreason:

OnExit,ExitSub

return;Endofauto-executesection

#z::;Changethislinetopickadifferent

hotkey.

;Belowthispoint,nochangesshouldbemade

unlessyouwantto

;alterthescript'sbasicfunctionality.

;Uncommentthisnextlineifthissubroutineis

tobeconverted

;intoacustommenuitemratherthanahotkey.

Thedelayallows

;theactivewindowthatwasdeactivatedbythe

displayedmenuto

;becomeactiveagain:

;Sleep,200

WinGet,ws_ID,ID,A

Loop,Parse,ws_IDList,|

{

Page 1607: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

IfEqual,A_LoopField,%ws_ID%

{

;Matchfound,sothiswindowshouldbe

restored(unrolled):

StringTrimRight,ws_Height,

ws_Window%ws_ID%,0

WinMove,ahk_id%ws_ID%,,,,,%ws_Height%

StringReplace,ws_IDList,ws_IDList,

|%ws_ID%

return

}

}

WinGetPos,,,,ws_Height,A

ws_Window%ws_ID%=%ws_Height%

WinMove,ahk_id%ws_ID%,,,,,%ws_MinHeight%

ws_IDList=%ws_IDList%|%ws_ID%

return

ExitSub:

Loop,Parse,ws_IDList,|

{

ifA_LoopField=;Firstfieldinlistis

normallyblank.

continue;Soskipit.

StringTrimRight,ws_Height,

ws_Window%A_LoopField%,0

WinMove,ahk_id%A_LoopField%,,,,,%ws_Height%

}

ExitApp;MustdothisfortheOnExitsubroutine

toactuallyExitthescript.

Page 1608: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WinLIRC WinLIRC.Winamp,WindowsMediaPlayer,..,

WinLIRC"VolUp",VolUp

||

;Herearethestepstousethisscript:

;1)ConfigureWinLIRCtorecognizeyourremote

controlanditsbuttons.

;WinLIRCisathttp://winlirc.sourceforge.net

;2)EdittheWinLIRCpath,address,andportin

theCONFIGsectionbelow.

;3)Launchthisscript.ItwillstarttheWinLIRC

serverifneeded.

;4)Presssomebuttonsonyourremotecontrol.A

smallwindowwill

;appearshowingthenameofeachbuttonasyou

pressit.

;5)Configureyourbuttonstosendkeystrokesand

mouseclicksto

;windowssuchasWinamp,MediaPlayer,etc.

Seetheexamplesbelow.

;ThisscriptrequiresAutoHotkey1.0.38.04or

later.

;HISTORYOFCHANGES

;March2,2007:

;-Improvedreliabilityvia"Critical"in

ReceiveData().

;October5,2005:

;-EliminatedWinsockwarningdialog"10054"upon

systemshutdown/logoff.

;-Addedoption"DelayBetweenButtonRepeats"to

Page 1609: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

throttletherepeatspeed.

;------------------------------------------------

-

;CONFIGURATIONSECTION:Setyourpreferences

here.

;------------------------------------------------

-

;Someremotecontrolsrepeatthesignalrapidly

whileyou'reholdingdown

;abutton.Thismakesitdifficulttogetthe

remotetosendonlyasingle

;signal.Thefollowingsettingsolvesthisby

ignoringrepeatedsignals

;untilthespecifiedtimehaspassed.200is

oftenagoodsetting.Setit

;to0todisablethisfeature.

DelayBetweenButtonRepeats=200

;SpecifythepathtoWinLIRC,suchas

C:\WinLIRC\winlirc.exe

WinLIRC_Path=

%A_ProgramFiles%\WinLIRC\winlirc.exe

;SpecifyWinLIRC'saddressandport.Themost

commonare127.0.0.1(localhost)and8765.

WinLIRC_Address=127.0.0.1

WinLIRC_Port=8765

;Donotchangethefollowingtwolines.Skipthem

andcontinuebelow.

GosubWinLIRC_Init

return

;--------------------------------------------

;ASSIGNACTIONSTOTHEBUTTONSONYOURREMOTE

;--------------------------------------------

Page 1610: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;Configureyourremotecontrol'sbuttonsbelow.

UseWinLIRC'snames

;forthebuttons,whichcanbeseeninyour

WinLIRCconfigfile

;(.cffile)--oryoucanpressanybuttonon

yourremoteandthe

;scriptwillbrieflydisplaythebutton'snamein

asmallwindow.

;

;Belowaresomeexamples.Feelfreetoreviseor

deletethemtosuit

;yourpreferences.

VolUp:

SoundSet+5;Increasemastervolumeby5%.On

Vista,replacethislinewith:Send{Volume_Up}

return

VolDown:

SoundSet-5;Reducemastervolumeby5%.On

Vista,replacethislinewith:Send{Volume_Down}

return

ChUp:

WinGetClass,ActiveClass,A

ifActiveClassinWinampv1.x,WinampPE;Winamp

isactive.

Send{right};Sendaright-arrowkeystroke.

else;Someothertypeofwindowisactive.

Send{WheelUp};Rotatethemousewheelupby

onenotch.

return

ChDown:

WinGetClass,ActiveClass,A

ifActiveClassinWinampv1.x,WinampPE;Winamp

isactive.

Page 1611: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Send{left};Sendaleft-arrowkeystroke.

else;Someothertypeofwindowisactive.

Send{WheelDown};Rotatethemousewheel

downbyonenotch.

return

Menu:

IfWinExist,Untitled-Notepad

{

WinActivate

}

else

{

Run,Notepad

WinWait,Untitled-Notepad

WinActivate

}

SendHerearesomekeystrokessenttoNotepad.

{Enter}

return

;Theexamplesabovegiveafeelforhowto

accomplishcommontasks.

;TolearnthebasicsofAutoHotkey,checkoutthe

Quick-startTutorial

;athttp://www.autohotkey.com/docs/Tutorial.htm

;----------------------------

;ENDOFCONFIGURATIONSECTION

;----------------------------

;Donotmakechangesbelowthispointunlessyou

wanttochangethecore

;functionalityofthescript.

WinLIRC_Init:

OnExit,ExitSub;Forconnectioncleanup

purposes.

Page 1612: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;LaunchWinLIRCifitisn'talreadyrunning:

Process,Exist,winlirc.exe

ifnotErrorLevel;NoPIDforWinLIRCwasfound.

{

IfNotExist,%WinLIRC_Path%

{

MsgBoxThefile"%WinLIRC_Path%"doesnot

exist.Pleaseeditthisscripttospecifyits

location.

ExitApp

}

Run%WinLIRC_Path%

Sleep200;GiveWinLIRCalittletimeto

initialize(probablyneverneeded,justforpeace

ofmind).

}

;ConnecttoWinLIRC(oranytypeofserverfor

thatmatter):

socket:=ConnectToAddress(WinLIRC_Address,

WinLIRC_Port)

ifsocket=-1;Connectionfailed(italready

displayedthereason).

ExitApp

;Findthisscript'smainwindow:

Process,Exist;ThissetsErrorLeveltothis

script'sPID(it'sdonethiswaytosupport

compiledscripts).

DetectHiddenWindowsOn

ScriptMainWindowId:=WinExist("ahk_class

AutoHotkeyahk_pid".ErrorLevel)

DetectHiddenWindowsOff

;WhentheOSnotifiesthescriptthatthereis

incomingdatawaitingtobereceived,

Page 1613: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;thefollowingcausesafunctiontobelaunched

toreadthedata:

NotificationMsg=0x5555;Anarbitrarymessage

number,butshouldbegreaterthan0x1000.

OnMessage(NotificationMsg,"ReceiveData")

;Setuptheconnectiontonotifythisscriptvia

messagewhenevernewdatahasarrived.

;Thisavoidstheneedtopolltheconnectionand

thuscutsdownonresourceusage.

FD_READ=1;Receivedwhendataisavailable

toberead.

FD_CLOSE=32;Receivedwhenconnectionhas

beenclosed.

ifDllCall("Ws2_32\WSAAsyncSelect","UInt",

socket,"UInt",ScriptMainWindowId,"UInt",

NotificationMsg,"Int",FD_READ|FD_CLOSE)

{

MsgBox%"WSAAsyncSelect()indicatedWinsock

error".DllCall("Ws2_32\WSAGetLastError")

ExitApp

}

return

ConnectToAddress(IPAddress,Port)

;ThiscanconnecttomosttypesofTCPservers,

notjustWinLIRC.

;Returns-1(INVALID_SOCKET)uponfailureorthe

socketIDuponsuccess.

{

VarSetCapacity(wsaData,400)

result:=DllCall("Ws2_32\WSAStartup",

"UShort",0x0002,"UInt",&wsaData);Request

Winsock2.0(0x0002)

;SinceWSAStartup()willlikelybethefirst

Page 1614: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Winsockfunctioncalledbythisscript,

;checkErrorLeveltoseeiftheOShas

Winsock2.0available:

ifErrorLevel

{

MsgBoxWSAStartup()couldnotbecalled

duetoerror%ErrorLevel%.Winsock2.0orhigher

isrequired.

return-1

}

ifresult;Non-zero,whichmeansitfailed

(mostWinsockfunctionsreturn0uponsuccess).

{

MsgBox%"WSAStartup()indicatedWinsock

error".DllCall("Ws2_32\WSAGetLastError")

return-1

}

AF_INET=2

SOCK_STREAM=1

IPPROTO_TCP=6

socket:=DllCall("Ws2_32\socket","Int",

AF_INET,"Int",SOCK_STREAM,"Int",IPPROTO_TCP)

ifsocket=-1

{

MsgBox%"socket()indicatedWinsockerror

".DllCall("Ws2_32\WSAGetLastError")

return-1

}

;Prepareforconnection:

SizeOfSocketAddress=16

VarSetCapacity(SocketAddress,

SizeOfSocketAddress)

InsertInteger(2,SocketAddress,0,AF_INET)

;sin_family

InsertInteger(DllCall("Ws2_32\htons",

Page 1615: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"UShort",Port),SocketAddress,2,2);sin_port

InsertInteger(DllCall("Ws2_32\inet_addr",

"AStr",IPAddress),SocketAddress,4,4);

sin_addr.s_addr

;Attemptconnection:

ifDllCall("Ws2_32\connect","UInt",socket,

"UInt",&SocketAddress,"Int",

SizeOfSocketAddress)

{

MsgBox%"connect()indicatedWinsock

error".DllCall("Ws2_32\WSAGetLastError").".

IsWinLIRCrunning?"

return-1

}

returnsocket;Indicatesuccessbyreturning

avalidsocketIDratherthan-1.

}

ReceiveData(wParam,lParam)

;BymeansofOnMessage(),thisfunctionhasbeen

setuptobecalledautomaticallywhenevernew

data

;arrivesontheconnection.Itreadsthedata

fromWinLIRCandtakesappropriateaction

depending

;onthecontents.

{

Critical;Preventsanotherofthesame

messagefrombeingdiscardedduetothread-

already-running.

socket:=wParam

ReceivedDataSize=4096;Largeincasealot

ofdatagetsbufferedduetodelayinprocessing

previousdata.

Page 1616: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

VarSetCapacity(ReceivedData,ReceivedDataSize,

0);0forlastparamterminatesstringforuse

withrecv().

ReceivedDataLength:=DllCall("Ws2_32\recv",

"UInt",socket,"Str",ReceivedData,"Int",

ReceivedDataSize,"Int",0)

ifReceivedDataLength=0;Theconnection

wasgracefullyclosed,probablyduetoexiting

WinLIRC.

ExitApp;TheOnExitroutinewillcall

WSACleanup()forus.

ifReceivedDataLength=-1

{

WinsockError:=

DllCall("Ws2_32\WSAGetLastError")

ifWinsockError=10035;WSAEWOULDBLOCK,

whichmeans"nomoredatatoberead".

return1

ifWinsockError<>10054;WSAECONNRESET,

whichhappenswhenWinLIRCclosesviasystem

shutdown/logoff.

;Sinceit'sanunexpectederror,

reportit.Alsoexittoavoidinfiniteloop.

MsgBox%"recv()indicatedWinsock

error".WinsockError

ExitApp;TheOnExitroutinewillcall

WSACleanup()forus.

}

;Otherwise,processthedatareceived.

Testingshowsthatit'spossibletogetmorethan

oneline

;atatime(evenforexplicitly-sentIR

signals),whichthefollowingmethodhandles

properly.

;DatareceivedfromWinLIRClookslikethe

followingexample(seetheWinLIRCdocsfor

Page 1617: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

details):

;0000000000eab15400NameOfButton

NameOfRemote

Loop,parse,ReceivedData,`n,`r

{

ifA_LoopFieldin,BEGIN,SIGHUP,END;

IgnoreblanklinesandWinLIRC'sstart-up

messages.

continue

ButtonName=;Inittoblankincase

therearelessthan3fieldsfoundbelow.

Loop,parse,A_LoopField,%A_Space%;

Extractthebuttonname,whichisthethirdfield.

ifA_Index=3

ButtonName:=A_LoopField

globalDelayBetweenButtonRepeats;

Declareglobalstomakethemavailabletothis

function.

staticPrevButtonName,PrevButtonTime,

RepeatCount;Thesevariablesremembertheir

valuesbetweencalls.

if(ButtonName!=PrevButtonName||

A_TickCount-PrevButtonTime>

DelayBetweenButtonRepeats)

{

ifIsLabel(ButtonName);Thereisa

subroutineassociatedwiththisbutton.

Gosub%ButtonName%;Launchthe

subroutine.

else;Sincethereisnoassociated

subroutine,brieflydisplaywhichbuttonwas

pressed.

{

if(ButtonName==PrevButtonName)

RepeatCount+=1

else

RepeatCount=1

Page 1618: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

SplashTextOn,150,20,Buttonfrom

WinLIRC,%ButtonName%(%RepeatCount%)

SetTimer,SplashOff,3000;This

allowsmoresignalstobeprocessedwhile

displayingthewindow.

}

PrevButtonName:=ButtonName

PrevButtonTime:=A_TickCount

}

}

return1;Telltheprogramthatnofurther

processingofthismessageisneeded.

}

SplashOff:

SplashTextOff

SetTimer,SplashOff,Off

return

InsertInteger(pInteger,ByRefpDest,pOffset=0,

pSize=4)

;ThecallermustensurethatpDesthassufficient

capacity.Topreserveanyexistingcontentsin

pDest,

;onlypSizenumberofbytesstartingatpOffset

arealteredinit.

{

Loop%pSize%;Copyeachbyteintheinteger

intothestructureasrawbinarydata.

DllCall("RtlFillMemory","UInt",&pDest+

pOffset+A_Index-1,"UInt",1,"UChar",pInteger

>>8*(A_Index-1)&0xFF)

}

Page 1619: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ExitSub:;Thissubroutineiscalled

automaticallywhenthescriptexitsforany

reason.

;MSDN:"AnysocketsopenwhenWSACleanupis

calledareresetandautomatically

;deallocatedasifclosesocketwascalled."

DllCall("Ws2_32\WSACleanup")

ExitApp

Page 1620: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ArchivedChangesThisdocumentcontainsahistoryofchangesmadewithintheoriginalbranchof

AutoHotkeydevelopment,byChrisMallett.

Fornewerchanges,seeChanges&NewFeatures.

Page 1621: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.48.05-September25,2009

FixedcrashofSendMessageandPostMessagewhenwParamorlParamis

omitted(brokenby1.0.48.04).[thanksLexikos]

Page 1622: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.48.04-September25,2009

FixedStringSplittoworkproperlyinsidefunctionsofcompiledscripts(broken

by1.0.35.01).[thanksengunneer&Lexikos]

FixedSendPlaynottowaitforthereleaseoftheWindowskeypriortosending

an"L"keystroke(brokenby1.0.48.01).[thanksLexikos]

FixedA_EndChartobevalidwhentheB0optionispresent,andtobeempty

whenthereisnoendingcharacter(brokenby1.0.44.09).[thanksAl2000]

FixedFormatTimetoyieldavalidtimeofdayevenwhenthespecifiedmonthis

out-of-range(brokenby1.0.48.00).[thankssilveredge78]

FixedFileCreateDirtosupportaleadingbackslashevenwhenitistheonly

backslash;e.g.\dir.[thanksjaco0646]

FixedGuiControl/GuiControlGet/Gui/SendMessagetoworkreliablyevenwhen

theytriggeracallbackorOnMessagefunction.[thanksLexikos]

FixedRegExMatch()nottoproducetoofewreplacementswhenanempty-string

matchisfollowedbyanon-empty-stringmatch.

ChangedWhile() toberecognizedasaloopratherthanafunction.[thanks

Crash&Burn]

ImprovedUrlDownloadToFiletosupportFTPandGopher.[thanksLexikos]

Improvedthestdout/asteriskmodeofFileAppendtowriteimmediatelyrather

Page 1623: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

thanlazilytostandardoutput.[thanksLexikos]

Addedfullsupportforif%expression .[thankskenomby]

Page 1624: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.48.03-May3,2009

FixedListLinesOn nottoerasethemostrecentlogentryinthelinehistory.

[thanksLexikos]

FixedListViewtorespondproperlytomousedraggingwhentimersarerunning.

[thanksSolar]

Fixedkey-uphotkeyssothatifoneiscreatedwhileitskeyisbeinghelddown,

thereleaseofthekeydoesn'ttriggerthewronghotkey.[thanksPeter&

engunneer]

Page 1625: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.48.02-April19,2009

ChangedandfixedGosubandGroupActivatesothatwhenafunctioncallsan

external/publicsubroutine,thatsubroutinewilltreatalldynamicvariablesas

globals,andwillhaveoutside-of-functionGUIbehavior.[thankskenomby&

Lexikos]

ImprovedperformanceofTrue/False/A_EventInfoinexpressionsbytreating

themasintegersvs.strings.

Page 1626: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.48.01-April15,2009

Changed:ForWindowsVistaandlater,hotkeysthatincludetheWindowskey

(e.g.#a)willwaitforLWinandRWintobereleasedbeforesendinganytext

containingan"L"keystroke.ThispreventssuchahotkeyfromlockingthePC.

ThisbehaviorappliestoallsendingmodesexceptSendPlay(whichdoesn'tneed

it)andblindmode.

FixedA_LoopFileExttobeblankforanyfilenamehavingnoextensionbuta

periodinitspathname.[thanksYek-Toho-Tua].

Fixedtheassignmentofintegersthatare19or20characterslongtoworkas

theydidpriortov1.0.48.[thanksLaszlo&Lexikos]

Fixedfunctiondefinitionstoworkproperlyinsideablock.[thanksrmarko]

ImprovedperformanceofA_Indexinexpressionsbytreatingitasaninteger

ratherthanastring.

Improvedperformanceofifvar[not]in/contains .[developedby

Lexikos]

ImprovedListLineswithanoptiontoturnline-loggingOfforOn.[thanks

kenomby&ruespe]

Page 1627: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.48-February25,2009

Compatibility:Thechangemostlikelytoaffectbackwardcompatibilityisthat

floatingpointnumbersstoredinvariablesnowhavehigherprecision.Scripts

thatrelyontinydifferencesinprecisionwouldeitherneedtobereviewedand

updated,orhavetheircompatibilityimprovedbyusingSetFormatFloat

(e.g.SetFormat,Float,0.6 )anywhereinthescript.SetFormat

Float disablesthehigherprecision,butgivesupsomeofthenew,faster

floatingpointperformance.

Performance:Themainthemeofthisreleaseisfasterperformance.Almostall

scriptsshouldrunfaster--especiallythosethatmakeheavyuseofexpressions

andintegermath/comparisons(whichmayrunuptothreetimesasfast).To

achievethefullbenefit,ascripteithershouldavoidusingSetFormatorshould

useSetFormat'sfastmode.

Performanceimprovements

Expressionsandfunctioncallsarecompiledmoreheavily,makingthemmuch

faster(especiallycomplexintegerexpressions,includingthosewithcommas).

Binarynumbersarecachedforvariablestoavoidconversionsto/fromstrings.

Thismakesnumericaloperationsinvolvingvariablesmuchfaster.

Literalintegersinexpressionsandmath/comparisoncommandsarereplaced

withbinaryintegers,whichmakesthemfaster;e.g.X+5 andifx>5 .

Page 1628: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

LOOPs,IFs,andELSEsthathaveblocks(braces)arefasterduetoskippingthe

opening'{'.Aside-effectisthatthe'{'isomittedfromListLines.

Thread-creationperformanceisimproved,whichshouldhelprapid-firethreads

inOnMessage(),RegisterCallback(),andGUIevents.

Changesthatmightaffectexistingscripts(otherthanhigher-

precisionfloatingpointdescribedatthetop)

WhenSetFormat,Integer,Hex isineffect,assigningaliteraldecimal

integertoavariablealsoconvertsittohex.Usuallythisisonlyadisplayissue.

ForOnMessage()performance,themessagenumberandHWNDarriveas

standardnumbersratherthanappearingunconditionallyashex.Usuallythisis

onlyadisplayissue.

Toachievevariousimprovementsinperformance,scriptsnowuseslightlymore

memory(proportionatetothenumberofvariablesandexpressions).

Changedandfixedifvaristime andotherusesof

YYYYMMDDHHMISSdate-timestampstorecognizethatmonthsoutsidethe

range1-12areinvalid.[thanksNick]

Changedandimproveddynamicfunctioncallingtoallowpassingmore

parametersthandefinedbyafunction,inwhichcasetheparametersare

evaluatedbutdiscarded.[developedbyLexikos]

Otherimprovements

Page 1629: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AddedfunctionIsFunc(),whichindicateswhetherafunctionmaybecalled

dynamically.[developedbyLexikos]

Addedthewhile-loop,whichrepeatsitscommandsuntilitsexpressionevaluates

tofalse.[developedbyLexikos]

Addedanassume-staticmodeforfunctions.[developedbyLexikos]

Addedbuilt-invariablesA_IsPausedandA_IsCritical.[developedbyLexikos]

ImprovedNumPut()tosupportUInt64likeDllCall().[thanksSean]

ImprovedmousewheelsupportbyaddingWheelLeftandWheelRightas

hotkeysandsupportingtheminSend,Click,andrelatedcommands.However,

WheelLeft/RighthasnoeffectonoperatingsystemsolderthanWindowsVista.

[developedbyLexikos]

UpgradedcompiledscriptcompressorfromUPX3.00to3.03.

Fixes

FixedinabilitytouseMsgBox'stimeoutparameterwhenthe"Text"parameter

hadanexpressioncontainingcommas.

FixedMenu,Delete,Item-that's-a-submenu nottodisruptthe

associatedsubmenu.[thanksanimeaime&Lexikos]

FixedtheGUIHotkeycontroltoreturnusablehotkeynamesevenfordeadkeys

(e.g."^"insteadofZircumflex).[thanksDerRaphael]

Page 1630: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

FixedRegDeletesothatitwon'tdeleteanentirerootkeywhenSubKeyisblank.

[thanksIcarus]

Fixedregistryloopstosupportsubkeynameslongerthan259(rare).Inprior

versions,suchsubkeyswouldeitherbeskippedorcauseacrash.[thanks

KrzysztofSliwinski&Eggi]

FixedFileSelectFolderbyprovidinganoptiontomakeitcompatiblewith

BartPE/WinPE.[thanksmarkreflex]

Fixedwindow/controlIDs(HWNDs),whichinrarecaseswronglystartedwith

0xFFFFFFFFinsteadofjust0x.[thanksMicahs]

FixedinabilityofSendcommandstousetheDown/Upmodifierswiththe"}"

character.[thanksneovars]

Page 1631: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47.06-March9,2008

FixedcrashwhenafunctionwascalledconcurrentlywithanoptionalByRef

parameteromittedbyonethreadbutnotomittedbytheother.[thanks

DeathByNukes]

FixedMenu,Tray,MainWindow toenablethemenuitemsinthemain

window'sViewmenu.[thanksLexikos]

Addeddynamicfunctioncalling.[developedbyLexikos]

Page 1632: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47.05-November21,2007

FixedtheSortcommand:1)fixedthe"function"optionnottomisbehavewhen

it'sthelastoptioninthelist;2)fixedthe"unique"optionsothatwhenthe

delimiterisCRLF,thelastitemcanbedetectedasaduplicateevenwhenit

doesn'tendinCRLF;3)fixedthe"unique"optionnottoappendatrailing

delimiterwhenthelastitemisaduplicate.[thanksRoland]

FixedRegExMatch()andRegExReplace()toyieldcorrectresultsevenwhen

HaystackandOutputVarareboththesamevariable.[thanksSuperfraggle]

Fixedinabilitytopassaparameterthatis"avariabletowhichClipboardAllhas

beenassigned".[thanksJoy2DWorld&Lexikos]

UpdatedRegEx/PCREfrom7.0to7.4.Forasummaryofthemajorchanges,see

www.pcre.org/news.txt.Forfulldetailsofeverychangeandfix,see

www.pcre.org/changelog.txt.

AddedGUIcontrol"Tab2"thatfixesrareredrawingproblemsintheoriginal

"Tab"control(e.g.activatingaGUIwindowbyclickingonacontrol'sscrollbar).

TheoriginalTabcontrolisretainedforbackwardcompatibilitybecause"Tab2"

putsitstabcontrolafteritscontainedcontrolsinthetab-keynavigationorder.

[thanksXander]

Page 1633: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47.04-August28,2007

Fixedkey-uphotkeyslikeaup:: nottoblockthepressingofthe"a"key

unlessthehotkey's#IfWincriteriaaremet.[thanksRoland]

FixedRound(Var,NegativeNumber) ,whichinrarecaseswasoffby1.

[thanksIcarus]

FixedcrashofscriptsthatendinasyntaxerrorconsistingofanorphanedIF-

statement(brokenby1.0.47.00).[thanksmsgboxoftheGermanforum]

Eliminatedthe"GetClipboardData"errordialog.Instead,anemptystringis

retrievedwhenthedatacannotbeaccessedwithinthe#ClipboardTimeout

period.[thanksManaUser&Sean]

ChangedGUIcheckboxesandradiobuttonstodefaultto"noword-wrap"when

nowidth,height,orCR/LFcharactersarespecified.Thissolvesdisplayissues

undercertainunusualDPIsettings.[thanksBoskoop]

Page 1634: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47.03-August1,2007

Fixedexpressionstoallowliteralnegativehexadecimalnumbersthatendin"E";

e.g.fn(-0xe).[thanksLaszlo]

Fixedblocksyntaxtoallowafunction-callimmediatelytotherightofa'}'.

[thanksRoland]

Page 1635: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47.02-July19,2007

FixedtheNumberoptionofEditcontrolstoproperlydisplayaballoontipwhen

theusertypessomethingotherthanadigit.[thankstfcahm]

FixedWM_TIMERnottobeblockedunlessit'spostedtothescript'smain

window.[thankstfcahm]

Fixedwildcardhotkeysnottoacquiretildebehaviorwhenthesamehotkey

existsinthescriptwithatilde.[thanksLexikos]

Fixeddeclarationinitializersnottoretainwhitespaceattheendofliteral

numbers.Also,theynowallowspacesbetweenaclosingquoteandthenext

comma.[thanksHardeep]

Page 1636: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47.01-July8,2007

FixedRunAsnottocrashormisbehavewhenadomainisspecified.[thanks

MarkusFrohnmaier]

Changedrelationaloperatorstoyieldintegersevenwhentheinputsarefloating

point;e.g.1.0<2.0 yields1vs.1.0.[thanksLexikos]

Page 1637: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.47-June19,2007

Addedsupportforfunctionlibraries,whichallowascripttocallafunctioninan

externalfilewithouthavingtouse#Include.

AddedRegisterCallback(),whichcreatesamachine-codeaddressthatwhen

called,redirectsthecalltoafunctioninthescript.[developedbyJonathan

Rennison(JGR)]

AddedNumGet()andNumPut(),whichretrieve/storebinarynumberswithmuch

greaterspeedthanExtract/InsertInteger.

ImprovedSortwithanoptiontodocustomsortingaccordingtothecriteriaina

callbackfunction.[thanksLaszlo]

ImprovedOnMessage()withanoptiontoallowmorethanonesimultaneous

thread.[thanksJGR]

ImprovedCriticalwithanoptiontochangethemessage-checkinterval,which

mayimprovereliabilityforsomeusages.[thanksMajkinetorandJGR]

ChangedCriticaltoputSetBatchLines-1intoeffect.

Changedtheerrormessagesproducedby#ErrorStdOuttocontainaspacebefore

thecolon.[thanksToralf]

FixedOnMessage()functionsthatreturnoneoftheirownlocalvariablesto

returnthenumberinthatvariable,not0.

Page 1638: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Fixedpotentialcrashingofbuilt-invariablesthataccesstheregistry(e.g.

A_AppData,A_Desktop,A_MyDocuments,A_ProgramFiles).[thanksTekl]

Page 1639: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.17-May31,2007

FixedA_UserName(brokenby1.0.46.16).

Page 1640: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.16-May30,2007

FixedGui,Tab,TabName whenusedafterapreviousGuiTab .[thanks

Toralf]

ImprovedSetTimertotreatnegativeperiodsas"runonlyonce".[thanks

Majkinetor]

AddedGuiControlGetHwnd ,whichisamoremodular/dynamicwayto

retrieveacontrol'sHWND.[thanksMajkinetor]

Addedbuilt-invariablesA_ThisLabelandA_ThisFunc,whichcontainthe

namesofthecurrently-executinglabel/function.[thanksTitan&Majkinetor]

Page 1641: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.15-May9,2007

FixedGuiControl,GuiControlGet,andGuiListView/TreeView to

supportstaticvariablesandByRefsthatpointtoglobals/statics.[thanksPeter]

FixedFileInstallcausingtheRandomcommandtobecomenon-randomin

compiledscripts.[thanksVelocity]

Reducedthesizeofcompiledscriptsbyabout16KBduetoUPX3.0.[thanksto

atnbuenofordiscoveringtheoptimalcommand-lineswitches]

Page 1642: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.14-May2,2007

Addedthe"requireadministrator"flagtotheinstallertoavoidawarningdialog

onWindowsVista.[thanksRoussiNikolov]

Page 1643: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.13-May1,2007

Fixedhotkeyslike*xtofireevenwhenxisalsoahotkeythatispreventedfrom

firingdueto#IfWin.[thanksJoy2DWorld&Engunneer]

Improvedoptionalparameterstoacceptquoted/literalstringsasdefaultvalues.

ImprovedByRefparameterswiththeabilitytobeoptional(i.e.theymayaccept

defaultvalues).[thanksCorrupt]

Page 1644: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.12-April24,2007

Fixedinabilitytorecognizealiteralscientificnotationnumberthatbeginswith

0,suchas0.15e+1.[thanksLaszlo]

Page 1645: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.11-April23,2007

Fixedinabilitytohaveafunction-callasthefirstitemincertaincomma-

separatedexpressions.[thanksMajkinetor]

FixedWinTitleslikeahk_id%ControlHwnd% inControlGet's

FindString/Choice/List,andControl'sAdd/Delete/Choose.[thanksFreighter&

PhiLho]

Improvedfloatingpointsupporttorecognizescientificnotation;e.g.1.2e-5(the

decimalpointismandatory).Alsoimproved"SetFormatFloat"withanoptionto

outputinscientificnotation.[thanksLaszlo]

Page 1646: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.10-March22,2007

FixedStringSplitinsideassume-localfunctionssothatitcreatesalocalarray

evenwhenOutputArray0existsasaglobalbutnotalocal.[thanksKZ]

ImprovedListView'sitem-changednotification("I")toindicateviaErrorLevel

whethertheitemhasbeenselected/deselected,focused/unfocused,and/or

checked/unchecked.[thanksfoom]

Addedanadditionallayerofprotectiontocompiledscripts.Itisrecommended

thatscriptscontainingsensitivedataorsourcecodeberecompiledwiththe

/NoDecompileswitch.

Page 1647: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.09-March4,2007

Fixed:= deepinsideexpressionswhenusedtoassigntheresultofarecursive

functiontoalocalvariable(brokenby1.0.46.06).[thanksLaszlo]

FixedinabilitytopasscertainternaryexpressionstoByRefparameters.[thanks

Titan]

FixedGuiControlGet,OutputVar,Pos sothatitdoesn'tmakethe

OutputVarblank.[thanksPhiLho]

Changedandfixedcontinuationsectionssothatthe"Comment"optiondoesn't

forcetheLTrimoptionintoeffect.[thanksTitan]

ChangedtheTerminalServerAwarenessflagbackto"disabled"on

AutoHotkey.exeandcompiledscripts.Thisimprovesflexibilityandbackward

compatibility(seediscussionatforum).

Page 1648: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.08-February7,2007

FixedunreliabilityofComSpecandenvironmentvariablesonWindows9x

(brokenbyv1.0.46.07).[thanksLoriss]

Changed:WhenAutoHotkey.exeislaunchedwithoutascriptspecified,itwill

nowrun(orpromptyoutocreate)thefileAutoHotkey.ahkintheMyDocuments

folder.TheonlyexceptioniswhenAutoHotkey.iniexistsintheworking

directory,inwhichcaseitusestheoldbehaviorofexecutingthatfile.

ImprovedDllCalltosupportanintegerinplaceofthefunctionname,whichis

interpretedastheaddressofthefunctiontocall.[thanksSean]

Page 1649: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.07-January23,2007

Fixedcrashofillegally-nameddynamicvariablesontheleftofanequal-sign

assignment(brokenbyv1.0.45).[thanksPhiLho]

FixedFileMoveDir's"Option2"toworkproperlyevenwhenthedirectoryis

beingbothrenamedandmoved.[thanksbugmenot]

FixedinabilitytopassavariableByRefifthatsameexpressionchangeditfrom

emptytonon-empty(when#NoEnvisabsent).[thanksJoy2DWorld]

ChangedDllCall'sA_LastErrortoreflectonlychangesmadebythescript,not

byAutoHotkeyitself.[thanksAzerty]

Page 1650: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.06-January16,2007

Appliedminorfixesandimprovementstoregularexpressionsbyupgradingfrom

PCRE6.7to7.0.Oneofthemostnotableimprovementsisthe`aoption,which

recognizesanytypeofnewline(namely`r,`n,or`r`n).Similarly,the\Rescape

sequencemeans"anysinglenewlineofanytype".Seealso:FullPCRE

changelog

ChangedandfixedallControlcommandsandStatusBarWaittoobey

SetTitleMatchModeRegExasdocumented.

ChangedRegExReplace()toreturntheoriginal/unalteredstringratherthan""

whenanerroroccurs.

Changed:EnabledtheTerminalServerAwarenessflagonAutoHotkey.exeand

compiledscripts.

Improvedperformancewhenassigninglargestringsreturnedfromuser-defined

functions.[thanksLaszlo]

Page 1651: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.05-January4,2007

FixedtheInputcommandtoallownamedendkeyslike{F9}toworkevenwhen

theshiftkeyisbeinghelddown(brokenbyv1.0.45).[thanksHalweg]

Fixedinabilityof"GuiShow"tofocustheGUIwindowwhenthetraymenuis

usedbothtoreloadthescriptandtoshowtheGUIwindow.[thanksRnon]

Fixedinabilitytopasssometypesofassignments(:=)toaByRefparameter.

[thanksLaszlo]

Page 1652: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.04-January2,2007

Fixedinabilitytopasstheresultofanassignment(:=)toaByRefparameter.

[thanksTitan]

Page 1653: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.03-December18,2006

FixedListView'sfloatingpointsortingtoproducethecorrectordering.[thanks

oldbrother/Goyyah/Laszlo]

Page 1654: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.02-December17,2006

Fixedenvironmentvariablestoworkproperlyasinputvariablesinvarious

commandssuchasStringLenandStringReplace(brokenby1.0.44.14).[thanks

Camarade_Tux]

Page 1655: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46.01-December15,2006

NOTE:Althoughthisreleasehasbeenextensivelytested,severallow-level

enhancementsweremade.Ifyouhaveanymission-criticalscripts,itis

recommendedthatyouretestthemand/orwaitafewweeksforanybugstoget

fixed.

Fixedcomma-separateddeclarationinitializerssuchaslocalx=1,y=

2 toworkevenwhenimmediatelybelowanif/else/loopstatement.

Fixedcomma-separatedexpressionssowhentheleftmostitemisanassignment,

itwilloccurbeforetheothersratherthanafter.[thanksLaszlo]

Changedandfixedfunction-callssothatanychangestheymaketodynamic

variablenames,environmentvariables,andbuilt-invariables(suchas

Clipboard)arealwaysvisibletosubsequentpartsoftheexpressionthatcalled

them.

Changed:Whenamulti-statementcommaisfollowedimmediatelybyavariable

andanequalsign,thatequalsignisautomaticallytreatedasa:=assignment.For

example,allofthefollowingareassignments:x:=1,y=2,a=b=c .

Changedcomma-separatedexpressionstoproducethefollowingeffects:1)the

leftmost/=operatorbecomestruedivideratherthanEnvDiv;2)blankvaluesare

nottreatedaszeroinmathexpressions(thustheyyieldblankresults).

Improvedtheperformanceofexpressionsby5to20%(dependingontype).

Page 1656: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Improvedthenewassignmentoperatorssuchas.=tosupporttheClipboard

variable(evenincomma-separatedexpressions).

Improvedthe.=operatorsothatitdoesn'trequireaspacetoitsleft.

ImprovedGUIcontrolstoacceptstaticvariablesastheirassociatedvariables

(formerlyonlyglobalswereallowed).

AddedoptionHwndOutputVartoGuiAdd ,whichstoresacontrol'sHWNDin

OutputVar.[thanksCorrupt&Toralf]

Page 1657: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.46-November29,2006

NOTE:Althoughthisreleasehasbeenextensivelytestedandisnotexpectedto

breakanyexistingscripts,severallow-levelenhancementsweremade.Ifyou

haveanymission-criticalscripts,itisrecommendedthatyouretestthemand/or

waitafewweeksforanybugstogetfixed.

AddedfunctionSubStr(),whichretrievesthespecifiednumberofcharactersat

thespecifiedpositioninastring.

Addedassignmentoperators//=,.=,|=,&=,^=,>>=,and<<=,whichcanbe

usedanywhereinexpressions.Forexample,Var.="abc" appendsthe

string"abc"toVar'scurrentcontents.

Addedfullsupportinexpressionsfortheoperators:=,++,--,+=,-=,*=,and/=

(formerly,theycouldbeusedonlyastheleftmostoperatoronaline).All

assignmentoperators(especially++and--)behaveinaC-likewaywhentheir

resultisusedbysomeotheroperator.

Addedtheternaryoperator(?:),whichisashorthandreplacementfortheif-else

statement.Forexample,var:=x>y?2:3 assignsthevalue2ifxis

greaterthany;otherwiseitassigns3.

Addedsupportforcomma-separatedexpressions,whichallowasinglelineto

containmultipleassignments,functioncalls,andotherexpressions.[thanks

PhiLho&Titan]

Page 1658: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Improvedvariabledeclarationstosupportinitializationonthesameline.Note:A

staticvariable'sinitializationoccursonlyonce,beforethescriptbegins

executing.

Improvedlinecontinuationtosupportallexpressionoperators.Forexample,a

linethatstartswith"?"or"+"isautomaticallyappendedtothelineaboveit.

Improvedperformanceofoperators"."and".="tobeasfastasthepercent-sign

methodofappendingastring.

Improvedexpressionstoallowmoretypesofconsecutiveunaryoperatorssuch

as!!Var.[thanksLaszlo]

ChangedCriticaltocheckmessageslessoften(20vs.10ms),whichimproves

thereliabilityoffrequently-calledOnMessagefunctions.[thanksMajkinetor]

Changed:Avariablenamedsimply"?"isnolongervalidinexpressionsdueto

thenewternaryoperator.

Fixedhotkeystosupport::: (colonasahotkey)and:&x (colonasa

hotkeyprefix).

Fixedtheinstallertoremovepsapi.dllfromtheAutoHotkeyfolder(excepton

WindowsNT4).ThisavoidsaconflictwithInternetExplorer7.[thankstoall

whoreportedit]

Page 1659: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.45.04-November15,2006

FixedcrashonWindows9xwhenascriptdoesn'tactuallyrun(e.g.duetosyntax

error)(brokenbyv1.0.45).[thanksrogerg]

ChangedControlStyle|ExStyle toreportErrorLevel0vs.1whenthe

requestedstylechangewasn'tnecessarybecauseitwasalreadyineffect.

Improved#Includetosupport%A_AppData%and%A_AppDataCommon%.

[thanksTekl]

Page 1660: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.45.03-November12,2006

Fixedfile-patternloopsnottocrashwhenrecursingintopathslongerthan259

characters.Inaddition,suchpathsandfilesarenowignored(skippedover)by

file-patternloops,FileSetAttrib,andFileSetTime.[thanksPhilR]

Fixedfunctionsthatcallthemselvesandassigntheresulttooneoftheirown

locals(brokenbyv1.0.45).[thanksbjennings]

Fixedcrashofscriptscontainingregularexpressionsthathavecompileerrors.

[thanksPhiLho]

FixedGuiControlnottoconvertcheckboxesinto3-stateunlessrequested.

[thanksJBensimon]

ChangedUrlDownloadToFiletoannounceauser-agentof"AutoHotkey"tothe

serverratherthanablankstring.[thanksjaco0646]

Improvedcontinuationsectionstosupportsemicoloncommentsinsidethe

sectionviatheoption-wordComments.

Page 1661: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.45.02-November8,2006

FixedStringUpperandStringLowertoworkwhenOutputVaristheclipboard

(brokenbyv1.0.45).[thankssongsoverruins]

Fixedthehotkeys~Alt,~Control,and~Shifttofireuponpress-downratherthan

release(brokenbyv1.0.44).

Background:Withoutthetilde,Alt/Control/Shiftfireuponreleasetoavoid

takingoverboththeleftandrightkey.Butaspecificleft/righthotkeylikeLAlt

orRShiftfiresuponpress-down.

Page 1662: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.45.01-November7,2006

FixedFileReadLineandFileSelectFilenottocrashormisbehavewhenother

threadsinterruptthem(brokenbyv1.0.45).[thankstoralf]

FixedRegExMatch()sothatwhenthere'snomatch,namedsubpatternsare

properlysetto""intheoutputarray.[thanksPhiLho]

FixedRegExMatch()'s"J"optiontoproperlywriteduplicatenamedsubpatterns

totheoutputarray.[thanksPhiLho]

ChangedSetWorkingDirand#IncludeDirNametosucceedevenforaroot

directorysuchasC:thatlacksabackslash.

ImprovedDllCall()todisplayawarningdialogifthecalledfunctionwritestoa

variableofzerocapacity.

Page 1663: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

1.0.45-November4,2006

NOTE:Althoughthisreleasehasbeenextensivelytestedandisnotexpectedto

breakanyexistingscripts,severallow-levelperformanceenhancementswere

made.Ifyouhaveanymission-criticalscripts,itisrecommendedthatyouretest

themand/orwaitafewweeksforanybugstogetfixed.

AddedsupportforregularexpressionsviaRegExMatch(),RegExReplace(),and

SetTitleMatchModeRegEx.[thanksPhilipHazel&PhiLho]

ImprovedperformanceandmemoryutilizationofStringReplace.

Improvedperformanceofthe:=operatorforexpressionsandfunctionsinvolving

longstrings.

ImprovedControlClickwithanewoption"NA"thatavoidsactivatingthetarget

window(thismodealsoimprovesreliabilityinsomecases).Inaddition,it'sbeen

documentedthatSetControlDelay-1canimprovethereliabilityofControlClick

insomecases.[thanksnnesori]

ChangedGUIbuttonstodefaultto"noword-wrap"whennowidth,height,or

CR/LFcharacterswerespecified.Thismaysolvebuttondisplayissuesunder

somedesktopthemes.

Fixed"TransformHTML"forthefollowingcharacters:&`n><

Fixedmisinterpretationoflinesstartingwith"ifnotis"suchas"ifnotIsDone".

Page 1664: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Fixedinabilityof"GuiShow"tomoveawindowverticallydownwardtowhere

itsbottommostrowofpixelsisnow.

FixedinabilitytouseGroupActivateastheonlylinebeneathanIForELSE.

FixedinabilityoftheInputcommandtodifferentiatebetweenend-keysenclosed

inbracesandtheir(un)shiftedcounterparts;e.g.'{'vs.'['.[thanksLaszlo]

Visitwww.autohotkey.com/changelog/forevenolderchanges.

Page 1665: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoItv2AutoHotkeyv1.1.09AutoItv2(.aut).AutoHotkeyAutoItv2,..

.autv1.1.08.01.

#AllowSameLineComments .

A_ScriptDir .

DetectHiddenText Off.

#EscapeChar (\).

FileCopy ErrorLevel1.

IniDelete ErrorLevel.

IniRead Default. OutputVarERROR.

IniWrite ErrorLevel.

InputBox , OutputVar., ErrorLevel.

SetBatchLines 1,.

SetKeyDelay SendEvent Delay20.

Send # .

SplashTextOn Height.

Page 1666: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkeyv1.1.08.01 .aut.ahk ,AutoItv2()

AutoHotkey().

Page 1667: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

AutoHotkey(

):LeftClick,LeftClickDrag,RightClick,RightClickDrag,HideAutoItWin,Repeat,EndRepeat.

v1.1.09.

Page 1668: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

"". .,,.

,(Titan/polyethene Recorder)., .,

"".

.,,,:

^!s::;Control+Alt+S.

IfWinNotExistInbox-MicrosoftOutlook

return;Outlook,.

WinActivate;.

Send^n;Control+N/.

WinWaitActiveUntitledMessage

Send{Tab2}ProductRecallforACMERocket

Skates;.

Send{Tab}DearSirorMadam,{Enter2}Wehave

recentlydiscoveredaminordefect...;.

return;.

.,,.

, .

----

Page 1669: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett
Page 1670: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,. PPJoy.

AutoHotkey132., .

Page 1671: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

.().

#1 :.:

Joy1::Send{Left};#1.

Joy2::Click;#2.

Joy3::Senda{Esc}{Space}{Enter};#3"a"

Escape,SpaceEnter.

Joy4::SendSincerely,{Enter}JohnSmith;#4

.

, return.:

Joy5::

RunNotepad

WinWaitUntitled-Notepad

WinActivate

SendThisisthetextthatwillappearin

Notepad.{Enter}

return

/.

#2 :.:

Joy2::

Send{Leftdown};.

KeyWaitJoy2;.

Send{Leftup};.

Page 1672: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

#3 :#2,.:

Joy3::

Send{LButtondown};.

SetTimer,WaitForButtonUp3,10

return

WaitForButtonUp3:

ifGetKeyState("Joy3");,.

return

;.

Send{LButtonup};.

SetTimer,WaitForButtonUp3,off

return

:()..

Joy2::

Send{Spacedown};.

SetTimer,WaitForJoy2,30; 302010

..

return

WaitForJoy2:

ifnotGetKeyState("Joy2");.

{

Send{Spaceup};.

SetTimer,WaitForJoy2,off;.

Page 1673: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

}

;"return",.

Send{Spacedown};.

return

:#IfWinActive/Exist().

:.

Page 1674: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, SetTimer GetKeyState.XY(,,):

#Persistent;,.

SetTimer,WatchAxis,5

return

WatchAxis:

GetKeyState,JoyX,JoyX;X.

GetKeyState,JoyY,JoyY;Y.

KeyToHoldDownPrev=%KeyToHoldDown%;Prev(

).

ifJoyX>70

KeyToHoldDown=Right

elseifJoyX<30

KeyToHoldDown=Left

elseifJoyY>70

KeyToHoldDown=Down

elseifJoyY<30

KeyToHoldDown=Up

else

KeyToHoldDown=

ifKeyToHoldDown=%KeyToHoldDownPrev%;(

).

return;.

;,:

SetKeyDelay-1;.

ifKeyToHoldDownPrev;.

Send,{%KeyToHoldDownPrev%up};.

ifKeyToHoldDown;.

Send,{%KeyToHoldDown%down};.

Page 1675: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

return

;(,,):

#Persistent;,.

SetTimer,WatchPOV,5

return

WatchPOV:

GetKeyState,POV,JoyPOV;POV.

KeyToHoldDownPrev=%KeyToHoldDown%;Prev(

).

;/.;,:

ifPOV<0;

KeyToHoldDown=

elseifPOV>31500;315360

:

KeyToHoldDown=Up

elseifPOVbetween0and4500;045:

KeyToHoldDown=Up

elseifPOVbetween4501and13500;45135

:

KeyToHoldDown=Right

elseifPOVbetween13501and22500;135225

:

KeyToHoldDown=Down

else;225315

:

KeyToHoldDown=Left

ifKeyToHoldDown=%KeyToHoldDownPrev%;(

Page 1676: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

).

return;.

;,:

SetKeyDelay-1;.

ifKeyToHoldDownPrev;.

Send,{%KeyToHoldDownPrev%up};.

ifKeyToHoldDown;.

Send,{%KeyToHoldDown%down};.

return

:,().,:

return;.

:

{

ifKeyToHoldDown

Send,{%KeyToHoldDown%down};.

return

}

Page 1677: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

., 2Joy1 .

, AutoHotkey. JoystickandGetKeyStateandSend.

Page 1678: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

()

,

GetKeyState()

Page 1679: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,SetFormat( ):

#NoEnv

SetBatchLines-1

ListLinesOff

,: SendMode,SetKeyDelay,SetMouseDelay,SetWinDelay,

SetControlDelay SetDefaultMouseSpeed.

,.,.

():

() .

Loop,,IF ELSE.

,Gosub Goto,.

.

, ().

.

.

/.

,,. SetFormat.

Page 1680: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Arrays

[AHK_L31+]

Object().:

;,:

Array:=Object()

;:

Loop,Read,C:\GuestList.txt;,.

{

Array.Insert(A_LoopReadLine);.

}

;:

;Loop%Array.MaxIndex();.

forindex,elementinArray;.

{

;"Loop",,1

;().

;MsgBox%"Elementnumber".A_Index."

is".Array[A_Index]

;"for",("")

;,**.

MsgBox%"Elementnumber".index."is"

.element

}

.,,,.,.. .

Insert(),:

Page 1681: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;:

Array:=Object()

;Array%j%:=A_LoopField

Array[j]:=A_LoopField

;Array%j%_%k%:=A_LoopReadLine

Array[j,k]:=A_LoopReadLine

ArrayCount:=0

Loop,Read,C:\GuestList.txt

{

ArrayCount+=1

;Array%ArrayCount%:=A_LoopReadLine

Array[ArrayCount]:=A_LoopReadLine

}

Loop%ArrayCount%

{

;element:=Array%A_Index%

element:=Array[A_Index]

;MsgBox%"Elementnumber".A_Index."

is".Array%A_Index%

MsgBox%"Elementnumber".A_Index."

is".Array[A_Index]

}

ArrayCount, Array.Count:=n ,

Array._MaxIndex() .1, Array._MinIndex() .

Page 1682: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

: , .AutoHotkey.

StringSplit" WinGetList",OutputVar. (:=) ,:

Array%j%:=A_LoopField

.:

Array%j%_%k%:=A_LoopReadLine

,:

;:

ArrayCount=0

Loop,Read,C:\GuestList.txt;,.

{

ArrayCount+=1;.

Array%ArrayCount%:=A_LoopReadLine;.

}

;:

Loop%ArrayCount%

{

;:=:

element:=Array%A_Index%;A_Index.

;,"%"MsgBox

MsgBox%"Elementnumber".A_Index."is

".Array%A_Index%

}

Page 1683: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

NumPut() NumGet()/./.

Page 1684: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

ErrorLevel(ErrorLevel).0,.ErrorLevel.

RunWaitErrorLevel..

ErrorLevel, ,ErrorLevel,ErrorLevel.

:1ErrorLevel,ErrorLevel1,.

WinWait,MyWindow,,1

ifErrorLevel;,.

MsgBox,Thewindowdoesnotexist.

else

MsgBox,Thewindowexists.

Page 1685: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

[AHK_L14+]

.PCRE, pcre.txt.

RegExMatch RegExReplace.

AutoHotkey (?CNumber:Function) , Number Function.

Function, Number. Function,.

Function, pcre_callout.,. pcre_callout, Function

.

Function(Match,CalloutNumber,FoundPos,Haystack,

NeedleRegEx)

{

...

}

5:

Match:RegExMatch UnquotedOutputVar,.

CalloutNumber: Number.

FoundPos:.

Haystack:RegExMatchRegExReplace Haystack.

Page 1686: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

NeedleRegEx:RegExMatchRegExReplace NeedleRegEx.

..

,:

0,.

1,,.

-1,.

-1,PCRE.RegExMatch,RegExReplace

Haystack.,ErrorLevel.

:

Haystack=Thequickbrownfoxjumpsoverthe

lazydog.

RegExMatch(Haystack,"i)(The)(\w+)\b(?

CCallout)")

Callout(m){

MsgBoxm=%m%`nm1=%m1%`nm2=%m2%

return1

}

, Func. \b , Thequic,Thequi,Thequ,.

EventInfo

A_EventInfopcre_callout_block.

version:=NumGet(A_EventInfo,0,

"Int")

Page 1687: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

callout_number:=NumGet(A_EventInfo,4,

"Int")

offset_vector:=NumGet(A_EventInfo,8)

subject:=NumGet(A_EventInfo,8+

A_PtrSize)

subject_length:=NumGet(A_EventInfo,8+

A_PtrSize*2,"Int")

start_match:=NumGet(A_EventInfo,12+

A_PtrSize*2,"Int")

current_position:=NumGet(A_EventInfo,16+

A_PtrSize*2,"Int")

capture_top:=NumGet(A_EventInfo,20+

A_PtrSize*2,"Int")

capture_last:=NumGet(A_EventInfo,24+

A_PtrSize*2,"Int")

pad:=A_PtrSize=8?4:0;64.

callout_data:=NumGet(A_EventInfo,28+

pad+A_PtrSize*2)

pattern_position:=NumGet(A_EventInfo,28+

pad+A_PtrSize*3,"Int")

next_item_length:=NumGet(A_EventInfo,32+

pad+A_PtrSize*3,"Int")

ifversion>=2

mark:=StrGet(NumGet(A_EventInfo,36+

pad+A_PtrSize*3,"Int"),"UTF-8")

, pcre.txt,NumGet A_PtrSize.

C . (?C255) .,:

;.

pcre_callout=DebugRegEx

Page 1688: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;CRegExMatch.

RegExMatch("xxxabc123xyz","C)abc.*xyz")

DebugRegEx(Match,CalloutNumber,FoundPos,

Haystack,NeedleRegEx)

{

;pcre.txt.

start_match:=NumGet(A_EventInfo,12

+A_PtrSize*2,"Int")

current_position:=NumGet(A_EventInfo,16

+A_PtrSize*2,"Int")

pad:=A_PtrSize=8?4:0

pattern_position:=NumGet(A_EventInfo,28

+pad+A_PtrSize*3,"Int")

next_item_length:=NumGet(A_EventInfo,32

+pad+A_PtrSize*3,"Int")

;>><<.

_HAYSTACK:=SubStr(Haystack,1,start_match)

.">>"SubStr(Haystack,start_match+

1,current_position-start_match)

."<<"SubStr(Haystack,

current_position+1)

;>><<.

_NEEDLE:=SubStr(NeedleRegEx,1,

pattern_position)

.">>"SubStr(NeedleRegEx,

pattern_position+1,next_item_length)

."<<"SubStr(NeedleRegEx,

pattern_position+1+next_item_length)

ListVars

;Pause.

Pause

}

Page 1689: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

,A_EventInfo.RegExMatchRegExReplaceErrorLevel.

,PCRE("")., (*NO_START_OPT) .

v1.1.05.

Page 1690: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

, A_Language..,A_Language0436,Afrikaans.:

.

A_Language4: if(A_Language="0436") .,.

languageCode_0436=Afrikaans

languageCode_041c=Albanian

languageCode_0401=Arabic_Saudi_Arabia

languageCode_0801=Arabic_Iraq

languageCode_0c01=Arabic_Egypt

languageCode_0401=Arabic_Saudi_Arabia

languageCode_0801=Arabic_Iraq

languageCode_0c01=Arabic_Egypt

languageCode_1001=Arabic_Libya

languageCode_1401=Arabic_Algeria

languageCode_1801=Arabic_Morocco

languageCode_1c01=Arabic_Tunisia

languageCode_2001=Arabic_Oman

languageCode_2401=Arabic_Yemen

languageCode_2801=Arabic_Syria

languageCode_2c01=Arabic_Jordan

languageCode_3001=Arabic_Lebanon

languageCode_3401=Arabic_Kuwait

languageCode_3801=Arabic_UAE

languageCode_3c01=Arabic_Bahrain

languageCode_4001=Arabic_Qatar

languageCode_042b=Armenian

languageCode_042c=Azeri_Latin

languageCode_082c=Azeri_Cyrillic

languageCode_042d=Basque

languageCode_0423=Belarusian

languageCode_0402=Bulgarian

Page 1691: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

languageCode_0403=Catalan

languageCode_0404=Chinese_Taiwan

languageCode_0804=Chinese_PRC

languageCode_0c04=Chinese_Hong_Kong

languageCode_1004=Chinese_Singapore

languageCode_1404=Chinese_Macau

languageCode_041a=Croatian

languageCode_0405=Czech

languageCode_0406=Danish

languageCode_0413=Dutch_Standard

languageCode_0813=Dutch_Belgian

languageCode_0409=English_United_States

languageCode_0809=English_United_Kingdom

languageCode_0c09=English_Australian

languageCode_1009=English_Canadian

languageCode_1409=English_New_Zealand

languageCode_1809=English_Irish

languageCode_1c09=English_South_Africa

languageCode_2009=English_Jamaica

languageCode_2409=English_Caribbean

languageCode_2809=English_Belize

languageCode_2c09=English_Trinidad

languageCode_3009=English_Zimbabwe

languageCode_3409=English_Philippines

languageCode_0425=Estonian

languageCode_0438=Faeroese

languageCode_0429=Farsi

languageCode_040b=Finnish

languageCode_040c=French_Standard

languageCode_080c=French_Belgian

languageCode_0c0c=French_Canadian

languageCode_100c=French_Swiss

languageCode_140c=French_Luxembourg

languageCode_180c=French_Monaco

languageCode_0437=Georgian

languageCode_0407=German_Standard

languageCode_0807=German_Swiss

Page 1692: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

languageCode_0c07=German_Austrian

languageCode_1007=German_Luxembourg

languageCode_1407=German_Liechtenstein

languageCode_0408=Greek

languageCode_040d=Hebrew

languageCode_0439=Hindi

languageCode_040e=Hungarian

languageCode_040f=Icelandic

languageCode_0421=Indonesian

languageCode_0410=Italian_Standard

languageCode_0810=Italian_Swiss

languageCode_0411=Japanese

languageCode_043f=Kazakh

languageCode_0457=Konkani

languageCode_0412=Korean

languageCode_0426=Latvian

languageCode_0427=Lithuanian

languageCode_042f=Macedonian

languageCode_043e=Malay_Malaysia

languageCode_083e=Malay_Brunei_Darussalam

languageCode_044e=Marathi

languageCode_0414=Norwegian_Bokmal

languageCode_0814=Norwegian_Nynorsk

languageCode_0415=Polish

languageCode_0416=Portuguese_Brazilian

languageCode_0816=Portuguese_Standard

languageCode_0418=Romanian

languageCode_0419=Russian

languageCode_044f=Sanskrit

languageCode_081a=Serbian_Latin

languageCode_0c1a=Serbian_Cyrillic

languageCode_041b=Slovak

languageCode_0424=Slovenian

languageCode_040a=Spanish_Traditional_Sort

languageCode_080a=Spanish_Mexican

languageCode_0c0a=Spanish_Modern_Sort

languageCode_100a=Spanish_Guatemala

Page 1693: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

languageCode_140a=Spanish_Costa_Rica

languageCode_180a=Spanish_Panama

languageCode_1c0a=Spanish_Dominican_Republic

languageCode_200a=Spanish_Venezuela

languageCode_240a=Spanish_Colombia

languageCode_280a=Spanish_Peru

languageCode_2c0a=Spanish_Argentina

languageCode_300a=Spanish_Ecuador

languageCode_340a=Spanish_Chile

languageCode_380a=Spanish_Uruguay

languageCode_3c0a=Spanish_Paraguay

languageCode_400a=Spanish_Bolivia

languageCode_440a=Spanish_El_Salvador

languageCode_480a=Spanish_Honduras

languageCode_4c0a=Spanish_Nicaragua

languageCode_500a=Spanish_Puerto_Rico

languageCode_0441=Swahili

languageCode_041d=Swedish

languageCode_081d=Swedish_Finland

languageCode_0449=Tamil

languageCode_0444=Tatar

languageCode_041e=Thai

languageCode_041f=Turkish

languageCode_0422=Ukrainian

languageCode_0420=Urdu

languageCode_0443=Uzbek_Latin

languageCode_0843=Uzbek_Cyrillic

languageCode_042a=Vietnamese

the_language:=languageCode_%A_Language%;.

MsgBox%the_language%;.

Page 1694: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Windows PostMessage SendMessage Msg.( WM_VSCROLL),

http://msdn.microsoft.com., .

WM_NULL=0x00

WM_CREATE=0x01

WM_DESTROY=0x02

WM_MOVE=0x03

WM_SIZE=0x05

WM_ACTIVATE=0x06

WM_SETFOCUS=0x07

WM_KILLFOCUS=0x08

WM_ENABLE=0x0A

WM_SETREDRAW=0x0B

WM_SETTEXT=0x0C

WM_GETTEXT=0x0D

WM_GETTEXTLENGTH=0x0E

WM_PAINT=0x0F

WM_CLOSE=0x10

WM_QUERYENDSESSION=0x11

WM_QUIT=0x12

WM_QUERYOPEN=0x13

WM_ERASEBKGND=0x14

WM_SYSCOLORCHANGE=0x15

WM_ENDSESSION=0x16

WM_SYSTEMERROR=0x17

WM_SHOWWINDOW=0x18

WM_CTLCOLOR=0x19

WM_WININICHANGE=0x1A

WM_SETTINGCHANGE=0x1A

WM_DEVMODECHANGE=0x1B

WM_ACTIVATEAPP=0x1C

WM_FONTCHANGE=0x1D

Page 1695: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WM_TIMECHANGE=0x1E

WM_CANCELMODE=0x1F

WM_SETCURSOR=0x20

WM_MOUSEACTIVATE=0x21

WM_CHILDACTIVATE=0x22

WM_QUEUESYNC=0x23

WM_GETMINMAXINFO=0x24

WM_PAINTICON=0x26

WM_ICONERASEBKGND=0x27

WM_NEXTDLGCTL=0x28

WM_SPOOLERSTATUS=0x2A

WM_DRAWITEM=0x2B

WM_MEASUREITEM=0x2C

WM_DELETEITEM=0x2D

WM_VKEYTOITEM=0x2E

WM_CHARTOITEM=0x2F

WM_SETFONT=0x30

WM_GETFONT=0x31

WM_SETHOTKEY=0x32

WM_GETHOTKEY=0x33

WM_QUERYDRAGICON=0x37

WM_COMPAREITEM=0x39

WM_COMPACTING=0x41

WM_WINDOWPOSCHANGING=0x46

WM_WINDOWPOSCHANGED=0x47

WM_POWER=0x48

WM_COPYDATA=0x4A

WM_CANCELJOURNAL=0x4B

WM_NOTIFY=0x4E

WM_INPUTLANGCHANGEREQUEST=0x50

WM_INPUTLANGCHANGE=0x51

WM_TCARD=0x52

WM_HELP=0x53

WM_USERCHANGED=0x54

WM_NOTIFYFORMAT=0x55

WM_CONTEXTMENU=0x7B

Page 1696: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WM_STYLECHANGING=0x7C

WM_STYLECHANGED=0x7D

WM_DISPLAYCHANGE=0x7E

WM_GETICON=0x7F

WM_SETICON=0x80

WM_NCCREATE=0x81

WM_NCDESTROY=0x82

WM_NCCALCSIZE=0x83

WM_NCHITTEST=0x84

WM_NCPAINT=0x85

WM_NCACTIVATE=0x86

WM_GETDLGCODE=0x87

WM_NCMOUSEMOVE=0xA0

WM_NCLBUTTONDOWN=0xA1

WM_NCLBUTTONUP=0xA2

WM_NCLBUTTONDBLCLK=0xA3

WM_NCRBUTTONDOWN=0xA4

WM_NCRBUTTONUP=0xA5

WM_NCRBUTTONDBLCLK=0xA6

WM_NCMBUTTONDOWN=0xA7

WM_NCMBUTTONUP=0xA8

WM_NCMBUTTONDBLCLK=0xA9

WM_KEYFIRST=0x100

WM_KEYDOWN=0x100

WM_KEYUP=0x101

WM_CHAR=0x102

WM_DEADCHAR=0x103

WM_SYSKEYDOWN=0x104

WM_SYSKEYUP=0x105

WM_SYSCHAR=0x106

WM_SYSDEADCHAR=0x107

WM_KEYLAST=0x108

WM_IME_STARTCOMPOSITION=0x10D

WM_IME_ENDCOMPOSITION=0x10E

Page 1697: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WM_IME_COMPOSITION=0x10F

WM_IME_KEYLAST=0x10F

WM_INITDIALOG=0x110

WM_COMMAND=0x111

WM_SYSCOMMAND=0x112

WM_TIMER=0x113

WM_HSCROLL=0x114

WM_VSCROLL=0x115

WM_INITMENU=0x116

WM_INITMENUPOPUP=0x117

WM_MENUSELECT=0x11F

WM_MENUCHAR=0x120

WM_ENTERIDLE=0x121

WM_CTLCOLORMSGBOX=0x132

WM_CTLCOLOREDIT=0x133

WM_CTLCOLORLISTBOX=0x134

WM_CTLCOLORBTN=0x135

WM_CTLCOLORDLG=0x136

WM_CTLCOLORSCROLLBAR=0x137

WM_CTLCOLORSTATIC=0x138

WM_MOUSEFIRST=0x200

WM_MOUSEMOVE=0x200

WM_LBUTTONDOWN=0x201

WM_LBUTTONUP=0x202

WM_LBUTTONDBLCLK=0x203

WM_RBUTTONDOWN=0x204

WM_RBUTTONUP=0x205

WM_RBUTTONDBLCLK=0x206

WM_MBUTTONDOWN=0x207

WM_MBUTTONUP=0x208

WM_MBUTTONDBLCLK=0x209

WM_MOUSEWHEEL=0x20A

WM_MOUSEHWHEEL=0x20E

Page 1698: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WM_PARENTNOTIFY=0x210

WM_ENTERMENULOOP=0x211

WM_EXITMENULOOP=0x212

WM_NEXTMENU=0x213

WM_SIZING=0x214

WM_CAPTURECHANGED=0x215

WM_MOVING=0x216

WM_POWERBROADCAST=0x218

WM_DEVICECHANGE=0x219

WM_MDICREATE=0x220

WM_MDIDESTROY=0x221

WM_MDIACTIVATE=0x222

WM_MDIRESTORE=0x223

WM_MDINEXT=0x224

WM_MDIMAXIMIZE=0x225

WM_MDITILE=0x226

WM_MDICASCADE=0x227

WM_MDIICONARRANGE=0x228

WM_MDIGETACTIVE=0x229

WM_MDISETMENU=0x230

WM_ENTERSIZEMOVE=0x231

WM_EXITSIZEMOVE=0x232

WM_DROPFILES=0x233

WM_MDIREFRESHMENU=0x234

WM_IME_SETCONTEXT=0x281

WM_IME_NOTIFY=0x282

WM_IME_CONTROL=0x283

WM_IME_COMPOSITIONFULL=0x284

WM_IME_SELECT=0x285

WM_IME_CHAR=0x286

WM_IME_KEYDOWN=0x290

WM_IME_KEYUP=0x291

WM_MOUSEHOVER=0x2A1

WM_NCMOUSELEAVE=0x2A2

Page 1699: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WM_MOUSELEAVE=0x2A3

WM_CUT=0x300

WM_COPY=0x301

WM_PASTE=0x302

WM_CLEAR=0x303

WM_UNDO=0x304

WM_RENDERFORMAT=0x305

WM_RENDERALLFORMATS=0x306

WM_DESTROYCLIPBOARD=0x307

WM_DRAWCLIPBOARD=0x308

WM_PAINTCLIPBOARD=0x309

WM_VSCROLLCLIPBOARD=0x30A

WM_SIZECLIPBOARD=0x30B

WM_ASKCBFORMATNAME=0x30C

WM_CHANGECBCHAIN=0x30D

WM_HSCROLLCLIPBOARD=0x30E

WM_QUERYNEWPALETTE=0x30F

WM_PALETTEISCHANGING=0x310

WM_PALETTECHANGED=0x311

WM_HOTKEY=0x312

WM_PRINT=0x317

WM_PRINTCLIENT=0x318

WM_HANDHELDFIRST=0x358

WM_HANDHELDLAST=0x35F

WM_PENWINFIRST=0x380

WM_PENWINLAST=0x38F

WM_COALESCE_FIRST=0x390

WM_COALESCE_LAST=0x39F

WM_DDE_FIRST=0x3E0

WM_DDE_INITIATE=0x3E0

WM_DDE_TERMINATE=0x3E1

WM_DDE_ADVISE=0x3E2

WM_DDE_UNADVISE=0x3E3

Page 1700: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WM_DDE_ACK=0x3E4

WM_DDE_DATA=0x3E5

WM_DDE_REQUEST=0x3E6

WM_DDE_POKE=0x3E7

WM_DDE_EXECUTE=0x3E8

WM_DDE_LAST=0x3E8

WM_USER=0x400

WM_APP=0x8000

Page 1701: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

CLSID(Windows). FileSelectFile,FileSelectFolder Run.:

FileSelectFile,OutputVar,,::{645ff040-5081-

101b-9f08-00aa002f954e};.

FileSelectFolder,OutputVar,::{20d04fe0-3aea-

1069-a2d8-08002b30309d};.

CLSID / Run?

::{d20ea4e1-3957-11d2-a40b-0c5020524153}

::{85bbd920-42a0-1069-a2e4-08002b30309d}

::{21ec2020-3aea-1069-a2dd-08002b30309d}

::{d20ea4e1-3957-11d2-a40b-0c5020524152} Fonts

::{ff393560-c2a7-11cf-bff4-444553540000}

::{00020d75-0000-0000-c000-000000000046}

::{00028b00-0000-0000-c000-000000000046}

::{20d04fe0-3aea-1069-a2d8-08002b30309d}

::{450d8fba-ad25-11d0-98a8-0800361b1103}

::{208d2c60-3aea-1069-a2d7-08002b30309d}

::{1f4de370-d627-11d1-ba4f-00a0c91eedba}

::{7007acc7-3202-11d1-aad2-00805fc1270e}

::{2227a280-3aea-1069-a2de-08002b30309d}

::{7be9d83c-a729-4d97-b5a7-1b7313c39e0a}

::{645ff040-5081-101b-9f08-00aa002f954e}

Page 1702: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

::{e211b736-43fd-11d1-9efb-0000f8757fcd}

::{d6277990-4c6a-11cf-8d87-00aa0060f5bf}

::{48e7caab-b918-4e58-a94d-505519c795dc}

::{7bd29e00-76c1-11cf-9dd0-00a0c9034933} Internet

::{bdeadf00-c265-11d0-bced-00a0c90ab50f}

"": RunCLSID.RunCLSID,CLSID.:

Run::{20d04fe0-3aea-1069-a2d8-08002b30309d};

"".

Run::{645ff040-5081-101b-9f08-00aa002f954e};

.

Run::{450d8fba-ad25-11d0-98a8-0800361b1103}\My

Folder;"".

Run%A_MyDocuments%\MyFolder;.

Page 1703: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

Windows Progress,GUI SplashImage.

.

Win95 WinNT Win98 Win2000 WinMe WinXP

AbadiMTCondensedLight

x

Arial x x x x x x

ArialAlternativeRegular

x

ArialAlternativeSymbol

x

ArialBlack x x x x

ArialBold x x x x x x

ArialBoldItalic x x x x x x

ArialItalic x x x x x x

BookAntiqua x

CalistoMT x

CenturyGothic x

CenturyGothicBold x

Century

Page 1704: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GothicBoldItalic

x

CenturyGothicItalic x

ComicSansMS x x x

ComicSansMSBold x x x x

CopperplateGothicBold x

CopperplateGothicLight x

Courier x x x x x x

CourierNew x x x x x x

CourierNewBold x x x x x x

CourierNewBoldItalic x x x x x x

CourierNewItalic x x x x x x

EstrangeloEdessa x

FranklinGothicMedium

x

FranklinGothicMediumItalic

x

Gautami x

Georgia x x

Page 1705: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

GeorgiaBold x x

GeorgiaBoldItalic x x

GeorgiaItalic x x

GeorgiaItalicImpact x

Impact x x x

Latha x

LucidaConsole x x x x x

LucidaHandwritingItalic

x

LucidaSansItalic x

LucidaSansUnicode x x x

Marlett x x

MatisseITC x

Modern x x x x

ModernMSSansSerif x

MSSansSerif x x x x x x

MSSerif x x x x x

MvBoli x

NewsGothicMT x

NewsGothic

Page 1706: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

MTBold x

NewsGothicMTItalic x

OCRAExtended x

PalatinoLinotype x x

PalatinoLinotypeBold x x

PalatinoLinotypeBoldItalic

x x

PalatinoLinotypeItalic x x

Roman x x x

x x x

SmallFonts x x x

Smallfonts x x x

x x x x x x

Tahoma x x x x

TahomaBold x x x x

TempusSansITC x x

TimesNewRoman x x x x x x

TimesNewRomanBold x x x x x x

TimesNew

Page 1707: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

RomanBoldItalic

x x x x x x

TimesNewRomanItalic x x x x x x

Trebuchet x

TrebuchetBold x

TrebuchetBoldItalic x

TrebuchetItalic x

TrebuchetMS x x

TrebuchetMSBold x x

TrebuchetMSBoldItalic x x

TrebuchetMSItalic x x

Tunga x

Verdana(MSIE3+) x x x x

VerdanaBold x x x x

VerdanaBoldItalic x x x x

VerdanaItalic x x x x

Webdings x x x x

Westminster x x x

Wingdings x x x x

Page 1708: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

WST_Czech x

WST_Engl x

WST_Fren x

WST_Germ x

WST_Ital x

WST_Span x

WST_Swed x

KaysKreationsAutoIt.

Page 1709: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

:Rajat PostMessage SendMessage:

"?"

" WinMenuSelectItem,?!"

"....?"

" ?!"

:AutoHotkeyv1.0.09+WinspectorSpy

(http://www.softpedia.com/get/Security/Security-Related/Winspector.shtml)

, WinMenuSelectItemOutlookExpress"NewMessage".,

:

WinMenuSelectItem,NewMessage,,&Insert,

&Picture...

PostMessage:

PostMessage,0x111,40239,0,,NewMessage

!?0x111 wm_command,40239'InsertPicture'.

Page 1710: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

40239:

1. WinspectorSpy,"NewMessage".

2. WinspectorSpy"NewMessage"(WinspectorSpy).

3. 'Messages'.

4. 'Editmessagefilter'.

5. 'filterall','wm_command'..

6. "NewMessage":Insert>Picture.

7. WinspectorSpy.

8. wm_command().

9. ()0.'winactivated''windestroyed'..

wm_command.'ControlID:40239'...!

10. !wParam.

,.AutoHotkey;.

?,?!/.,.:

PostMessage,0x111,639,,,untitled-Paint

PostMessage;,.

.:WinXPPro(SP1)...,(windows;):

;

PostMessage,0x111,32788,0,,Document-

WordPad

Page 1711: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

;

PostMessage,0x111,65,0,,Untitled-Notepad

;

PostMessage,0x111,32,0,,Untitled-Notepad

;WindowsMediaPlayer/

PostMessage,0x111,32808,0,,WindowsMedia

Player

;AHK

DetectHiddenWindows,on

SetTitleMatchMode,2

PostMessage,0x111,65305,,,MyScript.ahk-

AutoHotkey;,65306.

PostMessage. SendMessage,,,Winamp( Winamp

).

:

XP.(),.,(WindowsMediaPlayer

Winamp).

WinspectorSpywm_command,,()....

WinspectorSpy,.0()''(SendMessage,

%ErrorLevel%).

,:

SetTitleMatchMode,2

,:

Page 1712: Version 1.1.26 - documentation.helpJonathan Bennett, 1999 AutoIt v2 , .,AutoHotkey AutoIt v2 Window Spy AutoIt v3 . Jon AutoIt ., AutoHotkey . ~ Chris Mallett

DetectHiddenWindows,On

:.VBDelphi.C,C++.VB'LParam'.

Delphi...GUIwm_command..

....AutoHotkey.!

(),.,,.

-Rajat