下载 IDE scite编辑器
首先实现一个msg函数:
MsgBox(0,"my first msgbox","your computer is overheting")
将文件保存 运行 ;(后缀名为.au3)
声名变量 和 数组:
变量:
$var_1 = 0
$var_2 = "hello"
$var_3 = "hello mr.zxl"
MsgBox($var_1,$var_2,$var_3)
数组:
Global $var[3]
$var[0] = 0
$var[1] = "hello"
$var[2] = "hello mr.zxl"
MsgBox($var[0],$var[1],$var[2])
DO 循环体:
$var = 1
Do
MsgBox(0,"h","t")
$var=$var-1
Until $var=1
while循环体:
$var = 3
While $var <> 1
MsgBox(0,"h","t")
$var=$var-1
WEnd
for循环体:
$var = 5
For $var=5 To 1 Step -1
MsgBox(0,"h","t")
Next
MsgBox(0,"end","end")
if 语句判断:
$var = MsgBox(4,"h","t")
If $var = 6 Then
MsgBox(0,"6","yes")
EndIf
If $var = 7 Then
MsgBox(0,"7","no")
EndIf
GUI 设计:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $Form1 = GUICreate("my gui",486,164,276,167)
Global $Button1 = GUICtrlCreateButton("A button",96,64,75,25,0)
Global $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1",248,104,97,17)
Global $Lable1= GUICtrlCreateLabel("label1",72,16,36,17)
GUISetState(@SW_SHOW,$Form1)
While 1
$nMsg=GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1 ;单击事件
MsgBox(0,"t","t")
Case 0 ;窗体加载事件 死循环
MsgBox(0,"load","load")
EndSwitch
WEnd
自定义函数过程:
msgbox_func(0,"hi","hello")
; msgbox_func(0,"hi","hello",5) ;函数启动后5秒后关闭
Func msgbox_func($param_1,$param_2,$param_3,$param_4=0) ;最后一个参数可有可无
MsgBox($param_1,$param_2,$param_3,$param_4)
EndFunc
Server: and Client:
server.au3
TCPStartup()
$TCPListen = TCPListen(@IPAddress1,403)
Do
$TCPAccept = TCPAccept($TCPListen)
Until $TCPAccept <> -1
Do
$TCPRecive = TCPRecv($TCPAccept,1000000)
Until $TCPRecive <> ""
MsgBox(0,"data recived",$TCPRecive)
client.au3
TCPStartup()
$TCPConnect = TCPConnect(@IPAddress1,403)
If $TCPConnect = -1 Then Exit
TCPSend($TCPConnect,"hello")
自动运行鼠标定位单击:
MouseClick("left",340,620,2)
Sleep(10000)
MouseClick("left",522,103,1)
Send("google.com{ENTER}")