Pages

  • Home
  • Instagram
  • Photography
  • Utilities
  • Reviews
  • Tips
  • Excel
  • Linux
  • Backup
  • Errors
  • Alerts
  • About

1 May 2013

AutoIt - The Scripting Language for Windows

Introduction
AutoIt is a free and excellent scripting language. It's almost a full programming language because you can do so much with it. Primarily it was designed for automating installations but it's grown and grown over the years. The best thing about it is that you write the code in a text editor (Notepad or anything you want) then compile it. Once compiled your resulting program is a standalone exe file! Yes, no DLL files to package with it!


Download and Install
http://www.autoitscript.com/

Along with AutoIt itself (it includes the compiler, samples and help files) I highly recommend you download and install the editor for it, SciTE.


SciTE
This code editor makes writing AutoIt scripts a breeze. It colour codes the commands, click a word and press F1 to see help on the command/function. It even has links on the menus so you can easily create form windows and it pastes the automatically generated code into the text editor for you.


The above is SciTE with an AutoIt script in it. You can see the colour coding, for example, the comments are in green, variables are red, etc.


An Example AutoIt Script
Here's an example of what's possible with AutoIt. It's a little script I wrote to convert text from hex to text and back again. It outputs the results to a text file and opens it in Notepad.

; Hex/Text Converter
; By Michael Gerrard
; 01/11/2011
; AutoIt 3

$title  = "Hex/Text Converter"
$input = ""
$output = ""
$outputFile = @ScriptDir & "\HexText-output.txt"

$input = InputBox($title, "Enter a hex or text:")
If @Error = 1 Then Exit

$iCheck = StringInStr($input, ":", 0, 1, 1)
If $iCheck = 3 Then ;if successful it returns 1, a colon was found and therefore it's a hex string
 _CreateText()
Else
 _CreateHex()
EndIf

; Output the result to a file
$file = FileOpen($outputFile, 2)
FileWriteLine($file, $input)
FileWriteLine($file, $output)
FileClose($file)
Run('notepad "' & $outputFile & '"', @ScriptDir)
Exit




; =========
; Functions
; =========

; Create a Hex string from Text
Func _CreateHex()

  $i = StringSplit($input, "")

  ; Make the hex numbers from each character of the text string
 For $n = 1 to $i[0]

   $hex = StringRight(Hex(Asc($i[$n])), 2)

   ; Add each char together with colons
  If $n = $i[0] Then
   $output = $output & $hex
  Else
   $output = $output & $hex & ":"
  EndIf
 Next

EndFunc


; Create a Text string from Hex
Func _CreateText()

  $i = StringSplit($input, ":")

  ; Take the hex numbers and convert them to text
 For $n = 1 to $i[0]

   $iText = Chr(Dec($i[$n]))

   ; Add each char together with colons
  $output = $output & $iText
 Next

EndFunc



What else can you do?
Read and write to the registry, to ini files easily with dedicated commands, control windows, send keystrokes to programs, interact with window controls, run command line DOS programs, pass variables to DOS programs, etc. AutoIt is really for making scripts to automate a process but you can also write GUI (Graphical User Interface) forms and other windows.


Conclusion
I've used AutoIt countless times for many years. It is powerful yet easy to learn. If you want to automate Windows this is one of the best scripting languages out there.

Recommended: 9.9 / 10



No comments:

Newer Post Older Post Home

两个鬼故事电脑蓝牙海鲎呼兰河传读后感测字公司起名大空港2013起个好的微信名字大全锘字起名字好不好民国总统起名字男孩文五金店卖什么姓柳女孩起名字恶魔岛网站三亚新规可罚100万贝利妻子八字八字起名测试打分reveals招聘广告语吉祥起名韩姓女孩起名 打分大全锲而不舍的锲是什么意思小石潭记翻译goldwave中文版适合起名的诗词2020年潘姓男孩起名属兔的女孩起名宜用字cctv6电影牛肉汤女儿姓氏郑 起名八字取名起名大全 打分科技企业怎么起名称少年生前被连续抽血16次?多部门介入两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”淀粉肠小王子日销售额涨超10倍高中生被打伤下体休学 邯郸通报单亲妈妈陷入热恋 14岁儿子报警何赛飞追着代拍打雅江山火三名扑火人员牺牲系谣言张家界的山上“长”满了韩国人?男孩8年未见母亲被告知被遗忘中国拥有亿元资产的家庭达13.3万户19岁小伙救下5人后溺亡 多方发声315晚会后胖东来又人满为患了张立群任西安交通大学校长“重生之我在北大当嫡校长”男子被猫抓伤后确诊“猫抓病”测试车高速逃费 小米:已补缴周杰伦一审败诉网易网友洛杉矶偶遇贾玲今日春分倪萍分享减重40斤方法七年后宇文玥被薅头发捞上岸许家印被限制高消费萧美琴窜访捷克 外交部回应联合利华开始重组专访95后高颜值猪保姆胖东来员工每周单休无小长假男子被流浪猫绊倒 投喂者赔24万小米汽车超级工厂正式揭幕黑马情侣提车了西双版纳热带植物园回应蜉蝣大爆发当地回应沈阳致3死车祸车主疑毒驾恒大被罚41.75亿到底怎么缴妈妈回应孩子在校撞护栏坠楼外国人感慨凌晨的中国很安全杨倩无缘巴黎奥运校方回应护栏损坏小学生课间坠楼房客欠租失踪 房东直发愁专家建议不必谈骨泥色变王树国卸任西安交大校长 师生送别手机成瘾是影响睡眠质量重要因素国产伟哥去年销售近13亿阿根廷将发行1万与2万面值的纸币兔狲“狲大娘”因病死亡遭遇山火的松茸之乡“开封王婆”爆火:促成四五十对奥巴马现身唐宁街 黑色着装引猜测考生莫言也上北大硕士复试名单了德国打算提及普京时仅用姓名天水麻辣烫把捣辣椒大爷累坏了

两个鬼故事 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化