Sign in to follow this  
Followers 0
Xeirus

Another humble newbie

7 posts in this topic

Hello all,

So I just started learning to script and have been asking a friend for help. I have been altering scripts that he made previously with the help from the help file for AutoIt. I generally only use the program for very simple key presses and just loop them, as I do a lot of repetitive tasks on servers. All of the scripts have worked up until now, as this one is a little more involved.

Basically I need the program to check if a box is checked and if it is then close the window and move on; if it's not I need it to be checked and click "ok" and move on.

I'm 99% positive it's just not looking at the correct box to check, but I have used the window info tool and copied what it stated there. The script is below and if you need any other information let me know.

Keep into mind this is the first script I have ever really tried to write myself so the code could look like total junk. Any help is much appreciated!

-----------------------------------

$counter = 0

Do

sleep(1500)

send ("{F2}")

sleep(100)

If ControlCommand("Discharge Plan", "TCheckBox3", 1031, "IsChecked") then

Winclose("Discharge Plan")

Else

ControlClick("Discharge Plan","TCheckBox3", 1031,"left")

sleep(500)

ControlClick("Discharge Plan","TButton2", 2622860,"left")

Endif

sleep(500)

send ("{DOWN}")

sleep(500)

send ("{F2}")

sleep(100)

until $counter = 100

Share this post


Link to post
Share on other sites



Welcome to the Forums :D

Here's some things to help with your script although I see nothing wrong with the syntax

Get rid of "$counter = 0", "Do", and "Until $counter = 100" and replace with the following:

For Infinite Loop: "While 1" and "WEnd"

For Non-Infintie Loop: "For $Counter = 0 to 100" and "Next"

Also for Code please use the [ autoit ] and [ /autoit ] tags (no spaces within tags)


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

What is the problem?

The script opens but never actually checks the check box, it just sort of hangs there and after a while it will close and move on. It seems like the script is working outside of the manually checking the box.

Share this post


Link to post
Share on other sites

I got it!

I have to change it from

ControlClick("Discharge Plan","TCheckBox3", 1031,"left")

to

ControlClick("Discharge Plan","", "[CLASS:TCheckBox; INSTANCE:3]", "left")

Your advice to search based on the Tcheckbox really helped. Thank you so so much. I have been working on this for a solid 5 hours and was getting pretty discouraged.

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