boy15 Posted November 29, 2019 Share Posted November 29, 2019 Hi, I want run script after 15 sec every time #RequireAdmin FileInstall("Anyname.bat",@TempDir&"\Anyname.bat",1) Run(@TempDir&"\Anyname.bat",1) Can any one help me thanks Link to comment Share on other sites More sharing options...
spudw2k Posted November 29, 2019 Share Posted November 29, 2019 Which is it, 30 seconds, or 15 seconds? O.o Anyways, For the delay / timing, look up the sleep and timerdiff functions in the help file. For the repeating, look up the do and while loop statements in the help file. Let us know what questions you have. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
boy15 Posted November 29, 2019 Author Share Posted November 29, 2019 6 hours ago, spudw2k said: Which is it, 30 seconds, or 15 seconds? O.o Anyways, Link to comment Share on other sites More sharing options...
Nine Posted November 29, 2019 Share Posted November 29, 2019 I would suggest AdlibRegister function. Look in help file... spudw2k 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
boy15 Posted November 29, 2019 Author Share Posted November 29, 2019 #RequireAdmin #NoTrayIcon While 1 While fileExists(@ScriptDir&"\anyname.bat") run(@ScriptDir&"\anyname.bat") WEnd Sleep(30000) WEnd Link to comment Share on other sites More sharing options...
boy15 Posted November 29, 2019 Author Share Posted November 29, 2019 2 hours ago, boy15 said: #RequireAdmin #NoTrayIcon While 1 While fileExists(@ScriptDir&"\anyname.bat") run(@ScriptDir&"\anyname.bat") WEnd Sleep(30000) WEnd there is wrong in script can any one correct script Link to comment Share on other sites More sharing options...
Developers Jos Posted November 29, 2019 Developers Share Posted November 29, 2019 50 minutes ago, boy15 said: there is wrong in script can any one correct script You seriously have no clue what is going wrong in this script? Check your process explorer and see how many anyname.bat files are running! Jos TheXman and SkysLastChance 2 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. Link to comment Share on other sites More sharing options...
boy15 Posted November 29, 2019 Author Share Posted November 29, 2019 I have one batch file If I run it manually it opens one time but when I use script, it open many windows for same batch Link to comment Share on other sites More sharing options...
Developers Jos Posted November 29, 2019 Developers Share Posted November 29, 2019 So read the script code and try to understand what it does and why it is running your script endless times! You should be able to figure this out yourself. Jos 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. Link to comment Share on other sites More sharing options...
Musashi Posted November 29, 2019 Share Posted November 29, 2019 2 hours ago, boy15 said: but when I use script, it open many windows for same batch 2 hours ago, Jos said: You should be able to figure this out yourself. @boy15 : Therefore, no ready-made solution is provided, but only a simulation to analyze the problem . ; Original : ;~ While 1 ;~ While fileExists(@ScriptDir&"\anyname.bat") ;~ run(@ScriptDir&"\anyname.bat") ;~ WEnd ;~ Sleep(30000) ;~ WEnd ; Simulation : HotKeySet("{ESC}", "_ExitNow") ; *** just to have an option to quit Global $g_sFilename = @ScriptDir & "\anyname.bat" While 1 ; Loop 1 While FileExists($g_sFilename) ; Loop 2 ConsoleWrite("> --> Loop 2 : RUN " & $g_sFilename & " ...press ESC to Exit" & @CRLF) Sleep(500) ; *** just to slow it down WEnd ConsoleWrite("+ ==> Loop 1 ...press ESC to Exit" & @CRLF) Sleep(1000) ; *** reduced for testing purposes WEnd Func _ExitNow() ConsoleWrite("! the script was terminated by the user." & @CRLF) Exit EndFunc ;==>_ExitNow "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
boy15 Posted November 30, 2019 Author Share Posted November 30, 2019 4 hours ago, Musashi said: @boy15 : Therefore, no ready-made solution is provided, but only a simulation to analyze the problem . ; Original : ;~ While 1 ;~ While fileExists(@ScriptDir&"\anyname.bat") ;~ run(@ScriptDir&"\anyname.bat") ;~ WEnd ;~ Sleep(30000) ;~ WEnd ; Simulation : HotKeySet("{ESC}", "_ExitNow") ; *** just to have an option to quit Global $g_sFilename = @ScriptDir & "\anyname.bat" While 1 ; Loop 1 While FileExists($g_sFilename) ; Loop 2 ConsoleWrite("> --> Loop 2 : RUN " & $g_sFilename & " ...press ESC to Exit" & @CRLF) Sleep(500) ; *** just to slow it down WEnd ConsoleWrite("+ ==> Loop 1 ...press ESC to Exit" & @CRLF) Sleep(1000) ; *** reduced for testing purposes WEnd Func _ExitNow() ConsoleWrite("! the script was terminated by the user." & @CRLF) Exit EndFunc ;==>_ExitNow not work your script Link to comment Share on other sites More sharing options...
Developers Jos Posted November 30, 2019 Developers Share Posted November 30, 2019 6 hours ago, boy15 said: not work your script What about you kick your own brains in gear and think about what I said instead of blaming others? Jos Musashi 1 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. Link to comment Share on other sites More sharing options...
Musashi Posted November 30, 2019 Share Posted November 30, 2019 7 hours ago, boy15 said: not work your script The script works for the purpose it was made for (not to spoon-feed you). 11 hours ago, Musashi said: (it is) only a simulation to analyze the problem. Which part of the sentence do you not understand ? So stop playing with Emojies and start analyzing. There is e.g. no need to run the batch file to find out the flaws in your construct. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
rudi Posted November 30, 2019 Share Posted November 30, 2019 20 hours ago, boy15 said: I have one batch file If I run it manually it opens one time but when I use script, it open many windows for same batch When you write a Autoit script, that will run an external BATCH file every 30 seconds, ist simply WAD, that every 30 seconds a new instance of the BATCH file is started, each one opening a Independent, separate Window. What else do you expect? And, basically, what are you trying to achive? It might be helpful to explain what you Need to do. Possibly the BAT file isn't really necessary and doing everything withing AUTOIT is the better Approach... Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Developers Jos Posted November 30, 2019 Developers Share Posted November 30, 2019 @rudi, Have a closer look at the script the OP posted. It will shell endless versions of the bachtfile when it exists for as long as the computer doesn't hang itself. This is an indicator the OP doesn't have the foggiest clue what the script does and I am trying to encourage the OP to think and understand it first. Jos 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. Link to comment Share on other sites More sharing options...
rudi Posted November 30, 2019 Share Posted November 30, 2019 @Jos A Loop starting a new instance of the BAT script every 30 seconds, or what did I miss? So opening a new CMD box with the BAT running is just WAD, isn't it? Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Developers Jos Posted November 30, 2019 Developers Share Posted November 30, 2019 (edited) Guess you didn't scroll back far enough. this is what the OP posted before somebody else started to pollute the thread with other code: There's clearly a big OOPS in there. Edited November 30, 2019 by Jos 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. Link to comment Share on other sites More sharing options...
Musashi Posted November 30, 2019 Share Posted November 30, 2019 7 minutes ago, Jos said: ... before somebody else started to pollute the thread with other code: I hope you don't mean my contribution. I just wanted to make the OP aware of the problem with the endless running While-Loops. A ready-made solution would have undermined your advice : " So read the script code and try to understand what it does and why it is running your script endless times! " . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Developers Jos Posted November 30, 2019 Developers Share Posted November 30, 2019 1 minute ago, Musashi said: I hope you don't mean my contribution. Yes I did and was just playing a little... Understood what you were trying but, as you saw, it only confused the OP and diverted the attention from his own script to your script. .. but feel free to contribute anytime you feel you can help! Jos 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. Link to comment Share on other sites More sharing options...
rudi Posted November 30, 2019 Share Posted November 30, 2019 Oh yesss! I didn't notice the "inner" Loop without any sleep() in that post. ; <snip> While fileExists(@ScriptDir&"\anyname.bat") run(@ScriptDir&"\anyname.bat") WEnd ; </snip> Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
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