2016-04-26 83 views
0

我一直在试图让一个窗口,在软件安装过程中的焦点。该窗口没有标题。该脚本保持失败。有人可以告诉我,如果有什么我可以改变我的脚本?autohotkey焦点没有标题

这应该共同努力,单击确定按钮:

Sleep, 4000. 
Send, {control down} 
MouseClick, Left, 300, 185, 
Send, {Control up} 

的结果是,它会打开谷歌浏览器旁边的Windows的开始菜单,而不是点击打开的窗口中所确定的点在中间桌面。

我完整的脚本如下:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 
;#Warn ; Enable warnings to assist with detecting common errors. 
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 

Sleep, 1000 ;language selection and next. 
Send, {tab} 
Sleep, 500 
Send, {tab} 
Sleep, 500 
Send, {tab} 
Sleep, 500 
Sleep, 2000 
Send, {Enter} 

Sleep, 1000 ;directory and installation. 
Send, {tab} 
Sleep, 500 
Send, {tab} 
Sleep, 500 
Send, {tab} 
Sleep, 500 
Send, {tab} 
Sleep, 500 
Send, {tab} 
Sleep, 5000 
Send, {Enter} 
Sleep, 500 
Send, {tab} 
Sleep, 5000 ;for installation wait time. 
Send, {Enter} ;finish. 

Sleep, 7000 
Run "myexecutable.exe" 

Sleep, 4000 ;focus attempt 2. 
Send, {control down} 
MouseClick, Left, 300, 185, 
Send, {Control up} ;for association OK. 

回答

0

你可以用鼠标点击在相对模式:

CoordMode, Mouse, Window 

这将使点击相对坐标到活动窗口代替屏幕。

因此,计算窗口上需要点击的位置的新坐标,并确保该窗口处于活动状态。

要获得窗口句柄,请使用程序的可执行文件名称。例如,要激活窗口,而不是参数WinTitle使用ahk_exe和进程名称:

WinActivate, ahk_exe myexecutable.exe 
+0

感谢您的答复。实际的问题是该窗口没有“关注”焦点。它不显示标题,也没有“隐藏”标题。 我确实尝试了不同的方法来关注弹出窗口,但都没有成功。有趣的是,尝试使用SCREEN的相对坐标有时有效,但在97%的时间内失败(使用完全相同的编码)。 此外,当我将它作为一个单独的片段进行测试时,它的工作成功率更高(50%),绘制精确编码的坐标(空白窗口标题选项)。 –

+0

˙@ JDoe查看更新。 – 2501