Jump to content

İşlem Bitince Delete Komutu


byMaPa
 Share

Recommended Posts

;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 by mesale0077
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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ış.

Link to comment
Share on other sites

#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ı

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...