tsksch
A python pywin32 wrapper library for Windows Task Scheduler.
List All Scheduled Tasks
from tasksch.scheduler import TaskService
with TaskService() as ts:
root = ts.root_folder()
for folder in root.walk():
print(f"DIR: {folder.path}")
for task in folder.tasks():
print(f"TSK: {task.path}")
Create New Folder
from tasksch.scheduler import TaskService
with TaskService() as ts:
root = ts.root_folder()
if not root.find("\\NEW FOLDER"):
root.create_folder("\\NEW FOLDER")
Create New Task
from tasksch folder import TaskFolder
from tasksch.scheduler import TaskService
from tasksch.com import local_datetime
from tasksch.settings import duration, TaskInstancesPolicy
from tasksch.principle import TaskRunlevelType
with TaskService() as ts:
root = ts.root_folder()
folder = root.find(folder_name)
if not folder:
return
existing_task = folder.find_task(task_name)
if existing_task:
return
task = service.new_task()
reg_info = task.registration_info
reg_info.author = 'Mark Gemmill'
reg_info.description = 'Test Task'
action = task.actions.create_exec_action()
action.path = r"C:\Users\username\execute.bat"
action.working_directory = r"C:\Users\username"
trigger = task.triggers.create_daily_trigger()
trigger.start_boundary = local_datetime(2024, 1, 1, 5, 30)
trigger.days_interval = 1
trigger.enabled = True
settings = task.settings
settings.enabled = True
settings.hidden = True
settings.multiple_instances = TaskInstancesPolicy.TASK_INSTANCES_IGNORE_NEW
settings.allow_demand_start = True
settings.execution_time_limit = duration(hours=1, minutes=30)
principal = task.principal
principal.user_id = 'mark'
principal.run_level = TaskRunlevelType.TASK_RUNLEVEL_HIGHEST
folder.register_new_task_definition(
task,
task_name,
'username',
'Ckr1t',
)
Metadata
Release files for tasksch 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tasksch-0.3.0.tar.gz | 20.8 kB | Without provenance | Details for tasksch-0.3.0.tar.gz |
Release files / tasksch-0.3.0.tar.gz
| Download URL | tasksch-0.3.0.tar.gz |
|---|---|
| Size | 20.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcdfdca08d34fef01dbe9c7650c1b400009162e2f7d55319ca89986ef8c1c37c
|
|
BLAKE2b-256 checksum How to use checksums |
1fabbf37893b9943cf54535b9715e5587606da645b4ad390b56cfd1bb2120b12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Darwin/23.6.0
|
Security for tasksch 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.