After a few more tests, I found that calling time.sleep(n)
, where n
is anything large enough to leave enough time to click on Ok to get to the app you want to open works. Apparently, the clock stops when the Pythonista isn't active, and so it doesn't stop waiting until we get back.
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by ejetzer
-
RE: When trying to loop several `webbrowser.open()` with `x-callback` to Due in, only the first call works
-
RE: When trying to loop several `webbrowser.open()` with `x-callback` to Due in, only the first call works
Browsing other answers, I saw people using
Scene.pause()
for this, and I coupled it withtime.sleep()
in a loop, to wait some time before repeating. It seems to work fine, but I'm not sure I usedscene
right, and maybe it's just thesleep()
that stops the script until the app regains foreground.I did think about chaining scripts though, thank you.
-
When trying to loop several `webbrowser.open()` with `x-callback` to Due in, only the first call works
I've been trying to automate the export of Omnifocus tasks to Due, & for that I need to use Due's url scheme repeatedly in the script. You can see an example in this gist: https://gist.github.com/4b3561200491814c5538 . It looks like
webbrowser.open(url1) print 'Done 1.' webbrowser.open(url2) print 'Done 2.'
No exceptions are raised, & the output is
Done 1. Done 2.
As if all calls were made. Why does it not open the url, come back to Pythonista, & open the next one?