Is It Conceivable to Create a Macro to Generate Other Macros?

Hello,

I created the simple macro below to move documents in DevonThink. The document moved is the one selected and the destination is located in the action insert text by typing. It works fine.

I would like to create a series of macros which I would amalgamate into a palette of different destinations of the move.

  • Destination1
  • Destination2
  • Destination3
  • Destination4
  • Etc

In other words, I would like to take the macro below and create copies replacing each time mac.KBM keyboard maestro with a different destination taken from a list of folder names in a text file.

Is this possible ? If not a macro, could I create a set of actions which I could paste into a macro ? Or should it all be done within the same macro ?

Please note that searching for the destination within a list is not my first choice. I can already do that in DevonThink. I would prefer a palette with hotkeys

Thanks in advance for your time and help

1 Like

Hey @ronald,

You can:

  • Create a macro.
  • Copy its XML.
  • Make changes to the XML by whatever means.
  • Create a new macro using the changed XML with AppleScript.

So – the answer to your question is yes.

Not so simple, but not so difficult either.

See this thread for the basics:

Macro to Create a Text Expansion Macro from the Selected Text

Peter's macro will NOT do what you want, but the mechanisms he uses give you the gist of HOW to do what you want.

-Chris

1 Like

I made a macro long ago to generate a quiz answer list for a class.
Not sure how helpful it can be to you, but at least you can have a sense how I did it. Looks like it's not a difficult one. However, it's been long ago, so I will have to spend sometime to understand what I did.

(Edit: now I have a little bit more about scripting. I should simplify the applescript to avoid unnecessary repetitive lines there.)

Edit2: OK. here is the simplified version:

z_Make a Quiz List Answer for a class.kmmacros (6.1 KB)

1 Like

If I understand your goal correctly, it sounds like it would be easier to do using a variable. So rather than modifying your target macro, it would just use the variable you set from your list of folder names, calling the target macro in a loop.

1 Like

thank you very much. I am not sure how I would integrate this into my macro.

I think that you are 100% right, and I realize that I was looking for a contorted solution to try to work around my difficulty creating input interfaces.
Using variables is definitely the way to go.
Could you suggest an input menu action linked to a variable, something like Press 1 to move to X, press 2 to move to y, etc
If you just give me a general idea, I can work on it from there.
thanks very much

Hey @ronald,

My personal opinion is that you're taking an overly difficult crack at this by trying to use a conflict palette.

It's too hard to maintain and somewhat inflexible when designating keyboard shortcuts.

I recommend using a Prompt With List action, like I've done with the following two macros:

Move Selected Finder Items to the Specified Folder

Open a Folder in the Finder via a Path List in a User Prompt

The open folder macro supports text-tags – the move item macro does not at present, although I plan to remedy that.

-Chris