Sign in to follow this  
Followers 0
davy

IsVisible always returns success

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks a lot.

I think using the @error will work perfectly for what i'm trying to achieve.

Davy

Share this post


Link to post
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
Sign in to follow this  
Followers 0