Jump to content

ControlCommand function not giving expected output


Recommended Posts

OS = WinXP Pro SP2

The following line of code returns 1 when run under AutoIt 3.2.10.0 F5 from Scite but returns 0 when run under the latest beta 3.2.11.3 Alt+F5 from Scite. In both cases @error is 0 on return. Has there been some change to the way this function works in the latest beta that I have missed or is this a bug that has crept in?

$iResult = ControlCommand("[REGEXPTITLE:^.* - ArcMap - ArcEditor$]", "", "[CLASS:ArkansasCoolBar; TEXT:EditClient Validation]", "IsVisible", "")

I have also noticed that the value of $hCtrlTB is different in 3.2.10.0 and 3.2.11.3 but remains consistently the same in each version of AutoIt. The application I'm running against remains open between runs, so the control handle should not change. The handle returned by AutoIt 3.2.10.0 matches that displayed by AuInfo.exe.

Can anyone shed any light on this?

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

  • Moderators

OS = WinXP Pro SP2

The following line of code returns 1 when run under AutoIt 3.2.10.0 F5 from Scite but returns 0 when run under the latest beta 3.2.11.3 Alt+F5 from Scite. In both cases @error is 0 on return. Has there been some change to the way this function works in the latest beta that I have missed or is this a bug that has crept in?

$iResult = ControlCommand("[REGEXPTITLE:^.* - ArcMap - ArcEditor$]", "", "[CLASS:ArkansasCoolBar; TEXT:EditClient Validation]", "IsVisible", "")

I have also noticed that the value of $hCtrlTB is different in 3.2.10.0 and 3.2.11.3 but remains consistently the same in each version of AutoIt. The application I'm running against remains open between runs, so the control handle should not change. The handle returned by AutoIt 3.2.10.0 matches that displayed by AuInfo.exe.

Can anyone shed any light on this?

I personally would have to dig more, but I could have swore I read a change in the regexp and class validation... you do get a handle with WinGetHandle("[REGEXPTITLE:^.* - ArcMap - ArcEditor$]") of the win in question with the upper betas?

TITLE - Window title

CLASS - The internal window classname

REGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2)

LAST - Last window used in a previous AutoIt command

ACTIVE - Currently active window

INSTANCE - The 1-based instance when all given properties match

No TEXT: option there I see. Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I personally would have to dig more, but I could have swore I read a change in the regexp and class validation... you do get a handle with WinGetHandle("[REGEXPTITLE:^.* - ArcMap - ArcEditor$]") of the win in question with the upper betas?

No TEXT: option there I see.

Using the CLASSNN method works with both 3.2.10.0 and 3.2.11.3 so the issue would seem to be with the TEXT: control identifier method.

$hCtrlTB =  ControlGetHandle("[REGEXPTITLE:^.* - ArcMap - ArcEditor$]", "", "[CLASSNN:ArkansasCoolBar19]")
$iResult = _WinAPI_IsWindowVisible($hCtrlTB)oÝ÷ Ú«¨µéÚ

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

OOps I forgot to mention in my last post. The critical thing causing the correct control not to be found using the CLASS: TEXT: combination appears to be if there is another control in the same CLASS but with "" text.

I didn't edtit the above post because I did not want to risk it messing up the code.

Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...