brian75 Posted February 6, 2014 Share Posted February 6, 2014 Hello all, I'm having trouble with this script and am hoping someone can give me some pointers. I am trying to do a ping every 15 seconds and if the ping does not respond I want to run an ipconfig /release and /renew then start pinging again. The loop with the ping is working but I can't get the _Ipconfig function (that runs the release and renew) to trigger when the ping fails. I'm using some splashtext statements just to aid in troubleshooting. Once I get it working I'll remove those as I need this to run pretty silently. So, I am mainly looking for help in getting this to work but, secondly, this script increases processor usage by about 10% so if anyone has a suggestion for a less processor intensive way to do this I am open to suggestions. Thanks! HotKeySet("^!x", "MyExit") Func MyExit() Exit EndFunc Func _Ipconfig() SplashTextOn ("Ipconfig", "Running ipconfig", 300, 200, 1, 1, "", 18, 40) Run (@ComSpec & " /k " & 'ipconfig /release', "", @SW_MAXIMIZE) Run (@ComSpec & " /k " & 'ipconfig /renew', "", @SW_MAXIMIZE) Sleep (10000) SplashOff () EndFunc While 1 ping ("192.168.1.10") $error = @error SplashTextOn ("Ping", "@Error is: " & $error, 300, 200, 1, 1, "", 8, 20) Sleep (3000) SplashOff() If @error Then _Ipconfig() Sleep (15000) WEnd Link to comment Share on other sites More sharing options...
Solution jchd Posted February 6, 2014 Solution Share Posted February 6, 2014 If $error Then _Ipconfig() This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
brian75 Posted February 6, 2014 Author Share Posted February 6, 2014 JCHD, Duh. Thanks so much for your help! That fixed it. I think that was a case of just staring at this problem for too long. Thanks again! 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