anixon Posted December 6, 2006 Share Posted December 6, 2006 (edited) Can I have some help with this. When starting the script with AutoIT Window Info running in the Window detail section the Tile is Program Manager Class Progman so I am not sure how to set the WinWaitActive statement. How do I ensure that the variable associated with the 'Send' is sent to the right application? This is an example of what the code might look like: run("c:\myscripts\myscript.exe') ; Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") ; ; Switch to myscript.exe ; WinWaitActive(????) Send("{NUMPAD9 2}") Thanks in advance Ant Edited December 6, 2006 by anixon Link to comment Share on other sites More sharing options...
CoePSX Posted December 6, 2006 Share Posted December 6, 2006 Try using ControlSend to send the keystrokes directly to the notepad window. [quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"]╔══════════════════════════════╗║░░██░░░░░░░░██░░███░░░████░░░█║║░█░░█░░██░░█░░█░█░░█░█░░░░█░█░║║░█░░░░█░░█░████░███░░░██░░░█░░║║░█░░█░█░░█░█░░░░█░░░░░░░█░█░█░║║░░██░░░██░░░██░░█░░░░███░█░░░█║╚══════════════════════════════╝[/font] Link to comment Share on other sites More sharing options...
anixon Posted December 6, 2006 Author Share Posted December 6, 2006 Try using ControlSend to send the keystrokes directly to the notepad window.I am not sure of the language so this might not be a correct description but Connection Description is a Child? screen that you get which appears in front of the Hyper Terminal Screen. It offers what connection you want to make or cancel. In my case I simply want to cancel and move to the Terminal ScreenI am trying to activate the Cancel button but this does not seem to work.Run('c:\program files\windows nt\hypertrm.exe')WinWaitActive("Connection Description")Controlsend("Connection Description", "", "Cancel", "{Enter}")Help is always appreciated Ant Link to comment Share on other sites More sharing options...
CoePSX Posted December 6, 2006 Share Posted December 6, 2006 Open the Autoit Window Info, and put your mouse over the control you want to send the keystrokes to. You'll se something like this: >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: X: 226 Y: 250 W: 1037 H: 701 Control ID: ClassNameNN: OperaWindowClass18 Text: Style: 0x56010000 ExStyle: 0x00000000 In this case you would use the function like this: Controlsend("Connection Description", "", "OperaWindowClass18", "{Enter}") If there's a control Id in Control ID: section, you can also use it, without the quotes, like: Controlsend("Connection Description", "", 3, "{Enter}") [quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"]╔══════════════════════════════╗║░░██░░░░░░░░██░░███░░░████░░░█║║░█░░█░░██░░█░░█░█░░█░█░░░░█░█░║║░█░░░░█░░█░████░███░░░██░░░█░░║║░█░░█░█░░█░█░░░░█░░░░░░░█░█░█░║║░░██░░░██░░░██░░█░░░░███░█░░░█║╚══════════════════════════════╝[/font] Link to comment Share on other sites More sharing options...
anixon Posted December 6, 2006 Author Share Posted December 6, 2006 Open the Autoit Window Info, and put your mouse over the control you want to send the keystrokes to.You'll se something like this:>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Size: X: 226 Y: 250 W: 1037 H: 701Control ID: ClassNameNN: OperaWindowClass18Text: Style: 0x56010000ExStyle: 0x00000000In this case you would use the function like this:Controlsend("Connection Description", "", "OperaWindowClass18", "{Enter}")If there's a control Id in Control ID: section, you can also use it, without the quotes, like:Controlsend("Connection Description", "", 3, "{Enter}")This is the Autoit Window>>>>>>>>>>>> Window Details <<<<<<<<<<<<<Title: Connection DescriptionClass: #32770Size: X: 440 Y: 371 W: 332 H: 299>>>>>>>>>>> Mouse Details <<<<<<<<<<<Screen: X: 718 Y: 638Cursor ID: 2>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<RGB: Hex: 0xF5F5F1 Dec: 16119281>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Size: X: 240 Y: 229 W: 75 H: 23Control ID: 2ClassNameNN: Button2Text: CancelStyle: 0x50010000ExStyle: 0x00000004>>>>>>>>>>> Status Bar Text <<<<<<<<<<<>>>>>>>>>>> Visible Window Text <<<<<<<<<<<New ConnectionEnter a name and choose an icon for the connection:&Name:&Icon:OKCancel>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<And neither of these workControlsend("Connection Description", "", "Button2", "{Enter}")Controlsend("Connection Description", "", 2, "{Enter}")Cheers Ant Link to comment Share on other sites More sharing options...
CoePSX Posted December 6, 2006 Share Posted December 6, 2006 Oh, I'm sorry, I got it now. ControlSend is supposed to send keystrokes to a control, and I'm not sure it works with buttons. You better ControlClick it. Like this: ControlClick ("Connection Description", "", "Button2") [quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"]╔══════════════════════════════╗║░░██░░░░░░░░██░░███░░░████░░░█║║░█░░█░░██░░█░░█░█░░█░█░░░░█░█░║║░█░░░░█░░█░████░███░░░██░░░█░░║║░█░░█░█░░█░█░░░░█░░░░░░░█░█░█░║║░░██░░░██░░░██░░█░░░░███░█░░░█║╚══════════════════════════════╝[/font] Link to comment Share on other sites More sharing options...
anixon Posted December 6, 2006 Author Share Posted December 6, 2006 Oh, I'm sorry, I got it now.ControlSend is supposed to send keystrokes to a control, and I'm not sure it works with buttons.You better ControlClick it. Like this:ControlClick ("Connection Description", "", "Button2")Thanks for that that solution works fine I very much appreciate your help 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