AutoIT练习

#cs  ----------------------------------------------------------------------------

 AutoIt Version: 
3.3 . 6.1
 Author:         myName

 Script 
Function :
    Template AutoIt script.

#ce 
----------------------------------------------------------------------------

; Script Start 
-  Add your code below here

#cs
if   " love "   =   " LOVE "   then
    
Exit
    
msgBox ( 64 , " 这是我的标题 " , " yes " )
Else
    
msgBox ( 64 , " 这是我的标题 " , @WDAY)    
EndIf
#ce

#cs
Dim  $i
for  $i = 1   to   5  Step  1  
    
MsgBox ( 0 , " title " , " content "   &  $i)
Next

msgbox ( 0 , " title " ,_fun( 1 , 2 ))

Func _fun($a,$b)
    return $a
+ $b
EndFunc
#ce

#cs
Func _fn($n)
    
if  $n == 1   then  
        return 
1
    
else
        return _fn($n
- 1 +  $n
    EndIf
EndFunc
    
MsgBox ( 0 , " title " ,_fn( 10 ));
#ce

#cs
Global 
Const  $GUI_EVENT_CLOSE  =   - 3 ;窗口关闭消息的值
GUICreate(
" 我的第一个窗口 " ) ; 创建一个居中显示的GUI 窗口
GUISetState(@SW_SHOW) ; 显示一个空白的窗口
While   1
$msg 
=  GUIGetMsg();捕获窗口消息
If  $msg  =  $GUI_EVENT_CLOSE  Then  ExitLoop;使用关键字ExitLoop 跳出While 循环
WEnd
GUIDelete();

dim  $rand = random( 0 , 255 , 1 )
MsgBox ( 0 , "" ,$rand);
#ce

#cs
Run(
" notepad.exe " ) ;运行记事本
WinWait(
" 无标题- 记事本 " ) ;等待记事本窗口出现
$Gui 
=  GuiCreate( " 被装进了记事本 " 240 120 )
GuiSetState()
;DllCall(
" user32.dll " " int " " SetParent " " hwnd " , $Gui,  " hwnd " ,WinGetHandle( " 无标题- 记事本 " )) 
;使用API 把脚步建立的窗口嵌入记事本窗口中
Do
;
Do  循环,当窗口消息等于退出消息,或者记事本窗口消失时,就退出循环
Until GuiGetMsg() 
=- 3   Or   Not  WinExists( " 无标题- 记事本 " )
#ce

;run(
" notepad.exe " , "" ,@SW_MAXIMIZE)
;Run(@ComSpec 
&   "  /k notepad.exe " )

;
dim  $ret  = inputbox ( " title " , " 提示 " , " 这是默认值 " )

;
msgbox ( 0 , "" ,$ret  + @LF  , 2 )

run(
" cmd " )
WinWaitActive(
" C:\WINDOWS\system32\cmd.exe " )
;Sleep(
1 )
Send (
" ipconfig "   &  @CRLF)

Sleep(
3000 )

Send(
" exit "   &  @CRLF)

 

你可能感兴趣的:(auto)