underfenix Posted May 31, 2010 Posted May 31, 2010 (edited) Hi m8´s, im trying making this litle program but im with some problems. I want a script that restart a program every 5 seconds. Im waiting for some Help, thanks for all. Ric Edited May 31, 2010 by underfenix
Yashied Posted May 31, 2010 Posted May 31, 2010 Impossibly. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
underfenix Posted May 31, 2010 Author Posted May 31, 2010 Why is not possible? Is only a Batch file m8 thanks by the answer
underfenix Posted May 31, 2010 Author Posted May 31, 2010 When i run the script, will open the batch file, then close the batch file after 5 seconds, and repeat this process forever
SKlocke Posted May 31, 2010 Posted May 31, 2010 Have a look at the documentation of While <expression> statements ... WEnd and Sleep. And if you want more detailed help, people might want to know what you want to do this for. 5 seconds sound like a short time for many tasks, so just in case - asking about help to trick in a game is at least frowned upon, more likely forbidden on this site, depending on the game.
Developers Jos Posted May 31, 2010 Developers Posted May 31, 2010 help me please Please be patient and less post happy, in stead spent the time to do some research yourself. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
underfenix Posted June 1, 2010 Author Posted June 1, 2010 (edited) Hi, i whant this program to restart a batch file, that control a printer, some times the batch file dont find the printer thats the problem. i made this code but im having problems... while Run("C:\ASS_L\program.EXE") ProcessClose("program.EXE") Sleep(5000) Run("C:\ASS_L\program.EXE") ContinueLoop WEnd Edited June 1, 2010 by underfenix
Tvern Posted June 1, 2010 Posted June 1, 2010 I see a few problems with your script: while Run("C:\ASS_L\program.EXE") ProcessClose("program.EXE") ;this closes the process as soon as it starts Sleep(5000) Run("C:\ASS_L\program.EXE") ;you're not closing the program you're starting here ContinueLoop ;Continueloop basically starts the loop from the top again. Your loop is going to do this anyways as it has reached the end. WEnd Try this: while $PID = Run("C:\ASS_L\program.EXE") Sleep(5000) ProcessClose($PID) ;using the $PID ensures that you close the program you just opened and not one that might have the same name. WEnd For future reference "i made this code but im having problems..." will ususally not be enough information to help you. You'll need to explain what it does and what you expect it to do aswell as any error messages if any.
UEZ Posted June 1, 2010 Posted June 1, 2010 You are talking about batch files but you are calling .exe files. While 1 $run = Run(@ComSpec & " /c " & "C:\Test.cmd") Sleep(5000) If ProcessExists($run) Then ProcessClose($run) WEnd BR, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
JohnOne Posted June 1, 2010 Posted June 1, 2010 (edited) Provided you app outputs an exitcode it could be as simple as this. Do $exitcode = RunWait("C:\ASS_L\program.EXE") Sleep(5000) Until $exitcode = ;sucsessful exit code of your exe here Edited June 1, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
underfenix Posted June 1, 2010 Author Posted June 1, 2010 My ideia is.... If the application is running, then whait 5 seconds then close application, and open application again, Or if appliacation is not runing, open apllication, whait 5 seconds, close application and open again and repeat this processe allways restarting the application every 5 seconds closing and open. Im working on it i will place some code, to everyone see if is correct Thanks for all help m8´s
underfenix Posted June 1, 2010 Author Posted June 1, 2010 (edited) Well m8´s with the help of many good people the problem is solved. Anyone know why when i make the window hide it allways flash when restart the program??? Here is the code: While 1 $run = run ("C:\Application.exe") WinWait("Advanced IP Scanner v1.5") WinSetState("Advanced IP Scanner v1.5","",@SW_HIDE) Sleep(9000) If ProcessExists($run) Then ProcessClose ($run) WEnd Thanks m8´s Edited June 1, 2010 by underfenix
Tvern Posted June 1, 2010 Posted June 1, 2010 Because you run the application, resulting in a visible window, which you then hide. Specify @SW_HIDE as a parameter for the initial run(), so the window is never made visible.
underfenix Posted June 1, 2010 Author Posted June 1, 2010 I Solved the problem m8 see if this is correct... While 1 $run = run (@WindowsDir & "C:\Programas\Advanced IP Scanner\Advanced IP Scanner.exe", "", @SW_HIDE) Sleep(9000) If ProcessExists($run) Then ProcessClose ($run) WEnd Cumps
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now