Jump to content
Sign in to follow this  
Nicocohayek

DESPERATE HELP in Coding keystroke and loop for a particular program

Recommended Posts

Nicocohayek

hey everyone. i joined this forum hoping for some help. i need to run a program in AutoIt to do the following:

Launch notepad;

Press "enter" for infinite times with 1 second pause between each one;

I tried using batch coding but i'm new into coding so C++ and VBS are not within my domain. Please help me out!! Thanks!!

Share this post


Link to post
Share on other sites
Jos

hey everyone. i joined this forum hoping for some help. i need to run a program in AutoIt to do the following:

Launch notepad;

Press "enter" for infinite times with 1 second pause between each one;

I tried using batch coding but i'm new into coding so C++ and VBS are not within my domain. Please help me out!! Thanks!!

Not a great way to start here.

What have you done thus far and what isn't working?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Nicocohayek

Not a great way to start here.

What have you done thus far and what isn't working?

Jos

I have tried batch processing and discovered a couple of stings but couldn't create the correct syntax. I even tried RemoteKeys 8.7.3 and wrote this code which only opened the program and pressed enter once. here's the code:

{/APP.OPEN Notepad}

{KEY.ENTER}

{/BTCH.DELAY.1}

{KEY.ENTER}

{/BTCH.LOOP.START.VAL.9}

{KEY.ENTER}

I deleted the other batch strings i tried since they all failed, and got back to square one:

START /MAX NOTEPAD

Share this post


Link to post
Share on other sites
Jos

I have tried batch processing and discovered a couple of stings but couldn't create the correct syntax. I even tried RemoteKeys 8.7.3 and wrote this code which only opened the program and pressed enter once. here's the code:

{/APP.OPEN Notepad}

{KEY.ENTER}

{/BTCH.DELAY.1}

{KEY.ENTER}

{/BTCH.LOOP.START.VAL.9}

{KEY.ENTER}

I deleted the other batch strings i tried since they all failed, and got back to square one:

START /MAX NOTEPAD

What have you tried to create with AutoIt3 ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Nicocohayek

What have you tried to create with AutoIt3 ?

i tried to make use of the examples that come with the program but nothing came up ... i found it very difficult to start from scratch so i decided to call for help

Share this post


Link to post
Share on other sites
Jos

i tried to make use of the examples that come with the program but nothing came up ... i found it very difficult to start from scratch so i decided to call for help

You are being very vague here and this doesn't help much.

Which example did you try that didn't work launching Notepad and sending Enters?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Nicocohayek

You are being very vague here and this doesn't help much.

Which example did you try that didn't work launching Notepad and sending Enters?

Here's what i wrote:

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("{ENTER}")

Loop()

I didn't know how to put the timer to press enter ever 1 second, and practically that's how far i've gotten so far

Share this post


Link to post
Share on other sites
Nicocohayek

Look at While..Wend and Sleep() in the Helpfile for a resolution to that question.

Thanks alot!! The Sleep function solves my delay needs in theory. i am still, though, lost in knowing how to write the While..Wend function.

Share this post


Link to post
Share on other sites
Nicocohayek

That's what i managed to write so far but it keeps giving me syntax error:

Run("Notepad")

WinWaitActive("Unitled"

While

Send("{ENTER}")

Sleep(1000)

Send("{ENTER}")

WEnd

Share this post


Link to post
Share on other sites
Jos

That's what i managed to write so far but it keeps giving me syntax error:

Run("Notepad")

WinWaitActive("Unitled"

While

Send("{ENTER}")

Sleep(1000)

Send("{ENTER}")

WEnd

Spelling and syntax is important.

Make that:

Run("Notepad")
WinWaitActive("Untitled")
While 1
   Send("{ENTER}")
   Sleep(1000)
WEnd

So now you are off to test if it also works on your game...right?

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Fainth

Why is everyone so tense about scripts beeing used for games?

Share this post


Link to post
Share on other sites
Nicocohayek

Spelling and syntax is important.

Make that:

Run("Notepad")
WinWaitActive("Untitled")
While 1
   Send("{ENTER}")
   Sleep(1000)
WEnd

So now you are off to test if it also works on your game...right?

Most of my problems are syntax-related. Now i'm searching the help files to know how to change destinations to my own program

Share this post


Link to post
Share on other sites
Nicocohayek

Why is everyone so tense about scripts beeing used for games?

they give you an edge on condition you stay within legal and ethical values of the game...at least that's what i believe

Share this post


Link to post
Share on other sites
Jos

Why is everyone so tense about scripts beeing used for games?

Have fun reading and don't bring up this subject again.

Back on topic.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Nicocohayek

Spelling and syntax is important.

Make that:

Run("Notepad")
WinWaitActive("Untitled")
While 1
   Send("{ENTER}")
   Sleep(1000)
WEnd

So now you are off to test if it also works on your game...right?

i checked the help files and there's no way i could find out how to open X.exe if it's on my desktop and my directory is C:\Users\''\Desktop\ChemicalX.exe

Share this post


Link to post
Share on other sites
Fainth

??? how to open x.exe?

you can run about anything with run('wherever\whatever.exe')

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  

×