Академический Документы
Профессиональный Документы
Культура Документы
Com
AU3
&
&
AU3AU3
2010
AU3
AU3
au3
AU3
vbsP p
AU3 cmdline
dos DIY flash
AutoIt :
BASIC
,
""(/ ,,,)
(GUI)
COM
AutoIt , DLL .
. Aut2Exe
AutoIt ActiveX DLL AutoItX
(COM DLL DLL ). AutoItX AutoIt
3
ps AU3
AU3 ACN
AU3 SciTE
Msgbox(0,"","")
AU3 OK"
.au3".
AU3
AU3
Dim $name
$name=InputBox("","")
Msgbox(0,""&$name,"")
AU3
EXE
"
EXE
AU3
:1234567890
: AU3"""",
"hello"
"123"123
6
:true""false
AU3
AU3
const
, . ,
. , , , ,
, ....au3 ($) ,$abc,$123
, , , .
$apple $apple $apple $apple = = = = 10101010
$apple 10,
$apple .
AU3 Dim, Local Global $
AU3 vb VBS
Dim $a,$a1,$a2
Dim $a
Dim $a1
Dim $a2
C
AutoIt ,,
(5$var)
, $var = 5
+=
, $var += 1
-=
*=
/=
( 1 $var)
&=
$var = "one"
"one", $var &= 10
($var "one10")
( 30)
. 10 + 20
. 20 - 10
( 10)
. 20 * 10
( 200)
. 20 / 10
( 2)
&
. "one" & 10
. 2 ^ 4
("one10")
(2 4, 16)
( == )
. If $var= 5 Then
).
( $var 5
==
.,,
.
<>
. .
Not ("string1" == "string2")
>
>=
<
<=
AND
OR
NOT
. NOT 1
( $var 5
( $var 5
( False)
, .
AutoIt .
:
NOT
8
^
*/
+&
< > <= >= = <> ==
AND OR
2 + 4 * 10 42
42,:
4 * 10
(40)
2 + 40
(42)
* + .
.
(2 + 4) * 10 60
60.
If...Then...Else
(:()()()
VBS
dim $age
$age=inputbox("","")
if $age="" then
msgbox(0,"","")
else
msgbox(0,"",""&$age&"")
endif
IF ENDIF
VBS
IF
include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 403, 135, 192, 124)
$Button1 = GUICtrlCreateButton("", 112, 32, 107, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
9
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$ce=InputBox("","")
If $ce="" Then
MsgBox(0,"","")
Else
MsgBox(0,"",""&$ce)
EndSwitch
WEnd
IF
ENDIF
O()o
Select...Case
(,)
if....then...else ( IF
"""" select
)
dim $age
$age=inputbox("","")
select
case $age=""
10
msgbox(0,"","")
case $age>10 and $age<18
msgbox(0,"","")
case $age>=18 and $age<26
msgbox(0,"","")
case $age>=26
msgbox(0,"","")
endselect
Switch...Case
()
AU3
For...Next
Next
step Step
1.
for $i=1 to 10 step 1
msgbox(0,""," AU3")
next
While...Wend
.... while
[]
While <>
...
Wend
WEnd
11
While...WEnd .
,
,.
, 0 .
Dim $ok
$ok=InputBox(""," 10 ,")
While $ok>10
MsgBox(0,"","")
sleep(1900)
exit
WEnd
Do...Until
Until not.until
do not stop until
Dim $num
$num=Random(1,6,1)
Do
MsgBox(0,"",""&$num)
Until $num<5
For...In...Next
()
12
AU3
AU3
13
[1]ClipGet ( )
..
""
Dim $nr
$nr=ClipGet()
MsgBox(0,"",$nr)
ClipPut ( ".." ) ..
[2]
[2]ClipPut
ClipPut("")
EnvGet ( ""
" ) ..
[3]
[3]EnvGet
" [, ""]
"] )
[4]EnvSet ( ""
..
..
AutoIt ( Run RunWait). AutoIt
.
DOS
Path
,
. path, ,
, , ;
14
C
Windows 98D Windows XP Windows 98
Windows XP
Windows 98 Windows XP
()?
2.cmd
set
path set path
aa c:set aa=c:
aa set aa==
aa D:
set aa=%path%;D:
3.
Administrator
Administrator
path
path
path
%ALLUSERSPROFILE%
%APPDATA%
%CD%
15
%CMDCMDLINE% Cmd.exe
%CMDEXTVERSION%
%COMPUTERNAME%
%COMSPEC%
%DATE% date /t Cmd.exe
date Date
%ERRORLEVEL%
%HOMEDRIVE%
%HOMEPATH%
%HOMESHARE%
%LOGONSEVER%
%NUMBER_OF_PROCESSORS%
%OS% Windows 2000
Windows_NT
%PATH%
%PATHEXT%
%PROCESSOR_ARCHITECTURE% : x86
IA64
%PROCESSOR_IDENTFIER%
%PROCESSOR_LEVEL%
%PROCESSOR_REVISION%
%PROMPT% Cmd.exe
%RANDOM% 0 32767 Cmd.exe
%SYSTEMDRIVE% Windows XP
%SYSTEMROOT% Windows XP
%TEMP% and %TMP%
TEMP TMP
%TIME% time /t Cmd.exe
time Time
%USERDOMAIN%
%USERNAME%
%UserPrefix%
%WINDIR%
,,
", ""
" [, ]] )
[5]DirCopy ( "",
).
(( xcopy ).
16
().: "C:\Path1"
().: "C:\Path_Copy"
[]
0 = ()
1 =
" ) //..
[6]DirCreate ( ""
\" )
DirCreate ( "C:\
"C:\\"
C
(),.
\" )
DirCreate ( "C:\
"C:\\\\\\"
DirGetSize ( ""
" [, ]] )
[7]
[7]DirGetSize
).
(().
, . "C:\Windows".
[] ,(
):
0 = ()
1 = -> ( ).
2 = ()
:
:
>= 0,.
-1, @error 1, .
//
,!
,:
$array[0] =
17
$array[1] =
$array[2] =
Dim $folder
$folder=DirGetSize("C:\WINDOWS\",1)
MsgBox(0,"",""&$folder[2]&""&$folder[1]&"
,"&$folder[0]/(1024*1024)&"MB")
-------------
Dim $folder,$way
$way=InputBox("","")
$folder=DirGetSize($way,1)
MsgBox(0,"",""&$folder[2]&""&$folder[1]&"
,"&$folder[0]/(1024*1024)&"MB")
1MB=1024KB=1024*1024Byte
1MB=1024KB=1024*1024Byte
", ""
" [, ]] ) ..
[8]DirMove ( "",
().: "C:\Path1"
().: "C:\Path_Copy"
[] :
0 = ()
1 =
//
UNC ,/
.
18
(), .
AutoIt,"DirRename" (), DirMove !
" [, ]] ) //..
[9]DirRemove ( ""
[] .
0 = ()
1 = ( DOS DelTree )
" ) ..
[10]DriveGetDrive ( ""
:
"ALL()", "CDROM()", "REMOVABLE()", "FIXED(
)", "NETWORK()", "RAMDISK()", or "UNKNOWN(
)"
:
:
().
0.
"" (), @error 1.
" ) ..
[11]DriveGetFileSystem ( ""
:
:
,.
@error 1.
1 ()
"FAT"
500MB ,,,USB"
".
"FAT32"
Windows 9x/Me .
"NTFS"
Windows NT/2000/XP .
"NWFS"
Novell .
"CDFS"
CD( ISO ).
19
DVD
"UDF"
" ) (().
).
[12]DriveGetLabel ( ""
" ) ..
[13]DriveGetType ( ""
:
:
", ""
" ) ..
[14]DriveSetLabel ( "",
(11)
//
()11,
DriveSetLabel ., FAT32
.
[15]DriveSpaceFree ( ""
" ) MB(
MB())..
:
:
MB()().
0, @error 1.
//
()DriveSpaceFree
;.
Round ().
", ""
" [, ]] ) ..
[16]FileCopy ( "",
..
20
[] .
:
0 = ()
1 =
8 = , ( ).
:
:
1.
0.
//
,8.
'9'(1+8),,.
FileFindFirstFile .
().
", ""
" [, ]] ) NTFS
[17]FileCreateNTFSLink ( "",
..
.().
[] .
:
0 = () .
1 = .
//
.
NTFS .
,.
,.
FileDelete FileMove .
NTFSLink .
[]]
10MB E:\a.docE:\\a.doca.doc
10MB
NTFS
E:\a.docE:\\a.docE:\
\a.docE:\a.doc
21
Junction
C:\ApplicationsE:\\Applications
C:\ApplicationsE:\
\ApplicationsE:\\Applications
C:\Applications
wondows
->
lnk
(*.lnk).
[] ().
[] .
[] ().
[] .
[] , Send() .
[] (0).
[ ] ( ).
@SW_SHOWNORMAL,@SW_SHOWMINNOACTIVE
@SW_SHOWMAXIMIZED
//
Windows
:Ctrl+Alt+X,Ctrl+Shift+X,Shift+Alt+X,Ctrl+NumPadKey Alt+NumPadKey(NumPadKey
), X ,.
Windows Ctrl+Alt.
Windows (,)
.,FileCreateShortcut Ctrl+X Alt+X
( Windows X );,
22
,.
Windows ESC,ENTER,TAB,SPACEBAR ( ),PRINT SCREEN,SHIFT
BACKSPACE ().
FileCreateShortcut ,,,
"" LNK ; LNK !
.,\,
.
" ) ..
[19]FileDelete ( ""
//
: "" ,.
*.*.
FileFindFirstFile .
" ) ..
[19]FileExists ( ""
:
:
1.
0,/.
" ) ..
[20]FileGetSize ( ""
", ""
" [, ]] )
[21]FileInstall ( "",
..
.,,..
( .\ ..\ )
,.
.
[] :
0 = ()
1 =
//
FileInstall AutoIt .
"".
.
(), CALL,
.
.
(
).
/.
23
, FileInstall , 0
. DirCreate() .
. FileDelete() FileSetAttrib()
.
DIRcreate FILECOPY
#AutoIt3Wrapper_Res_Description= Win7
#AutoIt3Wrapper_Res_Fileversion=
#AutoIt3Wrapper_Res_LegalCopyright=
#EndRegion ;**** ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
FileInstall("c:\GodMode Creator.exe",@TempDir&"\")
FileInstall("c:\7active.exe",@TempDir&"\")
$Form1 = GUICreate(" Win7", 319, 444, 394, 171)
$Group1 = GUICtrlCreateGroup("", 6, 240, 305, 121)
$txt=" Win7
Win7 GodMode Creator
Win7"
GUICtrlCreateLabel($txt, 14, 264, 293, 60)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("", 90, 48, 115, 41)
24
EndSwitch
WEnd
", ""
" [, ]] )
[22]FileMove ( "",
(*).
(*).
[] :
0 = ()
1 =
8 = , ().
//
,/.
AutoIt "FileRename"(), FileMove !
, '8'.
'9' (1 + 8) ,.
,:,..
", ""
" [, ""]
"] ) (*.ini)
(*.ini)
[23]IniDelete ( "",
(*.ini)
..
.ini /.
.ini .
[] ..
Default
INI :
[]
=
", "",
", "",
", ""
")
[24]IniRead ( "",
..
:
:
(*.ini)
(*.ini)
(*.ini)
.
.
", ""
" ) (*.ini)
(*.ini)
[25]IniReadSection ( "",
(*.ini)
..
26
:
:
, element[n][0] element[n][1]
.
@error=1 (INI ).
$result[0][0] .
.
: 32767 , Win9x .
", "",
", ""
" [, ]] ) INI
[26]IniRenameSection ( "",
..
[] 0 () - "" .
1 - "". ("",)
", "",
", "",
", ""
" ) .ini ..
[27]IniWrite ( "",
//
,,
.
,. INI ,.: ""
"" "" .
. , . , "
" , .
.
", "",
", ""
" [, ]] ) INI
[28]IniWriteSection ( "",
]] )
[29]Beep ( [ [, ]]
(PC ).
).
beep (PC
[] (). = 1000 .
#include <GUIConstants.au3>
$Main_Form=GUICreate("", 200, 100)
$Main_Form_Button_Play=GUICtrlCreateButton("", 70, 50, 60)
27
GUISetState(@SW_SHOW,$Main_Form)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Main_Form_Button_Play
beep( 587, 100*3)
beep( 784, 100*3)
beep( 880, 100*3)
beep( 988, 100*3)
beep( 988, 200*3)
beep( 0, 100*3)
beep( 988, 100*3)
beep( 880, 100*3)
beep( 988, 100*3)
beep( 1047, 200*3)
beep( 988, 100*3)
beep( 988, 100*3)
beep( 880, 100*3)
sleep(100*3)
beep( 880, 100*3)
beep( 784, 100*3)
beep( 988, 100*3)
beep( 0, 5*3)
beep( 988, 100*3)
28
beep( 0, 5*3)
beep( 988, 100*3)
beep( 0, 5*3)
beep( 988, 100*3)
beep( 880, 100*3)
beep( 784, 100*3)
beep( 740, 100*3)
beep( 784, 200*3)
sleep(100*3)
beep( 784, 100*3)
beep( 880, 100*3)
beep( 784, 100*3)
beep( 988, 100*3)
beep( 0, 5*3)
beep( 988, 100*3)
beep( 0, 5*3)
beep( 988, 100*3)
beep( 0, 5*3)
beep( 988, 100*3)
sleep(100*3)
beep( 587, 100*3)
beep( 784, 100*3)
beep( 1175, 100*3)
beep( 0, 5*3)
29
Func frequency($scale,$melody="C")
If $scale="0" Then Return 0
If $melody="C" Then
Switch $scale
Case "1"
Return 264
Case "2"
Return 297
Case "3"
Return 330
Case "4"
Return 352
Case "5"
31
Return 396
Case "6"
Return 440
Case "7"
Return 495
EndSwitch
ElseIf $melody="D" Then
Switch $scale
Case "1"
Return 297
Case "2"
Return 334
Case "3"
Return 371
Case "4"
Return 396
Case "5"
Return 446
Case "6"
Return 495
Case "7"
Return 557
EndSwitch
EndIf
32
SetError(1)
EndFunc
Func book($book,$speed=500,$melody="c")
For $s=1 To StringLen($book)
$frequency=frequency(StringMid($book,$s,1),$melody)
If @error Then ContinueLoop
$Duration=$speed
Switch StringMid($book,$s+1,1)
Case "H"
$frequency=frequency(StringMid($book,$s,1),$melody)*2
Case "L"
$frequency=frequency(StringMid($book,$s,1),$melody)/2
Case "Q"
$Duration=$speed/2
Case "S"
$Duration=$speed*2
EndSwitch
If $frequency=0 Then
Sleep($speed)
Else
Beep($frequency,$Duration)
EndIf
Next
EndFunc
33
book("12311231345034505Q6Q5Q4Q315Q6Q5Q4Q3126L1026L1",300,"D")
" [, ]] ) ..
[30] SoundPlay ( ""
( WAV MP3 )
[]
:
1 =
0 = ()
//
().
SoundPlay("") ,.
, SoundPlay("") .
:,.
[31]SoundSetWaveVolume ( ) ..
0100
//
,.,
Windows Vista ,. .
.
GUI
[32]
[32] AU3
AU3 KODA VB
KODA
AU3
34
caption
VB,VF KODA
AU3
(Message-loop) ())
(Message-loop)
, GUI
GUIGetMsg (). GUIGetMsg (
,GUI ,)., GUIGetMsg
,, GUI .
GUI ,.
(OnEvent)
(OnEvent)
OnEvent , GUI (),
GUI .,
1 GUI 1.
. Visual Basic .
GUI ,.
#include <GUIConstantsEx.au3>
GUICreate("", 200, 100)
GUICtrlCreateLabel("", 30, 10)
$okbutton = GUICtrlCreateButton("", 70, 50, 60)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
35
36
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 507, 191, 192, 124)
37
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 507, 191, 192, 124)
$Button1 = GUICtrlCreateButton("", 80, 40, 75, 41)
$Button2 = GUICtrlCreateButton("", 232, 40, 107, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"","")
Exit
Case $Button2
Run(@ComSpec&" /c start bbs.seeyoon.com")
EndSwitch
WEnd
38
" [, ""]
"] ) ..
[33]HotKeySet ( ""
// AutoIt ,
(,
).
** AutoIt /,
,.:
1) ()"(blocking)",
.MsgBox FileSelectFolder .
Shift-Alt-d.
2) AutoIt
.
::
Ctrl+Alt+Delete
Windows
F12
Windows , API.
Enter()
{Enter} .
Win+Shift+M
Windows XP .
""
'{F1}{F2}', '{LALT}' '{ALTDOWN}'
.
,AutoIt ,
: Lock ( NumLockCapsLock ScrollLock)
!
, Send
ControlSend :
;
HotKeySet("{Esc}", "captureEsc")
Func captureEsc()
;
HotKeySet("{Esc}")
Send("{Esc}")
HotKeySet("{Esc}", "captureEsc")
EndFunc
. .
" [, ]] ) ..
[33]Send ( ""
"Send" ScriptIt Visual Basic "SendKeys" .
,:
'!'
AutoIt ALT , Send("This is text!a")
"This is text" "ALT+a".
ALT ,,"!A" "!a";
ALT+SHIFT+A, ALT+a.!
'+'
AutoIt SHIFT , Send("Hell+o")
"HellO".Send("!+a") "ALT+SHIFT+a".
'^'
AutoIt CONTROL , Send("^!a")
"CTRL+ALT+a".
CTRL ,, "^A" "^a";
CTRL+SHIFT+A, CTRL+a. !
40
'#'
Windows , Send("#r") Win+r,
.
SendCapslockMode Send (
,CAPS LOCK).
, Send Shift ,
.
Send
Send("{SHIFTDOWN}{SHIFTUP}").
() SHIFT CAP LOCK()
().
AUTOIT CAPS LOCK()():
Windows "CTRL-ALT-DEL"
Send (())
{!}
{#}
{+}
{^}
{{}
{}}
{SPACE}
{ENTER}
{ALT}
ALT
{BACKSPACE} / {BS}
{DELETE} / {DEL}
{UP}
{DOWN}
{LEFT}
{RIGHT}
{HOME}
HOME
{END}
END
41
{ESCAPE} / {ESC}
ESC
{INSERT} / {INS}
INS
{PGUP}
PageUp
{PGDN}
PageDown
{F1} - {F12}
{TAB}
TAB
{PRINTSCREEN}
Print Screen
{LWIN}
{RWIN}
{NUMLOCK on}
NUMLOCK (on/off/toggle)
{CAPSLOCK off}
CAPSLOCK (on/off/toggle)
{SCROLLLOCK toggle}
SCROLLLOCK (on/off/toggle)
{BREAK}
{PAUSE}
PAUSE
{NUMPAD0} - {NUMPAD9}
{NUMPADMULT}
{NUMPADADD}
{NUMPADSUB}
{NUMPADDIV}
{NUMPADDOT}
{NUMPADENTER}
{APPSKEY}
Windows
{LALT}
ALT
{RALT}
ALT
{LCTRL}
CTRL
{RCTRL}
CTRL
{LSHIFT}
Shift
{RSHIFT}
Shift
{SLEEP}
SLEEP
{ALTDOWN}
ALT {ALTUP}
42
{SHIFTDOWN}
SHIFT {SHIFTUP}
{CTRLDOWN}
CTRL {CTRLUP}
{LWINDOWN}
{LWINUP}
{RWINDOWN}
{RWINUP}
{ASC nnnn}
ALT+nnnn
{BROWSER_BACK}
2000/XP:""
{BROWSER_FORWARD}
2000/XP:""
{BROWSER_REFRESH}
2000/XP:""
{BROWSER_STOP}
2000/XP:""
{BROWSER_SEARCH}
2000/XP:""
{BROWSER_FAVORITES}
2000/XP:""
{BROWSER_HOME}
2000/XP:
{VOLUME_MUTE}
2000/XP:
{VOLUME_DOWN}
2000/XP:
{VOLUME_UP}
2000/XP:
{MEDIA_NEXT}
2000/XP:
{MEDIA_PREV}
2000/XP:
{MEDIA_STOP}
2000/XP:
{MEDIA_PLAY_PAUSE}
2000/XP:/
{LAUNCH_MAIL}
2000/XP:
{LAUNCH_MEDIA}
2000/XP:
{LAUNCH_APP1}
2000/XP:1
{LAUNCH_APP2}
2000/XP:2
43
.
Send("{DEL 4}") ; 4 DEL
Send("{S 30}") ; 30 "S"
Send("+{TAB 4}") ; 4 SHIFT+TAB
The key will be send at least once even if the count is zero.
()()
Send("{a down}") ; A
Send("{a up}") ; A
capslock,numlock scrolllock ,:
Send("{NumLock on}") ; NumLock
Send("{CapsLock off}") ; CapsLock
Send("{ScrollLock toggle}") ; ScrollLock
,:
$n = 4
Send("+{TAB " & $n & "}")
ASCII ( A),:
$x = Chr(65)
Send("{" & $x & " 4}")
Fn ,.
1 "".,
,.
, (),:
Send("{TAB}")
()()
Send("+{TAB}")
Send("^{TAB}")
Send("^+{TAB}")
Send("{SPACE}")
Send("{+}")
("")
Send("{-}")
Send("{NumPadMult}
")
SysTreeView32 .
44
Alt ,:
Send("!f") Alt+f,,!
Send("{DOWN}")
Send("{UP}")
Send("{LEFT}")
Send("{RIGHT}")
(Alt+F4,PrintScreen,Ctrl+C ), Windows
( Win+F1 ) .
[]] AU3
AutoIt --Controls
AutoIt v3
Edit! AutoIt
: AutoIt Microsoft
MS
AutoIt Window Info Window Info
IDControl ID
ClassNameNN
Text
(HWND) ( AutoIt Window Info )
Control...() IDControlID
IDControl ID
ID Windows
AutoIt Window Info
Microsoft API ID
ClassNameNN
45
Microsoft buttonedit
AutoIt ClassNameNN
ClassNameNN"Button1", "Button2", "Button3"
ID
Text
AU3InfoAutoIt Window Info Next
AU3Info &Next (&
ClassNameNN
SXD
http://sxd1140.blog.163.com
-
AU3
AU3 2010-02-27 22:16:17 140 2
AU3,.
AU3 AU3(
)
, AU3,,
,, (AU3
) ,,, MouseClick,,ok
.
46
,,,
)
MouseClick("left"
"left")
,,.,,
AU3.
,X , Y ., X Y
,
AU3
( AU3),
47
,
,,.
, 110, 571)
MouseClick('left'
'left',
, ,,
,"".
, 110, 571, 2)
MouseClick('left'
'left',
, . ,
.,.
MouseClick "",,:
48
[] 1() 100(). 0
. 10.
,0.
, 110, 571, 2, 0)
MouseClick('left'
'left',
: -->-->-->-->
-->.
,,,
,,.
-1
1
AU3
AU3 2010-03-14 23:38:54 182 4
, AU3,
.
'''' Send .
''
AU3.
,:
!"
)
Send(" AU3
AU3!"
!")
49
'', Send ,.
, AU3.
Sleep(2000)
!"
)
Send(" AU3
AU3!"
!")
F5,,2," AU3!"
Sleep ,,2,2 Send .
?ok,
50
,'','''WinActivate',
:
(,).
,,
.
.txt - "
")
WinActivate(".txt
!"
)
Send(" AU3
AU3!"
!")
, AU3.
51
, AU3'',
,.
, ,
.
(,)' AutoIt''
()'.
,,.
,,.:12.
,.
)
WinActivate("[CLASS:Notepad]"
"[CLASS:Notepad]")
!"
)
Send(" AU3
AU3!"
!")
,,,AU3
.
,,,,?.
,,
,,.
52
,,,,.
,,,.
, ID ,
,
,,Sxd,thesnoW,Kodin. ,(,
OOP, google ), Sxd , thesnoW Kodin
53
Edit ,,INSTANCE:1.
Edit . ID .
,,
.
'''''Controls'('')
.
ControlSend ,
, ""
, "[CLASS:Edit; INSTANCE:1]"
, " AU3
ControlSend("[CLASS:Notepad]"
"[CLASS:Notepad]",
"",
INSTANCE:1]",
AU3
!"
)
!"
!")
SciTe F5,,
.
,,send .
send ,,,
.
-2
2
AU3
AU3 2010-04-11 22:56:05 68 0
,,
,(),
,,.
,(,),.
,.
.
54
.txt - "
")
WinActivate(".txt
.:"
,WinActivate .,"
".@extended ,.
2, ,,
,
.txt - "
", "1"
1"
)
WinActivate(".txt
1")
1
, AutoItSetOption(Opt).
, xxxxx.txt - ,
""
Opt("WinTitleMatchMode"
, 2)
"WinTitleMatchMode",
")
WinActivate(""
55
""3,,
AutoItSetOption , au3,,.
,,ok..
TITLE
CLASS
REGEXPTITLE
REGEXPCLASS
LAST
ACTIVE
X/Y/W/H (4)
INSTANCE ,
,.
,(),,
au3info
56
)
WinClose("[X:388; Y:42; W:686; H:550]"
H:550]")
686,550
)
WinClose("[CLASS:Notepad; W:686; H:550]"
H:550]")
)
WinClose("[ACTIVE]"
"[ACTIVE]")
)
WinClose(""
"")
57
windows , WinGetHandle
,.
au3"""".
", ""
" [, ""
" [, ""
" [, ,, [, ,,
[34]InputBox ( "",
]]]]]] )
[, [,
[,]]]]]]
", ""
" [, [, ]]
]] ) ((
[35]MsgBox ( ,, "",
).
).
()..
().
[] ..
[] .
:
:
ID.
-1,().
((
))
OK()
CANCEL()
ABORT()
RETRY()
IGNORE()
YES()
NO()
58
//
():
0x0
0x1
,,
0x2
,,
0x3
0x4
0x5
6 **
,,
0x6
()
0x0
16
()
0x10
32
0x20
48
0x30
64
"i"(
0x40
)
0x0
256
0x100
512
0x200
0x0
4096
()
0x1000
8192
0x2000
59
()
0x0
262144
0x40000
524288
0x80000
** Windows 2000/XP .
, /,
4096+4(4100)., 0x1000+0x4( 0x1004).
. "
"(4096).
Default (@Scriptname)
msgbox()
" [, X [, Y [, ""
" [, [, ]]]]]
]]]]] )
[36]ToolTip ( ""
..
().
[] X .
[] Y .
[] , IE5+
[] : .
0 = , 1 = , 2 = , 3 =
[] ():
1 = IE5+
IE5+
2 = X,Y ,..
4 = ,,
,.
:
:
1.
0 , 99.
//
60
, Default .
X,Y ,.
ToolTip("") .
@CR @LF .
, . ,
.
, .
,.
", "",
", [, ]] )
[37]TrayTip ( "",
,(63).
(255).
(,).Windows
10-30 ,.
[] . 0=(),
1=, 2=, 3=
", ""
" ) ..
[37]CDTray ( "",
, D:
D:, E:
E:, .
: "open"
"open"() "closed"
"closed"()
:
:
1.
0, CD .
//
61
DriveGetDrive
Dim $cd
$cd=DriveGetDrive("cdrom")
MsgBox(0,"",""&$cd[0]&"")
CDTray($cd[1],"open")
" ) ..
[38]ProcessExists ( ""
PID().
:
:
PID .
0,.
/ ( ), :"notepad.exe"
"winword.exe"
PID .
250 .
PID
--
62
PID
") ..
[39]ProcessClose ( "")
PID().
" [, ""
" [, [,
[, ]]]
]]] ) ..
[40]Run ( ""
( EXE,BAT,COM PIF).
[] ..
63
[] :
@SW_HIDE =
@SW_MINIMIZE =
@SW_MAXIMIZE =
[] .
0x1 ($STDIN_CHILD) = STDIN .
0x2 ($STDOUT_CHILD) = STDOUT .
0x4 ($STDERR_CHILD) = STDERR .
0x8 ($STDERR_MERGED) = Provides the same handle for STDOUT and STDERR.
Implies both $STDOUT_CHILD and $STDERR_CHILD.
0x10 ($STDIO_INHERIT_PARENT) = Provide the child with the parent's STDIO
streams. This flag can not be combined with any other STDIO flag. This flag is only
useful when the parent is compiled as a Console application.
0x10000 ($RUN_CREATE_NEW_CONSOLE) = The child console process should
be created with it's own window instead of using the parent's window. This flag is only
useful when the parent is compiled as a Console application.
:
:
PID().
0 @error 0.
//
,(").
DOS( ) , Run(@ComSpec & " /c " & 'commandName', "",
@SW_HIDE) ; "/c" " "
().
RunWait .
DOS DOS
Run(@ComSpec & " /c
commandName' Run(@ComSpec & " /c
commandName1&&commandName2&&..
Run(@ComSpec & " /c
commandName1&commandName2&..
DOS
Run(@ComSpec & " /c
commandName1||commandName2||..
" [, ""
" [, [, ]]]
]]] )
[41]RunWait ( ""
.
.
64
( EXE,BAT,COM PIF).()
[] ..
[] "":
@SW_HIDE = ( Default )
@SW_MINIMIZE =
@SW_MAXIMIZE =
[ ] Controls various options related to how the parent and child process
interact.
0x10000 ($RUN_CREATE_NEW_CONSOLE) = The child console process should
be created with it's own window instead of using the parent's window. This flag is only
useful when the parent is compiled as a Console application.
Run
]) ..
[42]Shutdown ( [, ])
shutdown . .
[]
:
:
1.
0 GetLastError() @error.
//
:
0 = Logoff()
1 = Shutdown()
2 = Reboot()
4 = Force()
8 = Power down()
16= Force if hung()
32= Standby()
64= Hibernate()
.,, 9 (shutdown + power down = 1 + 8
= 9).
65
" [, ""]
"] ) ..
[43]RegDelete ( ""
[] .
:
:
:
1.
0,/.
2,/.
@error :
1 (key)
2 (main key)
3
-1
-2 /
//
( ):"HKEY_LOCAL_MACHINE"
("HKLM") "HKEY_USERS" ("HKU") "HKEY_CURRENT_USER" ("HKCU")
"HKEY_CLASSES_ROOT" ("HKCR") "HKEY_CURRENT_CONFIG" ("HKCC").
64- Windows ,,64.
HK 64,:HKLM64.
()) ""().
,!
"\\\".
.
", ""
" ) ..
[44]RegRead ( "",
. @EXTENDED $REG_... ,
66
"Constants.au3" .
"", @error :
1
2
3
-1
-2
" [,"
" [, ""
" [, ]]]
]]] ) ,,..
[45]RegWrite ( ""
[,""
..
[] .
[ ]
,
:"REG_SZ","REG_MULTI_SZ","REG_EXPAND_SZ","REG_DWORD"
"REG_QWORD" "REG_BINARY".
[] .
" ) ..
[46]StringLen ( ""
//
.
thesnow :ANSI (),UNICODE
46(1).
ANSI AutoIt .
[47]StringMid ( "",
", [, ]] ) ..
//
,
().
", "//",
", ""
" [, [,
[48]StringReplace ( "",
]] ..
]]
/ (),.
[] . ,.
0 = ()
67
[] .
0 = ()
1 =
2 = , /
/ , , / ,
StringReplace("aaa", "aa", "bb") "bba"
.
@error 1.
", ) ..
[49]StringTrimLeft ( "",
.
//
.
StringTrimLeft($str, $n) StringRight($str, StringLen($str) - $n)
", ) ..
[50]StringTrimRight ( "",
" ) ..
[50]StringLower ( ""
" ) ..
StringUpper ( ""
XI
" [, ""]
"] )
[51]WinActivate ( ""
).
).
(( ,,
. .
[] .
//
WinActive WinActivate ,
,WinActivate .
,"".
@extended ,.
[52]WinMove ( "",
", "",
", X ,, Y [, [, [,
[,
]]] )
[,]]]
..
/. .
X .
Y .
68
[] .
[] .
[] ,1()100(),,.
:
:
.
0 (.)
// WinMove ,.
() 1
12 x 27( ). [12+@DesktopWidth] x
[12+@DesktopHeight](,).
X Y .,;"
"().
.
X Y Default ,.
.
" [, ""
" [, ]]
]] )
[52]WinWait ( ""
(())..
"[, ""[,
"[, ]]
]] )
[53]WinWaitActive ( " "[,
(())..
" [, " "
" [, ]]
]] )
[54]WinWaitClose ( ""
.
.
69
AU3 FAQS
( ACN)
70
Q1
MsgBox(0,"",$var)
ConsoleWrite("var=" & $var & @CRLF)
Q2 CMD
Q2.1 DOS
Local $var="d:\dir.txt"
Run(@ComSpec & ' /c dir>"'&$var&'"',"", @SW_HIDE)
71
$dns="192.168.0.1"
RunWait(@ComSpec & ' /C netsh -c interface ip set dns source=static addr="' & $dns
&'" register=PRIMARY ',"", @SW_HIDE )
Q2.5 DOS
;: Run RunWait
#include <Constants.au3>
Opt("MustDeclareVars",1)
_test()
Func _test()
72
Local $foo,$line,$lines
$foo = Run(@ComSpec & " /c sc query Alerter", @SystemDir, @SW_HIDE, $STDOUT_CHILD)
$lines = ""
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
$lines &= $line
Wend
MsgBox(0,"test",$lines)
EndFunc
Q3
$g_szVersion = "test"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)
#include
_Singleton("test")
73
ShellExecute("Notepad.exe")
ShellExecute("test.txt", "", @ScriptDir, "edit")
ShellExecute("http://http://bbs.wglm.net")
ShellExecute("C:\boot.ini", "", "", "print")
ShellExecute("test.lnk","",@ScriptDir)
ShellExecute("gpedit.msc", "", "", "open", @SW_MAXIMIZE)
Q5
API
_StartService()
_StopService()
_ServiceExists()
_ServiceRunning()
_CreateService()
_DeleteService()
WMI
_ServStart()
_ServStop()
_ServDelete()
_ServGetDetails()
_ServGetState()
74
_ServListInstalled()
_ServPause()
_ServResume()
_SerSetState()
Q6
Q6.1
;
$var
RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir")
MsgBox(4096, "Program files ", $var)
;
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test")
; ()
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKey")
; RegEnumKey(),RegEnumVal()
Q6.2
setacl.exe
75
$setacl=@TempDir & "\setacl.exe"
RunWait(@ComSpec & ' /c '&$setacl& ' MACHINE\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL
/registry /grant everyone /full', @TempDir, @SW_HIDE)
[attach=275]
Q7
Do
ProcessClose("explorer.exe")
Until Not ProcessExists("explorer.exe")
Run("gpupdate /force","",@SW_HIDE)
;
DllCall("user32.dll","int","SendMessageTimeout","hwnd",65535,"int",26,"int",0,"int",0,"int",0,"int",1000,"str","d
wResult")
Q8 AU3
EndIf
If StringInStr($CmdLineRaw, "/help") Then
MsgBox(64,"","")
EndIf
Q9
;
Run(@ComSpec&' /c ping 127.0.0.1 -n 3&del /q "'&@ScriptFullPath&'"',@ScriptDir,@SW_HIDE)
;
Run(@ComSpec&' /c ping 127.0.0.1 -n 3&rd /q/s "'&@ScriptDir&'"',@ScriptDir,@SW_HIDE)
Q10 AU3
;RC4(AU3)
#include
Opt("MustDeclareVars", 1)
Local $var
;
$var=_StringEncrypt(1,"sanhen",@ComputerName,1)
77
MsgBox(0,"test",$var)
;
$var=_StringEncrypt(0,$var,@ComputerName,1)
MsgBox(0,"test",$var)
;MD5
AU3 MD5
MD5 UDF
MD5 UDF
C VBscript UDF
#include
#include
$c_md5=md5("sanhen")
$vb_md5=MD5_String("sanhen")
MsgBox(64,"C MD5",$c_md5)
MsgBox(64,"Vbscript MD5",$vb_md5)
;MD5
78
#compiler_plugin_funcs = MD5Hash
; Scite
$file=@SystemDir & "\userinit.exe"
$plH = PluginOpen("\\server-2\update\tools\MD5Hash.dll")
$md5=MD5Hash($file, 1, True)
If $md5<>"7BD70EC53CB7398246C84D25BFF33AA8" Then
; XP SP2MD5 DLL
FileWriteLine("\\server-2\log$\log.txt",@ComputerName &" ")
EndIf
PluginClose($plH)
;
1
FSHash
JSThePatriot
8-28-2006
MD5, SHA-1
2
StringHash
SolidSnake
12-12-2006
MD5,SHA1,SHA256,Tiger WhirlPool
79
3
FileHash
SolidSnake
12-12-2006
MD5,SHA1,SHA256,Tiger WhirlPool
4
Blowfish
piccaso
5-3-2007
blowfish /
Q11 //
: ChangeScreenRes.AU3 ()
#include-once
;===============================================================================
;
; : _ChangeScreenRes()
; : ,.
; : 1.0.0.1
; : $i_Width - (1024X768 1024)
; $i_Height - (1024X768 768)
; $i_BitsPP -( 32BIT,32)
; $i_RefreshRate - ( 75 MHZ).
80
Func
_ChangeScreenRes($i_Width
@DesktopWidth, $i_Height
@DesktopHeight, $i_BitsPP
$B
DllCall("user32.dll",
"int",
"EnumDisplaySettings",
"ptr",
0,
"long",
0,
"ptr",
DllStructGetPtr($DEVMODE))
81
If @error Then
$B = 0
SetError(1)
Return $B
Else
$B = $B[0]
EndIf
If $B <> 0 Then
DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL,
$DM_DISPLAYFREQUENCY), 5)
DllStructSetData($DEVMODE, 4, $i_Width, 2)
DllStructSetData($DEVMODE, 4, $i_Height, 3)
DllStructSetData($DEVMODE, 4, $i_BitsPP, 1)
DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5)
$B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int",
$CDS_TEST)
If @error Then
$B = -1
Else
$B = $B[0]
EndIf
Select
Case $B = $DISP_CHANGE_RESTART
$DEVMODE = ""
Return 2
82
Case $B = $DISP_CHANGE_SUCCESSFUL
DllCall("user32.dll",
"int",
"ChangeDisplaySettings",
"ptr",
DllStructGetPtr($DEVMODE),
"int",
$CDS_UPDATEREGISTRY)
DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
"int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
$DEVMODE = ""
Return 1
Case Else
$DEVMODE = ""
SetError(1)
Return $B
EndSelect
EndIf
EndFunc ;==>_ChangeScreenRes
:
-------------------------------------------------------------------
#include
;800X600 32,@75MHZ
_ChangeScreenRes(800,600,32,75)
-------------------------------------------------------------------
83
AU3
$MonitorClass
'HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96E-E325-11CE-BFC1-
08002BE10318}'
$i = 1
While $i > 0
$Ver = RegEnumKey($MonitorClass, $i)
If @error Then ExitLoop
$MODES = $MonitorClass & '\' & $Ver
$DriverDesc = RegRead ( $MODES, "DriverDesc" )
If $DriverDesc <> '' Then
RegWrite ( $MODES & '\MODES\1024,768' , "Mode1", "REG_SZ", '2.0-254.0,85.0-85.0,+,+' )
RegWrite ( $MODES & '\MODES\640,480' , "Mode1", "REG_SZ", '2.0-254.0,85.0-85.0,+,+' )
RegWrite ( $MODES & '\MODES\800,600' , "Mode1", "REG_SZ", '2.0-254.0,85.0-85.0,+,+' )
$i = $i + 1
Else
RegDelete ( $MODES )
EndIf
WEnd
84
MyUpdateREG()
Func MyUpdateREG()
Global Const $HWND_BROADCAST=0xFFFF
Global Const $WM_SETTINGCHANGE=0x1A
DLLCall("user32.dll","int","SendMessage","hwnd",$HWND_BROADCAST,"int",$WM_SETTINGCHANGE,"in
t","", "int", "")
EndFunc
85
WMI API
AU3 AU3 AU3
AU3
AU3
86