Bitten Posted July 31, 2014 Posted July 31, 2014 I'm trying to edit scheduled tasks through the COM object, but somehow it seems to be a little stubborn when i'm doing anything other than just reading. $TaskRootFolder = "\myFolder" $oTaskSchedule = ObjCreate("Schedule.Service") $oTaskSchedule.connect() $oRootFolder = $oTaskSchedule.GetFolder($TaskRootFolder) If IsObj($oRootFolder) then $oTaskDefinition = $oRootFolder.GetTasks(0) $NumTasks = $oTaskDefinition.count ConsoleWrite($NumTasks & " tasks found in " & $TaskRootFolder & @CRLF) For $oTask in $oTaskDefinition ConsoleWrite("Task: " & $oTask.name & " enabled: " & $oTask.enabled & @LF) $oTask.enabled = False Next Else ConsoleWrite("Task scheduler rootfolder not found." & @LF) Exit EndIf In the above code i connect just fine to the object, and i can read the tasks just fine. But nothing happens when i try to modify it with " $oTask.enabled = False ". I have tried every possible syntax of this i could think of but nothing works. Any info or ideas would be greatly appreciated.
Bitten Posted August 4, 2014 Author Posted August 4, 2014 Is this not the correct forum to ask this perhaps? Or is it just too weird for anyone to know
computergroove Posted August 4, 2014 Posted August 4, 2014 Perhaps your COM object is not in sync with the calls you are trying to read or send. Is there a newer COM object available with documentation that you can try? I have never tried using a COM object. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
LarsJ Posted August 4, 2014 Posted August 4, 2014 Bitten, Your code works for me on Windows 7. I have tested with $TaskRootFolder = "". I can disable and enable all tasks with your code. Are you sure you have the necessary rights to modify the tasks? Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Bitten Posted August 5, 2014 Author Posted August 5, 2014 Bitten, Your code works for me on Windows 7. I have tested with $TaskRootFolder = "". I can disable and enable all tasks with your code. Are you sure you have the necessary rights to modify the tasks? Hmm, strange, it's not working on my own windows 7, however i'm part of a domain, so it may be a rights problem. I am a local administrator of my windows system though, and running it as an admin makes no difference.
LarsJ Posted August 5, 2014 Posted August 5, 2014 I have tested on a standalone PC. Have you tried to fill in the parameters of the Connect method? Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now