Sign in to follow this  
Followers 0
JSThePatriot

Newbie

31 posts in this topic

#1 ·  Posted (edited)

I have just downloaded AutoIt. I heard about it from my little brother. I am needing to write a basic script for a game I am beta testing for. I just need it to press enter every so many seconds (rather wait till it gets a response from the game if possible) waiting would probably be easier script for me to start with.

Thanks,

JS

Edit: Also is there a way that I can keep the game minimized while allowing it to run the script? Using the window title or something?

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Some advices for you:

1- Check the manual

2- Check the manual

3- Check the manual

Did I mention to check the manual?

A part of this.

You can just use the command Send() to emulate Enter. You can try to see if the game uses standard control with Autospy. In order to give command to a non active windows you have to use Control commands.

Edit: Corrected a plural

Edited by ezzetabi

Share this post


Link to post
Share on other sites

LOL I have checked the manual. It isnt that friendly atleast not to one starting off since there is not stater's section or something.

How would I go about using the Control command? I would appreciate help. You know if I wanted to read the manual I would. I am asking for help why cant you just offer some good simple tips and advice for a beginner I mean after all what is this forum for so you that know stuff can just tell newbs to read the manual??? I have see this all too much. If you go look at some other forums thats not what they do, they try to help in any way possible. I am not trying to harp on you so please dont take it that way. I was just wanting some help and didnt want to be told to read a manual I already have read alot of and am still in the dark for the most part.

Thanks for your guidence on the Control issue.

JS

Some advices for you:

1- Check the manual

2- Check the manual

3- Check the manual

Did I mention to check the manual?

A part of this.

You can just use the command Send() to emulate Enter. You can try to see if the game uses standard control with Autospy. In order to give command to a non active windows you have to use Control command.

<{POST_SNAPBACK}>


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

The reason that anyone would tell you to read the helpfile is because the authors specifically invested hours of time into creating a manual. This information is layed out to be the easiest to read and use possible. Have you thought about the fact that we are taking our time to answer your questions? We will be more than happy to help you if you have a start on a script and the script doesn't work, but to simply ask someone else to do your work for you is rude. Please start by looking at the manual. Try to make it at first. If it doesn't work, then post your code here and we will help you.


Who else would I be?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Actually was "Control commandS", my mistake.

If the program uses standard controls you can send Keys directly to them without busing actually the keyboard and the program will take the command even if minimized, hidden, out of focus...

E.g. Without controls, sending Enter every 5 sec to a window with title "Hello World"

While 1
   WinActivate('Hello World')
   Send({enter})
   Sleep(5000)
WEnd

Using ControlSend command to the window "Hello World" to the control "Button1"

While 1
   ControlSend('Hello World','','Button1',{enter})
   Sleep(5000)
WEnd

Btw... did I adviced you to check the manual? LOL

Edited by ezzetabi

Share this post


Link to post
Share on other sites

The reason that anyone would tell you to read the helpfile is because the authors specifically invested hours of time into creating a manual. This information is layed out to be the easiest to read and use possible. Have you thought about the fact that we are taking our time to answer your questions? We will be more than happy to help you if you have a start on a script and the script doesn't work, but to simply ask someone else to do your work for you is rude. Please start by looking at the manual. Try to make it at first. If it doesn't work, then post your code here and we will help you.

<{POST_SNAPBACK}>

The thing is I have checked the manual it confused me. I just was really wanting a clear place to start. I am sorry I made it seem as though I wanted someone to write out the script for me. I just needed some general pointers, and ezzetabi has given me what I do believe is all I need to get started. I appreciate your help.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Actually was "Control commandS", my mistake.

If the program uses standard controls you can send Keys directly to them without busing actually the keyboard and the program will take the command even if minimized, hidden, out of focus...

E.g. Without controls, sending Enter every 5 sec to a window with title "Hello World"

While 1
   WinActivate('Hello World')
   Send({enter})
   Sleep(5000)
WEnd

Using ControlSend command to the window "Hello World" to the control "Button1"

While 1
   ControlSend('Hello World','','Button1',{enter})
   Sleep(5000)
WEnd

Btw... did I adviced you to check the manual? LOL

<{POST_SNAPBACK}>

The second one... will that loop indefinitely? I dont understand that use of a loop... (if it is even a loop). :-P Thanks for giving me this starting place. I am sorry to have seemed to down this forum that wasnt my intention.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Okay I am getting an error I would appreciate any help available.

Line 6 (File "C:\Documents and Settings\The Vortex\My Documents\enter.au3"):

ControlSend('Rise Or Die','','Button1',{enter})

ControlSend('Rise Or Die','','Button1',^ERROR

Error: Unable to parse line.

Then an okay box.

Thanks again for any and all help,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Okay I am getting an error I would appreciate any help available.

Then an okay box.

Thanks again for any and all help,

JS

<{POST_SNAPBACK}>

{ENTER} must be inside a string...

ControlSend('Rise Or Die','','Button1',"{enter}")

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

Share this post


Link to post
Share on other sites

{ENTER} must be inside a string...

ControlSend('Rise Or Die','','Button1',"{enter}")

<{POST_SNAPBACK}>

Thanks... I had just figured that out :ph34r:.

Now I am having a problem I need to set a key to end the process... is there any way I could set a combination of keys to make the script stop?

Thanks...

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Below is the code I am trying to use. I am trying both of the methods suggested to me. I cant seem to get the one that isnt behind the comments to work right now. I got the other one to work but it always brings the window up which I want it to stay minimized which is why I am trying to use the second one.

If any one could help it would be greatly appreciated.

Thanks again!,

JS

$g_szVersion = "My Script 1.1"
If WinExists($g_szVersion) Then Exit; It's already running
AutoItWinSetTitle($g_szVersion)

;While 1
;   WinActivate('Rise Or Die')
;   Send('{enter}')
;   Sleep(20000)
;WEnd

While 1
   ControlSend('Rise Or Die','','Button1','{enter}')
   Sleep(12000)
WEnd

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Thanks... I had just figured that out :ph34r:.

Now I am having a problem I need to set a key to end the process... is there any way I could set a combination of keys to make the script stop?

Thanks...

JS

<{POST_SNAPBACK}>

check for HotKeySet()

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

Share this post


Link to post
Share on other sites

check for HotKeySet()

<{POST_SNAPBACK}>

Okay thanks... I figured that out. Now I just need my code to work while the window is minimized. :-/

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Okay thanks... I figured that out. Now I just need my code to work while the window is minimized. :-/

JS

<{POST_SNAPBACK}>

do you mean that you have 2 windows with the same title and also a control called Button1 ?

ps. why do ControlSend to enter a button ? shouldn't that be controlclick() ?


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

Share this post


Link to post
Share on other sites

do you mean that you have 2 windows with the same title and also a control called Button1 ?

ps.  why do ControlSend to enter a button ?  shouldn't that be controlclick() ?

<{POST_SNAPBACK}>

I only have one window with the name of Rise Or Die.. the button1 deal I dont understand I am just using what was posted to me above. (or atleast trying to). I need autoit to press enter on a minimized window... I can make it pull up the window and send the 'enter' key but I need it to stay minimized.

Thanks

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

I only have one window with the name of Rise Or Die.. the button1 deal I dont understand I am just using what was posted to me above. (or atleast trying to). I need autoit to press enter on a minimized window... I can make it pull up the window and send the 'enter' key but I need it to stay minimized.

Thanks

JS

<{POST_SNAPBACK}>

Try the ControlClick command if that is what the Enter does...

ControlClick('Rise Or Die','','Button1')

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

Share this post


Link to post
Share on other sites

You need to look at the au3 spy in the start menu. It will tell you what control needs to be clicked.


Who else would I be?

Share this post


Link to post
Share on other sites

You need to look at the au3 spy in the start menu. It will tell you what control needs to be clicked.

<{POST_SNAPBACK}>

The thing is it doesnt need to be clicked. I just need to press enter. This is a text based game. (right now) And I just need it to keep pressing enter because when you press enter it resends the last thing typed in...

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

WHOO HOO! I figured it out finally after messing with it off and on all day. I just needed to use the spy to figure out where the enter key needed to be sent to! YAY! Thank you everyone for the much needed help. I will be writing more scripts to automate daily tasks soon.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

See, didn't I tell you we could help you?


Who else would I be?

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