How to set a pre-determined wallpaper based on file location?

Tman7077

New member
Hi,
I'm trying to set a lockscreen wallpaper based on a randomly-selected file. Attached is the screenshot of what the macro currently is. For reference, it goes simply like this. Triggered at sunrise and sunset, also every hour, it does the following:
1. Set a variable ("prev_random_number") to whatever the most recent random number generated was.
2. Set a variable ("is_dark") to TRUE if the sun is down and FALSE if the sun is up.
3. Set a variable ("random_number") to a random number from 1-11 if lv=is_dark is FALSE and from 1-19 if lv=is_dark is TRUE – this is because there are 11 wallpapers that I consider "day" wallpapers (they're brighter) and 19 that are night (darker).
4. Set a variable ("kustom_var-wallpaper") to a filepath. If it's dark outside (if lv=is_dark is TRUE), set the filepath to [filepath]/Night Wallpapers/*.jpg then replace "*.jpg" with the random number generated above. If it's light outside, do the same but in "/Day Wallpapers".
5. Send a broadcast to Kustom Live Wallpaper that tells it the generated filepath, so it can set the wallpaper from there. I know Kustom can do all of this by itself. However, Kustom can't set my lockscreen - with the conditions that I want. Trust me it just doesn't work, so I'm doing it with MacroDroid.

My question is this: how can I take this filepath with MacroDroid and set it as the lockscreen wallpaper? Can I do that? I have the filepath to the image I need, but the "set wallpaper" action seems to only support picking an image. I can go the long way and do something like "if lv=kustom_var-wallpaper equals '*/Day Wallpapers/1.jpg', set wallpaper to this image every time. If lv=kustom_var-wallpaper equals '*/Day Wallpapers/2.jpg', set wallpaper to this image every time, etc. etc." But that is lame. I'm just curious if there's a better way. Thank you! I know this is long.
Screenshot_20210223-101703.jpg
 
Top