pywin32-checkins Mailing List for Python for Windows Extensions (Page 137)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2004-04-15 05:52:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29611 Modified Files: testShell.py Log Message: Add SHFileOperation tests. Index: testShell.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testShell.py 9 Apr 2004 11:25:36 -0000 1.3 --- testShell.py 15 Apr 2004 05:52:24 -0000 1.4 *************** *** 75,79 **** self._rtCIDA(["\1"], [ ["\2"] ]) self._rtCIDA(["\0"], [ ["\0"], ["\1"], ["\2"] ]) ! if __name__=='__main__': unittest.main() --- 75,142 ---- self._rtCIDA(["\1"], [ ["\2"] ]) self._rtCIDA(["\0"], [ ["\0"], ["\1"], ["\2"] ]) ! ! class FileOperationTester(win32com.test.util.TestCase): ! def setUp(self): ! import tempfile ! self.src_name = os.path.join(tempfile.gettempdir(), "pywin32_testshell") ! self.dest_name = os.path.join(tempfile.gettempdir(), "pywin32_testshell_dest") ! self.test_data = "Hello from\0Python" ! f=file(self.src_name, "wb") ! f.write(self.test_data) ! f.close() ! try: ! os.unlink(self.dest_name) ! except os.error: ! pass ! ! def tearDown(self): ! for fname in (self.src_name, self.dest_name): ! if os.path.isfile(fname): ! os.unlink(fname) ! ! def testCopy(self): ! s = (0, # hwnd, ! FO_COPY, #operation ! self.src_name, ! self.dest_name) ! ! rc, aborted = shell.SHFileOperation(s) ! self.failUnless(not aborted) ! self.failUnlessEqual(0, rc) ! self.failUnless(os.path.isfile(self.src_name)) ! self.failUnless(os.path.isfile(self.dest_name)) ! ! def testRename(self): ! s = (0, # hwnd, ! FO_RENAME, #operation ! self.src_name, ! self.dest_name) ! rc, aborted = shell.SHFileOperation(s) ! self.failUnless(not aborted) ! self.failUnlessEqual(0, rc) ! self.failUnless(os.path.isfile(self.dest_name)) ! self.failUnless(not os.path.isfile(self.src_name)) ! ! def testMove(self): ! s = (0, # hwnd, ! FO_MOVE, #operation ! self.src_name, ! self.dest_name) ! rc, aborted = shell.SHFileOperation(s) ! self.failUnless(not aborted) ! self.failUnlessEqual(0, rc) ! self.failUnless(os.path.isfile(self.dest_name)) ! self.failUnless(not os.path.isfile(self.src_name)) ! ! def testDelete(self): ! s = (0, # hwnd, ! FO_DELETE, #operation ! self.src_name, None, ! FOF_NOCONFIRMATION) ! rc, aborted = shell.SHFileOperation(s) ! self.failUnless(not aborted) ! self.failUnlessEqual(0, rc) ! self.failUnless(not os.path.isfile(self.src_name)) ! if __name__=='__main__': unittest.main() |
From: Mark H. <mha...@us...> - 2004-04-11 04:57:59
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25485/pywin/framework Modified Files: app.py Log Message: "Copyright 2004" Index: app.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/app.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** app.py 7 Feb 2004 01:02:58 -0000 1.9 --- app.py 11 Apr 2004 04:44:24 -0000 1.10 *************** *** 321,325 **** return default ! scintilla = "Scintilla is Copyright 1998-2000 Neil Hodgson (http://www.scintilla.org)" idle = "This program uses IDLE extensions by Guido van Rossum, Tim Peters and others." contributors = "Thanks to the following people for making significant contributions: Sam Rushing, Curt Hagenlocher, Dave Brennan, Roger Burnham, Gordon McMillan, Neil Hodgson, Laramie Leavitt. (let me know if I have forgotten you!)" --- 321,325 ---- return default ! scintilla = "Scintilla is Copyright 1998-2004 Neil Hodgson (http://www.scintilla.org)" idle = "This program uses IDLE extensions by Guido van Rossum, Tim Peters and others." contributors = "Thanks to the following people for making significant contributions: Sam Rushing, Curt Hagenlocher, Dave Brennan, Roger Burnham, Gordon McMillan, Neil Hodgson, Laramie Leavitt. (let me know if I have forgotten you!)" |
From: Mark H. <mha...@us...> - 2004-04-11 04:57:59
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25485 Modified Files: win32uimodule.cpp Log Message: "Copyright 2004" Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** win32uimodule.cpp 15 Oct 2003 23:33:33 -0000 1.26 --- win32uimodule.cpp 11 Apr 2004 04:44:24 -0000 1.27 *************** *** 2194,2198 **** ui_module_error = PyString_FromString(errorName); PyDict_SetItemString(dict, "error", ui_module_error); ! PyObject *copyright = PyString_FromString("Copyright 1994-2001 Mark Hammond (mha...@sk...)"); PyDict_SetItemString(dict, "copyright", copyright); Py_XDECREF(copyright); --- 2194,2198 ---- ui_module_error = PyString_FromString(errorName); PyDict_SetItemString(dict, "error", ui_module_error); ! PyObject *copyright = PyString_FromString("Copyright 1994-2004 Mark Hammond (mha...@sk...)"); PyDict_SetItemString(dict, "copyright", copyright); Py_XDECREF(copyright); |
From: Mark H. <mha...@us...> - 2004-04-11 04:54:56
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25041 Modified Files: readme.htm Log Message: Bring a few of the readmes into this century. Index: readme.htm =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/readme.htm,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** readme.htm 5 Oct 2002 02:36:41 -0000 1.13 --- readme.htm 11 Apr 2004 04:41:21 -0000 1.14 *************** *** 20,27 **** <h3>Recent Changes</h3> ! <ul> ! <li>makepy generation 'for demand' has been fixed, particularly when using ! events</li> <li>Unexpected exceptions in Python COM objects will generally now dump the exception and traceback to stdout. This is useful for debugging --- 20,47 ---- <h3>Recent Changes</h3> ! <h4>win32com.shell</h4> ! The shell interfaces have undergone a number of enhancements and changes. ! A couple of methods have changed signature between the first build with shell support (200) and later builds. ! SHGetFileInfo was broken in its result handling, so had to be changed - this ! is the only function used by the samples that changed, but others not used by the samples also have changed. ! These shell interfaces are now generally stable. ! <h4>New win32com.taskscheduler module</h4> ! Roger Uploe has contribted an interface to the Windows task scheduler. This is actually very neat, and it allows ! Python to edit the task list as shown by Windows Control Panel. Property page suppport may even appear later, ! now that the win32 library has the new win32rcparser module. ! <h4>ActiveX Scripting </h4> ! ! <p>Python only supports "trusted" execution hosts - thus, it will no longer work ! as an engine inside IE (Python itself no longer has a restricted execution environment). ! Python continues to work fine as an Active Scripting Engine in all other ! applications, including Windows Scripting Host, and ASP. ! ! <p>There is also support for Python as an ActiveX Scripting Host.</p> ! ! <p>Active Debugging seems to be fully functional.</p> ! ! <h4>Older stuff</h4> <ul> ! </li> <li>Unexpected exceptions in Python COM objects will generally now dump the exception and traceback to stdout. This is useful for debugging *************** *** 35,274 **** Outlook Addin<br> </li> ! <li><b>Potential Breakage</b>: makepy supported objects should now support ! named parameters correctly. However, previously if there was a ByRef ! param not marked as optional, it could still often be omitted. This ! param may now need to be supplied (depending on the implementation - ! it is true for VB implemented objects)<br> ! </li> ! </ul> ! <h4>win32all-147/8</h4> ! <ul> ! <li>ActiveScripting bugs with ASP should have been fixed, including the ! dreaded <i>KeyboardInterrupt</i> problem. ASP should also be much faster ! second and subsequent loads of a page.<br> ! </li> ! <li>ActiveScripting now correctly registers all type libraries. This means ! that all ActiveScripting global variables should be using makepy supported ! early-bound objects.</li> ! <li>Dynamic dispatch objects now have a method <i>_FlagAsMethod,</i> which ! allows you to 'declare' that certain attribute names are actually methods ! rather than properties. This is used for some objects that don't otherwise ! allow you to call these methods due to problems in their implementation. ! OpenOffice is one such program. For example, you may call <i>ob._FlagAsMethod("AMethod")</i>, ! after which calling <i>ob.AMethod()</i> will work correctly.</li> ! ! </ul> ! ! <h4>win32all-143</h4> ! ! <p>ActiveScripting inside IE has been disabled by default. This is ! due to a <a ! href="http://starship.python.net/crew/mhammond/win32/PrivacyProblem.html">privacy ! concern</a> discovered in the engine. If you wish to re-enable this ! feature, you must execute:<br> ! <code>z:\> win32comext\axscript\client\pyscript_rexec.py</code></p> ! ! <h4>win32all-142</h4> ! ! <p>Build for Python 2.2. Note that ActiveDebugging will not work in this ! release - you will not be able to debug Python programs using the Microsoft ! Debuggers inside ActiveScripting apps (such as IE, ASP)</p> ! ! <h4>win32all-136/ActivePython 2.1</h4> ! ! <p>Universal gateway has arrived! You can now implement arbitrary vtable ! based interfaces, as long as they are defined in a type-library (and even ! if not if you bonkers :-). You simply add one extra statement to your ! COM server nominating the typelibrary with the interface. Your PythonCOM ! server then can list the interfaces in that typelibrary by name in _com_interfaces_. ! Note that you must still have _public_methods_, but it need not specify named ! vtable interface methods - ie, in most cases this list will be empty. ! See win32com\servers\test_pycomtest.py for an example. (Note the intent ! is for the list of interfaces passed to universal.RegisterInterfaces() will ! be optional)</p> ! ! <h4>win32all-133 changes</h4> ! ! <p>Bug fixes! We now have an option to honour the hidden attribute ! on objects. This currently defaults to off, so nothing should break.</p> ! ! <h4>win32all-130-132 changes</h4> ! ! <p>Bug fixes. Structures can be created quite simply, using <i>win32com.client.Record()</i> ! - see its docstring for details.</p> ! ! <p>See also the <a href="#OlderChanges">older changes</a>.</p> ! ! <h3>ActiveX Scripting </h3> ! ! <p>This release contains full support for Python as an ActiveX Scripting ! Engine and Host. Check out the <a ! href="../win32comext/axscript/demos/client/ie/demo.htm">ActiveX Scripting ! Demos</a> (which includes information on registering the engine)</p> ! ! <p>There is also support for Python as an ActiveX Scripting Host.</p> ! ! <p>Active Debugging seems to be fully functional.</p> ! ! <h3>Known bugs and problems...</h3> ! ! <p>Certain servers may hang at shutdown if all COM client objects not released ! - notably, MSOffice. Eg, if a Python program that is talking to excel raises ! an exception and exits, the Python program will be hung. There are no known ! leaks in win32com, but there is also no attempt at automatic object cleanup. ! All standard Python caveats about references apply! Note this is a "feature" ! of COM, and not a bug in win32com. You can use the function <i>pythoncom._GetInterfaceCount()</i> ! to determine how many COM objects are held by Python as your program terminates ! - this should return zero.</p> ! ! <h3><a name="OlderChanges">Even Older Changes</a></h3> ! ! <h4>win32all-129 changes</h4> ! ! <p>We now have complete support for COM structures. To take advantage ! of this, you need a late version of COM (Windows 2000, 98, Windows 95 with ! DCOM95 1.2, or Window NT 4.0 with Service Pack 4). You can receive ! structures from any COM object, and reference the structure's elements by ! name (eg,<i>struct.int_val</i>). Once you have a structure, you can ! pass it to any other function, but currently there is no simple way to create ! Record objects in Python. Records work with or without makepy support ! for an object.</p> ! ! <p>We support demand-building of <i>makepy</i> files. When a <i>makepy</i> ! file is built in this way, instead of a single file being generated in the ! gencache, a Python package is created. In the package <i>__init__</i> ! file is all the information you would normally find in a <i>makepy</i> file, ! except for the classes! As an object is needed at runtime, <i>makepy</i> ! is run again to generate only the specific class requested, into a separate ! file in the package. This has significant advantages when loading huge ! type libraries - you get all the benefits of <i>makepy</i>, but don't have ! to suffer the huge delay running <i>makepy</i>. Indeed, there are some ! type libraries that are too large to run <i>makepy</i> at all - this solves ! that problem.</p> ! ! <p>This new demand-building feature is not enabled by default - you must ! run<i>makepy -d</i>, or specify the new <i>bForDemand</i> parameter to the ! <i>gencache</i>functions. It is expected that in the future the existing ! code will be dropped in favour of this package mechanism (although we will ! always retain the option to generate the entire package at the start, as ! <i>makepy</i>does now)</p> ! ! <p><i>makepy</i> generated code should be even faster now - many of the run-time ! type conversions that the previous version performed have been optimized ! away (<i>makepy</i> already knows the return type of many functions - there ! was no need for it to check these types at runtime)</p> ! ! <h4>win32all-128 changes</h4> ! ! <p>We now have events working pretty well.<span style=""> </span>NOTE:<span ! style=""> </span>This is still experimental – all feedback appreciated. ! <span style=""> </span>See the docstring for <i>win32com.client.DispatchWithEvents</i> ! and <i>win32com\test\testMSOfficeEvents.py</i> for more details and samples.</p> ! ! <p>Active Debugging support improved again.</p> ! ! <h4>win32all-127 fixes (includes win32all-126).</h4> ! ! <p>All Arrays of VARIANT's of type VT_UI1 are now converted to a <i>buffer</i> ! object rather than the previous list of integers. In addition, a <i>buffer</i> ! object can be passed to COM and an array of type VT_UI1 will be created. ! This type is often used when passing raw binary data, and this change is ! far more efficient for large data sets. For example, if you have a string ! or array.array object holding binary data, you can use the <i>buffer()</i> ! built-in on the object to create a buffer object that will force the new ! behaviour.<b>Note</b>: This may break some code that uses arrays of this ! type, but after much soul-searching it was decided this new behaviour is ! worth the pain.</p> ! ! <p>A bug that caused the Active Scripting implementation to die has been ! fixed. (Specifically, the implementation of to <i>IActiveScript::AddTypeLib()</i> ! was buggy)</p> ! ! <p>Active Scripting bug when using IE5 fixed (it has a method called "print" ! which messed us up)</p> ! ! <p>Error handling when setting erroneous properties on COM objects fixed. ! There were cases where errors would not be reported.</p> ! ! <p>Threading bug that was exposed when using MTS has been fixed. Minor (but ! regular) memory leak plugged. Can now run for (nearly :-) ever under MTS ! with huge thread numbers.</p> ! ! <p>makepy has better support for objects that expose multiple IDispatch interfaces, ! Also sorts the list of type-libraries correctly, and hides libraries marked ! as hidden.</p> ! ! <p>COM now supports byref date arguments.</p> ! ! <h4>win32all-125 fixes.</h4> ! ! <p>Better support for DCOM via <code>win32com.client.DispathEx(progId, machineName=None, ! …)</code>. Small DCOM demo in <i>win32com\test\testDCOM.py</i>.</p> ! ! <p>Registration of COM servers has been made a little simpler, and the QuickStart ! has been changed to reflect this. Classes no longer need <i>_reg_class_spec_</i> ! or <i>_reg_desc_</i> attributes - the registration process now provides sensible ! defaults. Also note that if <i>_reg_class_spec_</i> is not specified, the ! PythonPath will also be modified when your server is loaded - this prevents ! the common problem of not having your COM server on the PythonPath. Note ! that if <i>_reg_class_spec_</i> is specified, the original behaviour remains ! - you must ensure the path is correct yourself.</p> ! ! <p>Type information has been upgraded. The Pythoncom core is now capable ! of creating COM Type Libraries. All left remaining is some Python programming, ! so expect this soon.</p> ! ! <p>Robin Becker has dramatically increased the speed of COM accessing certain ! objects (notably MSOffice) when not using <i>makepy</i>.</p> ! ! <h4>Build 123 and earlier changes.</h4> ! ! <p>Active Debugging should now be <b><i>nearly</i></b> capable of debugging ! stand-alone Python scripts.<br> ! Note that to use this feature you will need an Active Scripting debugger ! installed. Visual Interdev version 6 is one such debugger, or a free debugger ! can be found at <a href="http://msdn.microsoft.com/scripting">http://msdn.microsoft.com/scripting</a><br> ! To debug Python scripts, use the following commands:</p> ! ! <pre>from win32com.axscript import debugger<br>debugger.Break()</pre> ! ! <p>This currently has some problems – most notable is that modules imported ! after debugging has commenced does not work. It also occasionally crashes ! :-( So maybe using it isn't such a good idea after all :-)</p> ! ! <h4>Even older Changes</h4> ! ! <p>Active Debugging support has been improved greatly, and some bugs in Active ! Scripting have been resolved. Python scripts are fully debugging from MSIE, ! WSH, etc (havent tested ASP :-( Please let me know of any problems.)</p> ! ! <p>Couple of minor interfaces added. <i>win32com.shell.shell</i> has been ! filled out some more.</p> ! ! <p><i>pythoncom.CoUninitialize()</i> is no longer called automatically at ! shutdown. This seems to fix more problems than it causes, but if your COM ! program is hanging at shutdown, try adding an explicit call to this method ! just before you exit.</p> ! ! <p>Regressed back to the default COM threading model being "Apartment", as ! defaulting to "Free Threading" seems to break so many clients. <i>sys.coinit_flags</i> ! still allows you to dictate the behaviour before <i>pythoncom</i> is imported ! for the first time.</p> ! ! <p><i>makepy</i> generated files now have much better support for default ! values for arguments. Also attempted to remove some hacks related to "interface" ! descriptions in IDL file. Nothing should break, and my (now comprehensive) ! test suite runs to completion, but let me know of any problems with weird, ! custom IDL files.</p> ! ! <p>More changes to <i>makepy</i> to better support COM Constants. All external ! COM constants (eg, MSWord related constants) should now be available in<i>win32com.client.constants</i>. ! No old code should break, but in the future the "old style" of using COM ! constants will be removed. <a href="html/QuickStartClientCom.html">This is ! all documented in the Client Side Quick Start documentation</a>. Also made ! a few minor changes to the<i>bGuiProgress</i> param.</p> ! <br> ! <br> ! <br> </body> </html> --- 55,59 ---- Outlook Addin<br> </li> ! </body> </html> |
From: Mark H. <mha...@us...> - 2004-04-11 04:54:56
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25041/test Modified Files: readme.txt Log Message: Bring a few of the readmes into this century. Index: readme.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/readme.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** readme.txt 1 Sep 1999 23:04:51 -0000 1.1 --- readme.txt 11 Apr 2004 04:41:21 -0000 1.2 *************** *** 2,7 **** --------------------- - This is not for the feint hearted! - Running the test suite: ----------------------- --- 2,5 ---- *************** *** 12,39 **** to execute more tests. ! Requirements: ! ------------- ! ! There are various requirements for running the test suite. If you ! do not meet some of the requirements, and the test suite fails in ! a horrible way, then please feel free to patch the test suite so it ! fails "elegantly" :-) ! ! Requirements (put together by Greg recently, and he may hage missed a few :-) ! * Python.Interpreter and Python.dictionary be registered. ! (in win32com\servers directory) ! ! * The COM test Suite be built. This consists of: ! - Building the C++ Test Project ! - Building the VB DLL, and using "regsvr32" on it to register it. ! ! * Registry be correctly set so that "import win32com.axscript.axscript" ! suceeds. If you built from sources, this may involve setting the ! "BuildPath" subkey under PythonPath\win32com ! ! * Windows Scripting Host and Scriptlets be installed. ! See http://msdn.microsoft.com/scripting ! ! * Microsoft Office and Microsoft Exchange be installed ! for "level 2" testing. --- 10,18 ---- to execute more tests. ! In general, this should just run the best it can, utilizing what is available ! on the machine. It is likely some tests will refuse to run due to objects not ! being locally available - this is normal. + The win32com source tree has source code to a C++ and VB component used purely + for testing. You may like to build and register these, particularly if you + are doing anything related to argument/result handling. |
From: Mark H. <mha...@us...> - 2004-04-11 04:39:11
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22912 Modified Files: shell_view.py Log Message: Update for the new SHGetFileInfo result Index: shell_view.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers/shell_view.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** shell_view.py 25 Nov 2003 02:02:47 -0000 1.4 --- shell_view.py 11 Apr 2004 04:25:36 -0000 1.5 *************** *** 181,185 **** typ, name = pidl.split('\0') flags = shellcon.SHGFI_ATTRIBUTES ! info = shell.SHGetFileInfo(name, 0, flags) hIcon, iIcon, dwAttr, name, typeName = info # All our items, even files, have sub-items --- 181,185 ---- typ, name = pidl.split('\0') flags = shellcon.SHGFI_ATTRIBUTES ! rc, info = shell.SHGetFileInfo(name, 0, flags) hIcon, iIcon, dwAttr, name, typeName = info # All our items, even files, have sub-items |
From: Mark H. <mha...@us...> - 2004-04-10 05:33:21
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30781 Modified Files: Python and Extensions.dsw Log Message: Add the new taskscheduler package Index: Python and Extensions.dsw =================================================================== RCS file: /cvsroot/pywin32/pywin32/Python and Extensions.dsw,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Python and Extensions.dsw 29 Nov 2003 07:03:08 -0000 1.15 --- Python and Extensions.dsw 10 Apr 2004 05:19:56 -0000 1.16 *************** *** 469,472 **** --- 469,484 ---- ############################################################################### + Project: "taskscheduler"=.\com\taskscheduler.dsp - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ + }}} + + ############################################################################### + Project: "timer"=.\win32\timer.dsp - Package Owner=<4> |
From: Mark H. <mha...@us...> - 2004-04-10 05:32:45
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30643 Modified Files: setup_win32all.py Log Message: Fix slight confusion caused by 2 service related projects being built from the same source file. Ass taskscheduler module Index: setup_win32all.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup_win32all.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** setup_win32all.py 7 Feb 2004 09:55:11 -0000 1.14 --- setup_win32all.py 10 Apr 2004 05:19:20 -0000 1.15 *************** *** 436,441 **** for undef in ext.undef_macros: macros.append((undef,)) # 2.2 has no 'depends' param. ! kw = {'output_dir': self.build_temp, 'macros': macros, 'include_dirs': ext.include_dirs, --- 436,447 ---- for undef in ext.undef_macros: macros.append((undef,)) + # Note: custom 'output_dir' needed due to servicemanager.pyd and + # pythonservice.exe being built from the same .cpp file - without + # this, distutils gets confused, as they both try and use the same + # .obj. + output_dir = os.path.join(self.build_temp, ext.name) + print "OD is", output_dir # 2.2 has no 'depends' param. ! kw = {'output_dir': output_dir, 'macros': macros, 'include_dirs': ext.include_dirs, *************** *** 481,485 **** "executable", objects, ext_filename, **kw) ! def build_extension(self, ext): # It is well known that some of these extensions are difficult to --- 487,492 ---- "executable", objects, ext_filename, **kw) ! ! def build_extension(self, ext): # It is well known that some of these extensions are difficult to *************** *** 556,559 **** --- 563,569 ---- extra = self.debug and "_d.exe" or ".exe" return r"win32\win32popenWin9x" + extra + elif name.endswith("win32.pythonservice"): + extra = self.debug and "_d.exe" or ".exe" + return r"win32\pythonservice" + extra elif name.endswith("pythonwin.Pythonwin"): extra = self.debug and "_d.exe" or ".exe" *************** *** 765,769 **** EDKMAPI mapi32 version""", extra_link_args=["/nodefaultlib:libc"]), ! WinExt_win32com('shell', libraries='shell32', pch_header="shell_pch.h") ] --- 775,780 ---- EDKMAPI mapi32 version""", extra_link_args=["/nodefaultlib:libc"]), ! WinExt_win32com('shell', libraries='shell32', pch_header="shell_pch.h"), ! WinExt_win32com('taskscheduler', libraries='mstask'), ] *************** *** 779,782 **** --- 790,798 ---- WinExt_win32("win32popenWin9x", libraries = "user32"), + WinExt_win32("pythonservice", + dsp_file = "win32/PythonService EXE.dsp", + extra_compile_args = ['-DUNICODE', '-D_UNICODE', '-DWINNT'], + extra_link_args=["/SUBSYSTEM:CONSOLE"], + libraries = "user32 advapi32 ole32 shell32"), WinExt_pythonwin("Pythonwin", extra_link_args=["/SUBSYSTEM:WINDOWS"]), ] *************** *** 895,898 **** --- 911,915 ---- 'win32comext.internet', 'win32comext.axcontrol', + 'win32comext.taskscheduler', 'pythonwin.pywin', |
From: Mark H. <mha...@us...> - 2004-04-10 05:32:08
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30440/win32comext/taskscheduler/src Added Files: PyIScheduledWorkItem.cpp PyIScheduledWorkItem.h PyITask.cpp PyITask.h PyITaskScheduler.cpp PyITaskScheduler.h PyITaskTrigger.cpp PyITaskTrigger.h taskscheduler.cpp Log Message: Add a module for the TaskScheduler interfaces - from Roger Upole --- NEW FILE: PyITaskTrigger.cpp --- // This file implements the ITaskTrigger Interface for Python. // Generated by makegw.py #include "PyITaskTrigger.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyITaskTrigger::PyITaskTrigger(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyITaskTrigger::~PyITaskTrigger() { } /* static */ ITaskTrigger *PyITaskTrigger::GetI(PyObject *self) { return (ITaskTrigger *)PyIUnknown::GetI(self); } // @pymethod |PyITaskTrigger|SetTrigger|Set trigger parameters from a PyTASK_TRIGGER object PyObject *PyITaskTrigger::SetTrigger(PyObject *self, PyObject *args) { ITaskTrigger *pITT = GetI(self); if ( pITT == NULL ) return NULL; PyObject *obtt; if ( !PyArg_ParseTuple(args, "O:PyITaskTrigger::SetTrigger",&obtt)) return NULL; if (!PyTASK_TRIGGER_check(obtt)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITT->SetTrigger(&((PyTASK_TRIGGER *)obtt)->task_trigger); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pITT, IID_ITaskTrigger ); Py_INCREF(Py_None); return Py_None; } // @pymethod <o PyTASK_TRIGGER>|PyITaskTrigger|GetTrigger|Retrieves trigger parms as a PyTASK_TRIGGER object PyObject *PyITaskTrigger::GetTrigger(PyObject *self, PyObject *args) { TASK_TRIGGER tt; ITaskTrigger *pITT = GetI(self); if ( pITT == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":PyITaskTrigger::GetTrigger")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITT->GetTrigger(&tt); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr, pITT, IID_ITaskTrigger); return new PyTASK_TRIGGER(&tt); } // @pymethod <o PyUnicode>|PyITaskTrigger|GetTriggerString|Build text summary of trigger PyObject *PyITaskTrigger::GetTriggerString(PyObject *self, PyObject *args) { PyObject *ret=NULL; ITaskTrigger *pITT = GetI(self); if ( pITT == NULL ) return NULL; LPWSTR TriggerString; if ( !PyArg_ParseTuple(args, ":PyITaskTrigger::GetTriggerString")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITT->GetTriggerString(&TriggerString); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) ret=PyCom_BuildPyException(hr, pITT, IID_ITaskTrigger); else ret=PyWinObject_FromWCHAR(TriggerString); CoTaskMemFree(TriggerString); return ret; } // @object PyITaskTrigger|Description of the interface static struct PyMethodDef PyITaskTrigger_methods[] = { { "SetTrigger", PyITaskTrigger::SetTrigger, 1 }, // @pymeth SetTrigger|Set trigger parameters from a PyTASK_TRIGGER object { "GetTrigger", PyITaskTrigger::GetTrigger, 1 }, // @pymeth GetTrigger|Retrieves trigger parms as a PyTASK_TRIGGER object { "GetTriggerString", PyITaskTrigger::GetTriggerString, 1 }, // @pymeth GetTriggerString|Build text summary of trigger { NULL } }; PyComTypeObject PyITaskTrigger::type("PyITaskTrigger", &PyIUnknown::type, sizeof(PyITaskTrigger), PyITaskTrigger_methods, GET_PYCOM_CTOR(PyITaskTrigger)); static struct PyMethodDef PyTASK_TRIGGER_methods[] = { { NULL } }; #define OFF(e) offsetof(PyTASK_TRIGGER, e) static struct PyMemberDef PyTASK_TRIGGER_members[] = { {"Reserved1", T_USHORT, OFF(task_trigger.Reserved1), 0, "Reserved, do not use"}, {"Reserved2", T_USHORT, OFF(task_trigger.Reserved2), 0, "Reserved, do not use"}, {"BeginYear", T_USHORT, OFF(task_trigger.wBeginYear), 0, NULL}, {"BeginMonth", T_USHORT, OFF(task_trigger.wBeginMonth), 0, NULL}, {"BeginDay", T_USHORT, OFF(task_trigger.wBeginDay), 0, NULL}, {"EndYear", T_USHORT, OFF(task_trigger.wEndYear), 0, NULL}, {"EndMonth", T_USHORT, OFF(task_trigger.wEndMonth), 0, NULL}, {"EndDay", T_USHORT, OFF(task_trigger.wEndDay), 0, NULL}, {"StartHour", T_USHORT, OFF(task_trigger.wStartHour), 0, NULL}, {"StartMinute", T_USHORT, OFF(task_trigger.wStartMinute), 0, NULL}, {"MinutesDuration", T_ULONG, OFF(task_trigger.MinutesDuration), 0, NULL}, {"MinutesInterval", T_ULONG, OFF(task_trigger.MinutesInterval), 0, NULL}, {"RandomMinutesInterval", T_USHORT, OFF(task_trigger.wRandomMinutesInterval), 0, NULL}, {"Flags", T_ULONG, OFF(task_trigger.rgFlags), 0, "Combination of TASK_TRIGGER_FLAG_HAS_END_DATE,TASK_TRIGGER_FLAG_KILL_AT_DURATION_END,TASK_TRIGGER_FLAG_DISABLED"}, {"TriggerType", T_ULONG, OFF(task_trigger.TriggerType), 0, "Value from TASK_TRIGGER_TYPE enum:\n" "TASK_TIME_TRIGGER_ONCE,TASK_TIME_TRIGGER_DAILY,\n" "TASK_TIME_TRIGGER_WEEKLY,TASK_TIME_TRIGGER_MONTHLYDATE,\n" "TASK_TIME_TRIGGER_MONTHLYDOW,TASK_EVENT_TRIGGER_ON_IDLE,\n" "TASK_EVENT_TRIGGER_AT_SYSTEMSTART,TASK_EVENT_TRIGGER_AT_LOGON"}, {"Daily_DaysInterval", T_USHORT, OFF(task_trigger.Type.Daily.DaysInterval),0,"TASK_TIME_TRIGGER_DAILY"}, {"Weekly_WeeksInterval", T_USHORT, OFF(task_trigger.Type.Weekly.WeeksInterval),0,"TASK_TIME_TRIGGER_WEEKLY"}, {"Weekly_DaysOfTheWeek", T_USHORT, OFF(task_trigger.Type.Weekly.rgfDaysOfTheWeek),0,"TASK_TIME_TRIGGER_WEEKLY"}, {"MonthlyDate_Days", T_ULONG, OFF(task_trigger.Type.MonthlyDate.rgfDays),0,"TASK_TIME_TRIGGER_MONTHLYDATE"}, {"MonthlyDate_Months", T_USHORT, OFF(task_trigger.Type.MonthlyDate.rgfMonths),0,"TASK_TIME_TRIGGER_MONTHLYDATE"}, {"MonthlyDOW_WhichWeek", T_USHORT, OFF(task_trigger.Type.MonthlyDOW.wWhichWeek),0,"Only used for TASK_TIME_TRIGGER_MONTHLYDOW"}, {"MonthlyDOW_DaysOfTheWeek", T_USHORT, OFF(task_trigger.Type.MonthlyDOW.rgfDaysOfTheWeek),0,"Only used for TASK_TIME_TRIGGER_MONTHLYDOW"}, {"MonthlyDOW_Months", T_USHORT, OFF(task_trigger.Type.MonthlyDOW.rgfMonths),0,"Only used for TASK_TIME_TRIGGER_MONTHLYDOW"}, {NULL} }; static PyTypeObject PyTASK_TRIGGERType = { PyObject_HEAD_INIT(&PyType_Type) 0, "PyTASK_TRIGGER", sizeof(PyTASK_TRIGGER), 0, PyTASK_TRIGGER::deallocFunc, 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, // PyTASK_TRIGGER::getattro, PyObject_GenericSetAttr, // PyTASK_TRIGGER::setattro, 0, // tp_as_buffer; Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags; 0, // tp_doc; /* Documentation string */ 0, // traverseproc tp_traverse; 0, // tp_clear; 0, // tp_richcompare; 0, // tp_weaklistoffset; 0, // tp_iter 0, // iternextfunc tp_iternext PyTASK_TRIGGER_methods, PyTASK_TRIGGER_members }; PyTASK_TRIGGER::PyTASK_TRIGGER(PTASK_TRIGGER ptt) { ob_type = &PyTASK_TRIGGERType; task_trigger=*ptt; task_trigger.cbTriggerSize=sizeof(TASK_TRIGGER); _Py_NewReference(this); } PyTASK_TRIGGER::PyTASK_TRIGGER(void) { ob_type = &PyTASK_TRIGGERType; // ob_type->tp_members=PyTASK_TRIGGER::memberdef; ZeroMemory(&task_trigger,sizeof(TASK_TRIGGER)); task_trigger.cbTriggerSize=sizeof(TASK_TRIGGER); _Py_NewReference(this); } PyTASK_TRIGGER::~PyTASK_TRIGGER() { } BOOL PyTASK_TRIGGER_check(PyObject *ob) { if (ob->ob_type!=&PyTASK_TRIGGERType){ PyErr_SetString(PyExc_TypeError,"Object must be a PyTASK_TRIGGER"); return FALSE; } return TRUE; } void PyTASK_TRIGGER::deallocFunc(PyObject *ob) { delete (PyTASK_TRIGGER *)ob; } --- NEW FILE: PyITaskScheduler.h --- // This file declares the ITaskScheduler Interface for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration #include "mstask.h" #include "PythonCOM.h" class PyITaskScheduler : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyITaskScheduler); static ITaskScheduler *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *SetTargetComputer(PyObject *self, PyObject *args); static PyObject *GetTargetComputer(PyObject *self, PyObject *args); static PyObject *Enum(PyObject *self, PyObject *args); static PyObject *Activate(PyObject *self, PyObject *args); static PyObject *Delete(PyObject *self, PyObject *args); static PyObject *NewWorkItem(PyObject *self, PyObject *args); static PyObject *AddWorkItem(PyObject *self, PyObject *args); static PyObject *IsOfType(PyObject *self, PyObject *args); protected: PyITaskScheduler(IUnknown *pdisp); ~PyITaskScheduler(); }; --- NEW FILE: PyITaskScheduler.cpp --- // This file implements the ITaskScheduler Interface for Python. // Generated by makegw.py #include "PyITaskScheduler.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation BOOL wchar_input_noneok(PyObject *ob, WCHAR **ppwchar) { return PyWinObject_AsWCHAR(ob,ppwchar,TRUE); } BOOL wchar_input_nonenotok(PyObject *ob, WCHAR **ppwchar) { return PyWinObject_AsWCHAR(ob,ppwchar,FALSE); } PyITaskScheduler::PyITaskScheduler(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyITaskScheduler::~PyITaskScheduler() { } /* static */ ITaskScheduler *PyITaskScheduler::GetI(PyObject *self) { return (ITaskScheduler *)PyIUnknown::GetI(self); } // @pymethod |PyITaskScheduler|SetTargetComputer|Connect to another machine to manage its tasks PyObject *PyITaskScheduler::SetTargetComputer(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; // @pyparm <o unicode>|Computer||Name of system to connect to LPWSTR Computer; if ( !PyArg_ParseTuple(args, "O&:PyITaskScheduler::SetTargetComputer", wchar_input_nonenotok, &Computer) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITS->SetTargetComputer(Computer); PyWinObject_FreeWCHAR(Computer); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler ); Py_INCREF(Py_None); return Py_None; } // @pymethod <o unicode>|PyITaskScheduler|GetTargetComputer|Returns name of computer that the Task Scheduler is connected to PyObject *PyITaskScheduler::GetTargetComputer(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; PyObject *ret=NULL; HRESULT hr = NULL; WCHAR *Computer=NULL; if ( !PyArg_ParseTuple(args, ":PyITaskScheduler::GetTargetComputer")) return NULL; PY_INTERFACE_PRECALL; hr = pITS->GetTargetComputer(&Computer); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler ); else ret=PyWinObject_FromWCHAR(Computer); if (Computer!=NULL) CoTaskMemFree(Computer); return ret; } // @pymethod <o PyUnicode>,...|PyITaskScheduler|Enum|Retrieve list of task names PyObject *PyITaskScheduler::Enum(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; if (!PyArg_ParseTuple(args, ":PyITaskScheduler::Enum")) return NULL; PyObject *task_name_obj=NULL, *ret_list=NULL; HRESULT hr = S_OK; IEnumWorkItems *pIEnumWorkItems; ULONG ulTasksToGet=10, ulActualTasksRetrieved=0, task_ind=0; LPWSTR *task_names=NULL; PY_INTERFACE_PRECALL; // create an enumerator hr = pITS->Enum(&pIEnumWorkItems); if (FAILED(hr)){ PyWin_SetAPIError("PyITaskScheduler::Enum",hr); return NULL; } ret_list = PyList_New(0); if (ret_list==NULL) return NULL; // loop over all tasks do{ hr = pIEnumWorkItems->Next(ulTasksToGet, &task_names, &ulActualTasksRetrieved); if (FAILED(hr)){ PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler ); Py_DECREF(ret_list); ret_list=NULL; break; } for (task_ind=0;task_ind<ulActualTasksRetrieved;task_ind++){ task_name_obj = PyWinObject_FromWCHAR(task_names[task_ind]); PyList_Append(ret_list,task_name_obj); Py_DECREF(task_name_obj); CoTaskMemFree(task_names[task_ind]); } CoTaskMemFree(task_names); } while(hr==S_OK); if(pIEnumWorkItems){ pIEnumWorkItems->Release(); pIEnumWorkItems = NULL; } PY_INTERFACE_POSTCALL; return ret_list; } // @pymethod <o PyITask>|PyITaskScheduler|Activate|Opens the specified task and returns an ITask interface for it PyObject *PyITaskScheduler::Activate(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; // @pyparm <o unicode>|Name||Name of task to retreive // @pyparm <o PyIID>|riid||IID to return, currently only IID_ITask accepted PyObject *obtask_name=NULL, *obriid=NULL; LPWSTR task_name; IID riid=IID_ITask; IUnknown* pUnk; if (!PyArg_ParseTuple(args, "O|O:PyITaskScheduler::Activate", &obtask_name, &obriid) ) return NULL; if (obriid!=NULL) if (!PyWinObject_AsIID(obriid, &riid)) return NULL; if (!PyWinObject_AsWCHAR(obtask_name, &task_name, FALSE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITS->Activate(task_name, riid, &pUnk); PyWinObject_FreeWCHAR(task_name); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler ); return PyCom_PyObjectFromIUnknown(pUnk, riid, FALSE); } // @pymethod |PyITaskScheduler|Delete|Delete task by name PyObject *PyITaskScheduler::Delete(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; PyObject *ret=NULL; HRESULT hr = NULL; LPWSTR task_name=NULL; // @pyparm <o unicode>|TaskName||Name of task to delete if (!PyArg_ParseTuple(args,"O&:PyITaskScheduler::Delete", wchar_input_nonenotok, &task_name)) return NULL; PY_INTERFACE_PRECALL; hr = pITS->Delete(task_name); PyWinObject_FreeWCHAR(task_name); PY_INTERFACE_POSTCALL; if (FAILED(hr)) PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler); else{ Py_INCREF(Py_None); ret=Py_None; } return ret; } // @pymethod <o PyITask>|PyITaskScheduler|NewWorkItem|Creates a new task PyObject *PyITaskScheduler::NewWorkItem(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; // @pyparm <o unicode>|TaskName||Name of new task // @pyparm <o PyIID>|rclsid||Class id of work item, currently only CLSID_CTask (defaults if not passed in) // @pyparm <o PyIID>|riid||Interface IID to return, currently only IID_ITask (defaults if not passed in) PyObject *obTaskName=NULL; PyObject *obrclsid=NULL; PyObject *obriid=NULL; LPWSTR TaskName=NULL; IID rclsid=CLSID_CTask, riid=IID_ITask; IUnknown *pUnk; if (!PyArg_ParseTuple(args, "O|OO:NewWorkItem", &obTaskName, &obrclsid, &obriid) ) return NULL; if (obrclsid!=NULL) if (!PyWinObject_AsIID(obrclsid, &rclsid)) return NULL; if (obriid!=NULL) if (!PyWinObject_AsIID(obriid, &riid)) return NULL; if (!PyWinObject_AsWCHAR(obTaskName, &TaskName)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITS->NewWorkItem(TaskName, rclsid, riid, &pUnk ); PyWinObject_FreeWCHAR(TaskName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler); return PyCom_PyObjectFromIUnknown(pUnk, riid, FALSE); } // @pymethod <o PyUnicode>,<o PyITask>|PyITaskScheduler|AddWorkItem|Create a new scheduled task from PyITask object // @comm The PyItask passed in is modified in place and on success is associated with the new task, not the old one PyObject *PyITaskScheduler::AddWorkItem(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; // @pyparm <o unicode>|TaskName||Name of task to be created // @pyparm <o PyITask>|WorkItem||Existing PyITask object LPWSTR TaskName=NULL; IScheduledWorkItem *pISWI=NULL; PyObject *obpISWI=NULL; if (!PyArg_ParseTuple(args, "O&O:PyITaskScheduler::AddWorkItem", wchar_input_nonenotok, &TaskName, &obpISWI)) return NULL; if (!PyCom_InterfaceFromPyObject(obpISWI, IID_IScheduledWorkItem, (void **)&pISWI, FALSE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITS->AddWorkItem(TaskName, pISWI); pISWI->Release(); PyWinObject_FreeWCHAR(TaskName); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler ); Py_INCREF(Py_None); return Py_None; // return PyCom_PyObjectFromIUnknown(pISWI, IID_IScheduledWorkItem, FALSE); } // @pymethod |PyITaskScheduler|IsOfType|Check if named object supports specified interface PyObject *PyITaskScheduler::IsOfType(PyObject *self, PyObject *args) { ITaskScheduler *pITS = GetI(self); if ( pITS == NULL ) return NULL; // @pyparm <o unicode>|Name||Name of object // @pyparm <o PyIID>|riid||Named object is checked that it supports the interface of this IID PyObject *obName=NULL, *obriid=NULL, *ret=NULL; LPWSTR Name=NULL; IID riid; if ( !PyArg_ParseTuple(args, "OO:IsOfType", &obName, &obriid) ) return NULL; if (!PyWinObject_AsIID(obriid, &riid)) return NULL; if (!PyWinObject_AsWCHAR(obName, &Name)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pITS->IsOfType(Name, riid); PyWinObject_FreeWCHAR(Name); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler); if (hr==S_OK) ret=Py_True; else ret=Py_False; Py_INCREF(ret); return ret; } // @object PyITaskScheduler|Interface to the Windows Task Scheduler static struct PyMethodDef PyITaskScheduler_methods[] = { { "SetTargetComputer", PyITaskScheduler::SetTargetComputer, 1 }, // @pymeth SetTargetComputer|Connect to another machine to manage its tasks { "GetTargetComputer", PyITaskScheduler::GetTargetComputer, 1 }, // @pymeth GetTargetComputer|Returns name of computer that the Task Scheduler is connected to { "Enum", PyITaskScheduler::Enum, 1 }, // @pymeth Enum|Retrieve list of task names { "Activate", PyITaskScheduler::Activate, 1 }, // @pymeth Activate|Opens the specified task and returns an ITask interface for it { "Delete", PyITaskScheduler::Delete, 1 }, // @pymeth Delete|Delete task by name { "NewWorkItem", PyITaskScheduler::NewWorkItem, 1 }, // @pymeth NewWorkItem|Creates a new task { "AddWorkItem", PyITaskScheduler::AddWorkItem, 1 }, // @pymeth AddWorkItem|Create a new scheduled task from PyITask object { "IsOfType", PyITaskScheduler::IsOfType, 1 }, // @pymeth IsOfType|Check if named task supports specified interface { NULL } }; PyComTypeObject PyITaskScheduler::type("PyITaskScheduler", &PyIUnknown::type, sizeof(PyITaskScheduler), PyITaskScheduler_methods, GET_PYCOM_CTOR(PyITaskScheduler)); --- NEW FILE: taskscheduler.cpp --- # include "PythonCOM.h" # include "PythonCOMRegister.h" # include "mstask.h" # include "PyITaskScheduler.h" // # include "PyIScheduledWorkItem.h" # include "PyITask.h" # include "PyITaskTrigger.h" static struct PyMethodDef taskscheduler_methods[]= { NULL }; static const PyCom_InterfaceSupportInfo register_data[] = { PYCOM_INTERFACE_CLSID_ONLY ( CTaskScheduler ), PYCOM_INTERFACE_CLIENT_ONLY( TaskScheduler), PYCOM_INTERFACE_CLSID_ONLY ( CTask ), PYCOM_INTERFACE_CLIENT_ONLY( Task ), PYCOM_INTERFACE_CLIENT_ONLY( TaskTrigger ), PYCOM_INTERFACE_CLIENT_ONLY( ScheduledWorkItem ) }; extern "C" __declspec(dllexport) void inittaskscheduler() { PyObject *module; module = Py_InitModule("taskscheduler", taskscheduler_methods); if (module==NULL) return; PyObject *dict = PyModule_GetDict(module); if (dict==NULL) return; // Register all of our interfaces, gateways and IIDs. PyCom_RegisterExtensionSupport(dict, register_data, sizeof(register_data)/sizeof(PyCom_InterfaceSupportInfo)); // trigger types PyModule_AddIntConstant(module,"TASK_TIME_TRIGGER_ONCE", TASK_TIME_TRIGGER_ONCE); PyModule_AddIntConstant(module,"TASK_TIME_TRIGGER_DAILY", TASK_TIME_TRIGGER_DAILY); PyModule_AddIntConstant(module,"TASK_TIME_TRIGGER_WEEKLY", TASK_TIME_TRIGGER_WEEKLY); PyModule_AddIntConstant(module,"TASK_TIME_TRIGGER_MONTHLYDATE", TASK_TIME_TRIGGER_MONTHLYDATE); PyModule_AddIntConstant(module,"TASK_TIME_TRIGGER_MONTHLYDOW", TASK_TIME_TRIGGER_MONTHLYDOW); PyModule_AddIntConstant(module,"TASK_EVENT_TRIGGER_ON_IDLE", TASK_EVENT_TRIGGER_ON_IDLE); PyModule_AddIntConstant(module,"TASK_EVENT_TRIGGER_AT_SYSTEMSTART", TASK_EVENT_TRIGGER_AT_SYSTEMSTART); PyModule_AddIntConstant(module,"TASK_EVENT_TRIGGER_AT_LOGON", TASK_EVENT_TRIGGER_AT_LOGON); // trigger flags PyModule_AddIntConstant(module,"TASK_TRIGGER_FLAG_HAS_END_DATE", TASK_TRIGGER_FLAG_HAS_END_DATE); PyModule_AddIntConstant(module,"TASK_TRIGGER_FLAG_KILL_AT_DURATION_END", TASK_TRIGGER_FLAG_KILL_AT_DURATION_END); PyModule_AddIntConstant(module,"TASK_TRIGGER_FLAG_DISABLED", TASK_TRIGGER_FLAG_DISABLED); // task statuses from msterr.h PyModule_AddIntConstant(module,"SCHED_S_TASK_READY", SCHED_S_TASK_READY); PyModule_AddIntConstant(module,"SCHED_S_TASK_NOT_SCHEDULED", SCHED_S_TASK_NOT_SCHEDULED); PyModule_AddIntConstant(module,"SCHED_S_TASK_RUNNING", SCHED_S_TASK_RUNNING); PyModule_AddIntConstant(module,"SCHED_S_TASK_DISABLED", SCHED_S_TASK_DISABLED); PyModule_AddIntConstant(module,"SCHED_S_TASK_HAS_NOT_RUN", SCHED_S_TASK_HAS_NOT_RUN); PyModule_AddIntConstant(module,"SCHED_S_TASK_NO_MORE_RUNS", SCHED_S_TASK_NO_MORE_RUNS); PyModule_AddIntConstant(module,"SCHED_S_TASK_TERMINATED", SCHED_S_TASK_TERMINATED); PyModule_AddIntConstant(module,"SCHED_S_TASK_NO_VALID_TRIGGERS", SCHED_S_TASK_NO_VALID_TRIGGERS); PyModule_AddIntConstant(module,"SCHED_S_EVENT_TRIGGER", SCHED_S_EVENT_TRIGGER); // error codes from msterr.h PyModule_AddIntConstant(module,"SCHED_E_TRIGGER_NOT_FOUND", SCHED_E_TRIGGER_NOT_FOUND); PyModule_AddIntConstant(module,"SCHED_E_TASK_NOT_READY", SCHED_E_TASK_NOT_READY); PyModule_AddIntConstant(module,"SCHED_E_TASK_NOT_RUNNING", SCHED_E_TASK_NOT_RUNNING); PyModule_AddIntConstant(module,"SCHED_E_SERVICE_NOT_INSTALLED", SCHED_E_SERVICE_NOT_INSTALLED); PyModule_AddIntConstant(module,"SCHED_E_CANNOT_OPEN_TASK", SCHED_E_CANNOT_OPEN_TASK); PyModule_AddIntConstant(module,"SCHED_E_INVALID_TASK", SCHED_E_INVALID_TASK); PyModule_AddIntConstant(module,"SCHED_E_ACCOUNT_INFORMATION_NOT_SET", SCHED_E_ACCOUNT_INFORMATION_NOT_SET); PyModule_AddIntConstant(module,"SCHED_E_ACCOUNT_NAME_NOT_FOUND", SCHED_E_ACCOUNT_NAME_NOT_FOUND); PyModule_AddIntConstant(module,"SCHED_E_ACCOUNT_DBASE_CORRUPT", SCHED_E_ACCOUNT_DBASE_CORRUPT); PyModule_AddIntConstant(module,"SCHED_E_ACCOUNT_DBASE_CORRUPT", SCHED_E_ACCOUNT_DBASE_CORRUPT); PyModule_AddIntConstant(module,"SCHED_E_UNKNOWN_OBJECT_VERSION", SCHED_E_UNKNOWN_OBJECT_VERSION); // priority codes PyModule_AddIntConstant(module,"REALTIME_PRIORITY_CLASS", REALTIME_PRIORITY_CLASS); PyModule_AddIntConstant(module,"HIGH_PRIORITY_CLASS", HIGH_PRIORITY_CLASS); PyModule_AddIntConstant(module,"NORMAL_PRIORITY_CLASS", NORMAL_PRIORITY_CLASS); PyModule_AddIntConstant(module,"IDLE_PRIORITY_CLASS", IDLE_PRIORITY_CLASS); // task flags PyModule_AddIntConstant(module,"TASK_FLAG_INTERACTIVE", TASK_FLAG_INTERACTIVE); PyModule_AddIntConstant(module,"TASK_FLAG_DELETE_WHEN_DONE", TASK_FLAG_DELETE_WHEN_DONE); PyModule_AddIntConstant(module,"TASK_FLAG_DISABLED", TASK_FLAG_DISABLED ); PyModule_AddIntConstant(module,"TASK_FLAG_HIDDEN", TASK_FLAG_HIDDEN); PyModule_AddIntConstant(module,"TASK_FLAG_RUN_ONLY_IF_LOGGED_ON", TASK_FLAG_RUN_ONLY_IF_LOGGED_ON); PyModule_AddIntConstant(module,"TASK_FLAG_START_ONLY_IF_IDLE", TASK_FLAG_START_ONLY_IF_IDLE); PyModule_AddIntConstant(module,"TASK_FLAG_RUN_ONLY_IF_DOCKED", TASK_FLAG_RUN_ONLY_IF_DOCKED); PyModule_AddIntConstant(module,"TASK_FLAG_SYSTEM_REQUIRED", TASK_FLAG_SYSTEM_REQUIRED); PyModule_AddIntConstant(module,"TASK_FLAG_KILL_ON_IDLE_END", TASK_FLAG_KILL_ON_IDLE_END); PyModule_AddIntConstant(module,"TASK_FLAG_RESTART_ON_IDLE_RESUME", TASK_FLAG_RESTART_ON_IDLE_RESUME); PyModule_AddIntConstant(module,"TASK_FLAG_DONT_START_IF_ON_BATTERIES", TASK_FLAG_DONT_START_IF_ON_BATTERIES); PyModule_AddIntConstant(module,"TASK_FLAG_KILL_IF_GOING_ON_BATTERIES", TASK_FLAG_KILL_IF_GOING_ON_BATTERIES); PyModule_AddIntConstant(module,"TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET", TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET); // DOW constants PyModule_AddIntConstant(module,"TASK_SUNDAY", TASK_SUNDAY); PyModule_AddIntConstant(module,"TASK_MONDAY", TASK_MONDAY); PyModule_AddIntConstant(module,"TASK_TUESDAY", TASK_TUESDAY); PyModule_AddIntConstant(module,"TASK_WEDNESDAY", TASK_WEDNESDAY); PyModule_AddIntConstant(module,"TASK_THURSDAY", TASK_THURSDAY); PyModule_AddIntConstant(module,"TASK_FRIDAY", TASK_FRIDAY); PyModule_AddIntConstant(module,"TASK_SATURDAY", TASK_SATURDAY); // month contants PyModule_AddIntConstant(module,"TASK_JANUARY", TASK_JANUARY); PyModule_AddIntConstant(module,"TASK_FEBRUARY", TASK_FEBRUARY); PyModule_AddIntConstant(module,"TASK_MARCH", TASK_MARCH); PyModule_AddIntConstant(module,"TASK_APRIL", TASK_APRIL); PyModule_AddIntConstant(module,"TASK_MAY", TASK_MAY); PyModule_AddIntConstant(module,"TASK_JUNE", TASK_JUNE); PyModule_AddIntConstant(module,"TASK_JULY", TASK_JULY); PyModule_AddIntConstant(module,"TASK_AUGUST", TASK_AUGUST); PyModule_AddIntConstant(module,"TASK_SEPTEMBER", TASK_SEPTEMBER); PyModule_AddIntConstant(module,"TASK_OCTOBER", TASK_OCTOBER); PyModule_AddIntConstant(module,"TASK_NOVEMBER", TASK_NOVEMBER); PyModule_AddIntConstant(module,"TASK_DECEMBER", TASK_DECEMBER); // week nbr constants PyModule_AddIntConstant(module,"TASK_FIRST_WEEK", TASK_FIRST_WEEK); PyModule_AddIntConstant(module,"TASK_SECOND_WEEK", TASK_SECOND_WEEK); PyModule_AddIntConstant(module,"TASK_THIRD_WEEK", TASK_THIRD_WEEK); PyModule_AddIntConstant(module,"TASK_FOURTH_WEEK", TASK_FOURTH_WEEK); PyModule_AddIntConstant(module,"TASK_LAST_WEEK", TASK_LAST_WEEK); } --- NEW FILE: PyITask.cpp --- // This file implements the ITask Interface for Python. // Generated by makegw.py #include "PyITask.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyITask::PyITask(IUnknown *pdisp): PyIScheduledWorkItem(pdisp) { ob_type = &type; } PyITask::~PyITask() { } /* static */ ITask *PyITask::GetI(PyObject *self) { return (ITask *)PyIScheduledWorkItem::GetI(self); } // @pymethod |PyITask|SetApplicationName|Specify which program the task will run PyObject *PyITask::SetApplicationName(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; // @pyparm <o unicode>|ApplicationName||Program to execute PyObject *obpwszApplicationName; LPWSTR pwszApplicationName; if ( !PyArg_ParseTuple(args, "O:SetApplicationName", &obpwszApplicationName) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszApplicationName, &pwszApplicationName)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetApplicationName( pwszApplicationName ); SysFreeString(pwszApplicationName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyITask|GetApplicationName|Retrieve name of program that task will run PyObject *PyITask::GetApplicationName(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; LPWSTR ApplicationName=NULL; PyObject *ret=NULL; if (!PyArg_ParseTuple(args, ":PyITask::GetApplicationName")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->GetApplicationName(&ApplicationName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) PyCom_BuildPyException(hr, pIT, IID_ITask ); else ret=PyWinObject_FromWCHAR(ApplicationName); CoTaskMemFree(ApplicationName); return ret; } // @pymethod |PyITask|SetParameters|Sets command line parameters PyObject *PyITask::SetParameters(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; // @pyparm <o unicode>|Parameters||String containing command line parameters PyObject *obpwszParameters; LPWSTR pwszParameters; if ( !PyArg_ParseTuple(args, "O:SetParameters", &obpwszParameters) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszParameters, &pwszParameters)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetParameters( pwszParameters ); SysFreeString(pwszParameters); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyITask|GetParameters|Returns command line parameters for task PyObject *PyITask::GetParameters(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; LPWSTR Parameters; PyObject *ret=NULL; if (!PyArg_ParseTuple(args, ":PyITask::GetParameters")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->GetParameters(&Parameters); PY_INTERFACE_POSTCALL; if (FAILED(hr)) PyCom_BuildPyException(hr, pIT, IID_ITask); else ret=PyWinObject_FromWCHAR(Parameters); CoTaskMemFree(Parameters); return ret; } // @pymethod |PyITask|SetWorkingDirectory|Sets initial working directory for task PyObject *PyITask::SetWorkingDirectory(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; // @pyparm <o unicode>|WorkingDirectory||Initial working directory PyObject *obpwszWorkingDirectory; LPWSTR pwszWorkingDirectory; if ( !PyArg_ParseTuple(args, "O:SetWorkingDirectory", &obpwszWorkingDirectory) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszWorkingDirectory, &pwszWorkingDirectory)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetWorkingDirectory( pwszWorkingDirectory ); SysFreeString(pwszWorkingDirectory); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyITask|GetWorkingDirectory|Return working directory that the task will start out in PyObject *PyITask::GetWorkingDirectory(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; LPWSTR WorkingDirectory=NULL; PyObject *ret=NULL; if ( !PyArg_ParseTuple(args, ":PyITask::GetWorkingDirectory")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->GetWorkingDirectory(&WorkingDirectory); PY_INTERFACE_POSTCALL; if (FAILED(hr)) PyCom_BuildPyException(hr, pIT, IID_ITask); else ret=PyWinObject_FromWCHAR(WorkingDirectory); CoTaskMemFree(WorkingDirectory); return ret; } // @pymethod |PyITask|SetPriority|Sets priority for task PyObject *PyITask::SetPriority(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; // @pyparm int|Priority||One of REALTIME_PRIORITY_CLASS, HIGH_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, IDLE_PRIORITY_CLASS DWORD dwPriority; if ( !PyArg_ParseTuple(args, "l:SetPriority", &dwPriority) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetPriority( dwPriority ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyITask|GetPriority|Gets priority that will be assigned to process when task starts PyObject *PyITask::GetPriority(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; DWORD dwPriority; if (!PyArg_ParseTuple(args, ":PyITask::GetPriority")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->GetPriority(&dwPriority); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask); return Py_BuildValue("l",dwPriority); } // @pymethod |PyITask|SetTaskFlags|Sets flag for task. PyObject *PyITask::SetTaskFlags(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; // @pyparm int|dwFlags||None currently defined DWORD dwFlags; if ( !PyArg_ParseTuple(args, "l:SetTaskFlags", &dwFlags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetTaskFlags(dwFlags); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyITask|GetTaskFlags|Retrieve task flags (None currently defined) PyObject *PyITask::GetTaskFlags(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; DWORD dwFlags; if ( !PyArg_ParseTuple(args, ":PyITask::GetTaskFlags")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->GetTaskFlags(&dwFlags); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); return Py_BuildValue("l", dwFlags); } // @pymethod |PyITask|SetMaxRunTime|Sets maximun run time for task, use -1 to disable PyObject *PyITask::SetMaxRunTime(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; // @pyparm int|MaxRunTimeMS||Specified in milliseconds (use -1 to disable, not 0) DWORD dwMaxRunTimeMS; if ( !PyArg_ParseTuple(args, "l:SetMaxRunTime", &dwMaxRunTimeMS) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetMaxRunTime( dwMaxRunTimeMS ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyITask|GetMaxRunTime|Returns maximun run time for task PyObject *PyITask::GetMaxRunTime(PyObject *self, PyObject *args) { ITask *pIT = GetI(self); if ( pIT == NULL ) return NULL; DWORD dwMaxRunTimeMS=0; if ( !PyArg_ParseTuple(args, ":PyITask::GetMaxRunTime")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->GetMaxRunTime(&dwMaxRunTimeMS); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIT, IID_ITask); return Py_BuildValue("l",dwMaxRunTimeMS); Py_INCREF(Py_None); return Py_None; } // @object PyITask|Description of the interface static struct PyMethodDef PyITask_methods[] = { { "SetApplicationName", PyITask::SetApplicationName, 1 }, // @pymeth SetApplicationName|Specify which program the task will run { "GetApplicationName", PyITask::GetApplicationName, 1 }, // @pymeth GetApplicationName|Retrieve name of program that task will run { "SetParameters", PyITask::SetParameters, 1 }, // @pymeth SetParameters|Sets command line parameters { "GetParameters", PyITask::GetParameters, 1 }, // @pymeth GetParameters|Returns command line parameters for task { "SetWorkingDirectory", PyITask::SetWorkingDirectory, 1 }, // @pymeth SetWorkingDirectory|Sets initial working directory for task { "GetWorkingDirectory", PyITask::GetWorkingDirectory, 1 }, // @pymeth GetWorkingDirectory|Return working directory that the task will start out in { "SetPriority", PyITask::SetPriority, 1 }, // @pymeth SetPriority|Sets priority for task { "GetPriority", PyITask::GetPriority, 1 }, // @pymeth GetPriority|Gets priority that will be assigned to process when task starts { "SetTaskFlags", PyITask::SetTaskFlags, 1 }, // @pymeth SetTaskFlags|Sets flag for task { "GetTaskFlags", PyITask::GetTaskFlags, 1 }, // @pymeth GetTaskFlags|Retrieve task flags (None currently defined) { "SetMaxRunTime", PyITask::SetMaxRunTime, 1 }, // @pymeth SetMaxRunTime|Sets maximun run time for task, use -1 to disable { "GetMaxRunTime", PyITask::GetMaxRunTime, 1 }, // @pymeth GetMaxRunTime|Returns maximun run time for task { NULL } }; PyComTypeObject PyITask::type("PyITask", &PyIScheduledWorkItem::type, sizeof(PyITask), PyITask_methods, GET_PYCOM_CTOR(PyITask)); --- NEW FILE: PyIScheduledWorkItem.cpp --- // This file implements the IScheduledWorkItem Interface for Python. // Generated by makegw.py #include "PyIScheduledWorkItem.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIScheduledWorkItem::PyIScheduledWorkItem(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIScheduledWorkItem::~PyIScheduledWorkItem() { } /* static */ IScheduledWorkItem *PyIScheduledWorkItem::GetI(PyObject *self) { return (IScheduledWorkItem *)PyIUnknown::GetI(self); } // @pymethod int|PyIScheduledWorkItem|CreateTrigger|Creates a new trigger for a task, returns index and new ITaskTrigger interface PyObject *PyIScheduledWorkItem::CreateTrigger(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; ITaskTrigger *pITT; WORD trig_ind=0; if (!PyArg_ParseTuple(args, ":PyIScheduledWorkItem::CreateTrigger")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->CreateTrigger(&trig_ind, &pITT); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return Py_BuildValue("lN", trig_ind, PyCom_PyObjectFromIUnknown(pITT, IID_ITaskTrigger, FALSE)); } // @pymethod |PyIScheduledWorkItem|DeleteTrigger|Deletes specified trigger PyObject *PyIScheduledWorkItem::DeleteTrigger(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; INT iiTrigger; WORD iTrigger; if ( !PyArg_ParseTuple(args, "i:PyIScheduledWorkItem::DeleteTrigger", &iiTrigger) ) return NULL; //@pyparm int|Trigger||Index of trigger to delete iTrigger = iiTrigger; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->DeleteTrigger( iTrigger ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|GetTriggerCount|Returns number of triggers defined for the task PyObject *PyIScheduledWorkItem::GetTriggerCount(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; WORD wCount=0; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetTriggerCount")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetTriggerCount(&wCount); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); else return Py_BuildValue("i",wCount); } // @pymethod <o PyITaskTrigger>|PyIScheduledWorkItem|GetTrigger|Retrieves ITaskTrigger interface for specified trigger index PyObject *PyIScheduledWorkItem::GetTrigger(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm int|iTrigger||Index of trigger to retrieve INT iiTrigger; WORD iTrigger; ITaskTrigger *pITT; if ( !PyArg_ParseTuple(args, "i:PyIScheduledWorkItem::GetTrigger", &iiTrigger) ) return NULL; iTrigger = iiTrigger; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetTrigger( iTrigger, &pITT); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return PyCom_PyObjectFromIUnknown(pITT, IID_ITaskTrigger, FALSE); } // @pymethod |PyIScheduledWorkItem|GetTriggerString|Creates a human-readable summary of specified trigger PyObject *PyIScheduledWorkItem::GetTriggerString(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; LPWSTR TriggerString; PyObject *ret=NULL; INT iiTrigger; WORD iTrigger; if (!PyArg_ParseTuple(args, "i:PyIScheduledWorkItem::GetTriggerString", &iiTrigger)) return NULL; iTrigger = iiTrigger; ; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetTriggerString( iTrigger, &TriggerString); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem); else ret=PyWinObject_FromWCHAR(TriggerString); CoTaskMemFree(TriggerString); return ret; } // @pymethod |PyIScheduledWorkItem|GetRunTimes|Return specified number of run times within given time frame PyObject *PyIScheduledWorkItem::GetRunTimes(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm int|Count|Number of run times to retrieve // @pyparm <o PyTime>|Begin||Start time, defaults to current time if not passed or None // @pyparm <o PyTime>|End||End time, defaults to unlimited if not passed or None WORD wCount=0, time_ind=0; SYSTEMTIME start_time, end_time; LPSYSTEMTIME run_time=NULL, first_run_time=NULL, lpend_time=NULL; PyObject *ret=NULL, *run_time_obj=NULL; PyObject *obstart_time=NULL, *obend_time=NULL; if (!PyArg_ParseTuple(args, "l|OO:GetRunTimes", &wCount, &obstart_time, &obend_time)) return NULL; if ((obstart_time==NULL)||(obstart_time==Py_None)) GetLocalTime(&start_time); else if (!PyWinObject_AsSYSTEMTIME(obstart_time, &start_time)) return NULL; if ((obend_time!=NULL)&&(obend_time!=Py_None)){ if (!PyWinObject_AsSYSTEMTIME(obend_time, &end_time)) return NULL; lpend_time=&end_time; } HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetRunTimes( &start_time, lpend_time, &wCount, &first_run_time); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); ret = PyTuple_New(wCount); run_time = first_run_time; for (time_ind = 0; time_ind < wCount; time_ind++){ run_time_obj = PyWinObject_FromSYSTEMTIME(*run_time); PyTuple_SetItem(ret, time_ind, run_time_obj); run_time++; } CoTaskMemFree(first_run_time); return ret; } // @pymethod |PyIScheduledWorkItem|GetNextRunTime|Returns next time that task is scheduled to run PyObject *PyIScheduledWorkItem::GetNextRunTime(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; SYSTEMTIME NextRun; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetNextRunTime")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetNextRunTime(&NextRun); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return PyWinObject_FromSYSTEMTIME(NextRun); } // @pymethod |PyIScheduledWorkItem|SetIdleWait|Sets idle parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE PyObject *PyIScheduledWorkItem::SetIdleWait(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm int|wIdleMinutes||Nbr of minutes computer must be idle before task fires // @pyparm int|wDeadlineMinutes||Maximum nbr of minutes task will wait for computer to become idle INT iwIdleMinutes; INT iwDeadlineMinutes; WORD wIdleMinutes; WORD wDeadlineMinutes; if ( !PyArg_ParseTuple(args, "ii:SetIdleWait", &iwIdleMinutes, &iwDeadlineMinutes) ) return NULL; BOOL bPythonIsHappy = TRUE; wIdleMinutes = iwIdleMinutes; wDeadlineMinutes = iwDeadlineMinutes; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetIdleWait( wIdleMinutes, wDeadlineMinutes ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod int,int|PyIScheduledWorkItem|GetIdleWait|Gets IdleMinutes and DeadlineMinutes parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE PyObject *PyIScheduledWorkItem::GetIdleWait(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; HRESULT hr; WORD IdleMinutes=0,DeadlineMinutes=0; PyObject *obIdleMinutes=NULL, *obDeadlineMinutes=NULL; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetIdleWait")) return NULL; PY_INTERFACE_PRECALL; hr = pISWI->GetIdleWait(&IdleMinutes,&DeadlineMinutes ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return Py_BuildValue("ll",IdleMinutes, DeadlineMinutes); } // @pymethod |PyIScheduledWorkItem|Run|Starts task PyObject *PyIScheduledWorkItem::Run(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::Run") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->Run( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|Terminate|Terminate process if task is running PyObject *PyIScheduledWorkItem::Terminate(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::Terminate") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->Terminate( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|EditWorkItem|Brings up standard Scheduled Task dialog PyObject *PyIScheduledWorkItem::EditWorkItem(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm HWND|hParent||Reserved, use 0 if passed // @pyparm int|dwReserved||Reserved, use 0 if passed HWND hParent=NULL; DWORD dwReserved=0; if (!PyArg_ParseTuple(args, "|ll:PyIScheduledWorkItem::EditWorkItem", &hParent, &dwReserved)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->EditWorkItem( hParent, dwReserved ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod <o PyTime>|PyIScheduledWorkItem|GetMostRecentRunTime|Returns last time task ran PyObject *PyIScheduledWorkItem::GetMostRecentRunTime(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; SYSTEMTIME LastRun; if (!PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetMostRecentRunTime")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetMostRecentRunTime(&LastRun ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem); return PyWinObject_FromSYSTEMTIME(LastRun); } // @pymethod int|PyIScheduledWorkItem|GetStatus|Returns status (SCHED_S_TASK... constants) PyObject *PyIScheduledWorkItem::GetStatus(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; HRESULT hr, hrStatus; PY_INTERFACE_PRECALL; hr = pISWI->GetStatus(&hrStatus); PY_INTERFACE_POSTCALL; if ( FAILED(hr)) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return Py_BuildValue("l",hrStatus); } // @pymethod (int,int)|PyIScheduledWorkItem|GetExitCode|Returns tuple of task's exit code and error returned to Task Scheduler if process could not start PyObject *PyIScheduledWorkItem::GetExitCode(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; HRESULT hr=0; DWORD ExitCode=0; if (!PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetExitCode")) return NULL; PY_INTERFACE_PRECALL; // this hr receives the startup error code if task could not start hr = pISWI->GetExitCode(&ExitCode); PY_INTERFACE_POSTCALL; return Py_BuildValue("ll",ExitCode,hr); } // @pymethod |PyIScheduledWorkItem|SetComment|Set comment string for task PyObject *PyIScheduledWorkItem::SetComment(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm <o unicode>|Comment||Freeform comment string PyObject *obpwszComment; LPWSTR pwszComment; if ( !PyArg_ParseTuple(args, "O:SetComment", &obpwszComment) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszComment, &pwszComment)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetComment( pwszComment ); SysFreeString(pwszComment); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod <o PyUnicode>|PyIScheduledWorkItem|GetComment|Return comment string associated with task. PyObject *PyIScheduledWorkItem::GetComment(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; LPWSTR Comment=NULL; PyObject *ret=NULL; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetComment")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetComment(&Comment); PY_INTERFACE_POSTCALL; if (FAILED(hr)) PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem); else ret=PyWinObject_FromWCHAR(Comment); CoTaskMemFree(Comment); return ret; } // @pymethod |PyIScheduledWorkItem|SetCreator|Specify who (or what) created task, can be any string PyObject *PyIScheduledWorkItem::SetCreator(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm <o unicode>|pwszCreator||Description for pwszCreator PyObject *obpwszCreator; LPWSTR pwszCreator; if ( !PyArg_ParseTuple(args, "O:SetCreator", &obpwszCreator) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszCreator, &pwszCreator)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetCreator( pwszCreator ); SysFreeString(pwszCreator); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|GetCreator|Returns creator info, can be any string data PyObject *PyIScheduledWorkItem::GetCreator(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; LPWSTR Creator; PyObject *ret=NULL; if (!PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetCreator")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetCreator(&Creator); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); else ret=PyWinObject_FromWCHAR(Creator); CoTaskMemFree(Creator); return ret; } // @pymethod |PyIScheduledWorkItem|SetWorkItemData|Set data associated with task (treated as uninterpreted bytes) PyObject *PyIScheduledWorkItem::SetWorkItemData(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm string|Data||Character data, treated as uninterpreted bytes BYTE *workitem_data=NULL; WORD data_len=0; PyObject *obworkitem_data=NULL; if ( !PyArg_ParseTuple(args, "O:PyIScheduledWorkItem::SetWorkItemData", &obworkitem_data)) return NULL; if (obworkitem_data!=Py_None) if (PyString_AsStringAndSize(obworkitem_data, (CHAR **)&workitem_data, (int *)&data_len)==-1) return NULL; else // Task Scheduler won't take an empty string for data anymore ?????? if (data_len==0) workitem_data=NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetWorkItemData(data_len, workitem_data); PY_INTERFACE_POSTCALL; if( FAILED(hr)) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod string|PyIScheduledWorkItem|GetWorkItemData|Retrieve data associated with task PyObject *PyIScheduledWorkItem::GetWorkItemData(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; WORD data_len; PyObject *ret=NULL; BYTE *workitem_data; if (!PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetWorkItemData")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetWorkItemData(&data_len, &workitem_data); PY_INTERFACE_POSTCALL; if (FAILED(hr)) PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem); else if (workitem_data!=NULL) ret=PyString_FromStringAndSize((const char *)workitem_data,data_len); else{ Py_INCREF(Py_None); ret=Py_None; } CoTaskMemFree(workitem_data); return ret; } // @pymethod |PyIScheduledWorkItem|SetErrorRetryCount|Specify nbr of times to attempt to run task if it can't start (not currently implemented) PyObject *PyIScheduledWorkItem::SetErrorRetryCount(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm int|wRetryCount||Nbr of attemps to start task INT iwRetryCount; WORD wRetryCount; if ( !PyArg_ParseTuple(args, "i:SetErrorRetryCount", &iwRetryCount) ) return NULL; wRetryCount = iwRetryCount; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetErrorRetryCount( wRetryCount ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|GetErrorRetryCount|Return nbr of times Task scheduler should try to run task (not currently implemented) PyObject *PyIScheduledWorkItem::GetErrorRetryCount(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; WORD wRetryCount; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetErrorRetryCount")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetErrorRetryCount(&wRetryCount); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return Py_BuildValue("l",wRetryCount); } // @pymethod |PyIScheduledWorkItem|SetErrorRetryInterval|Interval in minutes between attempts to run task. Not implemented according to SDK PyObject *PyIScheduledWorkItem::SetErrorRetryInterval(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm int|RetryInterval||Interval in minutes INT iwRetryInterval; WORD wRetryInterval; if ( !PyArg_ParseTuple(args, "i:PyIScheduledWorkItem::SetErrorRetryInterval", &iwRetryInterval) ) return NULL; wRetryInterval = iwRetryInterval; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetErrorRetryInterval( wRetryInterval ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|GetErrorRetryInterval|Returns nbr of minutes between attempts to run task. Not implemented according to SDK PyObject *PyIScheduledWorkItem::GetErrorRetryInterval(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; WORD wRetryInterval=0; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetErrorRetryInterval")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetErrorRetryInterval(&wRetryInterval); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return Py_BuildValue("l",wRetryInterval); } // @pymethod |PyIScheduledWorkItem|SetFlags|Set flags for task PyObject *PyIScheduledWorkItem::SetFlags(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm int|dwFlags||Combination of TASK_FLAG_* constants DWORD dwFlags; if ( !PyArg_ParseTuple(args, "l:PyIScheduledWorkItem::SetFlags", &dwFlags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetFlags( dwFlags ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod int|PyIScheduledWorkItem|GetFlags|Returns flags for task (TASK_FLAG_* constants) PyObject *PyIScheduledWorkItem::GetFlags(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; DWORD dwFlags; if (!PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetFlags")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetFlags(&dwFlags); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); return Py_BuildValue("l",dwFlags); } // @pymethod |PyIScheduledWorkItem|SetAccountInformation|Set username and password under which task will run // @comm On some systems, username and password are verified at the time the task is saved, on others when the task tries to run PyObject *PyIScheduledWorkItem::SetAccountInformation(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; // @pyparm <o unicode>|AccountName||AccountName, use "" for local system account (can only be used by Administrators) // @pyparm <o unicode>|Password||Password - Can be None for local System account, or if TASK_FLAG_RUN_ONLY_IF_LOGGED_ON is set PyObject *obAccountName=NULL, *obPassword=NULL; LPWSTR AccountName=NULL, Password=NULL; if ( !PyArg_ParseTuple(args, "OO:SetAccountInformation", &obAccountName, &obPassword) ) return NULL; if (!PyWinObject_AsWCHAR(obAccountName, &AccountName, FALSE)) return NULL; if (!PyWinObject_AsWCHAR(obPassword, &Password, TRUE)){ PyWinObject_FreeWCHAR(AccountName); return NULL; } HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->SetAccountInformation(AccountName, Password); PyWinObject_FreeWCHAR(AccountName); PyWinObject_FreeWCHAR(Password); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIScheduledWorkItem|GetAccountInformation|Returns username that task will run under PyObject *PyIScheduledWorkItem::GetAccountInformation(PyObject *self, PyObject *args) { IScheduledWorkItem *pISWI = GetI(self); if ( pISWI == NULL ) return NULL; LPWSTR AccountName; PyObject *ret=NULL; if ( !PyArg_ParseTuple(args, ":PyIScheduledWorkItem::GetAccountInformation")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISWI->GetAccountInformation(&AccountName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem); else ret=PyWinObject_FromWCHAR(AccountName); CoTaskMemFree(AccountName); return ret; } // @object PyIScheduledWorkItem|Description of the interface static struct PyMethodDef PyIScheduledWorkItem_methods[] = { { "CreateTrigger", PyIScheduledWorkItem::CreateTrigger, 1 }, // @pymeth CreateTrigger|Creates a new trigger for a task, returns index and new ITaskTrigger interface { "DeleteTrigger", PyIScheduledWorkItem::DeleteTrigger, 1 }, // @pymeth DeleteTrigger|Deletes specified trigger { "GetTriggerCount", PyIScheduledWorkItem::GetTriggerCount, 1 }, // @pymeth GetTriggerCount|Returns number of triggers defined for the task { "GetTrigger", PyIScheduledWorkItem::GetTrigger, 1 }, // @pymeth GetTrigger|Retrieves ITaskTrigger interface for specified trigger index { "GetTriggerString", PyIScheduledWorkItem::GetTriggerString, 1 }, // @pymeth GetTriggerString|Creates a human-readable summary of specified trigger { "GetRunTimes", PyIScheduledWorkItem::GetRunTimes, 1 }, // @pymeth GetRunTimes|Return specified number of run times within given time frame { "GetNextRunTime", PyIScheduledWorkItem::GetNextRunTime, 1 }, // @pymeth GetNextRunTime|Returns next time that task is scheduled to run { "SetIdleWait", PyIScheduledWorkItem::SetIdleWait, 1 }, // @pymeth SetIdleWait|Sets idle parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE { "GetIdleWait", PyIScheduledWorkItem::GetIdleWait, 1 }, // @pymeth GetIdleWait|Gets idle parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE { "Run", PyIScheduledWorkItem::Run, 1 }, // @pymeth Run|Starts task { "Terminate", PyIScheduledWorkItem::Terminate, 1 }, // @pymeth Terminate|Terminate process if task is running { "EditWorkItem", PyIScheduledWorkItem::EditWorkItem, 1 }, // @pymeth EditWorkItem|Brings up standard Scheduled Task dialog { "GetMostRecentRunTime", PyIScheduledWorkItem::GetMostRecentRunTime, 1 }, // @pymeth GetMostRecentRunTime|Returns last time task ran { "GetStatus", PyIScheduledWorkItem::GetStatus, 1 }, // @pymeth GetStatus|Returns status (SCHED_S_TASK... constants) { "GetExitCode", PyIScheduledWorkItem::GetExitCode, 1 }, // @pymeth GetExitCode|Returns tuple of task's exit code and error returned to Task Scheduler if process could not start { "SetComment", PyIScheduledWorkItem::SetComment, 1 }, // @pymeth SetComment|Set comment string for task { "GetComment", PyIScheduledWorkItem::GetComment, 1 }, // @pymeth GetComment|Return comment string associated with task. { "SetCreator", PyIScheduledWorkItem::SetCreator, 1 }, // @pymeth SetCreator|Specify who (or what) created task, can be any string { "GetCreator", PyIScheduledWorkItem... [truncated message content] |
From: Mark H. <mha...@us...> - 2004-04-10 05:32:07
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30440/win32comext/taskscheduler/test Added Files: test_addtask.py test_addtask_1.py test_addtask_2.py test_localsystem.py Log Message: Add a module for the TaskScheduler interfaces - from Roger Upole --- NEW FILE: test_localsystem.py --- f=open('test_localsystem.txt','w') f.write('I have run\n') f.close() --- NEW FILE: test_addtask_2.py --- import pythoncom, time, win32api from win32com.taskscheduler import taskscheduler task_name='test_addtask_2.job' ts=pythoncom.CoCreateInstance(taskscheduler.CLSID_CTaskScheduler,None, pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITaskScheduler) tasks=ts.Enum() for task in tasks: print task if task_name in tasks: print 'Deleting existing task '+task_name ts.Delete(task_name) t=ts.NewWorkItem(task_name) t.SetComment('Test a task running as local system acct') t.SetApplicationName('c:\\python23\\python.exe') t.SetPriority(taskscheduler.REALTIME_PRIORITY_CLASS) t.SetParameters('test_localsystem.py') t.SetWorkingDirectory('c:\\python23') t.SetCreator('test_addtask_2.py') t.SetMaxRunTime(20000) #milliseconds t.SetFlags(taskscheduler.TASK_FLAG_DELETE_WHEN_DONE) t.SetAccountInformation('',None) ## empty string for account name means to use local system ## None is only valid for local system acct or if task flags contain TASK_FLAG_RUN_ONLY_IF_LOGGED_ON run_time = time.localtime(time.time() + 60) tr_ind, tr=t.CreateTrigger() tt=tr.GetTrigger() tt.Flags=0 ## flags for a new trigger default to TASK_TRIGGER_FLAG_DISABLED (4), make sure to clear them if not using any tt.TriggerType=taskscheduler.TASK_TIME_TRIGGER_ONCE tt.BeginYear=int(time.strftime('%Y',run_time)) tt.BeginMonth=int(time.strftime('%m',run_time)) tt.BeginDay=int(time.strftime('%d',run_time)) tt.StartMinute=int(time.strftime('%M',run_time)) tt.StartHour=int(time.strftime('%H',run_time)) tr.SetTrigger(tt) print t.GetTriggerString(tr_ind) pf=t.QueryInterface(pythoncom.IID_IPersistFile) pf.Save(None,1) --- NEW FILE: test_addtask_1.py --- import pythoncom, time, win32api from win32com.taskscheduler import taskscheduler test_task_name='test_addtask_1.job' ts=pythoncom.CoCreateInstance(taskscheduler.CLSID_CTaskScheduler,None, pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITaskScheduler) tasks=ts.Enum() for task in tasks: print task if test_task_name in tasks: print 'Deleting existing task '+test_task_name ts.Delete(test_task_name) new_task=pythoncom.CoCreateInstance(taskscheduler.CLSID_CTask,None, pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITask) ts.AddWorkItem(test_task_name,new_task) ## task object is modified in place new_task.SetFlags(taskscheduler.TASK_FLAG_INTERACTIVE|taskscheduler.TASK_FLAG_RUN_ONLY_IF_LOGGED_ON) new_task.SetIdleWait(1,10000) new_task.SetComment('test task with idle trigger') new_task.SetApplicationName('c:\\python23\\python.exe') new_task.SetPriority(taskscheduler.REALTIME_PRIORITY_CLASS) new_task.SetParameters('-c"import win32ui,time;win32ui.MessageBox(\'why aint you doing no work ?\');"') new_task.SetWorkingDirectory('c:\\python23') new_task.SetCreator('test_addtask_1.py') new_task.SetAccountInformation(win32api.GetUserName(),None) ## None is only valid for local system acct or if Flags contain TASK_FLAG_RUN_ONLY_IF_LOGGED_ON run_time = time.localtime(time.time() + 30) end_time = time.localtime(time.time() + 60*60*24) tr_ind, tr=new_task.CreateTrigger() tt=tr.GetTrigger() tt.TriggerType=taskscheduler.TASK_EVENT_TRIGGER_ON_IDLE tt.Flags=taskscheduler.TASK_TRIGGER_FLAG_HAS_END_DATE tt.BeginYear=int(time.strftime('%Y',run_time)) tt.BeginMonth=int(time.strftime('%m',run_time)) tt.BeginDay=int(time.strftime('%d',run_time)) tt.StartMinute=int(time.strftime('%M',run_time)) tt.StartHour=int(time.strftime('%H',run_time)) tt.EndYear=int(time.strftime('%Y',end_time)) tt.EndMonth=int(time.strftime('%m',end_time)) tt.EndDay=int(time.strftime('%d',end_time)) tr.SetTrigger(tt) print new_task.GetTriggerString(tr_ind) pf=new_task.QueryInterface(pythoncom.IID_IPersistFile) pf.Save(None,1) --- NEW FILE: test_addtask.py --- import pythoncom, sys, os, time, win32api from win32com.taskscheduler import taskscheduler task_name='test_addtask.job' ts=pythoncom.CoCreateInstance(taskscheduler.CLSID_CTaskScheduler,None, pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITaskScheduler) tasks=ts.Enum() for task in tasks: print task if task_name in tasks: print 'Deleting existing task '+task_name ts.Delete(task_name) t=ts.NewWorkItem(task_name) t.SetComment('rude comments') t.SetApplicationName(sys.executable) t.SetPriority(taskscheduler.REALTIME_PRIORITY_CLASS) t.SetParameters('-c"import win32ui,time;win32ui.MessageBox(\'hey bubba I am running\');"') t.SetWorkingDirectory(os.path.dirname(sys.executable)) t.SetCreator('test_addtask.py') t.SetMaxRunTime(20000) #milliseconds t.SetFlags(taskscheduler.TASK_FLAG_INTERACTIVE|taskscheduler.TASK_FLAG_RUN_ONLY_IF_LOGGED_ON) ## |taskscheduler.TASK_FLAG_DELETE_WHEN_DONE) #task self destructs when no more future run times t.SetAccountInformation(win32api.GetUserName(),None) ## None is only valid for local system acct or if task flags contain TASK_FLAG_RUN_ONLY_IF_LOGGED_ON t.SetWorkItemData('some binary garbage') run_time = time.localtime(time.time() + 60) tr_ind, tr=t.CreateTrigger() tt=tr.GetTrigger() ## flags default to TASK_TRIGGER_FLAG_DISABLED (4) tt.Flags=taskscheduler.TASK_TRIGGER_FLAG_KILL_AT_DURATION_END tt.BeginYear=int(time.strftime('%Y',run_time)) tt.BeginMonth=int(time.strftime('%m',run_time)) tt.BeginDay=int(time.strftime('%d',run_time)) tt.StartMinute=int(time.strftime('%M',run_time)) tt.StartHour=int(time.strftime('%H',run_time)) tt.MinutesInterval=1 tt.MinutesDuration=5 tt.TriggerType=taskscheduler.TASK_TIME_TRIGGER_MONTHLYDATE #months can contain multiples in a bitmask, use 1<<(month_nbr-1) tt.MonthlyDate_Months=1<<(int(time.strftime('%m',run_time))-1) ## corresponds to TASK_JANUARY..TASK_DECEMBER constants #days too tt.MonthlyDate_Days=1<<(int(time.strftime('%d',run_time))-1) tr.SetTrigger(tt) print t.GetTriggerString(tr_ind) pf=t.QueryInterface(pythoncom.IID_IPersistFile) pf.Save(None,1) |
From: Mark H. <mha...@us...> - 2004-04-10 05:32:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30440/win32comext/shell/src Modified Files: shell.cpp Log Message: Add a module for the TaskScheduler interfaces - from Roger Upole Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shell.cpp 9 Apr 2004 11:18:37 -0000 1.18 --- shell.cpp 10 Apr 2004 05:18:40 -0000 1.19 *************** *** 72,75 **** --- 72,81 ---- PyObject *PyObject_FromPIDL(LPCITEMIDLIST pidl, BOOL bFreeSystemPIDL) { + if (pidl==NULL) { + if (bFreeSystemPIDL) + PyShell_FreeMem( (void *)pidl); + Py_INCREF(Py_None); + return Py_None; + } PyObject *ret = PyList_New(0); if (!ret) *************** *** 202,205 **** --- 208,215 ---- PyObject *PyObject_FromPIDLArray(UINT cidl, LPCITEMIDLIST *pidl) { + if (pidl==NULL) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *ob = PyList_New(cidl); if (!ob) return NULL; *************** *** 224,227 **** --- 234,241 ---- PyObject *ret = NULL; PyObject *obItems = NULL; + if (pida==NULL) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *obFolder = PyObject_FromPIDL(GetPIDLFolder(pida), FALSE); if (obFolder==NULL) *************** *** 412,415 **** --- 426,435 ---- PyObject *PyObject_FromSTRRET(STRRET *ps, ITEMIDLIST *pidl, BOOL bFree) { + if (ps==NULL) { + if (bFree) + PyObject_FreeSTRRET(*ps); + Py_INCREF(Py_None); + return Py_None; + } PyObject *ret; switch (ps->uType) { *************** *** 439,442 **** --- 459,466 ---- PyObject *PyObject_FromMSG(const MSG *msg) { + if (!msg) { + Py_INCREF(Py_None); + return Py_None; + } return Py_BuildValue("iiiii(ii)", msg->hwnd,msg->message,msg->wParam,msg->lParam,msg->time,msg->pt.x,msg->pt.y); } *************** *** 448,451 **** --- 472,479 ---- PyObject *PyObject_FromFOLDERSETTINGS( const FOLDERSETTINGS *pf) { + if (!pf) { + Py_INCREF(Py_None); + return Py_None; + } return Py_BuildValue("ii", pf->ViewMode, pf->fFlags); } *************** *** 457,460 **** --- 485,492 ---- PyObject *PyObject_FromRECT(const RECT *r) { + if (!r) { + Py_INCREF(Py_None); + return Py_None; + } return Py_BuildValue("iiii", r->left, r->top, r->right, r->bottom); } *************** *** 483,486 **** --- 515,522 ---- PyObject *PyObject_FromSHCOLUMNID(LPCSHCOLUMNID p) { + if (!p) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *obIID = PyWinObject_FromIID(p->fmtid); if (!obIID) *************** *** 500,503 **** --- 536,543 ---- PyObject *PyObject_FromSHCOLUMNINIT(LPCSHCOLUMNINIT p) { + if (!p) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *obName = PyWinObject_FromWCHAR(p->wszFolder); if (!obName) *************** *** 523,526 **** --- 563,570 ---- PyObject *PyObject_FromSHCOLUMNINFO(LPCSHCOLUMNINFO p) { + if (!p) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *rc = NULL, *obID = NULL; PyObject *obDescription = NULL, *obTitle = NULL; *************** *** 559,562 **** --- 603,610 ---- PyObject *PyObject_FromSHCOLUMNDATA(LPCSHCOLUMNDATA p) { + if (!p) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *obFile = PyWinObject_FromWCHAR(p->wszFile); if (!obFile) return NULL; *************** *** 574,577 **** --- 622,629 ---- PyObject *PyObject_FromSHFILEINFO(SHFILEINFO *p) { + if (!p) { + Py_INCREF(Py_None); + return Py_None; + } PyObject *obDisplayName = PyWinObject_FromTCHAR(p->szDisplayName); PyObject *obTypeName = PyWinObject_FromTCHAR(p->szTypeName); *************** *** 591,594 **** --- 643,650 ---- PyObject *PyObject_FromOLEMENUGROUPWIDTHS(OLEMENUGROUPWIDTHS *pWidths) { + if (!pWidths) { + Py_INCREF(Py_None); + return Py_None; + } return Py_BuildValue("(iiiiii)", pWidths->width[0], pWidths->width[1], *************** *** 810,814 **** PY_INTERFACE_POSTCALL; ret = Py_BuildValue("iN", dw, PyObject_FromSHFILEINFO(&info)); - done: if (name) PyWinObject_FreeTCHAR(name); if (pidl) PyObject_FreePIDL(pidl); --- 866,869 ---- |
From: Mark H. <mha...@us...> - 2004-04-10 05:32:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30440/win32comext/taskscheduler Added Files: __init__.py Log Message: Add a module for the TaskScheduler interfaces - from Roger Upole --- NEW FILE: __init__.py --- # This is a python package # __PackageSupportBuildPath__ not needed for distutil based builds, # but not everyone is there yet. import win32com win32com.__PackageSupportBuildPath__(__path__) |
From: Mark H. <mha...@us...> - 2004-04-10 05:32:05
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30440 Added Files: taskscheduler.dsp Log Message: Add a module for the TaskScheduler interfaces - from Roger Upole --- NEW FILE: taskscheduler.dsp --- # Microsoft Developer Studio Project File - Name="taskscheduler" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=taskscheduler - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "taskscheduler.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "taskscheduler.mak" CFG="taskscheduler - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "taskscheduler - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "taskscheduler - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "taskscheduler - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Build" # PROP Intermediate_Dir "Build\Temp\taskscheduler\Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mstask.lib /nologo /dll /machine:I386 /out:"Build\taskscheduler.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "taskscheduler - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Build" # PROP Intermediate_Dir "Build\Temp\taskscheduler\Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mstask.lib /nologo /dll /debug /machine:I386 /out:"Build\taskscheduler_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "taskscheduler - Win32 Release" # Name "taskscheduler - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=win32comext\taskscheduler\src\PyIScheduledWorkItem.cpp # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\PyITask.cpp # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\PyITaskScheduler.cpp # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\PyITaskTrigger.cpp # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\taskscheduler.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=win32comext\taskscheduler\src\PyIScheduledWorkItem.h # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\PyITask.h # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\PyITaskScheduler.h # End Source File # Begin Source File SOURCE=win32comext\taskscheduler\src\PyITaskTrigger.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project |
From: Mark H. <mha...@us...> - 2004-04-10 05:29:38
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193/test Log Message: Directory /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/test added to the repository |
From: Mark H. <mha...@us...> - 2004-04-10 05:29:37
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193/src Log Message: Directory /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src added to the repository |
From: Mark H. <mha...@us...> - 2004-04-10 05:28:58
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30112/taskscheduler Log Message: Directory /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler added to the repository |
From: Mark H. <mha...@us...> - 2004-04-09 11:47:15
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31101/pywin/tools Modified Files: browser.py Log Message: Try and work with "new-style" classes Index: browser.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/browser.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** browser.py 7 Feb 2004 02:06:57 -0000 1.5 --- browser.py 9 Apr 2004 11:33:50 -0000 1.6 *************** *** 91,99 **** def CalculateIsExpandable(self): ! try: ! if self.myobject.__doc__: ! return 1 ! except (AttributeError, TypeError): ! pass try: for key in self.myobject.__dict__.keys(): --- 91,96 ---- def CalculateIsExpandable(self): ! if hasattr(self.myobject, '__doc__'): ! return 1 try: for key in self.myobject.__dict__.keys(): *************** *** 280,284 **** cls = TypeMap[type(ob)] except KeyError: ! cls = HLIPythonObject return cls( ob, name ) --- 277,284 ---- cls = TypeMap[type(ob)] except KeyError: ! if isinstance(ob, object): # 'new style' class ! cls = HLIInstance ! else: ! cls = HLIPythonObject return cls( ob, name ) |
From: Mark H. <mha...@us...> - 2004-04-09 11:45:20
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30656/Pythonwin/pywin/framework Modified Files: intpyapp.py Log Message: If the browser fails on an object, print a traceback. Index: intpyapp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/intpyapp.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** intpyapp.py 2 Aug 2002 12:57:44 -0000 1.7 --- intpyapp.py 9 Apr 2004 11:31:57 -0000 1.8 *************** *** 310,313 **** --- 310,314 ---- win32ui.MessageBox('The object has no attribute of that name') except: + traceback.print_exc() win32ui.MessageBox('This object can not be browsed') |
From: Mark H. <mha...@us...> - 2004-04-09 11:43:47
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30320/Pythonwin/pywin/tools Modified Files: TraceCollector.py Log Message: Replace '\0' characters, as these tend to screw us up! Index: TraceCollector.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/TraceCollector.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TraceCollector.py 18 Dec 2002 04:24:36 -0000 1.2 --- TraceCollector.py 9 Apr 2004 11:30:25 -0000 1.3 *************** *** 18,22 **** rc = win32event.WaitForMultipleObjects((handle, stopEvent), 0, win32event.INFINITE) if rc == win32event.WAIT_OBJECT_0: ! file.write(win32trace.read()) else: # Stop event --- 18,23 ---- rc = win32event.WaitForMultipleObjects((handle, stopEvent), 0, win32event.INFINITE) if rc == win32event.WAIT_OBJECT_0: ! # About the only char we can't live with is \0! ! file.write(win32trace.read().replace("\0", "<null>")) else: # Stop event |
From: Mark H. <mha...@us...> - 2004-04-09 11:42:56
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30170 Modified Files: shell.dsp Log Message: Add IDropTargetHelper Index: shell.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/shell.dsp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shell.dsp 6 Nov 2003 06:15:45 -0000 1.9 --- shell.dsp 9 Apr 2004 11:29:37 -0000 1.10 *************** *** 111,114 **** --- 111,118 ---- # Begin Source File + SOURCE=.\win32comext\shell\src\PyIDropTargetHelper.cpp + # End Source File + # Begin Source File + SOURCE=.\win32comext\shell\src\PyIEnumIDList.cpp # End Source File *************** *** 167,170 **** --- 171,178 ---- # Begin Source File + SOURCE=.\win32comext\shell\src\PyIDropTargetHelper.h + # End Source File + # Begin Source File + SOURCE=.\win32comext\shell\src\PyIEnumIDList.h # End Source File |
From: Mark H. <mha...@us...> - 2004-04-09 11:42:21
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30013/win32com Modified Files: util.py Log Message: Make IIDToInterfaceName prettier. Index: util.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/util.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** util.py 1 Sep 1999 22:52:47 -0000 1.1 --- util.py 9 Apr 2004 11:29:01 -0000 1.2 *************** *** 23,32 **** try: try: ! return win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, "Interface\\%s" % iid) + \ ! "(unregistered)" except win32api.error: pass except ImportError: pass ! return "<Unregistered interface>" --- 23,31 ---- try: try: ! return win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, "Interface\\%s" % iid) except win32api.error: pass except ImportError: pass ! return str(iid) |
From: Mark H. <mha...@us...> - 2004-04-09 11:41:07
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29784 Modified Files: win32com.dsp Log Message: Add IDropSource and IDropTarget interfaces. Index: win32com.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com.dsp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** win32com.dsp 7 Nov 2003 23:42:19 -0000 1.24 --- win32com.dsp 9 Apr 2004 11:27:49 -0000 1.25 *************** *** 283,286 **** --- 283,294 ---- # Begin Source File + SOURCE=.\win32com\src\extensions\PyIDropSource.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32com\src\extensions\PyIDropTarget.cpp + # End Source File + # Begin Source File + SOURCE=.\win32com\src\extensions\PyIEnumCATEGORYINFO.cpp # End Source File *************** *** 455,458 **** --- 463,474 ---- # Begin Source File + SOURCE=.\win32com\src\include\PyIDropSource.h + # End Source File + # Begin Source File + + SOURCE=.\win32com\src\include\PyIDropTarget.h + # End Source File + # Begin Source File + SOURCE=.\win32com\src\include\PyIEnumConnectionPoints.h # End Source File |
From: Mark H. <mha...@us...> - 2004-04-09 11:40:27
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29534/com/win32com/src/extensions Modified Files: PyICatInformation.cpp Log Message: Fix default values for array sizes to avoid E_POINTER errors Index: PyICatInformation.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyICatInformation.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyICatInformation.cpp 10 Jan 2003 02:47:13 -0000 1.4 --- PyICatInformation.cpp 9 Apr 2004 11:27:04 -0000 1.5 *************** *** 57,61 **** if (pMy==NULL) return NULL; ! ULONG cImplemented = (ULONG)-1; GUID *pIDs = NULL; if (listImplemented!=Py_None) { --- 57,61 ---- if (pMy==NULL) return NULL; ! ULONG cImplemented = (ULONG)0; GUID *pIDs = NULL; if (listImplemented!=Py_None) { *************** *** 78,82 **** } ! ULONG cRequired = (ULONG)-1; GUID iidTemp; GUID *pIDsReqd = &iidTemp; --- 78,82 ---- } ! ULONG cRequired = (ULONG)0; GUID iidTemp; GUID *pIDsReqd = &iidTemp; |
From: Mark H. <mha...@us...> - 2004-04-09 11:38:57
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29393/com/win32com/test Modified Files: testShell.py Log Message: Add PIDL and CIDA tests. Index: testShell.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testShell.py 10 Nov 2003 00:49:29 -0000 1.2 --- testShell.py 9 Apr 2004 11:25:36 -0000 1.3 *************** *** 45,48 **** --- 45,79 ---- self.assertEqual(names_1, names_2) + class PIDLTester(win32com.test.util.TestCase): + def _rtPIDL(self, pidl): + pidl_str = shell.PIDLAsString(pidl) + pidl_rt = shell.StringAsPIDL(pidl_str) + self.assertEqual(pidl_rt, pidl) + pidl_str_rt = shell.PIDLAsString(pidl_rt) + self.assertEqual(pidl_str_rt, pidl_str) + + def _rtCIDA(self, parent, kids): + cida = parent, kids + cida_str = shell.CIDAAsString(cida) + cida_rt = shell.StringAsCIDA(cida_str) + self.assertEqual(cida, cida_rt) + cida_str_rt = shell.CIDAAsString(cida_rt) + self.assertEqual(cida_str_rt, cida_str) + + def testPIDL(self): + # A PIDL of "\1" is: cb pidl cb + expect = "\03\00" "\1" "\0\0" + self.assertEqual(shell.PIDLAsString(["\1"]), expect) + self._rtPIDL(["\0"]) + self._rtPIDL(["\1", "\2", "\3"]) + self._rtPIDL(["\0" * 2048] * 2048) + # PIDL must be a list + self.assertRaises(TypeError, shell.PIDLAsString, "foo") + + def testCIDA(self): + self._rtCIDA(["\0"], [ ["\0"] ]) + self._rtCIDA(["\1"], [ ["\2"] ]) + self._rtCIDA(["\0"], [ ["\0"], ["\1"], ["\2"] ]) + if __name__=='__main__': unittest.main() |
From: Mark H. <mha...@us...> - 2004-04-09 11:38:16
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29179/com/win32comext/shell Modified Files: shellcon.py Log Message: Yet more shell constants. Index: shellcon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/shellcon.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shellcon.py 12 Mar 2004 08:44:13 -0000 1.9 --- shellcon.py 9 Apr 2004 11:24:53 -0000 1.10 *************** *** 234,237 **** --- 234,240 ---- SVGIO_SELECTION = 1 SVGIO_ALLVIEW = 2 + SVGIO_CHECKED = 0x3, + SVGIO_TYPE_MASK = 0xf, + SVGIO_FLAG_VIEWORDER = -2147483648 # 0x80000000 STRRET_WSTR = 0 STRRET_OFFSET = 1 *************** *** 567,570 **** --- 570,574 ---- SHGDN_NORMAL = 0 # default (display purpose) SHGDN_INFOLDER = 1 # displayed under a folder (relative) + SHGDN_FOREDITING = 4096 # for in-place editing SHGDN_INCLUDE_NONFILESYS = 8192 # if not set, display names for shell name space items that are not in the file system will fail. SHGDN_FORADDRESSBAR = 16384 # for displaying in the address (drives dropdown) bar *************** *** 847,848 **** --- 851,863 ---- FVM_TILE = 6 FVM_THUMBSTRIP = 7 + + SVUIA_DEACTIVATE = 0 + SVUIA_ACTIVATE_NOFOCUS = 1 + SVUIA_ACTIVATE_FOCUS = 2 + SVUIA_INPLACEACTIVATE = 3 + + # SHChangeNotifyRegister flags + SHCNRF_InterruptLevel = 1 + SHCNRF_ShellLevel = 2 + SHCNRF_RecursiveInterrupt = 4096 + SHCNRF_NewDelivery = 32768 |