Sign in to follow this  
Followers 0
anixon

Send Function

7 posts in this topic

#1 ·  Posted (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 by anixon

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

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 Screen

I 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

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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}")

This is the Autoit Window

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Connection Description

Class: #32770

Size: X: 440 Y: 371 W: 332 H: 299

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 718 Y: 638

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xF5F5F1 Dec: 16119281

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 240 Y: 229 W: 75 H: 23

Control ID: 2

ClassNameNN: Button2

Text: Cancel

Style: 0x50010000

ExStyle: 0x00000004

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

New Connection

Enter a name and choose an icon for the connection:

&Name:

&Icon:

OK

Cancel

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

And neither of these work

Controlsend("Connection Description", "", "Button2", "{Enter}")

Controlsend("Connection Description", "", 2, "{Enter}")

Cheers ;) Ant

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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

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  
Followers 0