Sign in to follow this  
Followers 0
ToyBoi

Press Enter

12 posts in this topic

This is going to sound stupid, but i'm having a problem having autoit to send the enter key.

Send("{ENTER}")
    
Exit

I run this, but it keeps pressing enter, i want it to only do it once. did i do something wrong?

Share this post


Link to post
Share on other sites



Can you show us the full code?

-AlmarM-


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

hi that was the full code

Share this post


Link to post
Share on other sites

Posted Image

this is my code, i just added the notepad line to prove that it in fact does press enter more than once,

when i comment out the sleep function, it opened 2x notepads

when i uncomment it, it opened 3x notepads.

if i comment out both, i get the busy cursor and hour glass cursor conseqetively until i manually click somewhere

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

if you want to see how many times enter is sent then uses something like this

CODE

run("notepad.exe")

WinWaitActive("Untitled -")

send("{enter}")

Edited by 7h331337

Share this post


Link to post
Share on other sites

when i use your code, it only presses enter once, but when i use mine, it opens more than one notepad? do you think it could a problem with my computer? or should i save it as an exe first? right now it's au3

Share this post


Link to post
Share on other sites

Perhaps you aren't releasing the F5 button fast enough so the script can run multiple times before you release the button?? (pure guess, I don't know if that's even possible)

Try running your script by pressing "Tools" and then "Go".

Share this post


Link to post
Share on other sites

well actually i just activate it by opening the actual au3 file

the reason why im doing this is when my macro from excel imports txt files, it asks for a confirmation and after i asked many vba experts, i concluded that there is no way to get around that.

so i want vba to call autoit to simulate an enter key, but if it keeps pressing enter non stop then it will mess up my macro.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

AutoIt presses only once, if you write Send"{ENTER}").

well actually i just activate it by opening the actual au3 file

Well, then the Script-Icon in Explorer is still activated and ... with "enter" it is started again... and again until the Explorer looses focus muttley

the reason why im doing this is when my macro from excel imports txt files, it asks for a confirmation and after i asked many vba experts, i concluded that there is no way to get around that.

so i want vba to call autoit to simulate an enter key, but if it keeps pressing enter non stop then it will mess up my macro.

It works, but you have to make a WinWaitactive and possibly you can use ControlClick instead of sending ENter. Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

AutoIt presses only once, if you write Send"{ENTER}").

Well, then the Script-Icon in Explorer is still activated and ... with "enter" it is started again... and again until the Explorer looses focus :)

It works, but you have to make a WinWaitactive and possibly you can use ControlClick instead of sending ENter.

omg you are right!! i feel so stupid, of course it's going to do that forever, well i said it was a stupid question muttley thanks for the help.

Share this post


Link to post
Share on other sites

quick last question, whats the vba code for me to call an autoit file, say if it's called "click.au3" and it is going to be in the same folder as my macro

i have a variable called importpath which is

importpath = ActiveWorkbook.path

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