Jump to content

Scheduler UDF - Run tasks according to a schedule in a day


TheDcoder
 Share

Recommended Posts

Good work bud.

I am guessing this is better than Windows Task Scheduler?

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

15 hours ago, TheSaint said:

Good work bud.

Thanks :)

15 hours ago, TheSaint said:

I am guessing this is better than Windows Task Scheduler?

Yes, definitely. Windows Task Scheduler just runs your program, it's not integrated into your program itself unlike my UDF, which gives you full control over the schedule, not to mention that your program can still display a GUI and do stuff periodically with AdlibRegister while the main event loop is sleeping. None of that is possible with Windows Task Scheduler.

The most important thing though, is the simplicity and independence, no need to bother messing with an external program and risk potential complications. Also it's just not a good look if you are developing a end-user GUI program and it doesn't have it's own schedule thing, instead you have to rely on the user or potentially other programs to not screw up whatever Task Scheduler settings need to be changed.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Sounds very promising .... now I just need a need for it. :lol: 

Most of my life follows an internal subconscious schedule. :muttley:

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Hello again,

I just fixed some wicked nasty bugs in the UDF which practically makes the original version unusable. I also added some quality of life improvements in the meanwhile :)

My most embarrassing bug is the nasty one, where I wrote incorrect documentation for the schedule format because I wrote from my memory. Turns out my 6-month old implementation was significantly different, who knew :wacko:

So I rewrote the algorithm to fit the documentation :lol:

---

If anyone has free time and would like to lend me a hand, please write an example script for the UDF. At this point the DIY testing script is broken due to all the changes, and I don't want to update it. So I'll probably remove it soon, so an example script could be of great help.

You will get due credit of course. If you are interested just fork my repo and send me a PR, or get in touch here with the script and I'll take a look.

---

Hopefully there aren't any more bugs in there...

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Hi @TheDcoder,

my first quick review is in progress 🧐 . What do you mean by:

44 minutes ago, TheDcoder said:

[...] the DIY testing script is broken due to all the changes, and I don't want to update it. So I'll probably remove it soon [...]

You are talking about Testing.au3, am I right?

44 minutes ago, TheDcoder said:

[...] please write an example script for the UDF [...] if you are interested just fork my repo and send me a PR, or get in touch here with the script and I'll take a look [...]

Could be possible that I can spent I bit of time to do this 😀 . But please don't necessarily expect it, I can not promise, but I will do my best .

Some questions:

  1. Do you prefer the creation of a GitHub issue (where I describe what I want to do) before I come up with a PR?
  2. Who is your target/focus group? You talk about an example for the UDF, what about extending the README (by some instructions) for a wider user field? Necessary or more nice to have?

Best regards
Sven

________________
Stay innovative!

Edited by SOLVE-SMART

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

To be honest @TheDcoder,

after forking your repository and reviewing your UDF a while and thinking about how the examples could look like, I struggle to find useful use cases (especially for a need of such accuracy) 🤔 . I would really like to contribute, but I miss a practiacl need (for now). Let me rethink it a bit later.

In a business view of point, I used such cronjob based scheduler before, maybe this could be a entry point for examples. Let's see,  I will get back.

Best regards
Sven

________________
Stay innovative!

Edited by SOLVE-SMART

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Hi @SOLVE-SMART,

2 hours ago, SOLVE-SMART said:

You are talking about Testing.au3, am I right?

Yup, that's the quick and dirty script I wrote to test changes on the fly :)

2 hours ago, SOLVE-SMART said:

Do you prefer the creation of a GitHub issue (where I describe what I want to do) before I come up with a PR?

Sure, it's your choice, we can also discuss here.

2 hours ago, SOLVE-SMART said:

Who is your target/focus group?

No one in particular, I just put it out for people who need to perform tasks according to a schedule everyday. Personally I'm using this in one of my work projects, I already created several variants of things like this for automation related work projects, so I made this comprehensive solution to cover all my bases in the future and avoid reinventing the wheel everytime :lol:

2 hours ago, SOLVE-SMART said:

You talk about an example for the UDF, what about extending the README (by some instructions) for a wider user field?

I think the README is adequate, but I'm always open for suggestions.

30 minutes ago, SOLVE-SMART said:

To be honest @TheDcoder,

after forking your repository and reviewing your UDF a while and thinking about how the examples could look like, I struggle to find useful use cases (especially for a need of such accuracy) 🤔 . I would really like to contribute, but I miss a practiacl need (for now). Let me rethink it a bit later.

No worries, the aspect about accuracy is just a nice to have feature, that wasn't one of my primary goals. It's fine if you don't have an use for this at the moment :)

32 minutes ago, SOLVE-SMART said:

In a business view of point, I used such cronjob based scheduler before, maybe this could be a entry point for examples. Let's see,  I will get back.

cron is indeed similar to Windows Task Scheduler, but it also shares all of the drawbacks that I mentioned. Don't push yourself to find some use case, at the end of the day it's just a hobby project :)

Having an example script is just another "nice to have" thing, it's not critical and I'm sure the person who wants to use this in a project can figure it out quite easily with the documentation... and maybe with a little bit of help from here :lol:

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Hi @TheDcoder,

all good and understandable, thanks. In case I find useful and meaningful examples and will create a pull request in which I explain whats going on etc. So I would skip the usage of GitHub issue beforehand 😅 .

I agree and like your mentioned advantages of this Scheduler.au3 UDF over "Windows Task Scheduler" or Cron(jobs) and their drawbacks 👍 .
I will not push myself, don't worry, but I guess I want to contribute 😅 .

Best regards
Sven

________________
Stay innovative!

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

7 hours ago, TheDcoder said:

So I rewrote the algorithm to fit the documentation

Really? :wacko:

I don't think you should have done that bud, and it brings to mind the Chicken or the Egg question. :blink:

Spoiler

Just kidding. Naturally you did what you thought was best. Lot of work though, and probably less thinking to have just rewritten the documentation instead. ;) 

Not to mention you screwed your example. :lol: 

 

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Hi @TheDcoder,

I am still working on the examples, but I do have a intermediate state which could be merged I think. The current state isn't working either, like you mentioned in a post above before. So I would like to come up with 1, 2 and 3 PRs as shown in the screenshot 🤝 .

image.thumb.png.58a1fe49c3321f34197fa593ec7812dd.png

  • Would you like to have a CHANGELOG.md file? I could create one with the keepachangelog.com style and SemVer, if you want to?
  • This would only make sense in my opinion, if you plan to extend the UDF more and more in the future?

Best regards
Sven

________________
Stay innovative!

 

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Hi @SOLVE-SMART,

Thanks for the PRs, I replied to all of them.

9 hours ago, SOLVE-SMART said:

Would you like to have a CHANGELOG.md file? I could create one with the keepachangelog.com style and SemVer, if you want to?

At this point, no. It would just increase the friction between changes. I don't intend to push a lot of updates, and I don't think the users of the UDF (i.e. other developers) would need such neat versioning and change-logs anyway, they can just diff the changes to see what changed, at-least that's what I do :lol:

9 hours ago, SOLVE-SMART said:

This would only make sense in my opinion, if you plan to extend the UDF more and more in the future?

I don't have any major plans for this UDF, there might be some small updates here and there but that's it.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Hi @TheDcoder,

great, understood 🤝 , further discussions and changes based on your replies can be made at GitHub. So see you there.

Best regards
Sven

________________
Stay innovative!

 

Edited by SOLVE-SMART

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

  • 2 months later...

I wrote to add 1 Function that can convert time (milliseconds) to timestamp format HH:MM:SS.

;~ ; #FUNCTION# ====================================================================================================================
; Name ..........: _Scheduler_TimeToStamp
; Description ...: Convert an integer time to timestamp for use in timesheets
; Syntax ........: _Scheduler_TimeToStamp($iTime)
; Parameters ....: $iTime              - The times, see remarks.
; Return values .: A timestamp representing the time since midnight
; Author ........: Phoenix Huynh
; Remarks .......:
; Related .......:
; ===============================================================================================================================

Func _Scheduler_TimeToStamp($iTime)
    Local $sTime = ""
    Local $iHours = Floor($iTime / 1000 / 60 / 60)
    $iTime -= $iHours * 1000 * 60 * 60
    Local $iMinutes = Floor($iTime / 1000 / 60)
    $iTime -= $iMinutes * 1000 * 60
    Local $iSeconds = Round($iTime / 1000)
    Switch $iHours
        Case $iHours = 0
            $sTime = "00"
        Case $iHours <= 9 And $iHours > 0
            $sTime = "0" & $iHours
        Case Else
            $sTime = $iHours
    EndSwitch
    Switch $iMinutes
        Case $iMinutes <= 9 And $iMinutes > 0
            $sTime &= String(':' & '0' & $iMinutes)
        Case $iMinutes = 0
            $sTime &= ":00"
        Case Else
            $sTime &= ":" & $iMinutes
    EndSwitch
    Switch $iSeconds
        Case $iSeconds <= 9 And $iSeconds > 0
            $sTime &= ":" & "0" & $iSeconds
        Case $iSeconds = 0
            $sTime &= ":00"
        Case Else
            $sTime &= ":" & $iSeconds
    EndSwitch
    Return $sTime
EndFunc   ;==>_Scheduler_TimeToStamp

 

Link to comment
Share on other sites

@phoenixhuynh09 Thanks, but are you sure that your code is correct? It seems you wanted to use "Select" and not "Switch"

Also I think we can rewrite it without using such long statements :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

10 hours ago, TheDcoder said:

@phoenixhuynh09 Thanks, but are you sure that your code is correct? It seems you wanted to use "Select" and not "Switch"

Also I think we can rewrite it without using such long statements :)


@TheDcoder Hi. I'm using it, haven't seen any errors yet. I am a newbie and self taught programming. So my code is not very good.
I'd be lucky if you rewrote that function.
Thanks a lot.

Link to comment
Share on other sites

@phoenixhuynh09 No worries, I suggest looking up the help file and understanding the difference between Select and Switch. Also look up the ternary operator (? and : symbols), it should help you reduce conditional statements.

If you are up for it, you can rewrite the function after learning and maybe even submit a PR at GitHub, I'll be happy to take a look :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

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...