Jump to content

New To This - need some basic help


judd
 Share

Recommended Posts

Hello,

I am new to autoit (and VB-likes).

I have a simple automation task I am trying to get going and need some help with the mental model for things like control clicking.

My specific example is as follows... I am using a tool called computer time to manage my kids' time on their machines. I want to reset that time each night by deleting the time tokens that I might assign them. That is the backstory.

To do this, here is the workflow (pseudocode) through the computer time app that I want to automate:

1. open the app, login window (1) opens

2. type in a password

3. hit enter

 

4. a new window (2) opens

5. click the button on the toolbar that says "tokens"

 

6. a new window (3) opens on top of this window

7. click the button (not in a toolbar) that says "delete all"

 

8. a message box pops open and says "are you sure?"

9. click the "yes" button

 

10. a message box pops open and says "tokens were deleted"

11. click the "ok" button

 

12. on window (3) click the close button

 

13. on window (2) click the "X" to close the app

 
The part I do not understand, and would love some super simple examples of, is around using windows to get down to controls. I am assuming that I should be using ControlClick to get through step 5, but cannot for the life of me understand the parameters I pass to it.
 
Here is what I see in the AutoIt Window Info tool summary tab for window (2), how do I click the "tokens" button below?
 
>>>> Window <<<<
Title: ComputerTime Admin
Class: CTAdmin
Position: 684, 48
Size: 612, 194
Style: 0x14CF0000
ExStyle: 0x00000100
Handle: 0x00150322
 
>>>> Control <<<<
Class: ToolbarWindow32
Instance: 1
ClassnameNN: ToolbarWindow321
Name:
Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:1]
ID: 59392
Text:
Position: -2, 0
Size: 581, 49
ControlClick Coords: 425, 38
Style: 0x5400084E
ExStyle: 0x00000000
Handle: 0x0257033C
 
>>>> Mouse <<<<
Position: 1115, 136
Cursor ID: 0
Color: 0x000000
 
>>>> StatusBar <<<<
1: ComputerTime server: XPS630
2:
3: NUM
4:
 
>>>> ToolsBar <<<<
1: 32789 New
2: 32790 Edit
3: 32791 Duplicate
4: 32792 Delete
5: 32793 Wizard
6: 0
7: 32794 Report
8: 32776 Tokens
9: 32817 Inst Token
10: 0
 
Here is my code to click the tokens button:
 
; Script Start - Add your code below here
Run ("C:Program FilesSoftwareTimeComputerTimebinCTAdmin.exe")
WinWaitActive("ComputerTime Admin Logon - SN-9CCY-EYPY-JA")
 
Send("XXXX{ENTER}", 0)
Local $topWin = WinWaitActive("ComputerTime Admin")
 
;click the tokens button
ControlClick("ComputerTime Admin", "Tokens", "[CLASS:ToolbarWindow32; INSTANCE:1]")
 
;exit the app
WinClose("ComputerTime Admin")

 

Everything works up to that ControlClick call. I am just not sure what "windows" or "handles" and "titles" or "controlIDs" I am supposed to stick into that call. I feel like the docs assume a more-than-basic level of knowledge and I need the notch below that.

Any help would be much appreciated.

Thanks,

Judd

Link to comment
Share on other sites

Hi Judd,

  if it is a button you are trying to click then the class name should have button in it not window.

The parameters are lined up:

Window Title: "ComputerTime Admin"

Text: try leaving this blank 

and the button instance: Which is where yours is most likely incorrect.

Try to get the name of the button with the window info tool.

If the buttons name is actually TOKENS this might work:

ControlClick("ComputerTime Admin", "" "Tokens")

Bill

Link to comment
Share on other sites

Hello everybody,

I am also new here, I started to use Autoit a few months ago / a few hours a day trying to automate my testing work.

Recently I had the same problem as Judd and JohnOne's suggestion works fine but I have a few questions:

 - Is there any other method to press that button from the toolbar instead of using ControlClick? I tried using ControlCommand with SendCommandID and use the Command ID of the button I want to press but that didn't work. The Command ID info was taken from ">>>> ToolsBar <<<<"

 - In my case, the button I want to press is a menu button that opens a list of submenu items. How do I select a submenu item and if the first submenu item also has submenu items, how do I select one?

I tried WinMenuSelectItem but it didn't work because my menu is a toolbar "pretending" to be a menu.

I am thinking about using Send with a few DOWN / RIGHT / ENTER keys but is there a more elegant method?

Thanks,

Mobert

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