2014-04-24 27 views
0

如何取消選中複選框?如何取消選中AutoIt中的複選框?

我真的希望這個複選框'未勾選'。我之前使用過send_keys,並且我可以發送一個切換(空格)「checked/unchecked」,但實際上可以在發送切換時取消選中,然後它將被檢查,我不想要。我希望它是絕對聯合國檢查。

我該怎麼做?

這裏是我的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) 

我留在每一個我都試過變體;他們不會錯誤地將他們留在那裏;再加上它顯示了我所嘗試過的。

ControlSend正常工作。

這裏的控制信息:

>>>> 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: 
+0

此命令的作用:ControlSend($標題, 「」, 「[NAME:cbBackupIIS]」,「「),所以至少我現在知道正確的方法解決控制問題。 – Arluin

+0

我也嘗試使用「UnCheck」,「」 – Arluin

+1

IsChecked總是返回0.但IsEnabled確實返回1. – Arluin

回答

0

從例如here,你應該能夠使用_IsChecked($hWnd),以確定是否一個複選框被選中。按鈕是複選框的正確類類型。

+2

我認爲我與Autoit有關的問題是檢查控制狀態的功能僅適用於Autoit生成的控件。但試圖訪問校園門戶安裝應用程序的控制狀態不起作用,因爲他們正在使用非標準的...東西。 GUICtrlRead($ hwnd)總是返回0. – Arluin

+0

我確定我有正確的窗口。如果我將Finder工具放在複選框上,ControlGetHandle($ Title,「」,「[NAME:cbBackupIIS]」)返回與Autoit Window Info相同的值。 – Arluin

0

礦還總是歸零。

我設法得到它的工作使用

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