Popular Post TheDcoder Posted December 26, 2022 Popular Post Share Posted December 26, 2022 Scheduler UDF A time-based task scheduler to run arbitrary tasks at set times in a day. Features Milli-second precision with reasonable accuracy Repeating tasks Run tasks even if scheduled time has elapsed (optional) Interruptible Project Home GitHub: https://github.com/TheDcoder/Scheduler.au3 --- Hello everyone, it's been a long time since I've made a new UDF I originally wanted to release this yesterday as my Christmas present to the AutoIt community but I couldn't find the time, so I'm releasing it today as a belated present Work on this was started many months ago but I got caught up with many things and couldn't find the time to clean this up and document everything. I made this UDF because I found myself implementing this in one way or the other in many projects, so I made it into a neat little package to release it to the general public, no need to reinvent the wheel and waste time on this. This implementation is very simple in my opinion and as a bonus I made it interruptible so that the user can exit out of the infinite event-loop. Enjoy and belated Merry Xmas! - TheDcoder Earthshine, SOLVE-SMART, Musashi and 2 others 5 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 More sharing options...
TheSaint Posted December 27, 2022 Share Posted December 27, 2022 Good work bud. I am guessing this is better than Windows Task Scheduler? TheDcoder 1 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) Link to comment Share on other sites More sharing options...
TheDcoder Posted December 28, 2022 Author Share Posted December 28, 2022 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. TheSaint 1 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 More sharing options...
TheSaint Posted December 28, 2022 Share Posted December 28, 2022 Sounds very promising .... now I just need a need for it. Most of my life follows an internal subconscious schedule. TheDcoder 1 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) Link to comment Share on other sites More sharing options...
TheDcoder Posted January 4, 2023 Author Share Posted January 4, 2023 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 So I rewrote the algorithm to fit the documentation --- 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 More sharing options...
SOLVE-SMART Posted January 4, 2023 Share Posted January 4, 2023 (edited) 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: Do you prefer the creation of a GitHub issue (where I describe what I want to do) before I come up with a PR? 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 regardsSven________________Stay innovative! Edited January 4, 2023 by SOLVE-SMART TheDcoder 1 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 More sharing options...
SOLVE-SMART Posted January 4, 2023 Share Posted January 4, 2023 (edited) 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 regardsSven________________Stay innovative! Edited January 4, 2023 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 More sharing options...
TheDcoder Posted January 4, 2023 Author Share Posted January 4, 2023 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 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 SOLVE-SMART 1 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 More sharing options...
SOLVE-SMART Posted January 4, 2023 Share Posted January 4, 2023 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 regardsSven________________Stay innovative! TheDcoder 1 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 More sharing options...
TheSaint Posted January 4, 2023 Share Posted January 4, 2023 7 hours ago, TheDcoder said: So I rewrote the algorithm to fit the documentation Really? I don't think you should have done that bud, and it brings to mind the Chicken or the Egg question. 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. TheDcoder 1 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) Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 4, 2023 Share Posted January 4, 2023 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 🤝 . 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 regardsSven________________Stay innovative! TheDcoder 1 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 More sharing options...
TheDcoder Posted January 5, 2023 Author Share Posted January 5, 2023 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 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. SOLVE-SMART 1 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 More sharing options...
SOLVE-SMART Posted January 5, 2023 Share Posted January 5, 2023 (edited) Hi @TheDcoder, great, understood 🤝 , further discussions and changes based on your replies can be made at GitHub. So see you there. Best regardsSven________________Stay innovative! Edited January 5, 2023 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 More sharing options...
phoenixhuynh09 Posted March 11, 2023 Share Posted March 11, 2023 I wrote to add 1 Function that can convert time (milliseconds) to timestamp format HH:MM:SS. expandcollapse popup;~ ; #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 More sharing options...
TheDcoder Posted March 11, 2023 Author Share Posted March 11, 2023 @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 phoenixhuynh09 1 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 More sharing options...
phoenixhuynh09 Posted March 12, 2023 Share Posted March 12, 2023 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 More sharing options...
TheDcoder Posted March 12, 2023 Author Share Posted March 12, 2023 @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 More sharing options...
phoenixhuynh09 Posted March 12, 2023 Share Posted March 12, 2023 @TheDcoder I have rewritten the _Scheduler_TimeToStamp function according to your suggestion. I also sent a pull request, please check it out. Thank you very much. Link to comment Share on other sites More sharing options...
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