Jump to content

Looping to address several instances of a class


Recommended Posts

Can anyone please tell me why this snippet of code does nothing? (no errors are reported).

I am trying to send a blank to each of the 6 Input boxes in my AutoIt GUI application, in order to clear them. I know I could achieve this by GUICtrlSetData("name", "") for each instance but because this is something I shall need a lot in many proglets, I plan to turn it into a UDF which clears all the inputs and/or edit boxes in the current window without knowing in advance what their ControlIDs are.

For $Count = 1 to 6
  ControlSend("", "", "[CLASS:Edit; INSTANCE:" & $Count & "]", "")
Next

Thanks.

Caravelle

Link to comment
Share on other sites

I thought I had found the error, I was trying to concatenate a number into my string. However, it still does nothing when $Count is converted to a string..

For $Count = 1 to 6
  ControlSend("", "", "[CLASS:Edit; INSTANCE:" & String($Count) & "]", "")
Next

Caravelle

Can anyone please tell me why this snippet of code does nothing? (no errors are reported).

I am trying to send a blank to each of the 6 Input boxes in my AutoIt GUI application, in order to clear them. I know I could achieve this by GUICtrlSetData("name", "") for each instance but because this is something I shall need a lot in many proglets, I plan to turn it into a UDF which clears all the inputs and/or edit boxes in the current window without knowing in advance what their ControlIDs are.

For $Count = 1 to 6
  ControlSend("", "", "[CLASS:Edit; INSTANCE:" & $Count & "]", "")
Next

Thanks.

Caravelle

Link to comment
Share on other sites

Right now you have the count inside "". Try removing the quotes.

Thanks, but I can't agree with you there. $Count is between an end quote and a start quote , not the other way around. It's definitely outside quotes.

Are you saying that the concatenation operator & and the items it concatenates don't have to be outside the quotation marks surrounding the string?

Caravelle

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