Jump to content

Make my script repeat


Recommended Posts

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
Link to comment
Share on other sites

Welcome to Autoit and the forum!

What is "RoAG Romanian Army Group"?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

  • Jos locked this topic
  • Moderators

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.

 

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Jos unlocked this topic

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