Automatically run workflow/pythonscript every X seconds
The closest answer to this Ive found is notification.schedule('message',seconds_delay,'action_url')
"Scheduled notifications are delivered even when your script (or even the entire app) is no longer running." Sounds great! If it was available for other stuff too that is (and if it already is, please tell me what Im supposed to look for, so far I haven't found it).
I could add an action_url, but requiring interaction is something I don't want (to quote the docs: "It is also possible to attach a URL to a notification that is launched when the notification is activated (e.g. selected in Notification Center).").
I was thinking of using a loop, but I haven't found out how to put an execution delay in python ;).
Battery consumption is not an issue.
Ok Ive found this http://omz-software.com/editorial/docs/library/threading.html#timer-objects lets just hope that your python supports it.
Other than it was "threading" and not "thread" I got it working . .. Gonna try and see if I can get it running in the background.
Doesn't run when another app got focus, much less when ipad is closed. Gonna experiment with forks and stuff and see if it works then.
You can't run code in the background (or when the screen is locked) for more than 10 minutes (approximately), it's an iOS limitation that you just can't get around.
In general, I wouldn't really recommend using threads in Pythonista/Editorial. For one thing, the apps won't continue to run your code in the background if the main interpreter thread isn't active, and it can get somewhat problematic when your threads run amok (i.e. it's not really possible in Python to stop a thread). To do something every few seconds, you don't need threads anyway, just put something like
time.sleep(1)in a loop...
Yes, the threads was just to see if I could get it to run in the background when editorial wasnt running. It didnt work. Ohwell, Ill have to see if I can do a workaround to what I want. Thanks anyway :)