Hi guys,
This is the first time I'm posting to the newsgroup, hope you can help out.
I'm writing a module to interface with the task scheduler in windows
using PyWin32. Everything has been great so far but I'm stuck on
displaying the propertys page of a task. Here's the code:
import pythoncom
import win32api
from win32com.tasksc heduler import taskscheduler
import win32ui
task_scheduler = pythoncom.CoCre ateInstance\
(taskscheduler. CLSID_CTaskSche duler,
None, pythoncom.CLSCT X_INPROC_SERVER ,
taskscheduler.I ID_ITaskSchedul er)
def show_schedule_p age(task_name):
TASKPAGE_TASK = 0,
TASKPAGE_SCHEDU LE = 1,
TASKPAGE_SETTIN GS = 2
try:
task = task_scheduler. Activate(task_n ame)
except pythoncom.com_e rror, e:
print 'Task name not found...'
return
# ** This returns a PyHandle
handle = task.QueryInter face(taskschedu ler.IID_IProvid eTaskPage).\
GetPage(1, True)
# ** Can't create a window with it using win32ui, returns error
try:
win32ui.CreateW indowFromHandle (handle)
except win32ui.error, e:
print e
# ** Can't add it to a property sheet, return an error
property_sheet = win32ui.CreateP ropertySheet('T ask Schedule')
try:
property_sheet. AddPage(handle)
except (win32ui.error, TypeError), e:
print e
show_schedule_p age('task1')
Any ideas on how to do it? The task schduler api reference is at
http://msdn.microsoft.com/library/de...start_page.asp
I'm pretty new at this, is there anything that I've missed out?
Cheers,
Fadly Tabrani
python loves me loves python
This is the first time I'm posting to the newsgroup, hope you can help out.
I'm writing a module to interface with the task scheduler in windows
using PyWin32. Everything has been great so far but I'm stuck on
displaying the propertys page of a task. Here's the code:
import pythoncom
import win32api
from win32com.tasksc heduler import taskscheduler
import win32ui
task_scheduler = pythoncom.CoCre ateInstance\
(taskscheduler. CLSID_CTaskSche duler,
None, pythoncom.CLSCT X_INPROC_SERVER ,
taskscheduler.I ID_ITaskSchedul er)
def show_schedule_p age(task_name):
TASKPAGE_TASK = 0,
TASKPAGE_SCHEDU LE = 1,
TASKPAGE_SETTIN GS = 2
try:
task = task_scheduler. Activate(task_n ame)
except pythoncom.com_e rror, e:
print 'Task name not found...'
return
# ** This returns a PyHandle
handle = task.QueryInter face(taskschedu ler.IID_IProvid eTaskPage).\
GetPage(1, True)
# ** Can't create a window with it using win32ui, returns error
try:
win32ui.CreateW indowFromHandle (handle)
except win32ui.error, e:
print e
# ** Can't add it to a property sheet, return an error
property_sheet = win32ui.CreateP ropertySheet('T ask Schedule')
try:
property_sheet. AddPage(handle)
except (win32ui.error, TypeError), e:
print e
show_schedule_p age('task1')
Any ideas on how to do it? The task schduler api reference is at
http://msdn.microsoft.com/library/de...start_page.asp
I'm pretty new at this, is there anything that I've missed out?
Cheers,
Fadly Tabrani
python loves me loves python
Comment