dimanche 28 février 2021

Autohotkey If Statement makes only one result

I wanted to run a program on working day only, so I wrote a AutoHotKey script to check "today is sunday or holiday"

But my script doesn't work and I didn't get what the problem is. Here is the code.

Result = "WorkingDay"

if(A_Wday = 1) {
Result = "Sunday"
}

HolidayList = 0101|0211|0212|0213|0301|0409|0501|0505|0519|0606|0815|0920|0921|0922|1003|1009|1225
StringSplit,HoliDay,HoliDayList,|
StringLeft,Today,A_Now,8
StringRight,Today,Today,4

Loop %Holiday0%
    {
    CheckDay := HoliDay%A_index%
    ; msgbox, %Today% = %CheckDay%
    if ( %Today% == %CheckDay% ) {
    Result = "Holiday"
    break
    }
}

msgbox, %Today% = %Result%

The problem is that the "Result" variable return only "Holiday"

Please help me out......... Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire