shay Posted March 15, 2009 Share Posted March 15, 2009 Hi i wont to create a computer restart loop witch in it a`ll have the ability to select how many restart will be preformed is it passable shay "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
toonboon Posted March 15, 2009 Share Posted March 15, 2009 yes it's possible. What are you creating this for? I suggest taking a look at file writing and reading functions to do the counting. [right]~What can I say, I'm a Simplistic person[/right] Link to comment Share on other sites More sharing options...
shay Posted March 15, 2009 Author Share Posted March 15, 2009 yes it's possible. What are you creating this for?I suggest taking a look at file writing and reading functions to do the counting.i need this for testing purposei know that i need to do a loop how read counter from some log filesand after each restart it will write -1 in the log fileso when log file will get to 0 it will stop running the restart loophow do i implant this? "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
toonboon Posted March 15, 2009 Share Posted March 15, 2009 First find yourself a piece of coding that will make this program run on startup... Or would you want to have to manually open your program every time you want to restart it? [right]~What can I say, I'm a Simplistic person[/right] Link to comment Share on other sites More sharing options...
shay Posted March 15, 2009 Author Share Posted March 15, 2009 First find yourself a piece of coding that will make this program run on startup... Or would you want to have to manually open your program every time you want to restart it? no problem i use this to add Run Once in the registry RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "ewf", "REG_SZ", "c:\runonce.exe") "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
toonboon Posted March 15, 2009 Share Posted March 15, 2009 FileRead(blahblah) FileWrite(blahblah) some code for restart. Voila you're finished. throw in some if... then... else... endif in there and you're set. [right]~What can I say, I'm a Simplistic person[/right] Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2009 Developers Share Posted March 15, 2009 Study this example:http://www.autoitscript.com/forum/index.ph...mp;#entry653631Jos 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...
shay Posted March 15, 2009 Author Share Posted March 15, 2009 all of that info is very helpful but i have some problem on the "conter" with the read and write to the counter..... "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
Bert Posted March 15, 2009 Share Posted March 15, 2009 Do you need this when the unit first starts, of after it is logged in? If after it is logged in, you could just place this compiled script in startup. Else you can put it in the path to it in the registry: RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "ewf", "REG_SZ", "c:\runonce.exe") Just edit the ini to handle the number of reboots you need. $path = "C:\restart.ini" $ini = IniRead($path, "1", "1", "0") if $ini => 1 then $ini = $ini - 1 IniWrite($path, "1", "1", $ini) Shutdown(6) ;Force a reboot endif The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2009 Developers Share Posted March 15, 2009 all of that info is very helpfulbut i have some problem on the "conter"with the read and write to the counter.....That is part of the examples... just be creative. 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...
firsttimer Posted March 15, 2009 Share Posted March 15, 2009 Do you need this when the unit first starts, of after it is logged in? If after it is logged in, you could just place this compiled script in startup. Else you can put it in the path to it in the registry: RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "ewf", "REG_SZ", "c:\runonce.exe") Just edit the ini to handle the number of reboots you need. $path = "C:\restart.ini" $ini = IniRead($path, "1", "1", "0") if $ini => 1 then $ini = $ini - 1 IniWrite($path, "1", "1", $ini) Shutdown(6) ;Force a reboot endif Isnt the registry should be RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "ewf", "REG_SZ", "c:\runonce.exe") Since runonce path registry means only run once then delete the registry path? Link to comment Share on other sites More sharing options...
shay Posted March 16, 2009 Author Share Posted March 16, 2009 Do you need this when the unit first starts, of after it is logged in? If after it is logged in, you could just place this compiled script in startup. Else you can put it in the path to it in the registry: RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "ewf", "REG_SZ", "c:\runonce.exe") Just edit the ini to handle the number of reboots you need. $path = "C:\restart.ini" $ini = IniRead($path, "1", "1", "0") if $ini => 1 then $ini = $ini - 1 IniWrite($path, "1", "1", $ini) Shutdown(6) ;Force a reboot endif thanks, that work great and short my code to more "clean" one i use the "REG run once" to run the code after restart. "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
shay Posted March 16, 2009 Author Share Posted March 16, 2009 thanks, that work great and short my code to more "clean" one i use the "REG run once" to run the code after restart. after i develop the code some more a had some another problems, after PC restart the firs thing that run is the code, the problem is that the code wait to a specific window (WinWaitActive), the code pause all the programs in the start-up, i need all the startup programs to load and then tell the code to wait to specific window, no meter if i use sleep or WinWaitActive pause al programs during startup $path = "d:\restart.ini" $ini = IniRead($path, "restart_count", "restart_number", "0") if $ini >= 1 then $ini = $ini - 1 IniWrite($path, "restart_count", "restart_number", $ini) ;log file $file = FileOpen("d:\restart.log", 1) FileWriteLine($file, "Restart " & @Hour & ":" & @Min & ":" & @Sec) FileClose($file) ; REG insert RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "ewf", "REG_SZ", "d:\restart.exe") Sleep(200) Run(@COMSPEC & " /c ewfmgr c: -commitanddisable") sleep(200) MsgBox(0,'','Insert regestry OK ' ,2) Sleep(60000) ;Restart WinWaitActive( "" , "connect") Beep(500, 500) Sleep(200) Beep(500, 500) Run(@COMSPEC & " /c shutdown -r -t 3") Else Beep(500, 1000) Sleep(200) Beep(500, 1000) $file = FileOpen("d:\restart.log", 1) FileWriteLine($file, "End of automation restart " & @Hour & ":" & @Min & ":" & @Sec) FileClose($file) Sleep(200) MsgBox(0,'','end of automation restart ' ) "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
toonboon Posted March 16, 2009 Share Posted March 16, 2009 Why exactly are you wanting the computer to restart? There must be an easier solution I think... [right]~What can I say, I'm a Simplistic person[/right] Link to comment Share on other sites More sharing options...
firsttimer Posted March 16, 2009 Share Posted March 16, 2009 Why exactly are you wanting the computer to restart? There must be an easier solution I think...Runonce will always be the first thing windows run after it start up.Its mean only run one time only and will always be the first priority program to load, once executed whether successful or not, the runonce registry path will be deleted.Thats why I suggested Run in the registry path instead of runonce.This way, you could pause or sleep your program to wait until all apps in computer to load up. Link to comment Share on other sites More sharing options...
shay Posted March 17, 2009 Author Share Posted March 17, 2009 OK i found the problem if i use run-once from the REG this is the firs application to load on windows, if i run it from the start-up its last to load (in my case i use it) "If the facts don't fit the theory, change the facts." Albert Einstein 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