SilverRing2040 Posted June 11, 2008 Share Posted June 11, 2008 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 More sharing options...
TurionAltec Posted June 11, 2008 Share Posted June 11, 2008 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 More sharing options...
k3v Posted June 11, 2008 Share Posted June 11, 2008 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 More sharing options...
SilverRing2040 Posted June 12, 2008 Author Share Posted June 12, 2008 (edited) Thanks for replyif you know the handle is 0x000205D4 then try $controlID= 0x000205D4$command = ControlSend ($title,$windowtext,$controlID,"{ENTER}")I've tried but it did not workControlClick("Title","","ControlText")I couldn't do that.With AutoIt Window Info, there is nothing captured except the handle string Edited June 12, 2008 by SilverRing2040 Link to comment Share on other sites More sharing options...
newbiescripter Posted June 12, 2008 Share Posted June 12, 2008 (edited) 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 Edited June 12, 2008 by newbiescripter Link to comment Share on other sites More sharing options...
SilverRing2040 Posted June 13, 2008 Author Share Posted June 13, 2008 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. expandcollapse popup>>>> 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 More sharing options...
AlexB Posted June 15, 2008 Share Posted June 15, 2008 Thanks for the reply I really got no clue so far. Here is the summary. expandcollapse popup>>>> 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 More sharing options...
SilverRing2040 Posted June 15, 2008 Author Share Posted June 15, 2008 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 More sharing options...
newbiescripter Posted June 15, 2008 Share Posted June 15, 2008 By the way, Is there a function that I can grab the control handle automatically?Yes use the function ControlGetHandleRegards Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 16, 2008 Share Posted June 16, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now