Closed hannes101 closed 2 years ago
You mean this part of the code? https://github.com/bnosac/taskscheduleR/blob/master/R/taskscheduleR.R#L163
Can you test if you replace
if(!schedule %in% c('ONCE', 'ONLOGON', 'ONIDLE')){
with
if(!schedule %in% c('ONLOGON', 'ONIDLE')){
if this works according to what you need.
Yes, that seems to work as expected. It's a bit tricky to keep track of all if-conditions :-)
how did you test this already
I just use a custom function based on taskscheduler_create
and thus I can quickly adapt the function, reload it and test the changes locally.
Can you test it on a real example as in schedule today, run tomorrow
That actually happened over night, I created a task and it was already executed with the changes to the function proposed by you.
I'm more in favor of adding something like this:
if(!schedule %in% c('ONLOGON', 'ONIDLE')){
if(missing(startdate)) then run immediately
else use the startdate
}
I don't really have a preference for any solution, but yours looks more safe. Thanks
I've made the changes, feel free to test out further.
Thanks a lot for the quick fix!
Hi,
I was struggling to create tasks, which should run once on particular dates. I initially thought this is caused by different locale settings and wrong formatting of the the dates, I provide for the startdate option of
taskscheduler_create
. I think that this is caused by the fact, that in case of "ONCE" the startdate is never set and defaults to Sys.Date().I think the code should be changed from
to
Because otherwise the addition of the date is never added to the cmd, or?