How to do this in Automagic
Moderator: Martin
How to do this in Automagic
In Tasker, I was able to create a screenshot of a cropped area, for example, a play button. It used good old autoinput, screen capture and crop to achieve this.
This would then be compared to another cropped screenshot to see if it is the same image.
This would be used in instances where you are running an app and if a certain button appeared it would be pressed.
Is there a way to replicate this in Automagic?
This would then be compared to another cropped screenshot to see if it is the same image.
This would be used in instances where you are running an app and if a certain button appeared it would be pressed.
Is there a way to replicate this in Automagic?
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: How to do this in Automagic
The action called "Take Screenshot" is experimental but worth a try. You will have to save the file to storage though. Which you then can delete after the process if you will, or just leave it there so it'll be rewritten next time.
Then use action "Init Variable Image File" to store the image from a file information inside a variable.
Then use that variable inside action "Modify Image" that you place after that, where you can crop your screenshot.
Then use action "Init Variable Image File" to store the image from a file information inside a variable.
Then use that variable inside action "Modify Image" that you place after that, where you can crop your screenshot.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: How to do this in Automagic
It can be done as answered by digitalstone, but it will be very slow. You have to save the image file again at the last and compared it to the exisiting one. But you have to do it exactly right. So probably you want to run the flow once until you get the exact portion of the cropped size in variable {image_data}. Pass this to hash() and get the hash value. next time, you only need to check whether the next {image_data} has the same hash as the first one.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: How to do this in Automagic
Could it run every 10 seconds and is it only Android 9 as that will decide if I have to use the Autoinput plugin instead as that works with Android 6.
Re: How to do this in Automagic
Action Take screenshot already available since LP 5.0, it uses Media Projection API, will prompt something like "Automagic is starting to recording your screen ....". You can check don't show again for automagic (so no need to confirm again later). The new takeScreenshot() is available on CUI only for android pie. You can't use this before Pie. AFAIK, Automagic v1.36 completely eliminate the need of autoinput, since it covers everything autoinput can do.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: How to do this in Automagic
I'm very close, the only problem I have is that each time I do the hash() I get a different number even if the 2 images are the same.
So h1 == h2 does not work as they will always be different numbers each time I run the flow.
[url=https://ibb.co/n1E5yL][img]https:/ ... .png[/img][/url]
So h1 == h2 does not work as they will always be different numbers each time I run the flow.
[url=https://ibb.co/n1E5yL][img]https:/ ... .png[/img][/url]
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: How to do this in Automagic
What happens when you generate and show hashtags multiple times for image1 and the same for image2 ?
Do they keep being the same for each image?
Sorry, just my 2 cents here.
Do they keep being the same for each image?
Sorry, just my 2 cents here.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: How to do this in Automagic
When I do multiple hash for image1 they are the same.
Also when I do multiple hash for image2 they are the same.
But image1 hash is never the same as image2 hash.
Is a hash based on filename too? so if they are called different names but the same picture will this give a different hash?
Also when I do multiple hash for image2 they are the same.
But image1 hash is never the same as image2 hash.
Is a hash based on filename too? so if they are called different names but the same picture will this give a different hash?
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: How to do this in Automagic
That should not be the case.
To get further in this troubleshooting you should limit as many factors as possible.
In this case i would take 1 picture, and make a copy of that file with a different filename to test the hashcodes out on those.
To get further in this troubleshooting you should limit as many factors as possible.
In this case i would take 1 picture, and make a copy of that file with a different filename to test the hashcodes out on those.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)
Re: How to do this in Automagic
Just copied the image gave it a different name and got 2 different hashes.