Screen content

hsurB

Well-known member
Hi, I have a question for people using screen content/touchtask plugin.
I want it to trigger my macro but only when chosen phrase on website is currently visible on screen.
Right now I manage to get it to trigger whenever the phrase is on website(even when its not currently visible on screen) using macrodroid screen content trigger.
I can't manage it to work with touchtask at all tho.
Any ideas if its even possible to achieve?
 

shao66

New member
As my prospective,

Achieving a trigger based on a chosen phrase being currently visible on the screen with the use of MacroDroid can be challenging. The Screen Content Trigger in MacroDroid detects specific text on the screen, but it doesn't inherently have the capability to check if that text is currently visible or within the user's current view.
To achieve this, you might need a more sophisticated automation tool or script, as it would require analyzing the layout of the webpage, scrolling if necessary, and checking if the chosen phrase is within the visible portion of the page. Tools like Selenium WebDriver in Python or JavaScript with headless browsers like Puppeteer are more suitable for this task. These tools allow you to interact with web pages programmatically, scroll through content, and perform actions based on what's visible.
In summary, while MacroDroid is a useful automation tool for many tasks, achieving a trigger based on the visibility of a specific phrase on a website may require a more robust scripting approach using tools designed for web automation.
 

hsurB

Well-known member
After days of trying I think you are right.
Read screen action is way more useful for this than trigger. I am looking for some updates on the top of a webpage.
The problem is after few refreshes there are some useless phrases saved into variable (cause something appears on page - maybe its even some kind of protection from using automated tools) and suddenly all indexes I have set up are messed up. Something that was saved in index:370 for exemple suddenly is in index:374 and everything is moved. I guess I could see how many versions of this there are and set multiple macros based on current scenario but still not too convinient.
For now I use ui interaction to copy whats on screen and save it in variable but thats just feels slow even tho its very reliable in my case.

To use tools you have provided I am simply too stupid for now 😅
 

sampleuserhere

Active member
The index may have changed because of some of the webpage contents hasn't been loaded yet. They usually are generated by js script embed in the sourcepage. (what HTTP Request > Get retrieves.)

Aside from Selenium and puppetter. You can also use AutoTools plugin (paid) with Read HTML action to make sure those contents are loaded. Normally, you just have to specify CSS queries for certain tag to retrieve certain text.

Anyway, what's the site and which text you want to scrap?
 

hsurB

Well-known member
Seems like most of the time it doesn't load everything. Everything is being loaded maybe once per 3-7 refreshes

Site I am writing about is https://skinport.com
Its marketplace with items from game that you buy or sell for real money. What I want to achieve is any time some new item appears on a page (I have some filters set up, like this one for exemple - https://skinport.com/pl/market?sort=sale&order=desc&pricegt=20000&pricelt=300000&rarity=4,6,12,30,27,5,28,2,29 ) I want to add it (I believe it reserves the item to verify later if I want to invest in it)

Since its about money, I don't mind paying if someone came up with something useful
 

sampleuserhere

Active member
My bad, I misunderstood your intention then.

If it's just about retrieving the information, AutoTools might have a shot with this with Javascript delay turned on. More or less the links for the items are stored in the following element <a class="ItemPreview-link" rel="nofollow" href="/item/m4a1-s-knight-minimal-wear/26415446">. You can then grab those with the following CSS query a.ItemPreview-link()=:=href with Autotools. Iterate the previous check with the new one to check for new items. Though there are also app like Web Alert that will notify you if there is a change within a site.


However, Interacting with the item directly within the site requires tools like Selenium, like what @shao66 had suggested.

https://www.reddit.com/r/tasker/comments/14nbemu/_/jqchflz
The above link may help you set up the requirements to run Selenium in your phone. The discussion may be in r/tasker, but the topic discussed there is not very specific to Tasker since MacroDroid can also interact with Termux via Termux:Tasker plugin.

Anyway, I couldn't help much after this point since this tool is also beyond myself. I'm sure there are far better forum to ask for this though, like r/termux, or stackoverflow.
 

hsurB

Well-known member
I did check the app and faced 2 problems, even in paid version it checks the website once/minute what is way too rarely, second - can't log into the site. But lets say I'd come up with an idea to solve the problem of checking for new items using macrodroid only (require a lot of macros to be created but I wouldn't mind). I saw some of your other posts @sampleuserhere and I saw that we can add #:~:text= at the end of link to find it on site and I thought 'hey, couldn't I use it to find the text my macro has just found as new on site to navigate to that and based on it perform ui interaction to add it to my cart?' and faced other problems. Since it was your post maybe you would be able to answer it.
I can use this only when I manually add it at the end of link in browser but didn't really manage to use it in macro either with WWW/HTTP GET or send intent.
Macro that would use UI Interaction to paste it at the end of link simply takes too much time so I donm't think its any option. And even if I managed it to work its still quite difficult to perform correct UI Interaction. I guess I could just add all 4 items in the row there was an update in (cause I have desktop version of site open on my phone and it shows 4 items in each row) and that would be fine cause I can later get rid off items I didn't really want it to add and proceed with buying the right one. As I said tho - any ideas how to correctly create a macro that would highlight the wear of items? - its in format 0.000 - 0.999 under each item and its really unlikely there are two items with the same wear.
Otherwise I will have to spend some time for a lot of learning to make any usage of Selenium or similar tools o_O
I really appreciate your effort guys to provide the help!
 

sampleuserhere

Active member
I don't have the pro version so I couldn't test the frequency check, but I could log-in to other site just fine, like Google for example.

Open the app > Open the website > Log-in.

Anyway, here's an example to open up the first item in search query with AutoTools. I extracted each item URLs with CSS query, load the first item, then have Macrodroid press add to cart button.


More of CSS Query. Selenium uses it to read and interact with the site too.


Otherwise I will have to spend some time for a lot of learning to make any usage of Selenium or similar tools o_O
I really appreciate your effort guys to provide the help!

This seems like the safest option. Your end goal is to interact with the website. Rather than trying to interact with the UI directly, having Selenium doing the job seems far more reliable.
 

Attachments

  • Load_HTTP.macro
    22.1 KB · Views: 3

sampleuserhere

Active member
As I said tho - any ideas how to correctly create a macro that would highlight the wear of items? - its in format 0.000 - 0.999 under each item and its really unlikely there are two items with the same wear.G

I forgot to answer this, afaik it's not possible to highlight the text with a pattern. The text must be exact and it will only highlight the very first match.
 

hsurB

Well-known member
I don't have the pro version so I couldn't test the frequency check, but I could log-in to other site just fine, like Google for example.

Open the app > Open the website > Log-in.

Anyway, here's an example to open up the first item in search query with AutoTools. I extracted each item URLs with CSS query, load the first item, then have Macrodroid press add to cart button.


More of CSS Query. Selenium uses it to read and interact with the site too.




This seems like the safest option. Your end goal is to interact with the website. Rather than trying to interact with the UI directly, having Selenium doing the job seems far more reliable.

Ok, so heres how I'd see this. Correct me if I am wrong with my thinking.
Basically what You sent would be one macro.
I could run it to scan whats on page (decide there is nothing interesting on page right now) and enable another macro that would look basically the same but in loop and would be saving items to another variable.
Then I could be checking if link1 in variable from 1st macro = link1 in variable from 2nd macro and notify me when theres difference. That would mean there is either something new on first position on site or they swapped places on page cause price has changed and then perform actions to open links with items from variables that are different and add to cart.
I am close to phone so I can check it quickly, its more about adding it to cart but that seems to be quick enough.
Then after it finds something new and deciding if I want it, I'd manually run 1st macro again to update all items I am aware of and enable 2nd macro again
Its interesting, I need to admit!
 
Last edited:

sampleuserhere

Active member
I was curious about what approach you ended up using and why you need to clone multiple macro. But you ended up replying to my last reply in this thread lmao.

Anyway, It seemed you get the general idea already.

I am close to phone so I can check it quickly, its more about adding it to cart but that seems to be quick enough.

The macro added the item to the cart too, It just happened so fast. I wasn't logged in either so it brought me to the login page instead.

Authentication can be done via the plugin configuration window, the option is at the most bottom of the list.
 

hsurB

Well-known member
I've tried creating all of it to test it finnaly and give feedback here but seems I have quite unexpected problem with correct usage of triggers.
For tests purposes I want to get notification any time that first link from first variable is different than first link from second variable and i can't seem to get it right. It either triggers everytime or doesn't trigger even though they are different.
 
Last edited:

hsurB

Well-known member
Basically Scan is 1st macro I run to save items from website after I've already seen them all, Bot is the one that will be runing in loop to notify me when there is something new and change contains triggers and actions that are supposted to be performed when 1st link from macro scan is different than 1st from macro bot etc. I think saving links to variable isn't yet considered as change so it wont make a trigger macrodroid variablr change to trigger so I created 3rd variable and is being cleared at the start of macro but then I had to add enable/disable macro 'change' so it wasn't triggering when variable is being cleared but its all quite tricky.
Please don't mind I am doing all of it in few macros but this way it seems to be clearer for me and later after adding all actions I want its even necessary
 

Attachments

  • Bot.macro
    30.6 KB · Views: 1
  • Change.macro
    13.4 KB · Views: 2
  • Scan.macro
    5.1 KB · Views: 1
  • received_1303064863931520.jpeg
    received_1303064863931520.jpeg
    44.8 KB · Views: 8
  • received_6579254402141947.jpeg
    received_6579254402141947.jpeg
    57.8 KB · Views: 8
  • received_838117881446458.jpeg
    received_838117881446458.jpeg
    39.4 KB · Views: 8
Last edited:

sampleuserhere

Active member
think saving links to variable isn't yet considered as change so it wont make a trigger macrodroid variablr change

I forgot to enable block next action for the plugin action, so the macro may not see the changes immediately. I think that happened because of this.

Anyway, This simplifies the approach and I enable block next action too. Try to run them as it is (with interval) for some time to see if it creates notification or not.

Load_HTTP.png
 

Attachments

  • Load_HTTP.macro
    57.5 KB · Views: 2

hsurB

Well-known member
I need to add more actions/triggers. It might take some time for it to catch any change in 1st. link.
Alhough I can't be comparing two variables the way I did or am I doing it wrong?
I even created simple macro that should trigger when two string variables are equal. I set them manually to the same value and it still never triggered 🤔
I already had problems with it when I tried to achieve it with read screen action. And it seems (I might be wrong) that if you have macro created with lets say:
Trigger - macrodroid variable change - random variable = 10
And its value was 10 earlier it has to be cleared for it to trigger again
 
Last edited:

sampleuserhere

Active member
I habe to revise mine. If you import the macro I sent earlier, you need to disable the Clear Variable action for items, before the autotools action. The trigger Macrodroid Variable Changes wouldn't detect the changes otherwise.


Alhough I can't be comparing two variables the way I did or am I doing it wrong?

I can't say for sure, I'm not that knowledgeable with Macrodroid flow yet.

Besides what I had mentioned before, it could be Change macro is playing catch with enable macro action inside Bot macro. Bot macro activates recently, but it may not start monitoring the change before the variable monitored in Change Macro gets set.
 

Attachments

  • Load_HTTP.macro
    12.3 KB · Views: 0

hsurB

Well-known member
I did run a test with your macro for quite a long time I'd say and I didn't get any notification. But maybe there wasn't anything new.
Anyway... I managed to make it work by fixing these 3 macros I updated here.
Run a test and it worked BUT ..
I check only first 16 items and there was a new item under link9 I believe what caused the rest of items behind it to be moved as well so I got notifications link9, 10... - 16.
And look .. the easiest thing to do is create 16macros - each for a change in links from 1 to 16 and add actions to disable other macros (since I don't want to be adding all 7 (or 16 if there is update in 1st link) items).
Change in link 9 should disable macros with change in link 10-16.
And here we are again at creating multiple macros 😂
When using clear variable action we can easily choose multiple variables, I wish it was a case with enable/disable macros action as well

Much thanks for Your effort to help me.
You had a decent idea, well executed with Read HTTP skills. Well done even when you didn't really know exactly what I want to achieve and how all of it works. Respect
 
Last edited:

sampleuserhere

Active member
Lmao, I appreciate that. I haven't interacted with array that much yet so this is a good way to get myself used to it.

Anyway, as you had mentioned, the index was indeed increased. I noticed that as well when I tried iterarting the new items against the old items

I think I may have figured it out now. Hopefully lmao. This one list the new urls if they don't present in old urls. You could see the track result I have in track array.

If this one doesn't even work I wouldn't know anynore. I guess you really do have to create 16 macros 😂 Though, I'm positive some veteran here should be able to give a better insight.
 

Attachments

  • Load_HTTP.macro
    73.3 KB · Views: 1
  • Load_HTTP.png
    Load_HTTP.png
    425.2 KB · Views: 3
Top