testbytest Posted October 31, 2008 Share Posted October 31, 2008 HI i used _SelfDelete iS OK but i can't understand how it work about " 'ping -n ' & $iDelay & '127.0.0.1 > nul' " It neam ping -n 0127.0.0.1 > nul but why need this thanks Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 31, 2008 Share Posted October 31, 2008 That allows the batch file to wait for a while. It's just an easy way to pause for a period of time. Link to comment Share on other sites More sharing options...
testbytest Posted October 31, 2008 Author Share Posted October 31, 2008 That allows the batch file to wait for a while. It's just an easy way to pause for a period of time.why need this "pause for a period of time " Link to comment Share on other sites More sharing options...
rasim Posted October 31, 2008 Share Posted October 31, 2008 why need this "pause for a period of time "For the AutoIt script termination waiting. Link to comment Share on other sites More sharing options...
trancexx Posted October 31, 2008 Share Posted October 31, 2008 To avoid cpu overload. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 31, 2008 Share Posted October 31, 2008 No, it has nothing to do with CPU overload. It's so that the script has time to stop so that the OS will allow the executable to be deleted. Link to comment Share on other sites More sharing options...
trancexx Posted October 31, 2008 Share Posted October 31, 2008 No, it has nothing to do with CPU overload. It's so that the script has time to stop so that the OS will allow the executable to be deleted.It could be that we are not talking about the same function. In case we are then try this: MsgBox(0, "", @ScriptFullPath) _SelfDelete() Sleep(6000) MsgBox(0, "", "Closing now") Func _SelfDelete() Local $cmdfile $randomname = Random(999999, 99999999, 1) & ".cmd" FileDelete(@TempDir & "\" & $randomname) $cmdfile = ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & '@ping 127.0.0.1 -n 2 -w 1000 > nul' & @CRLF _ & '@ping 127.0.0.1 -n %1% -w 1000> nul' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del "' & @TempDir & "\" & $randomname & '"' FileWrite(@TempDir & "\" & $randomname, $cmdfile) Run(@TempDir & "\" & $randomname, @TempDir, @SW_HIDE) EndFunc and then this: MsgBox(0, "", @ScriptFullPath) _SelfDelete() Sleep(6000) MsgBox(0, "", "Closing now") Func _SelfDelete() Local $cmdfile $randomname = Random(999999, 99999999, 1) & ".cmd" FileDelete(@TempDir & "\" & $randomname) $cmdfile = ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del "' & @TempDir & "\" & $randomname & '"' FileWrite(@TempDir & "\" & $randomname, $cmdfile) Run(@TempDir & "\" & $randomname, @TempDir, @SW_HIDE) EndFunc The difference is "ping part". One have it, the other not. Don't forget to compile scripts and monitor CPU usage while executing. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Developers Jos Posted October 31, 2008 Developers Share Posted October 31, 2008 127.0.0.1 is fine as the ping command takes long enough to let the Script finish. 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...
ProgAndy Posted October 31, 2008 Share Posted October 31, 2008 You should use ping -n 1 -w 1000 127.255.255.255 all other 127 addresses answer ping for me ... *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
trancexx Posted October 31, 2008 Share Posted October 31, 2008 Could someone of you start command prompt and type and execute this: ping 127.0.0.1 -n 10 -w 1000 > nul and post return time ...you lost me here ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 31, 2008 Share Posted October 31, 2008 That code takes 10 seconds to execute. Link to comment Share on other sites More sharing options...
ProgAndy Posted October 31, 2008 Share Posted October 31, 2008 (edited) For me, this takes 0 to 1 seconds //Edit: this needs 23 seconds: ping 127.0.0.1 -n 10 -w 1000 > nul Edited October 31, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
trancexx Posted October 31, 2008 Share Posted October 31, 2008 It should take you 9 sec (not 10 as Richard Robertson miscount) ping.exe is capable of doing 1 ping per sec and switch "n" is telling it how many pings to do altogether before returning completely. One initial ping and nine more afterward. (n=10) Switch "w" is what you all talk about (not all ). It's set to 1000 in case ... blah, blah Line ping 127.0.0.1 -n %1% -w 1000> nul is there to allow us to pass parameters to that batch file (longer pause). So, 127.0.0.1 is just fine. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 31, 2008 Share Posted October 31, 2008 (edited) You also have to remember that ping time can be delayed. Or rather, that pings aren't always instant. Edited October 31, 2008 by Richard Robertson 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