A thing I’m working on is supposed to interact with a Scheduled Task [1] if it exists. Instead of writing out my own parser for this backwater of the Windows operating system I found something lying about at CodePlex [2]. As far as documentation goes, this one is pretty decent [3]…for a CodePlex project. Then again, that bar is pretty low.
So this afternoon has been brought to you by the method Console.WriteLine()
Don’t know what a thing does? Console.WriteLine( THING )
is great. If it’s a string, it’ll tell you what it represents. If it is something else, it’ll give you a clue as to how that method/object reference is employed. It’s nowhere near as cool or useful as Python's dir()
[4] which is what I was really jonesing for this afternoon. Still, half an hour of iterating over Console.WriteLine( THING )
, compile, run test executable made quick work of finding a solution.
Eventually I found Microsoft.Win32.TaskScheduler.Task.Definition.XmlText
and this all the bait I need to make this an XML-based solution. Why use an object wrapper with moderately unhelpful documentation when you can just do a simple XPath operation? Pretty sure about half of the solutions I come up with eventually dump into XML and then leverage XPath. It is the very best hammer because it can turn virtually anything into a nail.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx
[2] http://taskscheduler.codeplex.com/
[3] http://taskscheduler.codeplex.com/documentation
[4] https://docs.python.org/3/library/functions.html?highlight=dir#dir
NERD!!!!