Jump to content
Sign in to follow this  
Keith

ControlCommand blocks

Recommended Posts

Keith

I needed a quick way to automate running a GUI and ran across AutoIt so I tried it out and it seems to be what I need. I was able to write a script that does most everything so far, but I ran into a problem with one part of the GUI operation where I need to select from a combobox. The select works because it pops up a confirmation dialog, but the script is still blocked on the ControlCommand call, so I cannot send a response to the confirmation dialog and the whole thing hangs. Here's a snippet of the offending call:

; Stop recording

ConsoleWrite("select")

ControlCommand("DATAQ Instruments Hardware Manager", "", "[CLASS:TComboBox; INSTANCE:1]", "SelectString", "Stop Recording to SD Memory")

ConsoleWrite("done")

WinWaitActive("", "Do you want to Stop Recording to SD Memory?", 2)

Send("y")

I see the "select" but not the "done" until I manually click on one of the confirmation dialog buttons. Any idea why ControlCommand is getting blocked? How do I work around this problem?

Thanks,

Keith.

Share this post


Link to post
Share on other sites
youknowwho4eva

appears to me you have it a lil backwards. Here is the example from the help file.

Run("notepad.exe")

ControlCommand("[CLASS:Notepad]", "", "Edit1", "GetLineCount", "")

The third element should be the control id.


Giggity

Share this post


Link to post
Share on other sites
Keith

I don't see how I have it backwards. "DATAQ Instruments Hardware Manager" is the window title and "[CLASS:TComboBox; INSTANCE:1]" is the control ID. Am I missing something?

Share this post


Link to post
Share on other sites
youknowwho4eva

Your right. I haven't used control functions in a while. can you put up a screenshot of the window info?


Giggity

Share this post


Link to post
Share on other sites
Keith

Here's what I get for the confirmation pop-up. Note it does not have a title.

Thanks for your help.

post-44644-1231279080_thumb.jpg

Share this post


Link to post
Share on other sites
FireFox

@Keith

For control functions you should make screenshot of control tab :)

ControlCommand("title",'',"[CLASS:TComboBox; INSTANCE:1]", ....)

Cheers, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Keith

Here's the control tab.

Crap -- I can't attach another jpg! Says I don't have enough space.

Edited by Keith

Share this post


Link to post
Share on other sites
FireFox

@Keith

go to your profile > my controls and delete all your attachment files,

go to http://imageshack.us/ and upload your picturethen display link here for picture :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bo8ster

I don't see how I have it backwards. "DATAQ Instruments Hardware Manager" is the window title and "[CLASS:TComboBox; INSTANCE:1]" is the control ID. Am I missing something?

A quicker way is just to copy and paste in the contents of the info window.

Like this - I use the Summary Tab

>>>> Window <<<<

Title: AutoIt Forums -> Replying in ControlCommand blocks - Mozilla Firefox

Class: MozillaUIWindowClass

Position: 1916, -4

Size: 1688, 1058

Style: 0x15CF0000

ExStyle: 0x00000100

Handle: 0x00010698

>>>> Control <<<<

Class: MozillaWindowClass

Instance: 5

ClassnameNN: MozillaWindowClass5

Advanced (Class): [CLASS:MozillaWindowClass; INSTANCE:5]

ID:

Text:

Position: 0, 114

Size: 1663, 888

ControlClick Coords: 666, 46

Style: 0x56000000

ExStyle: 0x00000000

Handle: 0x001006D0


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
Keith

Ah -- much easier! Here it is:

>>>> Window <<<<

Title:

Class: #32770

Position: 515, 471

Size: 257, 107

Style: 0x94C801C5

ExStyle: 0x00010101

Handle: 0x009D03CE

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Advanced (Class): [CLASS:Button; INSTANCE:1]

ID: 6

Text: &Yes

Position: 47, 41

Size: 75, 23

ControlClick Coords: 74, 10

Style: 0x50030001

ExStyle: 0x00000004

Handle: 0x004303F2

>>>> Mouse <<<<

Position: 639, 551

Cursor ID: 2

Color: 0x000000

>>>> StatusBar <<<<

>>>> Visible Text <<<<

&Yes

&No

Do you want to Stop Recording to SD Memory?

>>>> Hidden Text <<<<

Share this post


Link to post
Share on other sites
bo8ster

Control IDs change, they are dynamic.

Do something like this ControlCommand("", "", "CLASS:Button; INSTANCE:1; TEXT:&YES]" ....) or ControlCommand("", "", "Button1" ....).

As there is not a windows title it might be hard to get the right window. Try to get a handle to the window first then you can do

WinWaitActive("Window Name"); Wait for the aplication become active

Const $winHandle = WinGetHandle("Window Name", "");

$handle = ControlGetHandle($winHandle, "", "[CLASS:Button; INSTANCE:1; TEXT:&YES]")

ControlCommand($handle, "", "" ...)

Hope that is not too complicated.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
Keith

But I'm not even getting that far. The first ControlCommand that causes the confirmation popup is blocking. My script doesn't get back control until I manually click on one of the confirmation buttons. There's something funny about this popup because it seems to be blocking autoit. What would cause this behavior?

Share this post


Link to post
Share on other sites
bo8ster

what command are you trying to send and what control do u want to send it to?


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
Keith

OK, I'm obviously not communicating well here, so let me try again. Here's my code snippet:

-----

; Stop recording

ConsoleWrite("select")

ControlCommand("DATAQ Instruments Hardware Manager", "", "[CLASS:TComboBox; INSTANCE:1]", "SelectString", "Stop Recording to SD Memory")

ConsoleWrite("done")

WinWaitActive("", "Do you want to Stop Recording to SD Memory?", 2)

Send("y")

-----

As you can see, I'm sending a command to the main window's combobox control and selecting the stop recording. This part of the script works because a confirmation box from the app pops up. But my script does not get back control (I never see "done"). The script is still blocked in ControlCommand! So nothing I do later in the script will be able to acknowledge the confirmation popup and make it go away, rendering my little automation script useless.

Share this post


Link to post
Share on other sites
LarryDalooza

ControlCommand uses SendMessage API... perhaps SendMessageTimeout isn't being used... I don't know ... I do not think that TComboBox is a standard control... thus ControlCommand is an improper command to use. You should try using ControlSend() into the control to navigate it. I think...

meanwhile, I would drop a line in the Developer area or TRAC (bug area) about the possibility that ControlCommand uses SendMessage and not SendMessageTimeout.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

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  

×