์์ฉ ํ๋ก๊ทธ๋จProgID
Microsoft Access | Access.Application |
Microsoft Excel | Excel.Application |
Microsoft Outlook | Outlook.Application |
Microsoft PowerPoint | Powerpoint.Application |
Microsoft Word | Word.Application |
Microsoft FrontPage | FrontPage.Application |
import datetime
import win32com.client
scheduler = win32com.client.Dispatch('Schedule.Service')
scheduler.Connect()
root_folder = scheduler.GetFolder('\\')
task_def = scheduler.NewTask(0)
# Defining the Start time of job
start_time = datetime.datetime.now() + datetime.timedelta(minutes=1)
# For Daily Trigger set this variable to 2 ; for One time run set this value as 1
TASK_TRIGGER_DAILY = 2
trigger = task_def.Triggers.Create(TASK_TRIGGER_DAILY)
#Repeat for a duration of number of day
num_of_days = 10
trigger.Repetition.Duration = "P"+str(num_of_days)+"D"
#use PT2M for every 2 minutes, use PT1H for every 1 hour
trigger.Repetition.Interval = "PT2M"
trigger.StartBoundary = start_time.isoformat()
# Create action
TASK_ACTION_EXEC = 0
action = task_def.Actions.Create(TASK_ACTION_EXEC)
action.ID = 'TRIGGER BATCH'
action.Path = 'cmd.exe'
action.Arguments ='/c start "" "C:\\Ajay\\Desktop\\test.bat"'
# Set parameters
task_def.RegistrationInfo.Description = 'Test Task'
task_def.Settings.Enabled = True
task_def.Settings.StopIfGoingOnBatteries = False
# Register task
# If task already exists, it will be updated
TASK_CREATE_OR_UPDATE = 6
TASK_LOGON_NONE = 0
root_folder.RegisterTaskDefinition(
'Test Task', # Task name
task_def,
TASK_CREATE_OR_UPDATE,
'', # No user
'', # No password
TASK_LOGON_NONE
)
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=greenraycom&logNo=140184012166
'๐ํ๋ก๊ทธ๋๋ฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ์ด์ฌ] ์ปดํจํฐ ์์ ํ๋ก๊ทธ๋จ ๋ฑ๋ก ๋ฐฉ๋ฒ (0) | 2022.07.04 |
---|---|
[ํ์ด์ฌ] win32com ์์ ์ค์ผ์ค๋ฌ ์ฝ๋ (0) | 2022.07.01 |
[ํ์ด์ฌ] ๋ฐฐํฌ ์๋ํ ์ฐธ๊ณ ์ฝ๋ (0) | 2022.06.29 |
[ํ์ด์ฌ] ํ ์คํธ ํ์ผ ์ธ์ฝ๋ฉ ๋ณํ ํจ์ (0) | 2022.06.29 |
[ํ์ด์ฌ] ๊ตฌ๊ธ ํฌ๋กค๋ง ์ UserAgent ๋ฐ Coockie ์ค์ ํ์ (0) | 2022.06.10 |