Jump to content

[Soru]Ams İle Çalışan Programları Kapatma


kaan_karabey
 Share

Recommended Posts

Arkadaşlar Ben Şu Kodla Çalışan Programı Kapatmak İstiyorum Yalnız İkisini Kapatmıyor Sadece 1 tanesini Kapatıyor.

 

Kullandığım Kod:

kapat = Dialog.Message("Dikkat !", "Programlar Açık İse Kapanacak Devam Etmek İstiyor Musunuz ?", MB_YESNO, MB_ICONINFORMATION, MB_DEFBUTTON1);
    if kapat == 6 then -- evet butonu seçilirse ;
     
    file_to_check_for = "1.exe" and "2.exe";
     
    processes = System.EnumerateProcesses();
     
    for j, file_path in pairs (processes) do
    file = String.SplitPath(file_path);
    if (file.Filename..file.Extension) == file_to_check_for then
    System.TerminateProcess(j);
    end
    end
    else
    os.exit();
    end

İkisini Kapatması İçin Nasıl Bir Durum İzlemem Gerek???

 

Birde Uygulamanın 1 Kere Açılmasını Nasıl Yapabilirim???

Edited by kaan_karabey
Link to comment
Share on other sites

Kendim şöyle bir örnek hazırlayıp test ettim işe yaradı... kapatılmak istenen programları tablo yaptım sonra Processes tablosundakiler le karşılaştırıp kapattırdım... 

kapat = Dialog.Message("Dikkat !", "Programlar Açık İse Kapanacak Devam Etmek İstiyor Musunuz ?", MB_YESNO, MB_ICONINFORMATION, MB_DEFBUTTON1);
    if kapat == 6 then -- evet butonu seçilirse ;    
    

    Processes = System.EnumerateProcesses(); 
     
    file_to_check_for = {"notepad.exe" , "WinRAR.exe" , "firefox.exe" }     
        
	    for j, file_path in pairs (Processes) do
	    
	    file = String.SplitPath(file_path);	    
	
				for i in pairs (file_to_check_for) do
			
			    		if (file.Filename..file.Extension) == file_to_check_for[i] then   
			   			 System.TerminateProcess(j);
			    		end
		    	end
	    	
	    end
    
    else
    os.exit();
    end
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...