Checkbox 如何取消选中AutoIt中的复选框?

Checkbox 如何取消选中AutoIt中的复选框?,checkbox,autoit,Checkbox,Autoit,如何取消选中复选框 我真的想要这个复选框“未选中”。我以前使用过send_键,我可以给它发送一个选中/未选中的切换空间,但是当我发送切换时它实际上可以被取消选中,然后它就会被选中,这是我不想要的。我希望它绝对不被检查 我该怎么做 以下是我目前的AutoIt脚本: #include <StaticConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include

如何取消选中复选框

我真的想要这个复选框“未选中”。我以前使用过send_键,我可以给它发送一个选中/未选中的切换空间,但是当我发送切换时它实际上可以被取消选中,然后它就会被选中,这是我不想要的。我希望它绝对不被检查

我该怎么做

以下是我目前的AutoIt脚本:

#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

Local $Title = "Campus Portal Install"

Run("C:\Temp\PortalInstall-13_1_A_HF5_0003\cmcportalinstall.exe")

WinWaitActive($Title)

Send("z:\CampusPortal\")

ControlCommand($Title, "", "cbBackupIIS", "UnCheck")
ControlCommand($Title, "", "[NAME:cbBackupIIS]", "UnCheck")
ControlCommand($Title, "", 1049322, "UnCheck")
ControlCommand($Title, "", "[CLASS:#1049322]", "UnCheck")
ControlCommand($Title, "", "CLASS:Button]", "UnCheck")
ControlCommand($Title, "", "[WindowsForms10.BUTTON.app.0.2004eee]", "UnCheck")
ControlCommand("Campus Portal Install", "", "cbBackupIIS", "UnCheck")
ControlCommand("Campus Portal Install", "", "[NAME:cbBackupIIS]", "UnCheck")
ControlCommand("Campus Portal Install", "", 1049322, "UnCheck")
ControlCommand("Campus Portal Install", "", "[CLASS:#1049322]", "UnCheck")
ControlCommand("Campus Portal Install", "", "CLASS:Button]", "UnCheck")
ControlCommand("Campus Portal Install", "", "[WindowsForms10.BUTTON.app.0.2004eee]", "UnCheck")

MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10)
我尝试过的每一种变体都留下了痕迹;它们不会出错,所以把它们留在那里也没什么害处;再加上它显示了我的努力

控制发送工作正常

以下是控制信息:

>>>> Window <<<<
Title:  Campus Portal Install
Class:  WindowsForms10.Window.8.app.0.2004eee
Position:   496, 166
Size:   608, 523
Style:  0x16CF0000
ExStyle:    0x00050100
Handle: 0x00450334

>>>> Control <<<<
Class:  WindowsForms10.BUTTON.app.0.2004eee
Instance:   15
ClassnameNN:    WindowsForms10.BUTTON.app.0.2004eee15
Name:   cbBackupIIS
Advanced (Class):   [NAME:cbBackupIIS]
ID: 1049322
Text:   Backup IIS Entries?
Position:   108, 142
Size:   123, 15
ControlClick Coords:    55, 6
Style:  0x5601000B
ExStyle:    0x00000000
Handle: 0x001002EA

>>>> Mouse <<<<
Position:   663, 337
Cursor ID:  0
Color:  0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Version 13.1.a.hf5.0003\campusportal
Backup IIS Entries?
Backup Files?
...
C:\CampusPortalBackup\
Backup Path:
...
z:\CampusPortal\
Base Path:
E&xit
&Next >
Choose a base location and which applications will be installed.
Application Settings


>>>> Hidden Text <<<<
App Pool Credentials
Password:
Username:
Use Integrated Authentication?
Configure Portal Database?
Run Portal SQL Update Scripts?
Portal
Password:
Username:
Database Name:
Server Name:
Campus
Password:
Username:
Database Name:
Server Name:
Host Header:
Register ASP.Net with IIS?
IP Address:
global
DSBXDANSQL01
Description:
Branding Folder:
URL Name:
You are now ready to install/remove the selected applications.  Click the Begin button below to start the installation/removal/configuration process.
Clear All
Select All
Campus List:
Student:
Applicant:
Activate?
Employer:
Staff:
...
http://localhost:80/
Portal:
http://localhost:99/
Configuration Tool:
http://localhost:98/
Admin Console:
127.0.0.1
SMTP Server:
seconds.
30
Query Interval:
50
Records Quantity:
Password:
NT Domain\User:
minute(s)
Staff Active Directory Settings:
dev
NT Domain:
dev.campusmgmt.com
Fully Qual.  Domain:
LDAP://OU=CampusUsers,DC=dev,DC=campusmgmt,DC=com
AD Path:
Student Active Directory Settings:
dev
NT Domain:
dev.campusmgmt.com
Fully Qual.  Domain:
LDAP://OU=CampusUsers,DC=dev,DC=campusmgmt,DC=com
AD Path:
1
Cache Refresh:
doc|rtf|pdf|xls|txt
0
Allowable File Types:
Cache Refresh Time:
Add
Allow IPs
...
http://localhost:91/
http://localhost:97/
Security Service:
Login Service:
...
http://localhost:95/
http://localhost:93/
http://localhost:92/
http://localhost:96/
Online Registration:
Payment Service:
Messaging Service:
http://localhost:94/
Reporting Service:
Portal Data Service:
\\DSBXDANSQL01\Reports
Default Report Path:
\\DSBXDANSQL01\Reports
Custom Report Path:

从这个示例中,您应该能够使用_IsChecked$hWnd来确定是否选中了复选框。按钮是复选框的正确类类型。

我的也总是返回零

我设法让它工作使用

   If ControlCommand("Login", "Login", $checkBox, "IsChecked") Then
       ControlCommand("Login", "Login", $checkBox, "Uncheck")
   EndIf

这个命令的作用是:ControlSend$Title,[NAME:cbBackupIIS],所以至少我现在知道了正确的控件地址。我还尝试使用UnCheck,IsChecked始终返回0。但IsEnabled返回1。按钮不是复选框。。。你可能会尝试自动化一些你并不想做的事情吗?一个快速而肮脏的方法是获取其中心像素的像素颜色,并将其与选中状态的值进行比较。。那么您只需要在选中时发送空间。。。当您创建自己的GUI时,可以使用GUICtrlRead$checkBox==$GUI\u CHECKED。。。但这对您现有的GUI不起作用,对吗?我正在尝试自动化供应商的GUI安装。奇怪的是,这是一个按钮类,它看起来像一个复选框。我尝试在窗口上单击控件,但没有切换选中的状态。我认为Autoit的问题在于,检查控件状态的函数仅适用于Autoit生成的控件。但是尝试访问校园门户安装应用程序的控制状态不起作用,因为它们使用的是非标准。。。某物GUICtrlRead$hwnd始终返回0。我确信我有正确的窗口。ControlGetHandle$Title,[NAME:cbBackupIIS]如果将查找工具置于复选框上方,则返回与Autoit窗口信息相同的值。