byMaPa Posted April 23, 2013 Share Posted April 23, 2013 Autoit de işlem bitince scriptin kendisin silmesi için kod var mı? Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 (edited) ;Opt("OnExitFunc", "_SelfDelete") ;en üste koy ,çıkış yaptıktan sonra siler ;yada ;call("_SelfDelete");işlem bitirdikten sonra çağırırsın Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit Edited April 23, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 Opt("OnExitFunc", "_SelfDelete") ;en üste koy ,çıkış yaptıktan sonra ;yada call("_SelfDelete");işlem bitirdikten sonra çağırırsın Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit scratch.bat ne ? direk böylemi koyacağım scripte Quote Link to comment Share on other sites More sharing options...
reyiz Posted April 23, 2013 Share Posted April 23, 2013 (edited) @mesale0077 Hocam bu kod program zorla kapattırılırsa çalışmaz değil mi? Edited April 23, 2013 by reyiz Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 iki kullanım veriyorum lütfen autoiti kullanmak istiyorsanız en azından 3 satır bile yazıp paylaşsanız 1.örnek buttona basınca kendini silecek #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] Form1 [#]", 623, 442, 192, 124) $Button1 = GUICtrlCreateButton("çıkış", 136, 88, 313, 193) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 call("_SelfDelete") EndSwitch WEnd Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit 2.örnek #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("OnExitFunc", "_SelfDelete") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] Form1 [#]", 623, 442, 192, 124) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit gerisi sana kalmış. Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 #NoTrayIcon #RequireAdmin FileInstall('sph.exe',@TempDir & '\sph.exe',1) RunWait(@TempDir & "\sph.exe") FileDelete(@TempDir & "\sph.exe") call("_SelfDelete") Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit bu şekilde yaptım ama olmadı Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 @mesale0077 Hocam bu kod program zorla kapattırılırsa çalışmaz değil mi? onun için başka bir kod var ama amaç bu değil Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 iki kullanım veriyorum lütfen autoiti kullanmak istiyorsanız en azından 3 satır bile yazıp paylaşsanız 1.örnek buttona basınca kendini silecek #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] Form1 [#]", 623, 442, 192, 124) $Button1 = GUICtrlCreateButton("çıkış", 136, 88, 313, 193) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 call("_SelfDelete") EndSwitch WEnd Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit 2.örnek #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("OnExitFunc", "_SelfDelete") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] Form1 [#]", 623, 442, 192, 124) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit gerisi sana kalmış. kodu yazdım yanlışı düzeltir misniz ? Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 runwait bekliyor ondan fileexist kullan Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 runwait bekliyor ondan fileexist kullan sph.exe 3 sn çalışıp kendini kapatıyor zaten. o yüzden runwait yaptım. Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 ikinci yazdığımı kullan yeter Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 ikinci yazdığımı kullan yeter #NoTrayIcon #RequireAdmin FileInstall('sph.exe',@TempDir & '\sph.exe',1) RunWait(@TempDir & "\sph.exe") FileDelete(@TempDir & "\sph.exe") #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("OnExitFunc", "_SelfDelete") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] Form1 [#]", 623, 442, 192, 124) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit bu şekilde yazdım. form1 diye pencere çıkıyor. silmiyorki exe yi. Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 Opt("OnExitFunc", "_SelfDelete") FileInstall('sph.exe',@TempDir & '\sph.exe',1) RunWait(@TempDir & "\sph.exe") FileDelete(@TempDir & "\sph.exe") Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 Opt("OnExitFunc", "_SelfDelete") FileInstall('sph.exe',@TempDir & '\sph.exe',1) RunWait(@TempDir & "\sph.exe") FileDelete(@TempDir & "\sph.exe") Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Exit kardeş bunu exe haline getirdim tempdire attım çalıştırdım silmiyor kendisini yine :S Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 FileInstall('sph.exe',@TempDir & '\sph.exe',1) RunWait(@TempDir & "\sph.exe") FileDelete(@TempDir & "\sph.exe") _SelfDelete(1) Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc bu şekildene bakalım Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 FileInstall('sph.exe',@TempDir & '\sph.exe',1) RunWait(@TempDir & "\sph.exe") FileDelete(@TempDir & "\sph.exe") _SelfDelete(1) Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc bu şekildene bakalım silinmedi yine :S Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 (edited) pm atarmısın kodu ve şu ilgili exeyi normalde silmesi lazım bence işlem bitirmiyor gibi geldi yada antiler engelliyor olabilir belki kodun en üste bunu ekle #RequireAdmin Edited April 23, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
byMaPa Posted April 23, 2013 Author Share Posted April 23, 2013 pm atarmısın kodu ve şu ilgili exeyi normalde silmesi lazım bence işlem bitirmiyor gibi geldi kod tamamen bu. bunu exeye çeviriyorum ve çalıştırıyorum. çalıştırdıktan sonra kendisini silmesini istiyorum. yine de atayım mı ? pmden Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted April 23, 2013 Share Posted April 23, 2013 bende çalışıyor belki sende antiler engelliyor olabilir ve exe isminde boşluk olmasın Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.