Jump to content
Sign in to follow this  
pa18

Beginner - Can AutoIt do what i want?

Recommended Posts

pa18

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.

Share this post


Link to post
Share on other sites
Innovative

Search WinActivate and Send from the help files .

Share this post


Link to post
Share on other sites
Andreik

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.

When the words fail... music speaks

Share this post


Link to post
Share on other sites
pa18

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

Share this post


Link to post
Share on other sites
argumentum

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

Share this post


Link to post
Share on other sites
pa18

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

Share this post


Link to post
Share on other sites
pa18

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

Share this post


Link to post
Share on other sites
Andreik

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

When the words fail... music speaks

Share this post


Link to post
Share on other sites
pa18

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

Share this post


Link to post
Share on other sites
argumentum

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

lol, the way I got "the hang of it", was by copy, paste and modify what I've found in the forum and in the help file.

I should go to sleep now, take care.

Share this post


Link to post
Share on other sites
pa18

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!

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  

×