DelArray / DelVariable

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 498
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

DelArray / DelVariable

Post by PepsiHog » Sat Jan 25, 2020 7:29 pm

Hello All,
I am curious about possibilities. I think an answer to this may give me some ideas. So far I can't seem to wrap my head around this. I am looking for some plausible examples.

I was playing around and happened to use DelArray. It's pretty self explanatory what it does. The part that I am having difficulty with is why would someone writing a macro want to make an array not usable?

See, I get wanting to delete something. But I can not understand the purpose of making the array name unusable again. So you can't delete the array and redefine it. Once it's deleted, it's gone.

When "you" write a macro, you understand what your concept is. If you decide to delete an array, I get that. But what are you worried about that you'd want to make it unusable again?

Maybe, the macro fairy is gonna come along and give it value! Maybe he'll leave something under your pillow.

You are the writer. The macro is not going to grow a brain. So what are you scared might happen? The only way it could be redefined is if "you" redefine it.

I am not "knocking" the command. This is not to make an argument for or against the command.

I am merely curious how the result could be put to use. The portion of the macro that refers to the deleted array, once deleted, could not be executed successfully again.

Here's my challenge. Someone come up with some twisted way of using DelArray or DelVariable. Wherein the deletion of said array or variable is actually useful.

Again, this isn't an attack on the command. I am actively contemplating twisted as sh** macros to write.

Love,
PepsiHog
***You gotta admit....THAT'S TWISTED!!!
StringReplace>Post,Love,Later,NewPost
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
JRL
Automation Wizard
Posts: 3396
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: DelArray / DelVariable

Post by JRL » Mon Jan 27, 2020 2:10 pm

...So you can't delete the array and redefine it. Once it's deleted, it's gone.
Not in my experience. Could you provide a short script sample where the array is deleted and then cannot be redefined?

The following sample deletes the array "Cell" then redefines it a couple of times. You can set the If>Count=3 line to a higher number if you want to test for a limit but I think you'll find that its not necessary, the only limit is your lifespan.

One limitation of DelArray is that it only works on single level arrays (Var_1). You cannot use it to delete a multilevel array. (Var_1_1). I don't remember why this is but I have an example below that proves it to be the case.

As to why someone would want to delete an array variable... Lets imagine you define an array and it has 5 elements the first time around, you reuse the same array name and you only have two elements the second time around. If you do not delete the array, you still have five elements defined. Those extra 3 array variables might cause a problem. Of course one could usually avoid the problem but in the name of code efficiency, DelArray> works well.


Code: Select all

Let>Count=0

Label>Start
Add>Count,1

Let>hh=0
Repeat>hh
  Add>hh,1
  Let>cell_%hh%=%hh%
Until>hh=10

MDL>cell_4

           DelArray>Cell

MDL>cell_4
If>Count=3
  Exit
EndIf
Goto>Start
Here's another script that demonstrates that DelArray does not work on multilevel arrays.

Code: Select all

Let>kk=0
Let>kkk=0
Repeat>kkk
  Add>kkk,1
  Repeat>kk
    Add>kk,1
    Let>cell_%kkk%_%kk%=%kkk%*%kk%
  Until>kk=10
  Let>kk=0
Until>kkk=10

MDL>Cell_8_2

           DelArray>Cell

MDL>Cell_8_2

User avatar
PepsiHog
Automation Wizard
Posts: 498
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: DelArray / DelVariable

Post by PepsiHog » Wed Jan 29, 2020 11:13 am

@JRL,
Below you will see my original post that was going to be. I don't know what the hell. I'm 50 years old. Probably already have some old person disease. I can't re-create it. OnEvent>ERROR.........mud in face.

But, my theory, you did something to it. Enjoy the mud on my face, on me. And you know what mud spells backwards. (unrelated, but mud backwards is dumb spelled wrong, which may be why it is dumb to begin with, huh?)

Code: Select all

As always thanks for replying.  To me that does not make sense.  I appreciate you taking the time to explain,  but that just makes no sense. (You're probably right, but that makes no sense.)

Firstly, I never define an array, a string at a time.  StringName_1, StringName_2....and so on.

Secondly, it's called an array because it is a string with multiple elements.  A string is 1 value.   Such as;

Let>String=MacroScheduler

That is a string.  But sometimes you want multiple strings in one place.  Each string has the same name only differentiated by the number.  That is an array.  (Maybe I don't say it well, but you see what I am saying.)

So when I use the Separate> command, it creates an array.  To DelArray suggests you delete all elements of that array.  Not a single element.  That is why it is called an array.  It has multiple parts.

Blah, blah, blah, right?  Again, not complaining, not arguing, just expressing why I didn't get it.  Maybe the help for this command could be better.

Yea, I was trying to delete the entire array.  Then trying to recreate that array with new elements.  I could redefine an element, but not the array.

Take a look at this example.  This is where I was confused.
*******unable to recreate************

However, all that being said, I GREATLY_1, GREATLY_2, GREATLY_3 appreciated your help! I will work on seeing if I can recreate it and if so, I'll post.

Thanks,
PepsiHog

Dang! Wish I had saved my original try! I don't care if I was wrong, but I'd like to see what I did, that was wrong!
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
PepsiHog
Automation Wizard
Posts: 498
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: DelArray / DelVariable

Post by PepsiHog » Wed Jan 29, 2020 11:59 am

I hate being wrong. It sucks. Especially, when you do it *right* in front of people. :oops:
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
JRL
Automation Wizard
Posts: 3396
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: DelArray / DelVariable

Post by JRL » Wed Jan 29, 2020 2:38 pm

@PepsiHog
Piffle!
Being wrong just means you're pushing your personal envelope.
Thomas Edison, my favorite American A-Hole said:
:idea:"I have not failed. I've just found 10,000 ways that won't work." :idea:

Remember Bob Hansen? Before I came along he had the most forum posts of any non-Macro Scheduler employee.
Here is Bob's FIRST post on the Macro Scheduler Forum (September 23, 2002)

Did you read it? Did you notice? He was wrong and Marcus called him on it. Didn't stop him from posting 2447 more times.

Can't tell you how many times I've been wrong publicly on the forum.
*right* in front of people
The point is being wrong occasionally is expected. That's why we have that little red faced emoji. Incidentally, you used it correctly. Good job!

Incidentally (2): In Bob's SECOND post he felt he needed two of them.

Incidentally (3): doing a search for ":oops:" yields 421 hits. Those are just the posters who were willing to openly admit they needed an "oops" emoji.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 925
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: DelArray / DelVariable

Post by Dorian (MJT support) » Wed Jan 29, 2020 9:03 pm

Amazing reply, JRL.

It's very easy for everyone here to think everyone else knows more than them - that everyone else is an expert. We all do things differently. We all have experience in different areas. We all have weak points (mine are Dialogs, Regex, and probably a whole boatload of other things). Macro Scheduler has hundreds of commands, and it would take a JRL style super-brain to remember the ins-and-outs of all of them.

I often have to do a huge amount of research and experimentation before posting replies - simply because someone is asking a question about something I'd never considered before, and it's my job to try and answer a question without needing to interrupt Marcus. And sometimes - very occasionally - it's something he has to research too. We can't all know everything about everything, but finding out something new is usually quite rewarding. I often learn something from both of your posts, @pepsi and @jrl.

..and don't forget I have the benefit of thousands and thousands of prior support tickets in the database, and despite that, we frequently get asked a question that nobody has ever asked before. Apart from "how long is the 30 day trial". We were asked that a few times. :D

Bob Hansen, now that's a name I remember.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
PepsiHog
Automation Wizard
Posts: 498
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: DelArray / DelVariable

Post by PepsiHog » Thu Feb 20, 2020 12:26 am

@JRL,
AHHHHH! Shucks! You made me feel better. So much support. Who'd ever expect support on a forum? BTW, life interrupted again. Hence, late response. (way past 10,000 here, baby!)

@Dorian,
You got that right. I know exactly what you're saying. Sometimes I think we all feel like, "it's just me". And that can be a very lonely feeling.

Also, my 30 day trial was for 43 days, 17 hours, 5 minutes, and 31 seconds. And I enjoyed every second. Still do. Well, except it's no longer a trial.

Thanks, Guys,
PepsiHog

Before Marcus blows the whistle on me, I'd better admit my trial was MAYBE 2 or 3 days. I DL'd MS, used it for a day, Freak'n loved it, sent an e-mail to Marcus saying pretty much that, then shortly afterwards, I was a proud owner. In fact, I am quoted here on MJTNet as saying just that.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts