Skip to main content

Make executable files run after user login

Project description

pyautostart

PyAutostart is a Python library for making all sorts of executables files be run after the user logged in into his computer for macOS, Linux and Windows.

Please note that Linux is not yet being supported.

Installation

Use the package manager pip to install PyAutostart.

pip install pyautostart

Usage

Platform independent

Make a file be run after login

The options dict must contain args which has to be a list that usually contain the path to the executable file. The name parameter of autostart.enable sets the name of the file which will then be created by the platform dependent implementation.

from pyautostart import SmartAutostart

autostart = SmartAutostart()
options = {
    "args": [
        "/path/to/executable/file"
    ]
}
autostart.enable(name="com.example.myapplication", options=options)

Disable automatic execution

Calling autostart.disable will delete the file which is being created by autostart.enable. The name parameter has to be the one set during autostart.enable.

from pyautostart import SmartAutostart

autostart = SmartAutostart()
autostart.disable(name="com.example.myapplication")

macOS

Make a file be run after login

The options dict contains the configuration for launchd. For a list of all valid options and their meanings, go to the Wikipedia article of launchd. The name parameter of autostart.enable sets the name of the file which will be stored in /Users/<username>/Library/LaunchAgents if not changed.

from pyautostart import MacAutostart

autostart = MacAutostart()
options = {
    "Label": "Name of",
    "ProgramArguments": [
        "python3",
        "/path/to/your/file.py"
    ]
}
autostart.enable(name="com.example.myapplication", options=options)

Disable automatic execution

Calling autostart.disable will delete the file which is being created by autostart.enable. The name parameter has to be the one set during autostart.enable.

from pyautostart import MacAutostart

autostart = MacAutostart()
autostart.disable(name="com.example.myapplication")

Windows

Make a file be run after login

The options dict must contain executable, which has to store to path to your executable file. autostart.enable will then create a .bat file which by default contains start "" <executable>".

This file will be stored inside C:\\Users\\<username>\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup.

If you want to replace the start "" command. Add command: "<command>" to the options dict.

from pyautostart import WindowsAutostart

autostart = WindowsAutostart()
options = {
    "executable": "C:\\path\\to\\your\\executable",
}
autostart.enable(name="com.example.myapplication", options=options)

Disable automatic execution

Calling autostart.disable will delete the file which is being created by autostart.enable. The name parameter has to be the one set during autostart.enable.

from pyautostart import WindowsAutostart

autostart = WindowsAutostart()
autostart.disable(name="com.example.myapplication")

Linux

Linux is not supported yet.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU GENERAL PUBLIC LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyautostart-0.1.1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyautostart-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file pyautostart-0.1.1.tar.gz.

File metadata

  • Download URL: pyautostart-0.1.1.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.1

File hashes

Hashes for pyautostart-0.1.1.tar.gz
Algorithm Hash digest
SHA256 281a4f5a97512dda5a2b47992ce3f79cb44e5da0829a17e4e7db1e54ec53fd51
MD5 29fcdac937ba3ea53bb59cf3236d3090
BLAKE2b-256 4b89910aa99de8d43a54448cf62e3349a90378a050355273ac348d144f36fb4b

See more details on using hashes here.

File details

Details for the file pyautostart-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyautostart-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.1

File hashes

Hashes for pyautostart-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9139dabd7a395e7005aa06bbf5262a81248f55cfe6ca7c22da1d697084a291ab
MD5 e9f2cdf655c3eabb6d8bad0dea5d3173
BLAKE2b-256 b2a86034814cd8632b46f173e74c65feefb6d1f5ee55cfa87ff0e1ced1309e34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page