• 17-03-2021, 15:20:41
    #1
    merhaba bir python uygulamasını süreli olarak kapatıp açması için bir program yapmak istiyorum. Böyle bir kod buldum bunun yerlerini main.py olarak değiştirdim fakat bunu exe olarak kaydedemedim visual studioda nasıl yapabilirim? basit bir şey olsun varsa hazır bir program oda olur mesela 1 saatte bir python uygulamasını kapatıp açacak
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;//Ekle
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
     
    namespace bilgisayar_kapat
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
     
            private void button1_Click(object sender, EventArgs e)
            {
                ProcessStartInfo psi = new ProcessStartInfo();
                psi.FileName = "C:\\Windows\\system32\\shutdown.exe";
                psi.Arguments = "-f -s -t 0";
                Process.Start(psi);
            }
     
            private void button2_Click(object sender, EventArgs e)
            {
                textBox1.Enabled = false;
                textBox2.Enabled = false;
                textBox3.Enabled = false;
                timer1.Start();
            }
     
            private void button3_Click(object sender, EventArgs e)
            {
       
                System.Diagnostics.Process.Start("shutdown", "-f -s");
       
            }
     
            private void timer1_Tick(object sender, EventArgs e)
            {
                string saat, dakika, saniye;
                saat = textBox1.Text;
                dakika = textBox2.Text;
                saniye = textBox3.Text;
     
     
                if ((Convert.ToString(DateTime.Now.Hour)) == saat && (Convert.ToString(DateTime.Now.Minute) == dakika) && (Convert.ToString(DateTime.Now.Second)) == saniye)
                {
                    ProcessStartInfo psi = new ProcessStartInfo();
                    psi.FileName = "C:\\Windows\\system32\\shutdown.exe";
                    psi.Arguments = "-f -s -t 0";
                    Process.Start(psi);
                }
            }
        }
    }
  • 17-03-2021, 15:36:01
    #2
    Merhabalar,

    Pyinstaller modülü ekleyerek kolaylıkla exe yapabilirsiniz..

    Saygılarımla.
  • 17-03-2021, 17:32:58
    #3
    TekLanDC adlı üyeden alıntı: mesajı görüntüle
    Merhabalar,

    Pyinstaller modülü ekleyerek kolaylıkla exe yapabilirsiniz..

    Saygılarımla.
    hayır hocam visualde yaptığım şeyi exe yapamıyorum python uygulamasını değl
  • 17-03-2021, 18:51:26
    #4
    Endiseki adlı üyeden alıntı: mesajı görüntüle
    hayır hocam visualde yaptığım şeyi exe yapamıyorum python uygulamasını değl
    O zaman "Process Timer" işinizi görür

    Saygılarımla.11