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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyautostart-0.1.2.tar.gz.
File metadata
- Download URL: pyautostart-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9054d6d8aadef670dc64c5ed5531538fbb1d186ab847f2bde09d90aa1682d4d8
|
|
| MD5 |
287f880eb66c988e09290a159ca55a28
|
|
| BLAKE2b-256 |
4ffe8703f79531dee1f3b3695db815b28f22bdcb26a6aaec375437cee4bc9f83
|
File details
Details for the file pyautostart-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyautostart-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
924d78f87b8c87ec8ba7a1f43a30f4eecbd74887872776ec72d77d7388c2493d
|
|
| MD5 |
dc120479a4f7a24cb198b474056a84d1
|
|
| BLAKE2b-256 |
bebd8004332a879950b16ebdebe3a03b4ff943668c46167204a95b1270ec70cc
|