run control UI unattended

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

run control UI unattended

Post by tsolignani » 17 Mar 2020 21:07

Good afternoon folk.

I have a second phone where I run some flows with control UI unattended, so I wonder how I could avoid them to run at the same time, ruining everything.

Say I save a txt file with a status update on my first and main phone. Dropsync sync it to the second phone.

On the second phone there is a flow with a file observer trigger that launches a flow to copy the file's content and publish a status update on a social network, via its Android app. I have several flows one for Facebook, one for Instagram, one for vk, ecc.

I don't want them to run at the same time otherwise it won't work.

I tried defining a global variable say global_running and set it to on at the beginning not each flow. Then I put a condition, if the global_running is set to no, run the flow, if set to yes, wait 2 minutes and try again to run the flow, until you find it to no.

Sometimes it works, sometimes more flows run at the same time and so it does not work.

Any hint?

I wonder if I got the right path to face that problem or wethere I should have do it otherwise.

Thank you.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: run control UI unattended

Post by BoBo » 18 Mar 2020 16:35

Hi,
What about creating an HttpRequest (server) instance that delivers its current status if requested by a potential 'interferer'??
That way the running process could provide even changing status levels in real-time ("TrackingLevel: 9of10").
And bc the thing is about monitoring file transfers I'd go with a "before/after transfer" filesize comparison handshake (or md5 if needed).

Good luck :)

BTW, a nice app/widget to send request: HttpRequest Shortcuts by Waboodoo
https://github.com/Waboodoo/HTTP-Shortcuts
https://play.google.com/store/apps/deta ... _shortcuts

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: run control UI unattended

Post by Desmanto » 18 Mar 2020 20:06

You need to combine all the flow that need to run in single instance into single gigantic flow, and separate them using multiple parallel expression. Change the Flow Execution Policy to "Wait". This way, no matter how many times you dropsync the file, only single instance of the flow will run. Then it will continue to the next trigger when finish one instance. viewtopic.php?f=5&t=6882

Other way, if you still need flow separation for better flow management (sometimes it get ugly if we combine everything into single flow), you still have to combine the File observer trigger into single flow, using the same FEP "Wait". But instead of copying the whole action from each flow, you only use Execute flow, and use the flow name and check wait for called flow to finish. This will ensure the same single instance. The best thing with this is, you don't need multiple parallel expression, you can use map object to map each trigger to its corresponding flow name, saving a lot of space in the combined flow.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply