qxhuo28 发表于 2015-5-19 08:48:55

如何 用au3 配置teamviewer9.0[已解决]

本帖最后由 qxhuo28 于 2015-5-20 08:40 编辑

Dim $1 = "TeamViewer 9 安装"
Dim $2 = "TeamViewer"
Run("TeamViewer_9.0.exe")
TrayTip("提示", "正在安装-远程协助软件,安装过程已经禁止使用鼠标键盘,请稍等", 5)
sleep(100)
;第一个窗口
WinActivate($1)
WinWaitActive($1)
ControlClick($1,"","Button8")
Sleep(50)
ControlClick($1,"","Button2")
;配置程序
Sleep(1500)
WinActivate($2)
WinWaitActive($2)
Sleep(1000)
ControlClick($2,"","","left",1,84,48);这句执行没有反应,
我现在需要点击 其他-选项来 配置
谢谢!

文件过大,网盘分享了,谢谢
http://yunpan.cn/cjhH3duyj8AHs (提取码:4beb)

xlj310 发表于 2015-5-19 09:51:54

你问的这个地方我帮你写出代码了。 控件并非#327702,所以你那样写肯定是没有反应的。因为没有这个控件。

这个程序又不是一个标准的窗口,只能模拟点击。


WinActivate("TeamViewer", "控制远程计算机")
$winPos = WinGetPos("TeamViewer", "控制远程计算机")
$mousePos = MouseGetPos()
If WinExists("TeamViewer选项", "最常使用的选项") Then WinClose("TeamViewer选项", "最常使用的选项")

Do
        If Not WinExists("TeamViewer", "控制远程计算机") Then ExitLoop
        MouseClick("", $winPos + 87, $winPos + 44, 1, 0)
        Sleep(1000);这里的sleep语句请勿删除,否则一旦异常,有可能陷入死循环。
Until WinExists("", "")


Do
        MouseClick("", $winPos + 90, $winPos + 72, 1, 0)
        Sleep(1000)
Until WinExists("TeamViewer选项", "最常使用的选项")
MouseMove($mousePos, $mousePos, 0)

txen548 发表于 2015-5-19 10:33:44

sleep(2000)
Run("F:\重要資料\TeamViewerPortable_3987.com\TeamViewer.exe")
WinWait("TeamViewer","允許遠端控制")
WinActivate("TeamViewer","允許遠端控制")
WinClose("電腦與聯絡人","請登入...")
Send("{LALT}+f")
Send("{RIGHT}")
Send("{DOWN}")
Send("{ENTER}")
WinWait("TeamViewer選項","常用選項")
WinActivate("TeamViewer選項","常用選項")
Sleep(500)
MouseClick("left",284,272,1,1)
Sleep(500)       
ControlSetText("TeamViewer選項","這台電腦的存取選項","Edit10","123456789")
ControlSetText("TeamViewer選項","這台電腦的存取選項","Edit11","123456789")
ControlClick("TeamViewer選項","確定(&K)","Button71")
While 1
WinSetState("TeamViewer","允許遠端控制",@SW_MINIMIZE)
WinSetState("TeamViewer","允許遠端控制",@SW_DISABLE)
sleep(100)
Auto()       
wend
Func Auto()
If WinExists("TeamViewer面板","") Then
WinSetState("TeamViewer面板","",@SW_MINIMIZE)
WinSetState("TeamViewer面板","",@SW_DISABLE)
EndIf
EndFunc這一段代碼可以給你一點借鑒的效果,如有不懂的地方請告訴我.

qxhuo28 发表于 2015-5-19 10:42:27

回复 3# txen548


    非常感谢你,我学习下先

qxhuo28 发表于 2015-5-19 10:46:44

你问的这个地方我帮你写出代码了。 控件并非#327702,所以你那样写肯定是没有反应的。因为没有这个控件。
...
xlj310 发表于 2015-5-19 09:51 http://www.autoitx.com/images/common/back.gif

非常感谢 我学习下先

ila 发表于 2015-5-19 11:09:45

说个题外话,如果大批量使用,建议用VMThinApp打包成一个执行文件分发。

qxhuo28 发表于 2015-5-19 17:58:04

感谢楼上的 帮助,我贴下我的 代码Dim $1 = "TeamViewer 9 安装"
Dim $2 = "TeamViewer"
Dim $3 = "允许远程控制"
Dim $4 = "计算机和联系人"
Dim $5 = "TeamViewer选项"
Dim $6 = "配置永久访问"
Dim $7 = "永久连接已激活"
Run("TeamViewer_9.0.exe")
TrayTip("提示", "正在安装-远程协助软件,安装过程已经禁止使用鼠标键盘,请稍等", 5)
sleep(100)
;第一个窗口
WinActivate($1)
WinWaitActive($1)
ControlClick($1,"","Button8")
Sleep(50)
ControlClick($1,"","Button2")
;第二个窗口
Sleep(100)
WinActivate($1)
WinWaitActive($1)
ControlClick($1,"","Button5")
ControlClick($1,"","Button2");安装完成
;~ ;配置程序
sleep(2000)
WinWait($2,$3)
WinActivate($2,$3)
WinClose($4,"")
Send("{LALT}+f");快捷键AlT+f
Send("{RIGHT}");鼠标向右移
Send("{DOWN}");鼠标向下移
Send("{ENTER}");回车键
Send("{TAB}")
#CS ;~ //WinWait("TeamViewer选項","")
   ;~ //WinActivate("TeamViewer选項","")
#CE
ControlCommand($5,"随Windows一同启动TeamViewer","Button67","check","")
Sleep(50)
WinWait($6,"")
WinActivate($6,"");配置永久访问
ControlSetText($6,"","Edit1","123456789");配置永久访问
ControlSetText($6,"","Edit2","123456789");配置永久访问
ControlClick($6,"确定","Button2");配置永久访问
Sleep(50)
WinWait($7,"");永久连接已激活
WinActivate($7,"");永久连接已激活
ControlClick($7,"确定(&K)","Button4");永久连接已激活
ControlCommand($5,"","ComboBox19","SetCurrentSelection","2")
ControlClick($5,"","ListBox1","left",1,26,17)
Send("{DOWN}");鼠标向下移
#CS ;~ MouseClick("left",26,17,1,1)
#CE
Sleep(50)      
ControlCommand($5,"","ComboBox17","SetCurrentSelection","4")
Sleep(50)      
ControlCommand($5,"","ComboBox18","SetCurrentSelection","1")
ControlClick($5,"","ListBox1","left",1,30,47)
Send("{DOWN}");鼠标向下移
Send("{DOWN}");鼠标向下移
Send("{DOWN}");鼠标向下移
Send("{DOWN}");鼠标向下移
Send("{DOWN}");鼠标向下移
Send("{DOWN}");鼠标向下移
Send("{DOWN}");鼠标向下移
Sleep(100)
ControlClick($5,"显示高级选项","Button35")
Sleep(100)
ControlCommand($5,"","ComboBox2","SetCurrentSelection","2");关闭更新
ControlCommand($5,"","ComboBox3","SetCurrentSelection","3");关闭更新
ControlCommand($5,"自动最小化本地TeamViewer面板","Button5","check","");开启最小化
Sleep(100)
ControlCommand($5,"在启动时显示计算机和联系人","Button18","uncheck","");启动时不显示。。。
Sleep(50)
ControlCommand($5,"请勿使用呼入端口80 (建议仅用于Web服务器)","Button24","check","");关于80连接
Sleep(50)
ControlCommand($5,"禁用TeamViewer关闭程序","Button29","check","");禁用TeamViewer关闭程序
Sleep(50)
ControlCommand($5,"使用适用于Outlook的TeamViewer会议插件","Button30","uncheck","");不使用Outlook
Sleep(50)
ControlCommand($5,"更改需要在本计算机上具备管理员权限","Button31","check","");设置管理员密码
Sleep(100)
ControlSetText($5,"","Edit2","123456789");输入密码
ControlSetText($5,"","Edit3","123456789");确认密码
ControlClick($5,"确定(&K)","Button72");配置完成
Sleep(150)
WinWait($2,$3)
WinActivate($2,$3)
WinClose($2,$3);关闭主窗口,配置安成

qxhuo28 发表于 2015-5-19 18:02:15

回复 2# xlj310


感谢 xlj310,就是有报错
Subscript used on non-accessible variable


另外 宏之类的还没用,所以没看懂, 谢谢

xlj310 发表于 2015-5-19 19:23:18

回复 8# qxhuo28


    哪一行报错? 自己稍微修改一下

wangms 发表于 2015-5-21 10:25:34

本帖最后由 wangms 于 2015-5-21 12:26 编辑

回复 2# xlj310


经测试很好使! 能稍微注解一下每句代码的作用吗?另窗口类名、MouseClick("", $winPos + 87, $winPos + 44, 1, 0)控件坐标,是用窗口信息工具得出来的?能图解一下窗口信息工具测试过程?谢谢!!

后继续摆弄窗口信息工具,需将坐标模式改为'扑捉窗口',才有上面鼠标坐标数据的

wangms 发表于 2015-5-21 12:23:09

本帖最后由 wangms 于 2015-5-21 12:27 编辑

回复 8# qxhuo28

前几次都能正常运行2#脚本,后不知咋的突然又不行啦,提示你同样的错,也即不能激活隐藏文本为‘控制远程计算机’的窗口,我将‘控制远程计算机’改为可见文本'主持会议',又可以啦。请各位高手及2#老师解释下这是何原因?

qxhuo28 发表于 2015-5-21 16:43:04

回复 11# wangms


    莱鸟基本没看懂, 后面熟悉了再看

xlj310 发表于 2015-5-23 14:54:28

回复 10# wangms


    $winPos中是保存TeamViewer的窗口坐标位置,是横坐标,是纵坐标。

87,44,是偏移,你可以用截图工具等获取这个偏移量。

xlj310 发表于 2015-5-23 14:57:42

回复 11# wangms


    你说的这个问题我后来看了一下,是因为你在窗口上点了会议功能,所以文本中没有“远程控制计算机”了,解决办法是
将窗口文本改为“计算机和联系人”,这样无论你点的是远程控制,还是会议,都有此文本。

感谢你的建议,我修改一下源码。

wangms 发表于 2015-5-27 08:37:44

本帖最后由 wangms 于 2015-5-27 09:11 编辑

回复 14# xlj310


谢谢!!果真是这个原因,‘远程控制’与‘会议’不同选项下窗口文本会变化。经再次测试,“计算机和联系人”不行,倒是“免费许可证(仅非商业用途)”通用。另您的这段代码很漂亮!
页: [1]
查看完整版本: 如何 用au3 配置teamviewer9.0[已解决]