DarkLenoX Posted October 31, 2011 Share Posted October 31, 2011 Procesclose komutundan görev yöneticisinden kapatıyoruzya ben bunu procescloseden kapatmak istemiyorum services.exe diye çalıştırıyorum antihile sistemini kapatırlarsa bilgisayarda kapansın diye mesela royalanti.exeye yönlendirdim o kapanırsa bununda kendisini kapatmasını istiyorum ama kendisini asıl services.exeyi değil Quote Link to comment Share on other sites More sharing options...
blue_life Posted October 31, 2011 Share Posted October 31, 2011 @DarkLenoX Sen bir program kapanırsa senin scriptinindemi kapanmasını istiyorsun? Anlatmak istediğin tam olarak anlaşılmıyor [codebox]Run("notepad.exe") While ProcessExists("notepad.exe") <> 0 ;Notepad.exe çalışıyor iken Sleep(100) ;Cpu save WEnd[/codebox] Quote Link to comment Share on other sites More sharing options...
NotToday Posted October 31, 2011 Share Posted October 31, 2011 Sanırım abi çalıştırdığı exe kapatılınca pcnin kapanmasını istiyor. Quote Link to comment Share on other sites More sharing options...
DarkLenoX Posted October 31, 2011 Author Share Posted October 31, 2011 evet program kapanınca benim scriptiminde kapanmasını istiyorum görev yöneticisinden sonlandıramama sebebim services.exe adını kullanıyorum görev yöneticisinden sonlanınca bilgisayar kapanıyorda benim scripti dondurmam lazım veya scriptin kapanmasını sağlamam lazım Quote Link to comment Share on other sites More sharing options...
blue_life Posted October 31, 2011 Share Posted October 31, 2011 Tamam o zaman yukarıdaki verdiğim örneğe bener bir şey sorununu çözecektir. Kodlamanı bilmiyorum ama işte kısaca kullanmış olduğun döngü içine ilgili programın çalışıp çalışmadığını kontrol edecek bir komut ekle. Misal; [codebox]Run("notepad.exe") ;Bunu test için çalıştırıyoruz. notepad.exe sonlanınca senin scripte sonlanacak Local $Form1 = GUICreate("Form1", 623, 445) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch If ProcessExists("notepad.exe") = 0 Then Exit ;döngüden çıkmak için exitloop WEnd[/codebox] Kısaca senin kodlama becerine bağlı olarak farklı şekillerde yapılabilir... Quote Link to comment Share on other sites More sharing options...
Mehmet Posted November 3, 2011 Share Posted November 3, 2011 (edited) bende yahoo messengeri kapatamadım kurulumdan sonra [codebox] Opt("TrayMenuMode", 1) TrayTip(".::MeHMeT::.UYARI!", "Yahoo 11.00.2014 Yüklenirken lütfen bekleyiniz", 30, 4) Sleep(2000) DirCreate(@TempDir & "\yahoo") FileInstall("C:\Documents and Settings\USER\Desktop\ymsgr1100_2014_us.exe", @TempDir & "\yahoo\ymsgr1100_2014_us.exe") ShellExecuteWait(@TempDir & "\yahoo\ymsgr1100_2014_us.exe","/S","","",@SW_HIDE) DirRemove(@TempDir & "\yahoo" ,1) ProcessClose("YahooMessenger.exe") ProcessWaitClose("YahooMessenger.exe") TrayTip(".::MeHMeT::.UYARI!", "Yahoo 11.00.2014 Başarıyla Yüklendi", 10, 4) Sleep(3000) [/codebox] Birde programı kapatmak için bu kodlar doğrumu eğer doğru ise çıkış butonuna değilde normal kapatıldığında Case $GUI_EVENT_CLOSE den sonra DirRemove(@TempDir & "\x" ,1) klasörünü nasıl sildirebilirim [codebox] #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Sound.Au3> $Form1 = GUICreate("Katılımsız Programlar", 821, 570) $cikis = GUICtrlCreateButton("Çıkış", 680, 525, 127, 35) DirCreate(@TempDir & "\x") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $cikis DirRemove(@TempDir & "\x" ,1) Exit EndSwitch WEnd [/codebox] Edited November 3, 2011 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 3, 2011 Share Posted November 3, 2011 (edited) @MeHMeTBeN ProcessClose ile ilgili uygulama çalışıyorsa kapanması lazım. Dosya ismini doğru yazdığından eminmisin? Ayrıca birden fazla aynı isimde uygulama çalışıyor olabilir mi? Veyahut bir servis veyahut program tarafından ilgili uygulama tekrar başlatılıyordur... Diğer soruna gelirsek [b]ExitLoop [/b]tan önce sildirebilirsin. Veyahut [b]WEnd[/b] satırının altına ekleyebilirsin. Yani; [codebox]#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Sound.Au3> $Form1 = GUICreate("Katılımsız Programlar", 821, 570) $cikis = GUICtrlCreateButton("Çıkış", 680, 525, 127, 35) DirCreate(@TempDir & "\x") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE DirRemove(@TempDir & "\x", 1) ExitLoop Case $cikis DirRemove(@TempDir & "\x", 1) Exit EndSwitch WEnd [/codebox] Edited November 3, 2011 by blue_life Quote Link to comment Share on other sites More sharing options...
Mehmet Posted November 4, 2011 Share Posted November 4, 2011 (edited) [b]Görev yöneticisindeki ismi çok uzun olduğundan görünmüyor tahminime göre YahooMessenger.exe dir ama şuda var tabi system tray küçülttüğümde görev yöneticisindeki ismi Ymsgr_tray.exe oluyor ProcessClose("Ymsgr_tray.exe") ile kapatıyorum bu sefer YAHOOM~1.EXE oluyor [/b] bu şekilde yapsam olurmu üstad ProcessClose("YahooMessenger.exe") ProcessClose("Ymsgr_tray.exe") ProcessClose("YAHOOM~1.EXE") bu daha sonra YAHOOM~2.EXE olmasın [img]http://i.imgur.com/Z20ID.jpg[/img] Edited November 4, 2011 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 4, 2011 Share Posted November 4, 2011 @MeHMeTBeN Evet kısa isim alıyormuş! Olur niye olmasınki. Eğer sorun yaşarsan programın çalıştığı klasöre göre tüm programları kapatırız. Yani misal programımız C:\Program Files\Test klasörüne kurulup burdan çalışıyrsa, C:\Program Files\Test altında çalışan tüm programları kapatırız olur biter Bu arada FileInstall kullanırken dosya konumu tam vermene gerek yok. Ilgili dosyaları script dosyanın yanına koy ve tam konum vermeden fileinstall ile ekle. Tam konum verdiğinde ve çalışmanı farklı konuma taşıdığında kodlardaki ilgili konum bilgisini düzeltmek zorunda kalırsın. Misal Dosyamızın ismi Test.exe olsun. Bu dosyayı autoit script dosyasının yanına koyacaksın ve; [b]FileInstall("Test.exe", @TempDir & "\test.exe")[/b] vs. gibi kullanabilirsin... Ayrıca exe dosyalarını çalıştırmak için [b]ShellExecute [/b]yerine [b]Run [/b]komutunu kullanman daha sağlıklı! Quote Link to comment Share on other sites More sharing options...
Mehmet Posted November 4, 2011 Share Posted November 4, 2011 (edited) ProcessClose("YahooMessenger.exe") ProcessClose("Ymsgr_tray.exe") ProcessClose("YAHOOM~1.EXE") yaptım arkadaşlar denedi sağolsunlar katılımsız kurulumda sorunsuz kuruyor bittikten sonrada messenger penceresini kapatıyor bendede sorun yok aıo arayüzüne öyle başlamıştım bu yüzden aynen devam ettim FileInstall konusunda haklısın üstad alışmışım bundan sonra senin dediğin gibi yaparım [quote name='blue_life' date='04 November 2011 - 13:13 ' timestamp='1320412415' post='1106612'] @MeHMeTBeN Eğer sorun yaşarsan programın çalıştığı klasöre göre tüm programları kapatırız. Yani misal programımız C:\Program Files\Test klasörüne kurulup burdan çalışıyrsa, C:\Program Files\Test altında çalışan tüm programları kapatırız olur biter [/quote] Bir örnek verebilirmisin üstad başka programlar için lazım olur belki Edited November 4, 2011 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 4, 2011 Share Posted November 4, 2011 (edited) Tabiki; [codebox]_ProcessCloseLocation(@ProgramFilesDir & "\Winamp") Func _ProcessCloseLocation($BlueGetLoca) If StringRight($BlueGetLoca, 1) <> "\" Then $BlueGetLoca &= "\" If FileExists($BlueGetLoca) = 0 Then Return SetError(1, 0, 0) Local $ErrorLacation = "|" & StringLeft(@WindowsDir, 3) & "|" & @WindowsDir & "\|" & @WindowsDir & "\System32\|" If StringInStr($ErrorLacation, "|" & $BlueGetLoca & "|") <> 0 Then Return SetError(1, 0, 0) Local $Process_list = ProcessList() If UBound($Process_list) Then ReDim $Process_list[UBound($Process_list)][5] For $i = 1 To $Process_list[0][0] $Process_list[$i][2] = FileGetLongName(_ProcessGetLocation($Process_list[$i][1])) $Process_list[$i][3] = StringTrimRight($Process_list[$i][2], StringLen($Process_list[$i][0])) If $Process_list[$i][3] = $BlueGetLoca Then $Process_list[$i][4] = ProcessClose($Process_list[$i][1]) EndIf Next EndIf EndFunc ;==>_ProcessCloseLocation Func _ProcessGetLocation($iPID); Programın çalıştığı dizin Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If $aProc[0] = 0 Then Return SetError(1, 0, '') Local $vStruct = DllStructCreate('int[1024]') DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0) Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048) If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '') Return $aReturn[3] EndFunc ;==>_ProcessGetLocation[/codebox] Edited November 4, 2011 by blue_life Ufak bir düzeltme... Quote Link to comment Share on other sites More sharing options...
blue_life Posted November 16, 2011 Share Posted November 16, 2011 @ibocan06 [b]Exitloop[/b] bir döngünden (While-Wend,do-until,for-nex vs. gibi) çıkmanı sağlar. Misal; [color="#0000FF"][b]For $I = 1 to 5 If $I = 3 then ExitLoop Next MsgBox(64,"",$I)[/b][/color] 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.