Jump to content

TaskScheduler coding error


Recommended Posts

I see

Case $TASK_STATE_QUEUED
                    $sTaskState = "Ready"

at line 1259: in _TS_TaskPropertiesGet(). I think that it should be $TASK_STATE_READY.

Thanks for TaskScheduler.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

Oops, classic copy&paste error - will be fixed in the next version.
Thanks for pointing me to this bug :)

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

 

Link to comment
Share on other sites

You can modify the line in error yourself if you need the fixed version immediately.
I have to do some testing with another function. This might take some time.
Whn finished I will - as always - post the new version in the download section of this forum.

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

 

Link to comment
Share on other sites

I see a typo in line 2070: this => these

Also in 1958: _TS_TaskValidate() => _TS_TaskValidate($oService, $vTask)

Also in 2346: $oTriggers => $oTaskDefinition

I have written, and tested, a function for handling boundaries:

Func FormatBoundaryForTS($sDateTime)
; Daylight time starts at 2 AM on second Sunday of March amd edds at 2 AM on first Sunday of November

    Local $vec = StringSplit($sDateTime,"/ :")
    Local $yr = $vec[1],   $mon = $vec[2], $day = $vec[3]
    Local $bDaylight

    Switch ($mon)
        Case 3  ; Mar
            Local $q = 0
            For $i = 1 to 30
                if _DateToDayOfWeek($yr,3,$i) = 1 Then  ; Sunday
                    $q += 1
                    if $q=2 Then
                        ExitLoop
                    EndIf
                EndIf
            Next
            $bDaylight = $day >= $i
        Case 11 ; Nov
            For $i = 1 to 30
                if _DateToDayOfWeek($yr, 11, $i) = 1 Then
                    ExitLoop
                EndIf
            Next
            $bDaylight = $day < $i
        Case 4 to 10
            $bDaylight = True
        Case Else
            $bDaylight = False
    EndSwitch

    if $bDaylight Then
        $sDateTime = _DateAdd("h",5,$sDateTime)
    Else
        $sDateTime = _DateAdd("h",4,$sDateTime)
    EndIf

    Local $ret = StringReplace($sDateTime,"/","-")
    $ret =  StringReplace($ret," ","T")
    If $bDaylight Then      ; Eastern time zone
        $ret &= "-05:00"
    Else
        $ret &= "-04:00"
    EndIf

    Return $ret
EndFunc

As is, this is written for Eastern time. I have not figured out how to generalize this for all time zones.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

I see a typo in line 2070: this => these                                                               ==> FIXED: As I am not a native speaker I can live with this small mistakes :)
Also in 1958: _TS_TaskValidate() => _TS_TaskValidate($oService, $vTask)    ==> FIXED
Also in 2346: $oTriggers => $oTaskDefinition                                                   ==> Already FIXED: You mentioned this in one of your prior posts.

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

 

Link to comment
Share on other sites

Your English is excellent! Thanks for the fixes. I look forward to your next version of the UDF,

Do you have a suggestion for making my function handle all time zones? Perhaps its functionality could then be incorporated in your UDF.  Browsing the forum has suggested to me several approaches that do not work.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

I never had to deal with time zones. Maybe the _Date_Time UDF  that comes with AutoIt helps.
The following functions seem to be time zone related:

_Date_Time_SystemTimeToTzSpecificLocalTime
_Date_Time_TzSpecificLocalTimeToSystemTime

and others.

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

 

Link to comment
Share on other sites

I found _Date_Time_GetTimeZoneInformation(), but I have not yet figured out how to use it.

It appears to return the situation at the time a task is created but we need the bias on the date when the task runs.

What is meant by "SystemTime" ?

Edited by c.haslam
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

In this case I think you need to do the date/time calculation in the started exe.
The boundary when creating the task has to include the maximum possible values for all possible time zones.
 

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

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...