Jump to content

Recommended Posts

Posted

Wow, this is all new to me but it looks like I need a steep learning curve.

What I would like to do is to run a script so that the script will select an already opened window from my desktop GUI and press enter.

Can AutoIt do this?

If so, then how can I do this?

Thank you for your time.

Posted

Wow, this is all new to me but it looks like I need a steep learning curve.

What I would like to do is to run a script so that the script will select an already opened window from my desktop GUI and press enter.

Can AutoIt do this?

If so, then how can I do this?

Thank you for your time.

Yes, AutoIt can do that. Read in help file about WinActivate() and Send() functions.
Posted (edited)

that was quick! Thanks both, let me have a look and see if I can handle it

$vString = "Untitled - "
While Not WinExists($vString)
;~  GUIGetMsg() ; <--- this is as fast as posible
    Sleep(1000) ; <--- this sleeps for a second
WEnd
WinActivate($vString)
Send("{Enter}")oÝ÷ Ú+!j·mçâ®Ëlr¸©¶z&^®0²)©è­$°z)zz-¶Zz»¢*.­û§Ø­jëh×6$vString = "Untitled - "
WinWait($vString)
WinActivate($vString)
Send("{Enter}")
I like my first example, if you wait a sec (1000 milli sec.), it uses a lot less CPU Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

So I have this:

WinActivate "title" [, "text"]

Send "keys" [, flag]

I've been trying to understand it but I get an error surprise surprise (Error Parsing Function Call).

So if I have a window call AutoItX Help. I substitute the above for the following:

WinActivate "AutoItX Help"

since the second part is optional, I can omit [, "text"]

Then:

Send "{ENTER}"

The second part is optional so just omit [, flag]

Also, after pressing send how do I minimize the window again?

I think it is this one:

WinSetState "title", "text", flag

Posted

Whoops argumentum, I just posted my dumb attempt at programming :). Yours look very professional so let me run yours and see. Thanks!

Posted

If you want to send enter for a window that is minimize you can use ControlSend() like in this example:

AutoItSetOption("WinTitleMatchMode",2)
HotKeySet("{SPACE}","SendEnter") ;Press SPACE to send an ENTER to Notepad
HotKeySet("{ESC}","Quit")   ;Press ESC to exit
Run("notepad",@SystemDir,@SW_MINIMIZE)
WinWait("Notepad")

While 1
    Sleep(25)
WEnd

Func SendEnter()
    ControlSend("Notepad","","Edit1","{ENTER}")
EndFunc

Func Quit()
    Exit
EndFunc
Posted

Wow you guys really know how to spoil someones fun don't you. OK, THIS TIME ONLY, I will copy and paste :) Thanks guys!

Posted

Thank you all, this seems like a nice community and AutoIt seems like a nice app to play around with.

Volly, when I get some time I will have a look closer. Thank you for directing me there!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...