注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

chunwaihome 的博客

 
 
 

日志

 
 

AutoIT  

2010-02-16 19:39:43|  分类: AutoIt |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

AutoIt的腳本檔案以.au3為擴展名的, ;後的文字為註解和DOS的REM效果是相同的。

下面是很簡單的腳本例子

MsgBox.au3

MsgBox(0, "My First Script!", "Hello World!")

參數二"My First Script!" 為窗口標題,參數三"Hello World"為窗口內容。

 

MsgBox Function.au3

MsgBox(0, "My second script!", "Hello from the main script!")

TestFunc()

Func TestFunc()

    MsgBox(0, "My Third Script!", "Hello from the functions!")

EndFunc

執行腳本後首先會彈出一窗口標題為My second script,當您關閉它後,另一標題為My Third Script窗口會出現,需要留意的是兩個窗口是不會同時出現的。

 

  • Command Line Parameters

The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script.  Note the scriptname is not classed as a parameter; get this information with @ScriptName instead.  A parameter that contains spaces must be surrounded by "double quotes"Compiled(己編譯的) scripts accept command line parameters in the same way.

$CmdLine[0] is number of parameters

$CmdLine[1] is param 1 (after the script name)

$CmdLine[2] is param 2 etc

...

$CmdLine[$CmdLine[0]] is one way to get the last parameter...

 

So if your script is run like this:

    AutoIt3.exe myscript.au3 param1 "this is another param"

$CmdLine[0] equals... 2

$CmdLine[1] equals... param1

$CmdLine[2] equals... this is another param

@ScriptName equals... myscript.au3

 

In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example:

$CmdLineRaw equals... myscript.au3 param1 "this is another param"

 

  • Compiling Scripts with Aut2Exe

It is possible to take your .au3 script and compile it into a standalone executable; this executable can be used without the need for AutoIt to be installed and without the need to have AutoIt3.exe on the machine. 

In addition, the compiled script is compressed and encrypted and there is the option to bind(裝入) additional files (also compressed/encrypted) to the exe using the FileInstall function(函数).  Also, any #include files will also be compiled into the script so they are not required at run-time(運行當中).

Aut2Exe can be used in three ways:

  1. Start Menu
  2. Right Click
  3. The Command Line

Aut2exe.exe /in <infile.au3> [/out <outfile.exe>] [/icon <iconfile.ico>] [/nodecompile] [/comp 0-4] [/pass <passphrase>]

  评论这张
 
阅读(521)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017