I have a list of linux commands that I have to type frequently. They're in a text file. I like the functionality of the Prompt With List a lot, but I would prefer if the window remained opened after a selection is made, that way I dont' have to keep triggering the macro every time I need to input a command.
Is it possible? If not, is there any other action that I could use? Thank yoiu.
It is possible to keep a list prompt open indefinitely, but I wouldn't recommend it, since the prompt prevents you from interacting with your system until it's dismissed. Still, if you really want to try, here's a way to go about it:
To make use of this method, you'd just have to add a line to your text file used in the prompt exclusively for the purpose of changing the variable that the While loop checks to see if it should keep re-opening the prompt or not.
Again, however, I wouldn't recommend this method. Instead, I would suggest making a macro group that is only active and shows a palette while in the app(s) where you use these commands, and fill it with macros that each paste a different command from the file. That way you could click on the appropriate command from the palette while in the app, and it wouldn't interfere with anything else you might want to do. If you have a lot of commands in this file, and the prospect of making a new macro for each one individually seems daunting, you could very likely even automate this process with the For Each action and AppleScripting the KM editor. If this sounds like something you'd like to do but you're not sure how to go about doing so, and you don't mind sharing the text file in question, feel free to post it here, along with the name of the app(s) you use these commands in, as I'm sure one of us can help you with that too.
Yes, I mostly copy and paste commands in Terminal. Ideally I want to click a line and have it pasted (no need to select, no need to copy, and no need to focus on Terminal before pasting).
As you predicted, the window remains focused at all times and this kind of defeats the purpose. I learned a lot by reading your code though, thank you for sharing!
Do you know how you get a little menu when you assign the same shortcut to more than one macro? That is exactly what I am looking for in terms of functionality because it does not disappear when it loses focus. If only there was a way to keep that menu opened after an option is clicked, that would be so useful!
Yes, this is exactly what I was talking about here:
Here's an example of how this can work. First, make a macro group that is only available in the application(s) where you use these commands (I'm assuming this is Terminal here, but you can change this or add more):
Then you populate this macro group with simple macros consisting of a single "Insert text by pasting" actions:
You can then click on the macros listed in the palette to execute them (i.e. paste the commands they contain), and the palette will remain open until you close it. (Please note that once closed, it won't appear automatically again until you explicitly show it, which is why I've enabled the hotkey and status menu entry options in the macro group).
I set up a personal page that contains all the Shell commands that I need, and use clipboard.js to simply click and the content gets pasted into the clipboard.