Jump to content

Press Enter


Recommended Posts

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?

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

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

Link to comment
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".

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

Link to comment
Share on other sites

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

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

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

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...