I often create macros to open files (usually PDFs I am working on) and it's a bit tedious to have to construct a macro each time, even if I create a template which I duplicate to which I add the macro name (title) and insert path in ope file action.
Objective:
select a file in my file manager (I use Forklift but applies to any file manager - my macro copies both name and UNIX path to 2 variables using Forklift commands)
create a macro which opens the file in PDFExpert of HIghlights
name of macro is name of file
content of macro is open file action containing. UNIX path with PDFExpert
I want to ask the user of the file should be opened in PDFExpert or Highlights (another PDF annotation app)
put that macro in a macro group called current documents.
I am confused about the create macro part (the most important part...).
There is no "Make New Macro" command that lets you build a macro on the fly. The way you need to do this is by inserting the XML that creates a macro into the other macro. Some starting reading (which links to another post):
I am reviewing the link, have other ideas and will follow-up.
Quick question:
If I have the following text file which is basically the Copy XML of a macro which I can easily edit in 3 places and create exactly the macros I want, is there no way to convert that XML into a macro (XML to kmmacros) or import into KM ? I tried open in KM but it does not work.
There is, but I do so little of this that it's not my area of expertise—it's barely an area I'm aware of, in fact :).
I think you have to trim a few rows from the top and maybe a bit at the bottom, and then do it via AppleScript, somehow. Posting in one of the linked threads should get you a better answer, or someone else may reply here.
Approaching the issue from a different perspective: Do you need multiple macros? If the objective is to have a list of files to open in PDFExpert or Higlights, would a Prompt With List work, where the list is just an ever-changing list of files you want to work with?
If so, then you only need one macro that runs the list—maybe if you double-click a file in the list, it opens with PDFExpert, but if you Option-Double-Click then it opens in Highlights (or you could ask every time a file is chosen).
Your other macro would add items to the list.
This seems simpler than creating a slew of separate macros, but I don't know the overall objective, so this may not be viable for your needs.
there is a misunderstanding. I apologize for not expressing myself correctly.
As I am browsing the web → find interesting PDFs → download → in downloads in Forklift (could be anything) I look at the files with Quick Look→ I identify those files which I want to annotate → select file → run a macro which opens that file.
Nothing to do with Prompt for List which searches for already existing files I put in a list.
I think that I have a solution. Working on it and will follow-up
This is the part you could handle with one macro, as opposed to one macro for every file. But I'll wait and see what you post before trying to figure out the workflow in more detail :).
Is there a way to move the mouse down 284 pixels on the y axis, and keep the x axis coordinate the same ?
The move mouse action requires a x axis coordinate
Macros are always disabled when imported into the Keyboard Maestro Editor.
The user must ensure the macro is enabled.
The user must also ensure the macro's parent macro-group is enabled.
System information
macOS 14.7
Keyboard Maestro v11.0.3
It only works when you have a single item selected in Finder. When you do, and invoke the macro, it asks which app to open the file with, then does it. That could be modified to work with whatever tools you use without too much trouble ... or am I misunderstanding the objective?
There is a misunderstanding. I don't want to open a document. I want to have a library (palette in KM terms) of documents I am currently working on, each one with its own macro, not in an input list.
thank you
Then I would go back to the first approach I mentioned, but that's my personal preference. I'd have one macro that adds (and probably removes) documents from my Current Stuff Library. That macro could be tied to Finder or Forklift or whatever, making it easy to add things to the list.
I'd the have another macro that simply presented that list when I wanted to access one of the files in the Current Stuff Library.
And because I like integration, I'd have this wrapped up in one controlling macro. If I launch the macro with a selection in Finder, the macro would check to see if the item is in the library already. If it is, it'd ask me which app I wanted to open it in. If it wasn't, it'd add it to the list then ask me if I wanted to open it then or not. And if I didn't have anything selected, it'd let me remove things from the list.
But that's 100% personal preference, and for me, it's all about ease of implementation. I could write something like the above in maybe 30 minutes and be done. If I had to figure out how to write a macro to add more macros, and then worry about keyboard shortcuts and integration and removing macros I no longer need, I'd spend much more time on the process.
For your approach with macros making other macros, hopefully one of the experts on that subject will step in here, as that's not something I do very often at all.
This macro is ugly, clunky because of my limited understanding of KM, but it does the job
If you look at the group names, it's easy to follow the actions.
If you have any suggestions to make it faster, it would be great, but don't waste time on it.
The final result is that I browser the web → download PDFs of interest → review those PDFs with quick look in downloads → select those I want to annotate → create macros to open the docs and populate the current documents macro group with those macros
So what you do is have a subroutine that takes a file path as a parameter and opens that file in your choice of app, and make a palette of macros where each macro is nothing more than call to that subroutine.
Now all you have to to is Search and Replace "/path/to/the/file" with the path to your chosen file, get the name for the macro (presumably the file name), then use AppleScript to create a new macro (in the right Group!) and add an action using the new XML. Assuming the path is on the System Clipboard:
In your "Opener" subroutine, add a parameter so you can pass in the name of the app to open the file with.
Redo your template so it calls the sub with two parameters. Then follow the instructions above to change the XML text in the "Make a Macro" macro to the two-parameter version, add a prompt so you can choose the app, and a "Search and Replace" so you adjust the XML accordingly before using it in the AppleScript action.
Do the work in the "Opener" macro -- use the macros in your palette to tell "Opener" what to do.