MACRO: Variable Inspector Prompt and Dictionary Editor v3.2

That sounds strange. The macro 55)[VIP] Internal Inspector Tasks should get called when you click on the button, and the section that says "copyToClipboard" should happen. Can you stick something in there to verify that the macro is being called?

Thanks.

Make sure the group and the macros are enabled.

1 Like

That was it - the macros were enabled but the group wasn't. With the group enabled the copy function now works.

Thanks again!

2 Likes

This seems familiar :sweat_smile:

2 Likes

I've recommended looking in the forum/wiki for solutions to problems so many times I knew it would come round to bite me in the a$$ one day. LMAO.

1 Like

Cool. The strange thing is that with the group disabled, we're still able to launch the prompt. I guess I'll never understand the whole active/enabled/disabled thing, even though I thought I understood it.

1 Like

Yes - I was under the delusion that I understood it too.

1 Like

Perfectly worded! :laughing:

2 Likes

Haha it's inevitable man :laughing:

2 Likes

I just posted version 3.2 in the original post.

All users should install this new version. It contains numerous improvements and options, and assuming I didn't screw anything up, this will hopefully be the last update for a while.

2 Likes

It's a marvelous macro. But as a person who is completely unfamiliar with it, I tried learning how to use it, and came up with some questions/issues/observations. (I sent these to you privately but you suggested that I post them here, so I am doing that now.)

===

It's very cool. I'm beginning to understand it. And I'm starting to think it's an essential tool. But it did take me 5 minutes to find how to "Load All" my variables into it. That feature is hidden inside the "Options" button. Options?!? That feels like a difficult place to find something that nearly everyone needs nearly every time they start the app.

What does "(x)" mean? Does it mean "Total Number"? I've never seen that nomenclature before. If that's what it means, I would recommend "Qty." instead, which is far easier for noobs like me to understand. But this isn't very important.

I love the fact that you allow me to sort variables by size. But there's a problem. I can't find the total size, which means I have no idea what "percent" I'm saving when I delete a variable. Once again, me and my percentages.

You have a "Toggle Word Wrap" and "Toggle Fixed Font" button, but is there any chance you could also provide a "Toggle HTML view"? Many of my variables are HTML storage items. I'm not sure if this is a big ask or not.

What happens if I delete a variable, and before pressing OK, a KM macro runs and creates the variable? I'm not sure if it will be deleted or not. Here's a screenshot of a dictionary that I use for counting frequencies of five letter words. This is wonderful. Hmm, I pressed JSON while the dictionary was open, and it suddenly dawned on me that dictionaries are probably just JSON objects. I didn't realize that. Hmm, it seems your code has to have some sort of "JSON detection" algorithm. Interesting.

Hmm, when scrolling through a variable's contents, sometimes (about 5% of the time) I notice that the right half of the window scrolls, but the left half doesn't which results in a corrupted display. But when I try to take a screenshot, the corruption disappears before I can take the screen shot. Let me try taking a picture with my iPhone. I got it. Here it is, look for the glitch running downwards through the center of the pane... So I call this a "bug." It happens once every ten seconds on average.

I think the name of your app should not be "Variable Inspector" because (...I know Dictionaries are variables but...) your app can also edit Dictionaries. You are short-selling your app. Maybe "KM Data Inspector." Or come up with a truly unique name, so that web searches can find it more easily. Like "Scalpel" or "Maestroscope" (that's very cool!)

Okay, I'm grasping the idea that your initial three variables are there to assist new users in understanding what this app can do. But once I've read this once, why would I ever want to see it again? Shouldn't there be a way to have the app auto-load all my dictionaries and variables?

I see that you use the word "(Dictionary)" to help label them in the left pane. I'm beginning to see that it makes sense to put variables and dictionaries into the same pane. But I find it curious that you don't label "(JSON)" the same way. Personally, I would rather have the ability to select between displaying Dictionaries, JSON and Variables, because in my mind I'm working on only one type at a time. It's curious that you have three different buttons for loading three things (Dictionaries, Local, Global), but no way to select only one of them to see at any one time. Hmmm, I think I understand why.

To be honest, I don't understand how you can see or edit Local variables. They are usually very temporary. They shouldn't even exist when the Engine is not running. I'm not sure how they (or Instance variables?) show up in the list at all. How would you even edit something that's supposed to be local to a KM macro?

That's all for now. Maybe I'll do it again as I learn more about it.

2 Likes

From my PM reply:


Wow, that's a lot of questions, and they're all great.

Let me answer how to load variables first.

2022-02-15_15-06-41

This is the default "simple" parameters action. If you put "all" in the second field, you'll get all your global variables. If you put "all" in the third field, you'll get all your dictionaries. So you don't have to use the Options screen to load variables. I added the buttons to the option screen, just so I didn't have to go back and change the parameters.

Regarding the "(X)" numbers, hover your cursor over them, and after a few seconds, a tooltip should pop up. If it doesn't, read on.

By the way, if anything in the window doesn't appear to be working right, for instance, no popup tooltips, or no "hover" color change on the tool buttons, or the mouse pointer doesn't change to the "resize" pointer, stop the KM Engine and restart it. This is a known bug with... something. Peter doesn't think it's a KM issue, he thinks it's a Webkit issue. I don't have any idea, but I know that restarting the KM Engine seems to fix it.

And that may be the answer to your scrolling issue, I don't know. But whatever is causing it, it's not under my control. That's just a web element.

Total variable size and percent is a reasonable request. I'll see what I can do.

Regarding HTML view, do you mean you want the HTML to actually display web elements, like in a web page, or are you just talking about reformatting it?

Regarding changing variables, any changes you make to any variables or dictionaries takes place immediately. The OK and Cancel buttons are only there when the prompt is running synchronously, so you can either continue the current macro, or cancel it. And if it gets changed by another macro, I can't detect that.

And before you ask how to run the prompt Asynchronously, take a look at the #25 and #30 macros. They use the "advanced parameters" actions, which you can use in place of the more simple parameters actions any time you want. The only real advantage of running it Asynchronously is that the macro that launched the inspector can quit, so the Engine is doing a little less work. And the KM icon doesn't flash in the menu bar.

Hmm, it seems your code has to have some sort of "JSON detection" algorithm. Interesting.

There's a JavaScript routine to convert a string to JSON, so I just try it on each variable, and if it doesn't fail, then it's JSON. I don't know if Peter stores dictionaries as JSON or not - probably not. But yes, the formats are basically the same.

To be honest, I don't understand how you can see or edit Local variables. They are usually very temporary. They shouldn't even exist when the Engine is not running. I'm not sure how they (or Instance variables?) show up in the list at all. How would you even edit something that's supposed to be local to a KM macro?

It's actually no different than being able to access them in a Prompt for User Input action. As long as the prompt is running synchronously - in other words, the macro pauses while the prompt is being displayed - I can access the variables and change their values, just like a Prompt for User Input does.

Regarding the buttons for loading Local, Global, and Dictionaries, they just mirror what the parameters are in the actions that launch the Inspector.

Regarding filtering Dictionaries, JSON, or regular variables, I'll have to think about that. Maybe I can modify the Filter field somehow, I'll see.

Thanks for the kind words. I did mention "and Dictionary Editor" in the topic of the original post, but I couldn't figure out any way of making it clear, and not being confusing.

Let me know if I missed answering any questions. I'm guessing you'll have other questions as we go along.

2 Likes

I have quite a few variables that contain "HTML code" (ie, web pages) that I downloaded from websites. Maybe I'm the only one in the world that does this, so you don't have to accommodate me. You might even be able to auto-detect HTML variables just like you can already auto-detect JSON variables.

I'm just one person. I don't expect you to accommodate me, ever. I'm commenting because I enjoy critiquing software. Hopefully most developers are okay with critiques.

You're dang right I don't have to! :rofl: But if I can, and it's not hard, then I might.

You still didn't answer the question, though, but I'm guessing you'd like to see it formatted "pretty" if I can, right?

Hopefully most developers are okay with critiques.

Absolutely! :100: (I never know what that emoji is supposed to me, but I'm using it as "100%".)

I must have not understood your question. I just wanted to read the HTML code in a pretty manner, not as HTML commands.

That's what I thought. After a brief look online, I can't find anything that I could use easily for this. There's lots of websites that will do this for free, but none of them have APIs I can call from Javascript.

There's Javascript packages I could try and use, but frankly, it's more effort than it's worth. I suspect there might be a way to do it with BBEdit and a text filter of some kind, but I doubt it's easy.

So you're probably out of luck.

Is there some way you can create a button that passes the value to Safari for reading there?

Thanks for the idea. But he just wants the HTML reformatted, not rendered as a web page.

"He"? Do you regularly speak to your friends in the third person? I should be a second person pronoun. I'm not important enough to merit a three, (like the Queen's third-person "We are not amused") only a two.

Also, can you tell me the difference between "reformat" and "render"? I don't understand. I even googled it and they seem to be the same.

Well, sh!t. Sorry about that. I'm old - yeah, I'll blame it on that. Quick - look over there! :roll_eyes:

OK, let me restate it: I was under the impression that you just wanted it reformatted for display. In other words, turn this:

<h1>The world's most expensive cars</h1><ul><li>Bugatti La Voiture Noire: $18.68 million</li><li>Pagani Zonda HP Barchetta: $17.5 million</li><li>Rolls Royce Sweptail: $13 million</li><li>Bugatti Centodieci: $9 million</li><li>Lamborghini Veneno Roadster: $8.3 million</li></ul>

to this:

<h1>The world's most expensive cars</h1>
<ul>
    <li>Bugatti La Voiture Noire: $18.68 million</li>
    <li>Pagani Zonda HP Barchetta: $17.5 million</li>
    <li>Rolls Royce Sweptail: $13 million</li>
    <li>Bugatti Centodieci: $9 million</li>
    <li>Lamborghini Veneno Roadster: $8.3 million</li>
</ul>

That's what I mean by reformatting.

By rendering, I mean turning it into this:


The world's most expensive cars

  • Bugatti La Voiture Noire: $18.68 million
  • Pagani Zonda HP Barchetta: $17.5 million
  • Rolls Royce Sweptail: $13 million
  • Bugatti Centodieci: $9 million
  • Lamborghini Veneno Roadster: $8.3 million

Am I wrong about what you want?