Jump to content

Getting ControlID if AutoIt Window Info does not work


Recommended Posts

Hi,

I'm totally new to autoit. Just installed yesterday.

I need to use controlsend for a simple process, sending Enter key every few seconds to an inactive application.

But the AutoIt Window Info did not show anything under the control tab, only the control handle

I tried leave it blank but does not work.

I also tried to use the handle but does not work too.

$title = "
$windowtext = ""
$controlID = "[handle: 0x000205D4]"
$command = ControlSend ($title,$windowtext,$controlID,"{ENTER}")

$command returns 0

Syntax error?

or Is there any other way to get controlID?

Link to comment
Share on other sites

Hi,

I'm totally new to autoit. Just installed yesterday.

I need to use controlsend for a simple process, sending Enter key every few seconds to an inactive application.

But the AutoIt Window Info did not show anything under the control tab, only the control handle

I tried leave it blank but does not work.

I also tried to use the handle but does not work too.

$title = "
$windowtext = ""
$controlID = "[handle: 0x000205D4]"
$command = ControlSend ($title,$windowtext,$controlID,"{ENTER}")

$command returns 0

Syntax error?

or Is there any other way to get controlID?

if you know the handle is 0x000205D4 then try

$controlID= 0x000205D4

$command = ControlSend ($title,$windowtext,$controlID,"{ENTER}")

Note the handle may change when it's run again.

As indicated in the controls help, I've found sometimes non-standard controls resist using stuff like controlsend and I have to brute force it with

Winactivate()

send()

Link to comment
Share on other sites

This has worked for me in the past...

If you use ControlClick instead of ControlSend, you can use the text on the control. In my case, the control was a button, but maybe it'll work on other controls too.

ControlClick("Title","","ControlText")

With this, you shouldn't even have to activate the window

Link to comment
Share on other sites

Thanks for reply

if you know the handle is 0x000205D4 then try

$controlID= 0x000205D4

$command = ControlSend ($title,$windowtext,$controlID,"{ENTER}")

I've tried but it did not work

ControlClick("Title","","ControlText")

I couldn't do that.

With AutoIt Window Info, there is nothing captured except the handle string

Edited by SilverRing2040
Link to comment
Share on other sites

Did you make it work?

if not then try post a screenshot of the information you got from the summary, there is might another way to do it.

Regards

Thanks for the reply

I really got no clue so far.

Here is the summary.

>>>> Window <<<<
Title:  eppec
Class:  AST Script Window
Position:   851, 357
Size:   806, 627
Style:  0x14CA0000
ExStyle:    0x00000100
Handle: 0x004005E6

>>>> Control <<<<
Class:  
Instance:   
ClassnameNN:    
Advanced (Class):   
ID: 
Text:   
Position:   
Size:   
ControlClick Coords:    
Style:  
ExStyle:    
Handle: 0x002205A6

>>>> Mouse <<<<
Position:   502, 352
Cursor ID:  0
Color:  0xFFFEFD

>>>> StatusBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<


>>>> StatusBar <<<<

>>>> Visible Text <<<<
start
7:40 AM
Notification Area
TF_FloatingLangBar_WndTitle
Quick Launch
Running Applications
Running Applications


>>>> Hidden Text <<<<
Link to comment
Share on other sites

Thanks for the reply

I really got no clue so far.

Here is the summary.

>>>> Window <<<<
Title:  eppec
Class:  AST Script Window
Position:   851, 357
Size:   806, 627
Style:  0x14CA0000
ExStyle:    0x00000100
Handle: 0x004005E6

>>>> Control <<<<
Class:  
Instance:   
ClassnameNN:    
Advanced (Class):   
ID: 
Text:   
Position:   
Size:   
ControlClick Coords:    
Style:  
ExStyle:    
Handle: 0x002205A6

>>>> Mouse <<<<
Position:   502, 352
Cursor ID:  0
Color:  0xFFFEFD

>>>> StatusBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<


>>>> StatusBar <<<<

>>>> Visible Text <<<<
start
7:40 AM
Notification Area
TF_FloatingLangBar_WndTitle
Quick Launch
Running Applications
Running Applications


>>>> Hidden Text <<<<
If a "Click" action is good enough, you can try to use the UDF function:

#Include <GuiButton.au3>
$hWnd = '0x002205A6'
 _GUICtrlButton_S($hWnd)
Link to comment
Share on other sites

If a "Click" action is good enough, you can try to use the UDF function:

#Include <GuiButton.au3>
$hWnd = '0x002205A6'
 _GUICtrlButton_S($hWnd)
Thanks! That would be enough

I only need it to keep the application 'active' in background.

By the way,

Is there a function that I can grab the control handle automatically?

Link to comment
Share on other sites

Yes use the function ControlGetHandle

Regards

Trying to specify window or control handles with literal strings generally means you are screwing up, and it should be avoided -- but it can be done:
#Include <GuiButton.au3>

$hWIN = HWnd("0x005D0290")

$hButton = HWnd("0x00FB017A")

While WinExists($hWIN)
    Sleep(2000)
    _GUICtrlButton_Click($hButton)
    MsgBox(64, "Click", "Clicked button: " & $hButton)
WEnd
MsgBox(64, "Exit", "Window gone... exiting")

The values for $hWIN and $hButton would have to be changed every time the target window was recreated. Note you can't use the control handle with ControlClick(), but have you go with _GuiCtrlButton_Click().

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...