Jump to content
ArK112

Make my script repeat

Recommended Posts

ArK112

Hey i want to make my script repeat every 30 sec, i'm really new to scripting and i didn't read the Help files.

I'm using my script for auto saving (right now i need to manualy do it) a server i host.

;---------start this script------------------
If ProcessExists("Aplication.exe") Then

WinActivate("RoAG Romanian Army Group")

Send("save{ENTER}")
EndIf
;----------end this script--------------------

 

Edited by ArK112

Share this post


Link to post
Share on other sites
water

Welcome to Autoit and the forum!

What is "RoAG Romanian Army Group"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

ArK112,

seems you missed to read the forum rules on your way in.
Please do so now. You will see that any kind of game automation is not allowed on this forum. THat's way you will not get any help on this subject.
 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ArK112

ArK112,

seems you missed to read the forum rules on your way in.
Please do so now. You will see that any kind of game automation is not allowed on this forum. THat's way you will not get any help on this subject.

But it not a game automation it's a server automation, it's this still not ok? That's just the name of the server, there's nothing to do about with any type of game!

Edited by ArK112

Share this post


Link to post
Share on other sites
Scripthen

Minecraft server? ;)

However, you'll need to find the process name.
If started by CMD it'll be something like:
     " cmd.exe *parameters*"

if the {enter} doesn't work, try {numpadenter} I had trouble with {enter} so I tried {numpadenter} and it worked just fine.

 

As for the 30 seconds, add the code in to the While 1 loop and use Sleep. Examples below.

Sleep(30000)

Send("save-all")
Send("{NUMPADENTER}")
Sleep(2000)

Edited by Scripthen
Misread.

Share this post


Link to post
Share on other sites
water

But why would a server display a window titled "RoAG Romanian Army Group"?
What application do you try to automate?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ViciousXUSMC

You should go read the help files, asking for help without taking the time to try and help yourself is not the best way.

As far as repeating a simple script you're going to need a loop.

While 1 ;Start Loop
If ProcessExists("Aplication.exe") Then
WinActivate("RoAG Romanian Army Group")
Send("save{ENTER}")
Else ;If Process does not exist
ExitLoop ;Exit the Loop 
EndIf
Sleep(30000) ;sleep 30 seconds
WEnd ;Close Loop

Also the Function AdlibRegister() would work well for you.

https://www.autoitscript.com/autoit3/docs/functions/AdlibRegister.htm

I personally do not get involved with the politics on the board, but just be aware there are strictly enforced rules about "game automation" but somebody did get a "OK" from the mods the other day for the same kind of request about automating a server.

 

Regards,

Edited by ViciousXUSMC

Share this post


Link to post
Share on other sites
ArK112

It's a CMD window, the RoAG Romanian Army Group is the name of the server. The script is working, i did a exe out of it, when i'm runing the exe it's writing in the CMD window "save" and the it press "Enter" (Server was saved succesfully).

I just want to make this auto so i don't need to always run the exe manualy.

Share this post


Link to post
Share on other sites
Scripthen

You should go read the help files, asking for help without taking the time to try and help yourself is not the best way.

As far as repeating a simple script you're going to need a loop.

<code>
While 1 ;Start Loop
If ProcessExists("Aplication.exe") Then
WinActivate("RoAG Romanian Army Group")
Send("save{ENTER}")
Else ;If Process does not exist
ExitLoop ;Exit the Loop 
EndIf
Sleep(30000) ;sleep 30 seconds
WEnd ;Close Loop
</code>

 

Also the Function AdlibRegister() would work well for you.

https://www.autoitscript.com/autoit3/docs/functions/AdlibRegister.htm

I personally do not get involved with the politics on the board, but just be aware there are strictly enforced rules about "game automation"

 

Regards,

​Quick question. Will it violate the Game Automation Rule is it's a game server console? Technically, it's not a game, just code and a cmd window.

Share this post


Link to post
Share on other sites
ViciousXUSMC

Thats not for me to say, this is not my forum :)

I do moderate a forum however (Widescreen Gaming Forum) so I know as a member I would need to respect however the mods choose to run their own forum here.

Share this post


Link to post
Share on other sites
water

I have already reported this thread. So a Mod will chime in and tell us what he thinks about this subject.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
ArK112

ViciousXUSMC thx for the code looks like it's working (sorry for not reading the help files)

Is there a any way that when the script is running>writing in the CMD "save">hitting enter to do this in the background (i don't think this is possible but still)?

Right now at every 30 sec the window with the CMD is poping out and i need to minimize it every time.

Edited by ArK112

Share this post


Link to post
Share on other sites
ViciousXUSMC

This is where you should start researching "autoit minimize cmd window" there are a few ways to do it.

Since you're sending keys the window will have to come up, and then be minimized after.  So you should search for "autoit minimize window" and I am sure you will ultimatly come across: https://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm

 

 

Share this post


Link to post
Share on other sites
Scripthen

Yes WinSetState or you can also use Send() command with Keyboard Short-cuts.

Share this post


Link to post
Share on other sites
ArK112

ViciousXUSMC did it. The action is still going to interrupt me from other actions but it's a little better then before.

Share this post


Link to post
Share on other sites
Scripthen

ViciousXUSMC did it. The action is still going to interrupt me from other actions but it's a little better then before.

​Yes, because Autoit is just automation so it's how you would do it, just sped up. Really the only way to properly communicate with a program is to rewrite or add to the main program in it's native language.

Share this post


Link to post
Share on other sites
ViciousXUSMC

Its also why its best to run a server, on a server :)  a machine you do not use as your personal computer.

If you can find a cmd to do your task you can use @ComSpec and have a hidden CMD window, but it sounds like your interacting with a console not opening a fresh blank CMD window.

Its up to you to find how you can interact with the server and then have Autoit help you with it. 

Share this post


Link to post
Share on other sites
Melba23

ArK112,

Welcome to the AutoIt forums.

This is another of those threads that make Mods go grey early - although for both Jos and myself it is already too late! Although technical "game server interaction" it is, just like the other thread referred to above a simple automation of a CMD window - so I am leaving it open, but please read the Forum rules to make sure you understand where the boundaries of this forum are quite clearly set.

M23

P.S. I wish new members would read the Forum rules before posting - asking the same question without the overt game reference would have saved a lot of time and effort for several people.

 

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

×