Jump to content

IsVisible always returns success


davy
 Share

Recommended Posts

I have a simple windows form with 3 buttons on it. I need to check what ones are visible. The problem is that even when I pass in a rubbish value the control command always returns 1.

I've seen other people using this and think I might be doing something stupid. can someone help please? here is the code i'm using.

WinActivate("Form1");

$ControlText = "DoesNotExist";

$isVisible = ControlCommand("Form1", "",$ControlText, "IsVisible", "")

MsgBox(4096, "",$IsVisible , 1) ;

Thanks

Link to comment
Share on other sites

Welcome to the forums!

I can confirm that this is happening with AutoIt v3.1.1. This behaviour is not apparent in the beta; you will find that other v3.1.1 issues are also resolved making the beta more stable anyway.

Edit: What you probably should be doing is checking the @Error value, which correctly reports that there was a problem:

ControlCommand('Form1', '', 'DoesNotExist', 'IsVisible')
If @Error Then MsgBox(0x10, 'Stop!', 'That control does not exist!')
Edited by LxP
Link to comment
Share on other sites

Tested on CCleaners invisible progress bar

MsgBox(0, '', ControlCommand('CCleaner', '', 7, 'IsVisible', '') )

Run it when it is hidden intially returns 0.

Click Analyze then run again and it returns 1.

ControlCommand works as expected. As LxP notes, beta returns 0 for your test.

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...