找回密码
 加入
搜索
查看: 1804|回复: 3

foobar安装若干问(附代码)

[复制链接]
发表于 2009-7-8 14:59:50 | 显示全部楼层 |阅读模式
本帖最后由 gywx 于 2009-7-8 15:08 编辑
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         myName

 Script Function:
        Template AutoIt script.

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

; Script Start - Add your code below here

Opt("TrayIconDebug", 1)

$Title = "foobar2000 v0.9.6.8 Setup"

if WinExists($Title) Then
        MsgBox(4096+16,"警告","程序已在运行,请不要重复运行!!!",5)
        Exit
Else
        Run("foobar2000_0.9.6.8.exe")
EndIf

WinActivate($Title, "Welcome to the foobar2000 Setup")
Sleep(600)
ControlClick($Title, "Welcome to the foobar2000 Setup", "[Class:Button;INSTANCE:2]")
Sleep(600)
WinActivate($Title,"License Agreement")
ControlClick($Title,"License Agreement","[Class:Button;INSTANCE:2]")
Sleep(600)
WinActivate($Title,"Choose Install Type")
ControlClick($Title,"Choose Install Type","[Class:Button;INSTANCE:5]")
Sleep(600)
ControlClick($Title,"Choose Install Type","[Class:Button;INSTANCE:2]")
Sleep(600)
WinActivate($Title,"Choose Install Location")
ControlSetText($Title,"Choose Install Location","Edit1","C:\Program Files\foobar2000")
ControlClick($Title,"Choose Install Location","[Class:Button;INSTANCE:2]")
Sleep(600)
WinActivate($Title,"Choose Components")
ControlCommand($Title,"Choose Components","ComboBox1","SelectString","Full")
Sleep(600)

;ControlTreeView(
; How to handle the SysTreeWin32
;ControlCommand($Title,"Choose Install Location","ComboBox1","SetCurrentSelection", 2)


ControlClick($Title,"Choose Components","[Class:Button;INSTANCE:2]")
Sleep(600)
;Sleep(6000)
While not WinActivate($Title,"Completing the foobar2000 Setup")
        Sleep(10)
WEnd

;WinActivate($Title,"Completing the foobar2000 Setup")
;ControlCommand($Title,"Completing the foobar2000 Setup","Button4","UnCheck")



ControlClick($Title,"Completing the foobar2000 Setup","[Class:Button;INSTANCE:2]")
While not WinActivate("foobar2000 v0.9.6.8")
        Sleep(10)
WEnd

;Sleep(60)
If WinExists("foobar2000 v0.9.6.8") Then
        WinClose("foobar2000 v0.9.6.8")
EndIf
------------------------------------------------------------------------------------------------------------
1. 如何操作控件SysTreeWin32,我想选择Tree中的某几项,但始终不知道如何操作?
2. 如何在CMD环境下运行脚本,以及如何在CMD环境下运行编译生成的exe文件。目前我的操作是在CMD中直接运行生成的exe,没有输出,右下脚托盘里只有一个autoit的图标。不知道现在是那里有问题?
3. AutoIt有无类似silence的安装方式?如果有,我应该怎么用?
4. AutoIt中有无办法读取到foobar的播放列表中的信息,或者是类似机器的配置信息。我想在使用中对它进行判断和修改。

谢谢
 楼主| 发表于 2009-7-8 17:17:16 | 显示全部楼层
4. 我找到一个方法ControlGetText
ControlGetText("title", "text", controlID)
简单的实验如下:
保存字符串"autoit"到a.txt
Run("notepad.exe a.txt")
WinActivate("CLASS:Notepad]")
$var = ControlGetText("[CLASS:Notepad]", "", "Edit1")
Sleep(600)
MsgBox(0, $var, $var)

运行脚本好多次,弹出的对话框上都是空的。不知道为什么?然后编译成exe运行了一把,结果出来了,按照预想的对话框的标题和内容都是autoit。 很是不解。不知道为什么直接运行脚本不正常,编译后反而正常了。

我在脚本的头部加上了Opt("TrayIconDebug",1),运行时,把鼠标挪到右下角的托盘的autoit图标上,显示是Msgbox那行。貌似也没有什么作用。敢问各位大虾都是如何调试脚本的。

谢谢...
 楼主| 发表于 2009-7-8 17:42:24 | 显示全部楼层
2.不好意思,我是忘记把foobar的安装程序和exe放到相同目录下了。猪了一把。所以才出现上述运行程序后没有反应,在右下角托盘中有个autoit图标的情况。不好意思。
现在将foobar的安装程序和脚本编译生成的exe文件放到一起,在cmd下直接输入exe文件的全名就OK了。呵呵...
 楼主| 发表于 2009-7-9 17:55:53 | 显示全部楼层
自己顶一下。还请各位路过的大虾帮忙啊...
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-15 15:18 , Processed in 0.076049 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表