Jump to content

Beginner - Can AutoIt do what i want?


pa18
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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