Screen Content Macro to Prevent Uninstalling Apps: Help with RegEx

cristalcommons

New member
Hello, pals :)


I want to find a way to prevent uninstalling certain apps without having to grant them Device Admin permissions.

My idea for that was a Macro that:
  • T - Detects the name of the app and the word 'Uninstall' in Google Play and Package Installer apps
  • A - And then immediately closes those apps before I could press the Uninstall button.


Current macro
TRIGGER
  • Screen Content (On Screen)
    • Applications: Google Play Store, Package Installer
    • Type: On Screen
    • Match Option: Text content
      • Text to match: ???????
    • Enable regular expression matching: Yes
ACTION
  • Kill Application
    • Select Application: Google Play Store, Package Installer

qcffJKN.png
Bi6BBfL.png



About Regular Expression

But I don't know how to make Macrodroid detect the name of the app and the word 'Uninstall', as they are part of a different string.
Also I would like the RegEx to be case insensitive, because Google Play uses 'Uninstall' (case) and Package Installer uses 'uninstall' (no case).

rt6TSFR.png
xqL85tp.png


I don't know RegEx, this is my first time using it, so my ideas for it to make it work are probably very bad:
Code:
(?i)StayFree+desinstalar
Code:
(?i)StayFree+[\n\r]*desinstalar
Code:
(?i)(?=.*StayFree)(?=.*desinstalar)

If this can be done, could you please help me set the RegEx code right?
Thank you.

Have a nice day!
 

LF0

Member
The uninstall and app names are not in the same string
You can try this (it's easier)

trigger
Screen content (uninstall)

action
1. Check the text on the screen (app name)

2. Kill the app (constraint: check the text on the screen if the result is true)

For screen content triggers and inspect on-screen text actions, you can check Use regular matching and then use the symbol "|" Space out multiple words so you can match multiple different words
 

Attachments

  • Screenshot_20240107_110632.jpg
    Screenshot_20240107_110632.jpg
    214.6 KB · Views: 14

cristalcommons

New member
Hello, pal!
Thank you so much, it works! 😊

I remember you because before posting I used the Search function and I found you helping another user with their DashDoor app.
You are very very good at this! Thank you for giving support to us users. It's very much appreciated 🙏

Now I understand much better how Variables work.
I will show my screenshots too so other people can create this Macro too.



Macro 'Prevent Uninstall'
Images
0FUdJy4.png
REHNMfv.png

qjoKFhy.png
MHrMXUq.png


Notes
  • Regular expression for insensitive case:
    Code:
    (?i)your_text_here
  • Regular expression for 'this' OR 'this':
    Code:
    textA|textB|textC
  • Update Rate: The frequency (in seconds) which Macrodroid reads screen contents once triggers are activated.

How to prevent disabling/editing macros
We can put the Macros we want to lock in a Category and then lock that Category with a password, and give that password to another person.
This way, we prevent the user from disabling the macro and uninstalling the app.

Images
kYEc5B1.png
MsEpROZ.png


Steps
  1. Go to 'Macros' menu
  2. Hold tap on 'Prevent Uninstall' macro > Select Category > [New Category] > 'Blocked'
  3. Hold tap on 'Blocked' category > Lock category > (Type a PIN code)
  4. Note down that PIN code and give it to a friend, family member, etc. so you have to ask them for it if you want to unlock your macros.
  5. (Optional) Set Macrodroid as Device Admin so Macrodroid cannot be uninstalled either.


Thank you so much for your help, LF0! 😊

Have a nice day!
 
Last edited:

Endercraft

Moderator (& bug finder :D)
Hello, pal!
Thank you so much, it works!

I remember you because before posting I used the Search function and I found you helping another user with their DashDoor app.
You are very very good at this! Now I understand much better how Variables work. Thank you for giving support to us users.

I will show my screenshots too so other people can create this Macro too.



Macro 'Prevent Uninstall'
Images
0FUdJy4.png
REHNMfv.png

qjoKFhy.png
MHrMXUq.png


Notes
  • Regular expression for insensitive case:
    Code:
    (?i)your_text_here
  • Update Rate: The frequency in which Macrodroid reads screen contents once triggers are activated.



How to prevent disabling/editing macros
We can put the Macros we want to lock in a Category and then lock that Category with a password, and give that password to another person.
This way, we prevent the user from disabling the macro and uninstalling the app.

Images
kYEc5B1.png
MsEpROZ.png


Steps
  1. Go to 'Macros' menu
  2. Hold tap on 'Prevent Uninstall' macro > Select Category > [New Category] > 'Blocked'
  3. Hold tap on 'Blocked' category > Lock category > (Type a PIN code)
  4. Note down that PIN code and give it to a friend, family member, etc. so you have to ask them for it if you want to unlock your macros.
  5. (Optional) Set Macrodroid as Device Admin so Macrodroid cannot be uninstalled either.


Thank you for your help, LF0! 😊

Have a nice day!
Maybe you should set a password for the whole app else people can just disable the app using the toggle on home screen.
 

cristalcommons

New member
Maybe you should set a password for the whole app else people can just disable the app using the toggle on home screen.
Oh, true! That toggle button! Gawd, I just forgot about it, haha.
I wonder if there's a native option for that in Macrodroid?
I have to check yet.
 
Top