Feature Requests: Execute Macro Return; Prompt for User Input Lines; Comment format

@peternlewis:

I have to start by reaffirming what an awesome job you've done, and continue to do with KM. Obviously I'm loving the JSON support, Local and Instance variables, and even the nice touches like "Set Variable to String" can Append or Prepend (I don't even know when you added that).

But of course we always want more.

Execute a Macro

I'd love to see this have an option to be able to return a result. I know I can pass in the name of a variable to receive the result, and of course I do this all the time, but this requires parsing the TriggerValue, the variable has to be at least an Instance variable, and it's just generally more work (poor me).

I'm imagining a new action "Set Result", and the "Execute a Macro" action could have an option to store the result to a variable. And hopefully it could store it in a Local variable. Obviously you couldn't return a result if you're running it asynchronously.

I'm sure we've talked about this before, but with the new JSON support, I've already started making more complicated sub-macros, so this just seemed a natural extension.

Prompt

  1. In the action editor, I sure wish the "Prompt" editor could expand to show more than 2 lines. It's just too easy to miss the additional text.

  2. In the prompt itself, I wish there was support for multi-line variables.

Comment

When I paste in rich text I create in, say, TextEdit, it comes in with a margin. I wish there was a way to get rid of the margin. I'd even settle for Apply Style to Clipboard having an option for removing the margins. I could certainly make due with that.

The reason I'm noticing this need now is because as I implement JSON parameters in my sub-macros, I naturally want to document the interface, and I'm doing something like this:

I'm specifying the required parameters in red, and using a different font for the entire JSON string.


That's all I got for now, although I swear I'm forgetting something.

Thanks.

Just use a fixed, known, instance variable, eg "Instance Result", as the result of any macro that wants to return a result.

Which Prompt?

What Margin? Have you set a margin in your TextEdit document?

That's actually a great idea, thanks! I hadn't been doing that before because at first there weren't Instance variables, and then when there were, I didn't know about them. So this will work great!

For anyone else reading this, after executing the sub-macro, it's probably a good idea to transfer the Instance result to another variable, so you don't accidentally overwrite it if you execute another sub-macro later on.

Which Prompt?

"Prompt for user input". Sorry - I thought I checked the action name before I posted this, but I only checked what I called it in KMFAM, which is not what it's really called. Oops.

What Margin? Have you set a margin in your TextEdit document?

My bad, and thanks for calling me on it. I could have sworn I tested with a new document in TextEdit, but maybe I pasted something into it that had a margin. Anyway, good to know it should work like I expected. Thanks again.

I also want to thank @peternlewis for his work in bringing us the last update. However, I want to bring up (again) my biggest disappointment about the latest version, which is that the Prompt With List interface remains cripplingly narrow. I hope that you will consider adding an option to make the prompt full screen (full width of the screen to maximize the visibility of long entries, and placed at the top of the screen to maximize the number of entries that are visible). Having parameters for these that can be set by the user would be ideal for this otherwise marvelously fast and useful KM action.

Noted.

More easily said than done.

You can select various options for the width in the action (gear) :gear: menu. The current maximum width is achieved by using “Automatic Width” which has a maximum width of 900.

Yes, I know, but that is not wide enough for lists of entries each of which is a paragraph. Even at automatic width, most of each entry is replaced by an ellipsis. It would be tolerable, perhaps, if the entries were allowed to appear with text wrapping.

I'm afraid basically at this point you are exceeding the design specs for the action.

You might need to look at other solutions, perhaps the Custom HTML Prompt action.

1 Like

Really? I was just thinking of a multi-line text box, or whatever you call them. But OK, you're the boss. :smile:

@peternlewis, I actually did go to a Custom HTML Prompt, and that solves the visibility problem and allows for fast searching, but I can't figure out how to implement arrow key navigation into it. The point is that Prompt With List already does all of this wonderfully well, even with my very complex lists. I don't think most people realize how powerful the Prompt With List Action is when it comes to speedy searches with arrow key navigation. Using Prompt With List only for short lists with entries of a word or two is like buying a Lamborghini just to run errands in a small town. It's much more powerful then that ALREADY, except it has the problems of placement of the box and width of the box. So I guess I'm asking whether you're against allowing for wider boxes or multi-line display just as a matter of principle or because making them wider than 900 (or having text-wrap) would present inordinate coding problems for you.

2 Likes

Dan, in the future please post each request in a separate Topic, and provide a more meaningful Title. (do I really have to tell you this stuff?? :wink: )

Agreed.

As far as I can tell, the width of the Prompt with Lists covers 99%+ of use cases. So, IMO, scarce development time is better spent elsewhere.

If anyone really needs a massive-width, massive-length display, then either use Custom HTML Prompt, or even BBEdit. BBEdit is very scriptable.

Yes, because that's new (to me anyway).

Making them wider is just more UI, I'm not against it per se, but there are issues with screen width and such - the code would have to allow for limiting the width based on available screen width. I'm not against it per se, it is just that it is not a high enough priority that it is likely to happen any time soon (or maybe any time).

As far as multiple line/wrapping, that is way beyond the scope of the action and will almost certainly never happen - it would require massive rewriting that cannot be justified.

By the bye, the problem of the prompt appearing off-screen has not been fixed in the latest version.

Do you have a repeatable way of causing this?

I've been asked to post a specific use case for a full screen-width Prompt With List, because there are others who would like this feature, as well. I've already stated that I use a list that is hundreds of entries long, and each entry is a paragraph (typically about 700 characters long). I can imagine many uses similar to mine, but I specifically use my list (invoked by Prompt With List) to choose specific replies to inquiries from clients. By typing a search word or phrase, my list is quickly narrowed down to those that have any chance of being relevant. It's then a simple matter to use the arrow keys to find the most relevant response. Upon my choosing from the list, my macro not only pastes that response into the application I'm using (such as an email client), but it also rewrites the list file, so that particular response is marked as already having been used for that particular client. That way, I don't reuse responses for the same client (the macro will present me with a warning if I try to do so). It works wonderfully well, but only if I am able to see the bulk of the text in the entries, and even with the widest box that's available with KM's current options for the prompt, only the first few words and the last few words of each entry are shown (with an ellipsis replacing the words in the middle).

I tried using Dan's excellent Spotlight Search macro, but with such a complex list, the search logic bogs down so much that each keystroke stalls the macro for about a second and a half while the search is refined. KM's Prompt With List, on the other hand, processes the entire search in a fraction of a second.

Anyway, I hope this example satisfies the request I received for particulars. I should add that my list is ever-growing, because I have a different KM macro that will add new responses to the list for future use. I append the list when none of the existing entries is suitable as a response, in which case I have to compose a new one.

This should be resolved for the next version.

2 Likes

The short answer is no. The long answer is that it seems to be random, but if there is repeatability, I haven't figured out the pattern.

Just chiming in to say that I've been seeing the same bug as @thoffman666 in KM 9, and have been similarly unable to reproduce it consistently. Not very helpful, I know, but I thought I could at least verify that this is happening to more than one KM 9 user.