我想自动化我机器上安装的软件。我正在使用AutoIt但在一个屏幕上我无法获得控件ID或标题,以便我可以访问该控件然后在其中查找文本。我想点击该文本,所以我需要该文本的坐标。如何使用c#代码或任何其他第三方工具来协调该文本可以帮助我解决这个问题? 我已经检查了谷歌但我无法得到任何有趣或有用的东西。 任何与此问题相关的事情都将不胜感激。
答案 0 :(得分:0)
正如其他人所说,你问的问题有点模糊。你想要什么样的软件自动化?你想更准确地自动化什么? (鼠标操作?点击?软件特别的东西?..)
关于鼠标点击,例如,有两种主要方法可以自动化流程: 基于点击的窗口坐标或基于窗口坐标的点击。 下面,您可以找到自动安装特定应用程序的示例 来自"网络平台安装程序5.0" (您可以从Microsoft网站@ https://azure.microsoft.com/en-us/tools/ - > visual studio 2015下载)
;Gives Admin rights to autoIT
#RequireAdmin
;launches the program in the same directory as the installer
Run(@ScriptDir & '\azure.exe')
;Sets the coordinates as window coordinates with "0" (VS screen coordinates)
AutoItSetOption('MouseCoordMode',0)
;Waits for the program to open and to display a text like "Microsoft Web Platform Installer"
WinWait("Web Platform Installer 5.0","Microsoft Web Platform Installer")
;wait 1.5 seconds
sleep(1500)
;When the window is visible, le cursor is set as active ont that window (IMPORTANT)
WinActivate("Web Platform Installer 5.0")
;the following commands are mouseclicks on specific boxes of the program to automate specific installs on the installer
;MouseClick('primary', x, y, 1, speed (1 to 10))
; You will find those coordinates in the "AU3info.exe file" after you've installed autoIT ( Au3info allows to find coordinates
; by targeting specific places on a window)
MouseClick('primary', 155, 60, 1, 10)
sleep(1500)
;selects 4 apps to be installed (4 installs), clics INSTALL and waits 1.5 sec
MouseClick('primary', 817, 122, 1, 10)
MouseClick('primary', 821, 163, 1, 10)
MouseClick('primary', 815, 401, 1, 10)
MouseClick('primary', 828, 519, 1, 10)
MouseClick('primary', 692, 587, 1, 10)
sleep(1500)
;Prepaing the install and waiting till a text like "Review the following list" apprears
WinWait("Web Platform Installer 5.0","Review the following list")
WinActivate("Web Platform Installer 5.0")
sleep(1500)
MouseClick('primary', 43, 350, 1, 10)
MouseClick('primary', 603, 433, 1, 10)
;starts the installation and waits till the installation is finished (when "The following"..programm has installed ..blabla
WinWait("Web Platform Installer 5.0","The following")
MouseClick('primary', 612, 434, 1, 2)
;gets rid of some issues stemming from microsoft edge (the send functions allows to send keyboard keys (like ESC, SPACE, ALT, etc..))
sleep(1000)
Send("{ENTER}")
MouseClick('primary', 612, 434, 1, 2)
sleep(1000)
Send("{ENTER}")
;quits all the windows with ALT + F4
WinWait("Web Platform Installer 5.0")
WinActivate("Web Platform Installer 5.0")
Sleep(1000)
Send("{ALT down}{F4 down}{F4 up}{ALT up}")
Sleep(1000)
Send("{ALT down}{F4 down}{F4 up}{ALT up}")