water Posted October 19, 2019 Author Posted October 19, 2019 Hi guys,somehow it is very (if not to say too) quiet about Task Scheduler UDF.Does nobody use the thing or does everything work so well and is so perfectly explained that no questions arise?Would be glad to get some freedback My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
mLipok Posted October 19, 2019 Posted October 19, 2019 (edited) Recently I had different things to maintain and as so far honestly I do not use them, only test your examples. Sorry Edited October 19, 2019 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted October 19, 2019 Posted October 19, 2019 (edited) In windows task scheduler you can switch on/off logs. Whether your UDF contain function to check on off this setting ? Edited October 19, 2019 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
seadoggie01 Posted October 20, 2019 Posted October 20, 2019 (edited) Actually, now that you mention it... I don't seem to be able to register a task... I keep getting @Error=6 and @Extended -2147352567 when I use _TS_Wrapper_TaskRegister like this: #RequireAdmin ;<-- This fixes everything I found out Local Const $iSaturday = 64 Local $sFolderName = "\AutoIt\RebootModem" Local $oTS = _TS_Open() If ErrMsg(@error, "TS Open") Then Exit If Not _TS_FolderExists($oTS, $sFolderName) Then If ErrMsg(@error, "TS Folder Exists") Then Exit _TS_FolderCreate($oTS, $sFolderName) If ErrMsg(@error, "TS Folder Create") Then Exit EndIf Local $oTask = _TS_Wrapper_TaskCreate($oTS, "Restarts the Modem... supposedly") If ErrMsg(@error, "Wrapper_TaskCreate") Then Exit _TS_Wrapper_PrincipalSet($oTask, $TASK_LOGON_PASSWORD, $TASK_RUNLEVEL_HIGHEST, $username, "") If ErrMsg(@error, "Wrapper_PrincipalSet") Then Exit _TS_Wrapper_ActionCreate($oTask, @ScriptFullPath, "", "/reboot") If ErrMsg(@error, "Wrapper_ActionCreate") Then Exit _TS_Wrapper_TriggerDateTime($oTask, $TASK_TRIGGER_WEEKLY, $iSaturday, 1, "2019-10-01T01:00:00-04:00") If ErrMsg(@error, "Wrapper_TriggerDateTime") Then Exit _TS_Wrapper_TaskRegister($oTS, $sFolderName, "Restart Modem", $oTask, $username, $password, $TASK_LOGON_PASSWORD) If ErrMsg(@error, "Wrapper_TaskRegister Extended:" & @extended) Then Exit _TS_Close() Func ErrMsg($error, $sMsg) If $error Then ConsoleWrite("! " & $sMsg & @CRLF) Return $error EndFunc I've double checked my Username and password... they log me in to my computer, so they have to be correct Maybe I'm not setting up the logon parameters correctly? I'm trying to run this with highest privileges (and eventually run set some other options to wake the computer). I love this UDF (especially how simple this is!) The only thought I have is adding the possibility to view properties of an un-registered task by passing the task object (or task definition?) to _TS_PropertiesGet. It would help with debugging, I think Edited October 22, 2019 by seadoggie01 Admin FTW All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
water Posted October 21, 2019 Author Posted October 21, 2019 The error code you get is 0x80020009 (General Exception). Could you please add _TS_ErrorNotify(2) to your script so we get better error information? You are correct. Function _TS_TaskPropertiesGet does not support the Task Definition object. Will be added to the next release. In addition I will think about a function to "validate" the created Task Definition so we get better error information. The function should return a 2D array with codes for all discovered errors and potential problems (error, warning and information) plus a meaningful description for each. The "bug" in my signature has been fixed. Thanks! My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
seadoggie01 Posted October 21, 2019 Posted October 21, 2019 (edited) Sorry, there is no error output in my script with _TS_ErrorNotify(2). There appears to only be the COM error. There might be some properties that I need to set still, but I'm not sure of the minimum properties. I'll see if I can get it to work when I set some of them. Edit: Duh, to register a task to run as an admin... you probably need to run the script as an admin (#Require Admin fixed everything!) Unrelated-ly, _TS_TaskPropertySet says that it takes a 2D array... looks like it takes a | delimited 1D array Edited October 22, 2019 by seadoggie01 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
water Posted October 22, 2019 Author Posted October 22, 2019 Thanks a lot for testing. I will update the UDF and the wiki with your findings My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted October 25, 2019 Author Posted October 25, 2019 On 10/21/2019 at 1:16 AM, seadoggie01 said: I love this UDF (especially how simple this is!) The only thought I have is adding the possibility to view properties of an un-registered task by passing the task object (or task definition?) to _TS_PropertiesGet. It would help with debugging, I think Here is the updated _TS_TaskPropertiesGet. When you pass the Task Definition object as returned by _TS_TaskCreate you will get all properties of the unregistered task. expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _TS_TaskPropertiesGet ; Description ...: List all properties of a Task or Task Definition and return an array or write the properties to the console. ; Syntax.........: _TS_TaskPropertiesGet($oService, $vTask[, $iFormat = 1[, $bIgnoreNoValues = False]]) ; Parameters ....: $oService - Task Scheduler Service object as returned by _TS_Open ; $vTask - The path and name of the Task to process or a Task Definition object ; $iFormat - Format of the output. Can be one of the following values ; |1 - User friendly format (default) ; |2 - Format you can use as input to _TS_TaskPropertiesSet (just the content of the array) ; |3 - Format you can use as input to _TS_TaskPropertiesSet (full AutoIt syntax to define the array - without XML and written to the console) ; $bIgnoreNoValues - if set to True properties without a value do not get returned ; Return values .: Success - For $iFormat=1 or 2: Zero based two-dimensional array with the following information ; | 0 - Section related to a COM object ; | 1 - Property name ; | 2 - Property value ; | 3 - Comment ; Success - For $iFormat=3: Writes the AutoIt array definition to the console ; Failure - Returns "" and sets @error ; |1 - Error returned by _TS_TaskGet. @extended is set to the COM error code. Most probably the Task could not be found ; Author ........: water ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _TS_TaskPropertiesGet($oTaskService, $vTask, $iFormat = Default, $bIgnoreNoValues = Default) Local $oTask, $sTaskState, $sObjectType Local $oTaskDefinition, $cActions, $oTaskAction Local $oPrincipal, $oRegistrationInfo, $oTaskSettings, $oIdleSettings, $oTaskNetworkSettings Local $cTaskTriggers, $oTaskTrigger, $oTaskRepitition, $cAttachments, $cHeaderfields Local $iIndex = 0, $sSection If $iFormat = Default Then $iFormat = 1 If $bIgnoreNoValues = Default Then $bIgnoreNoValues = False If $iFormat = 1 Then Local $aProperties[1000][4] Else Local $aProperties[1000] EndIf If IsObj($vTask) Then ; Task Definition object $oTask = $vTask ; Dummy. Just to make sure $oTask is set. Else the function would crash for a Task Definition $oTaskDefinition = $vTask $sObjectType = "Task Definition" Else $oTask = _TS_TaskGet($oTaskService, $vTask) If @error Then Return SetError(1, @error, "") $sObjectType = "Task" EndIf With $oTask If $sObjectType = "Task" Then $sSection = "TASK" __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Name", .Name) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Enabled", .Enabled) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LastRunTime", .LastRunTime) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LastTaskResult", .LastTaskResult) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "NextRunTime", .NextRunTime) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "NumberOfMissedRuns", .NumberOfMissedRuns) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Path", .Path) Switch (.State) Case $TASK_STATE_UNKNOWN $sTaskState = "Unknown" Case $TASK_STATE_DISABLED $sTaskState = "Disabled" Case $TASK_STATE_QUEUED $sTaskState = "Queued" Case $TASK_STATE_QUEUED $sTaskState = "Ready" Case $TASK_STATE_RUNNING $sTaskState = "Running" EndSwitch __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "State", .State, $sTaskState) If $iFormat <> 3 Then __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "XML", .XML) $oTaskDefinition = .Definition EndIf $sSection = "DEFINITION" With $oTaskDefinition __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Data", .Data) $cActions = $oTaskDefinition.Actions For $oTaskAction In $cActions With $oTaskAction $sSection = "ACTIONS" __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ID", .Id) Switch (.Type) Case $TASK_ACTION_EXEC __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Execute / Command Line Operation") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Arguments ", .Arguments) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Path", .Path) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "WorkingDirectory", .WorkingDirectory) Case $TASK_ACTION_COM_HANDLER __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Handler") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ClassId", .ClassId) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Data", .Data) Case $TASK_ACTION_SEND_EMAIL __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Email Message") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "From", .From) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ReplyTo", .ReplyTo) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "To", .To) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Cc", .Cc) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Bcc", .Bcc) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Subject", .Subject) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Body", .Body) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Server", .Server) ; ==> CHECK $cAttachments = .Attachments $sSection = "ATTACHMENTS" For $sAttachment In $cAttachments __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Attachment", $sAttachment) Next $cHeaderfields = .HeaderFields $sSection = "HEADERFIELDS" For $oHeaderPair In $cHeaderfields __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "HeaderName|Value", $oHeaderPair.Name & "|" & $oHeaderPair.Value) Next Case $TASK_ACTION_SHOW_MESSAGE __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Message Box") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Title", .Title) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MessageBody", .MessageBody) EndSwitch EndWith ; oTaskAction Next ; objTaskAction $oPrincipal = .Principal $sSection = "PRINCIPAL" With $oPrincipal __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ID", .Id) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DisplayName", .DisplayName) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "GroupId", .GroupId) Switch (.LogonType) Case $TASK_LOGON_NONE __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "None") Case $TASK_LOGON_PASSWORD __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "Password") Case $TASK_LOGON_S4U __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "Service 4 Users") Case $TASK_LOGON_INTERACTIVE_TOKEN __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "Interactive (User must be logged in)") Case $TASK_LOGON_GROUP __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "Group") Case $TASK_LOGON_SERVICE_ACCOUNT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "Local $Service/System or Network Service") Case $TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .LogonType, "Interactive Token then Try Password") EndSwitch Switch (.RunLevel) Case $TASK_RUNLEVEL_LUA __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RunLevel", .RunLevel, "Least Privileges (LUA)") Case $TASK_RUNLEVEL_HIGHEST __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RunLevel", .RunLevel, "Highest Privileges") EndSwitch __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "UserId", .UserId) EndWith ; oPrincipal $oRegistrationInfo = .RegistrationInfo $sSection = "REGISTRATIONINFO" With $oRegistrationInfo __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Author", .Author) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Date", .Date) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Description", .Description) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Date", .Date) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Documentation", .Documentation) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "SecurityDescriptor", .SecurityDescriptor) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Source", .Source) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "URI", .URI) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Version", .Version) EndWith ; oRegistrationInfo $oTaskSettings = .Settings $sSection = "SETTINGS" With $oTaskSettings __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "AllowDemandStart", .AllowDemandStart) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "AllowHardTerminate", .AllowHardTerminate) Switch (.Compatibility) Case $TASK_COMPATIBILITY_AT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Compatibility", .Compatibility, "compatible with the AT command") Case $TASK_COMPATIBILITY_V1 __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Compatibility", .Compatibility, "compatible with Task Scheduler 1.0") Case $TASK_COMPATIBILITY_V2 __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Compatibility", .Compatibility, "compatible with Task Scheduler 2.0 (Windows Vista / Windows 2008)") Case 3 ; Not Documented __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Compatibility", .Compatibility, "compatible with Task Scheduler 2.0 (Windows 7 / Windows 2008 R2)") EndSwitch __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DeleteExpiredTaskAfter", .DeleteExpiredTaskAfter) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DisallowStartIfOnBatteries", .DisallowStartIfOnBatteries) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Enabled", .Enabled) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ExecutionTimeLimit", .ExecutionTimeLimit) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Hidden", .Hidden) Switch (.MultipleInstances) Case $TASK_INSTANCES_PARALLEL __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MultipleInstances", .MultipleInstances, "Run in parallel") Case $TASK_INSTANCES_QUEUE __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MultipleInstances", .MultipleInstances, "Add to queue") Case $TASK_INSTANCES_IGNORE_NEW __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MultipleInstances", .MultipleInstances, "Ignore new") Case $TASK_INSTANCES_STOP_EXISTING __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MultipleInstances", .MultipleInstances, "Stop existing task") EndSwitch __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Priority", .Priority, "(0=High / 10=Low)") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RestartCount", .RestartCount) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RestartInterval", .RestartInterval) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RunOnlyIfIdle", .RunOnlyIfIdle) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RunOnlyIfNetworkAvailable", .RunOnlyIfNetworkAvailable) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "StartWhenAvailable", .StartWhenAvailable) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "StopIfGoingOnBatteries", .StopIfGoingOnBatteries) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "WakeToRun", .WakeToRun) $oIdleSettings = .IdleSettings $sSection = "IDLESETTINGS" With $oIdleSettings __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "IdleDuration", .IdleDuration) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RestartOnIdle", .RestartOnIdle) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "StopOnIdleEnd", .StopOnIdleEnd) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "WaitTimeout", .WaitTimeout) EndWith ; oIdleSettings $oTaskNetworkSettings = .NetworkSettings $sSection = "NETWORKSETTINGS" With $oTaskNetworkSettings __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ID", .Id) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Name", .Name) EndWith ; oTaskNetworkSettings EndWith ; oTaskSettings $cTaskTriggers = .Triggers $sSection = "TRIGGERS" For $oTaskTrigger In $cTaskTriggers With $oTaskTrigger __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Enabled", .Enabled) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Id", .Id) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "StartBoundary", .StartBoundary) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "EndBoundary", .EndBoundary) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "ExecutionTimeLimit", .ExecutionTimeLimit) Switch (.Type) Case $TASK_TRIGGER_EVENT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, " Event") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Delay", .Delay) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Subscription ", .Subscription) Case $TASK_TRIGGER_TIME __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, " Time") Case $TASK_TRIGGER_DAILY __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, " Daily") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DaysInterval", .DaysInterval) Case $TASK_TRIGGER_WEEKLY __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, " Weekly") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "WeeksInterval", .WeeksInterval) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DaysOfWeek", .DaysOfWeek, "=" & __TS_ConvertDaysOfWeek(.DaysOfWeek)) Case $TASK_TRIGGER_MONTHLY __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Monthly") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DaysOfMonth", .DaysOfMonth, "=" & __TS_ConvertDaysOfMonth(.DaysOfMonth)) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MonthsOfYear", .MonthsOfYear, "=" & __TS_ConvertMonthsOfYear(.MonthsOfYear)) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RandomDelay", .RandomDelay) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RunOnLastDayOfMonth ", .RunOnLastDayOfMonth) Case $TASK_TRIGGER_MONTHLYDOW __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Monthly on Specific Day") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "DaysOfWeek", .DaysOfWeek, "=" & __TS_ConvertDaysOfWeek(.DaysOfWeek)) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "MonthsOfYear", .MonthsOfYear, "=" & __TS_ConvertMonthsOfYear(.MonthsOfYear)) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RandomDelay", .RandomDelay) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "RunOnLastWeekOfMonth ", .RunOnLastWeekOfMonth) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "WeeksOfMonth", .WeeksOfMonth, "=" & __TS_ConvertWeeksOfMonth(.WeeksOfMonth)) Case $TASK_TRIGGER_IDLE __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "When computer is idle") Case $TASK_TRIGGER_REGISTRATION __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "When task is registered") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Delay", .Delay) Case $TASK_TRIGGER_BOOT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Boot") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Delay", .Delay) Case $TASK_TRIGGER_LOGON __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Logon") __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Delay", .Delay) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "UserId", .UserId) Case $TASK_TRIGGER_SESSION_STATE_CHANGE __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Type", .Type, "Session State Change") Switch (.StateChange) Case 0 __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "None") Case $TASK_CONSOLE_CONNECT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "User session connect to local computer") Case $TASK_CONSOLE_DISCONNECT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "User session disconnect from local computer") Case $TASK_REMOTE_CONNECT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "User session connect to remote computer") Case $TASK_REMOTE_DISCONNECT __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "User session disconnect from remote computer") Case $TASK_SESSION_LOCK __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "On workstation lock") Case $TASK_SESSION_UNLOCK __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "LogonType", .StateChange, "On workstation unlock") EndSwitch __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Delay", .Delay) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "UserId", .UserId) EndSwitch $oTaskRepitition = .Repetition $sSection = "REPETITION" With $oTaskRepitition __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Duration", .Duration) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "Interval", .Interval) __TS_PropertyGetWrite($aProperties, $iIndex, $sSection, $iFormat, $bIgnoreNoValues, "StopAtDurationEnd", .StopAtDurationEnd) EndWith ; oTaskRepitition EndWith ; oTaskTrigger Next ; oTaskTrigger EndWith ; oTaskDefinition EndWith ; oTask If $iFormat = 1 Then ReDim $aProperties[$iIndex][4] Else ReDim $aProperties[$iIndex] EndIf If $iFormat = 3 Then Local $iLastIndex = UBound($aProperties) - 1 ConsoleWrite("Global $aProperties[] = [ _" & @CRLF) For $i = 0 To $iLastIndex $aProperties[$i] = StringReplace($aProperties[$i], @LF, '" & @CRLF & "') If $i = $iLastIndex Then ConsoleWrite('"' & $aProperties[$i] & '" _' & @CRLF) Else ConsoleWrite('"' & $aProperties[$i] & '", _' & @CRLF) EndIf Next ConsoleWrite('"]' & @CRLF) Return 1 Else Return $aProperties EndIf EndFunc ;==>_TS_TaskPropertiesGet If you find any bugs, please let me know seadoggie01 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted October 26, 2019 Author Posted October 26, 2019 Version 1.0.0.0 released Changelog can be found on the download page and the history in the ZIP file. For download please see my signature below. Please play with this version and tell me what doesn't work or is missing! FrancescoDiMuro and argumentum 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted October 27, 2019 Author Posted October 27, 2019 Version 1.1.0.0 released Changelog can be found on the download page and the history in the ZIP file. For download please see my signature below. Please play with this version and tell me what doesn't work or is missing! argumentum and seadoggie01 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
seadoggie01 Posted October 29, 2019 Posted October 29, 2019 (edited) The function header has error 7 listed twice in _TS_Wrapper_TaskRegister It seems weird that both _TS_Wrapper_PrincipalSet and _TS_Wrapper_TaskRegister have the logon method listed... is that intentional? (Still loving it! Using it in a second script now to maintain code between work and home with a FTP backup ) Edit: And I used the new _TS_TaskPropertiesGet, it's super effective! Edited October 29, 2019 by seadoggie01 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
water Posted October 29, 2019 Author Posted October 29, 2019 4 hours ago, seadoggie01 said: The function header has error 7 listed twice in _TS_Wrapper_TaskRegister Fixed 4 hours ago, seadoggie01 said: It seems weird that both _TS_Wrapper_PrincipalSet and _TS_Wrapper_TaskRegister have the logon method listed... is that intentional? Correct. Both objects provide this property.https://docs.microsoft.com/de-de/windows/win32/taskschd/principal-logontype https://docs.microsoft.com/de-de/windows/win32/taskschd/taskfolder-registertaskdefinition But I got your point. To make the wrappers as easy as possible I might remove this parameter from the Principal wrapper. Need to think about it. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted October 29, 2019 Author Posted October 29, 2019 (edited) I'm thinking about a function that would return the full error message text when you pass the error number (e.g. from @error) and the function name (default is the name of the last called function). Means: #include <TaskScheduler.au3> _TS_Open() $sErrorMessage = _TS_ErrorMessage(1) ; Returns the text for error 1 of function _TS_Open: Error creating the COM error handler. @extended is set to the error code returned by _TS_ErrorNotify $sErrorMessage = _TS_ErrorMessage(2, "_TS_ActionCreate") ; Returns the text for error 2 of function _TS_ActionCreate: Error creating the COM error handler. @extended is set to the error code returned by _TS_ErrorNotify What do you think? Edited October 29, 2019 by water seadoggie01 and AdamUL 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted November 3, 2019 Author Posted November 3, 2019 Version 1.2.0.0 released Changelog can be found on the download page and the history in the ZIP file. For download please see my signature below. Please play with this version and tell me what doesn't work or is missing! argumentum 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AdamUL Posted November 4, 2019 Posted November 4, 2019 Hi water, Great work on this UDF. I plan on using it in some future projects soon. Sorry, I haven't been able to comment on it much until now. I noticed that you have new functions _TS_TastRun and _TS_TaskStop. Do you plan on implementing any of the following functions _TS_TaskDisable, _TS_TaskEnable, _TS_TaskIsEnabled, and _TS_TaskIsRunning? Your functions for _TS_TastRun and _TS_TaskStop are great templates for creating these functions. Thanks again for the great work. Adam
water Posted November 4, 2019 Author Posted November 4, 2019 Great you like the UDF To set a Task (Disable, Enable ) you could use _TS_TaskPropertiesSet, to query a Task (IsEnabled, IsRunning) you could use _TS_TaskPropertiesGet. I will provide code examples for this and add a section to the wiki. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AdamUL Posted November 4, 2019 Posted November 4, 2019 Thanks @water I didn't know you could do that with those functions. Adam
water Posted November 5, 2019 Author Posted November 5, 2019 (edited) Examples (The query needs the latest version of the UDF (1.2.1.0) which I'm going to release quite soon): ; Enable/Disable the Registered Task Global $aProperties[] = ["TASK|Enabled|xxxx"] ; Replace xxxx with True or False to enable or disable the task _TS_TaskPropertiesSet($oTask, $aProperties) ; Query the Registered Task $aTaskProperties = _TS_TaskPropertiesGet($oService, $oTask, 1, False, "TASK", "Enabled") MsgBox(0, "Query Task", "Task is enabled = " & $aTaskproperties[0][2]) Edited November 5, 2019 by water AdamUL 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted November 5, 2019 Author Posted November 5, 2019 Version 1.2.1.0 released Changelog can be found on the download page and the history in the ZIP file. For download please see my signature below. Please play with this version and tell me what doesn't work or is missing! My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AdamUL Posted November 5, 2019 Posted November 5, 2019 Thanks @water for the examples. Looking through the UDF constants. I found another way to check both if the task is running or disabled using the "State" property. ; Query the Registered Task $aTaskProperties = _TS_TaskPropertiesGet($oService, $oTask, 1, False, "TASK", "State") Global $sState = "" Switch $aTaskProperties[0][2] Case $TASK_STATE_UNKNOWN $sState = "Unkown" Case $TASK_STATE_DISABLED $sState = "Disabled" Case $TASK_STATE_QUEUED $sState = "Queued" Case $TASK_STATE_READY $sState = "Ready" Case $TASK_STATE_RUNNING $sState = "Running" EndSwitch MsgBox(0, "Query Task", "Task state is = " & $sState) Adam
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