作者:革启兵 | 来源:互联网 | 2023-09-25 11:36
HowdoIgettheEnabledstateinAutoItofabutton(eitheritsdisableddimmedorenabled)?如何在按钮
How do I get the Enabled
state in AutoIt of a button (either it's disabled/dimmed or enabled)?
如何在按钮的AutoIt中获得启用状态(要么禁用/调暗,要么启用)?
This for a .NET application (Windows Forms, VB.NET) where the name of the button in the Visual Studio designer is btnStoreInModule
and property text is S&tore in Module
. The property Enabled
is what I am interested in. The button is of type System.Windows.Forms.Button
. My AutoIt script presses the button like this:
这适用于。net应用程序(Windows Forms, VB.NET),其中Visual Studio设计器中的按钮的名称是btnStoreInModule,属性文本是S&tore in Module。启用的属性是我所感兴趣的。按钮的类型是System.Windows.Forms.Button。我的AutoIt脚本按下如下按钮:
ControlClick("My Application", "", "[NAME:btnStoreInModule]")
The application responds by disabling the button while it is doing an operation. When the operation finished, the button is enabled again (undimmed). The application when the Store
button is disabled:
应用程序在执行操作时通过禁用按钮进行响应。操作完成后,按钮再次启用(未调暗)。当商店按钮被禁用时的应用程序:
AutoIt Window Information Tool gives the same result for both the disabled- and the enabled state:
AutoIt窗口信息工具为禁用状态和启用状态提供相同的结果:
>>>> Window <<<<
Title: My Application 1.2a6
Class: WindowsForms10.Window.8.app.0.b7ab7b
Position: -4, 34
Size: 1448, 870
Style: 0x17CF0000
ExStyle: 0x00050100
Handle: 0x000C08DE
>>>> Control <<<<
Class: WindowsForms10.BUTTON.app.0.b7ab7b
Instance: 21
ClassnameNN: WindowsForms10.BUTTON.app.0.b7ab7b21
Name: btnStoreInModule
Advanced (Class): [NAME:btnStoreInModule]
ID: 592026
Text: S&tore in Module
Position: 257, 675
Size: 91, 23
ControlClick Coords: 59, 8
Style: 0x5601000B
ExStyle: 0x00000000
Handle: 0x0009089A
I get the text of a TextBox control using (TB_Type
is name of TextBox in Visual Studio's property window):
我使用(TB_Type是Visual Studio属性窗口中TextBox的名称)获取文本框控件的文本:
Local $sText = ControlGetText ("My Application", "", "[NAME:TB_Type]")
For the button the corresponding line returns S&tore in Module
(as one might expect). AutoIt v3.3.8.1 (2012-01-29).
对于按钮,相应的行返回S&tore in模块(正如人们所期望的)。AutoIt v3.3.8.1(2012-01-29)。
2 个解决方案