Constants

Dm114

Well-known member
...Anyway there's something very strange I'm discovering: the global dictionary πŸ”ProtectedVARs contains some of my old test variables. Does it mean it came with the macros when you downloaded them?
@MacroDroidDev I know you are really busy but we discover something very strange and awkward (you could read our last posts here from this one)...

It seems that when uploading macros to the Template store, when users download them, they come with:
- Related Action blocks: ok
- Related Global variables if any. It could be ok and solves part of the dynamically variable creation question. The problem is that they are not empty and come with their content at the uplaoding time ☹️
- All macros and Action blocks that use these global variables (and have nothing to deal with the original uploaded macros)...
 

Dm114

Well-known member
Does it mean you also got the other mentioned macros? You only should have the macro πŸ”UpdtVARs and the Action block πŸ”GetVAR. Nothing else! The other ones were copies while testing the main ones (as you probably understood) and the BOOL boolean variable doesn't exist anymore.

I think there's a problem with exporting Action blocks...

Did you download the newest versions I uploaded yesterday. As I have a doubt, I wanted to upload them now but something goes wrong: both uploads fail today!

Anyway I just improved them a bit yesterday, adding a new functionality, but didn't change the logic that should work correctly. I remember that when I was making my tests, MD sometimes crashed or gave me odd results (as yours). Without changing anything, I sometimes restarted my device (not only MD) and then everything was clean...
Sorry, I forgot you also need 2 other functions (Action blocks): fⁿVerCheck (to check minimum MD version required depending on features used) and πŸ”RemVARs (to physically remove key variables, which is not yet possible even manually).
 

Dm114

Well-known member
Just rebooted, changed var to day(as you suggested), same result β˜ΉοΈπŸ€”
I'm really sorry. I checked again and again on my side: deleted dictionary, keys, recreated everything and everything workedcand still workd as intended... πŸ€”πŸ€”

I'll have another look deeper on your screnshots a bit later.

Does the πŸ”UpdtVARs macro works correctly? If you have time, just open the πŸ”GetVAR Action block as save it again (just in case some actions were pinked)
 

Dm114

Well-known member
Just rebooted, changed var to day(as you suggested), same result β˜ΉοΈπŸ€”
Hurrah! It's obvious: you didn't use the πŸ”UpdtVARs macro to create and update protected variables and the one you created was created manually! Its name is not in UPPERCASE so "Day" is not "reachable".

Modify manually its name by "DAY" and everything should work easily.

To avoid this kind of problem, use πŸ”UpdtVARs to create and maintain these variables (never use the kind of Set action you disabled in your test macro).
 

Dm114

Well-known member
Last but not least: I just realized that the update I made yesterday to the πŸ”GetVAR Action block failed and the bug about unknown protected variables wasn't fixed.

At last it is ok now (July 14 @ 18:45 UTC): an unknown name will return and empty string and/or a value to 0.

Sorry again, but it was not really my own fault... πŸ˜‰πŸ˜„
 

Snurre

Well-known member
Last but not least: I just realized that the update I made yesterday to the πŸ”GetVAR Action block failed and the bug about unknown protected variables wasn't fixed.

At last it is ok now (July 14 @ 18:45 UTC): an unknown name will return and empty string and/or a value to 0.

Sorry again, but it was not really my own fault... πŸ˜‰πŸ˜„
I've not got the time right now to test the macro's, but I don't know what's happening πŸ€”
I deleted all macro's, action block's, global var's and so on, rebooted and downloaded your two macro's again
I just say I got "value for the money" πŸ˜‚
Many action blocks, your test data in the var
Take a look
Screenshot_20220714_112915_com.arlosoft.macrodroid.jpg Screenshot_20220714_112937_com.arlosoft.macrodroid.jpg Screenshot_20220714_131047.jpg Screenshot_20220714_131223.jpg
 

Attachments

  • Screenshot_20220714_113030_com.arlosoft.macrodroid.jpg
    Screenshot_20220714_113030_com.arlosoft.macrodroid.jpg
    253.1 KB · Views: 6

Dm114

Well-known member
Hi friend,

I don't understand either what's happening! 😀
There's a real problem with the Template store!

My suggestion is to remove all this "shit" (variables, macros and action blocks that even haven't existed for several weeks on my device!) On my side I'm gonna delete the 2 faulty items in the Template store and will send you a new link for a fresh new download. Hope we'll get rid of that, at last!

If you're fed up (as I am) with all these problems, of course you can give up. πŸ˜‰
But you gave me a good idea and now I use this to store important informations (such as all celebration dates and special events) I was storing in my macros and I happened to erase by accident! Thanks to you... πŸ™
 

Dm114

Well-known member
Never give up my friend
It's not in my genes 🀣
Here we are! (hope so...)

1- link to TSTπŸ”GetVAR macro you should try first to check if it works (without changing anything) : just have a look to the content of the 3 local variables before and after running the macro ;

2- link to πŸ”UpdtVARs macro you should try then to visualize the content of the test variables already stored. I suggest not to go further at this step (do not create, update or remove yet).

3- you should only get the 3 action blocks (light bue) + πŸ”RemVARS and 2 macros (white) shown below:IMG-20220714-WA0006.jpgIMG-20220714-WA0007.jpg
(sorry I forgot to swap to English before screenshoting)

4- you should only get the global variable (dictionary) and nothing else with the content shown below:
IMG-20220714-WA0005.jpg
IMG-20220714-WA0008.jpg

Hope now everything will be ok for you. πŸ™

Have a nice day.
 

Snurre

Well-known member
Here we are! (hope so...)

1- link to TSTπŸ”GetVAR macro you should try first to check if it works (without changing anything) : just have a look to the content of the 3 local variables before and after running the macro ;

2- link to πŸ”UpdtVARs macro you should try then to visualize the content of the test variables already stored. I suggest not to go further at this step (do not create, update or remove yet).

3- you should only get the 3 action blocks (light bue) + πŸ”RemVARS and 2 macros (white) shown below:View attachment 3057View attachment 3056
(sorry I forgot to swap to English before screenshoting)

4- you should only get the global variable (dictionary) and nothing else with the content shown below:
View attachment 3058
View attachment 3059

Hope now everything will be ok for you. πŸ™

Have a nice day.
Strange, getting exactly the same as before, even after another reboot ☹️
Let's take a little break and try thinking about what's going onπŸ€”
In my opinion, I think it's something in the template store that f**k's up, don't know πŸ˜‰
 

Dm114

Well-known member
Strange, getting exactly the same as before, even after another reboot ☹️
Let's take a little break and try thinking about what's going onπŸ€”
In my opinion, I think it's something in the template store that f**k's up, don't know πŸ˜‰
Did you really delete all the previous garbage before downloading again?

Unless macros and action blocks keep in a hidden place old obsolete information... πŸ€”πŸ€”
I already suspected this kind of behaviour for another internal problem I had.

My very last suggestion would be to delete now all useless garbage (variable BOOL, unnecessary macros and action blocks) without downloading again.

To be sure you got the last version, try the TSTπŸ”GetVAR macro and modify the input field (e.g. adding or removing a letter) of one of the πŸ”Get VAR call to call an inexistent variable. If the result is empty or 0, it's ok.
 

Snurre

Well-known member
Hey my friendπŸ˜‰
I have used some time to read (and understand 😊) your work
I think it got a little tricky, so I gone another way, inspired by it
I have made a global var (dictionary) named Constants, with all of these var's I'm using in different macro's
When I need to use them, I read the value of that specific one into a local var first and use that instead of the global one's

I know it don't make the global var read only but I think it's somehow safer and maybe prevents accidental faults, when using a copy, for me anyway 😊
But thank you for taking the time to help me, you have done a great job, really appreciate that πŸ‘
Take care πŸ€—
 

Dm114

Well-known member
Hey my friendπŸ˜‰
I have used some time to read (and understand 😊) your work
I think it got a little tricky, so I gone another way, inspired by it
I have made a global var (dictionary) named Constants, with all of these var's I'm using in different macro's
When I need to use them, I read the value of that specific one into a local var first and use that instead of the global one's

I know it don't make the global var read only but I think it's somehow safer and maybe prevents accidental faults, when using a copy, for me anyway 😊
But thank you for taking the time to help me, you have done a great job, really appreciate that πŸ‘
Take care πŸ€—
I think the πŸ”UpdtVARs macro is a bit more "tricky" than the πŸ”GetVAR action block because it has many other functions (instead of simply retrieving a content/value). The πŸ”GetVAR action block is very simple if you exclude the MD version check and the control of the presence of the empty global dictionary, at the beginning. I had to add these controls to distribute these modules and make sure they would work anywhere and anytime.

For your personal use you could remove all these lines...

Anyway, you gave me the idea and I'm glad if you can start from my job to make your own macro. The only advice I would give you, is to never modifiy the content of your "constants" outside a dedicated macro (the reason why I created the specific πŸ”UpdtVARs macro). Or manually from the MD home page.

Good luck my friend!
 
Top