Macro only works when 2 versions of it are in KM Editor!

Hey and good day,
After a good while I realized that my KM macro stopped working, the moment I had deleted the other test versions of it. Strange, isn't it?

So everything is fine as long as there are 2 versions, see pic (item5 and 6):

Screenshot 2025-07-11 at 22.54.11

I could not upload the macro for some unknown reason, so here is the pic:

ALSO a question:
Although the macro does work, maybe there is a simpler way for the steps:

  • ⌘ Up Arrow
  • Pause
  • ⌘ A
  • Pause
    ?

/
best regards,
OmarKN

Are the macros all in the same macro group? If not, are the macro groups available to the same set of applications?

Check the Keyboard Maestro Engine log file to check which macros have been triggered (see Help > Open logs folder in the KM Editor).

Also, try Help > Interactive Help.

1 Like

Both 2 macros are in the Global Macro Group, they are almost the same, except 1 relies on the %SystemClipboard%, the other one on the 'temporaryClipboard'.

As long as the 2 macros have the same hot key trigger, they both work.

When 1 of them gets a different hot key trigger, only one of them works.

When 1 of them gets NO hot key trigger at all, the remaining macro will not work.

DISCLAIMER: If we cannot solve this issue, then we can leave it as it is.
(It's weird, and many things are weird, whereas most things are beautiful.)

/
best regards,
OmarKN

As @kevinb suggested, if a macro is not doing anything, use the Interactive Help, select Something expected is not happening, and see what it has to say.

Almost the same... Ah well... :wink:

So you need to check what the contents of both clipboards are while your macros are running. It would appear that the contents of both clipboards are significant for the running of your (combined!) macro.

If only while testing, perhaps put them both in the same new macro group. That would be firstly for focus of attention, but also, I get the impression (perhaps mistakenly?) that the macros are only needed while BBEdit is the foreground application; if that is the case, limit that new macro group to be available within BBEdit only.

If you can spot another way of doing what you need to (within BBEdit?) then fine, but otherwise, that sequence of steps is not in itself an unusual or inelegant way of doing things in a KM macro.

As a general tip: one can either follow the instructions in the KM Wiki or do the following:

  1. Select the macro in the KM Editor.
  2. Select File > Export and save the macro to (for example) the Desktop.
  3. Drag the exported macro file into the post.

That method is quite simple but one does then have to deal with pasting in an image of the macro (if required) into the post separately.

This is what I did:

One of the 2 macros, I set to hot key NONE, and tested the remaining:

Interactive Help - in step 3

Macro Was Triggered

The macro "Add item5 β†’ onequranverse.php (no success when only 1 'Add item')" has fired once.

Since the macro was triggered, you know that it is running the actions. If you are still not getting the results you want, you need to look at the actions you are using. Some common issues you might run in to include…

\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I reinstated the 2nd macro, gave it the same hot key, and whoops! both work.

Later I put the macros into their own group,
deleted the one which was necessary before,
and added another different macro with the same hot key.

So everything is working as it should.

/
best regards,
OmarKN

1 Like

Why move the insertion point to the beginning of the document? "Select All" selects everything so your "Insert text by pasting" will overwrite its entire contents, regardless of where the insertion point is.

1 Like

I used these steps because before the ⌘ A selected the file view left column in BBEdit.

Now however, with only the ⌘ A it works smoothly, thank you!

/
best regards,
OmarKN

I did wonder if it was something to do with the file viewer -- but, for me, βŒ˜β†‘ merely selects the first file in the list.

I've been using the following to check if BBEdit's active pane is the file viewer or the document -- it seems to work OK:

tell application "BBEdit"
	set theSelection to (get selection)
	if class of theSelection is list and (theSelection is {} or class of item 1 of theSelection is not character) then
		return "FileViewer"
	else
		return "Document"
	end if
end tell

As in:

BBEdit Select All Demo.kmmacros (4.2 KB)

Hej Nige_S,

Implemented your AScr (this macro is for Opera and FFOX, Safari working fine with old solution "if menu item Paste is not enabled") but now the macro doesn't COPY the bodytext in the blue step 1 "Copy".
Despited adding pauses .

Hopefully you can have a look into it :slight_smile:

Send8f2 β†’ LLLP - FFOX-Opera Macro (v11.0.4)

Send8f2 β†’ LLLP - FFOX-Opera.kmmacros (14 KB)

Is anything selected in the frontmost Firefox window?

What happens if you disable that "Copy" action, do the Copy manually, then run the macro?

The manual Copy did not help.

If I set "delete past clipboard 0" β‡’ BODYtext

If I set "delete past clipboard 1" β‡’ URL

The weird thing is that this macro was working alright all the time.

If you run this with the Debugger and with the Clipboard History Switcher window open you'll see this is doing exactly what it says it will. It:

  1. Copies whatever is selected in the current frontmost Firefox window
  2. Activates the Firefox window's address bar
  3. Pauses then copies the current URL to the System Clipboard
  4. Puts the content of the System Clipboard (the URL) into a variable
  5. Deletes past clipboard 1 -- whatever was copied in step 1
  6. Opens/brings the BBEdit document to the front and puts the insertion point at the beginning
  7. Inserts some text which includes the contents of the System Clipboard (the URL)

You don't use Local1f3_theURL after you set it, and you delete the past clipboard containing the Firefox window's body text without using it.

Have you got multiple versions of the same macro and this is an older, incomplete, version which shouldn't be running?

What's the text you want to insert into BBEdit? Where does the text copied from the web page fit in?

= : SOLVED!

With the Variable added, it works.

Don't have the sightest idea why it was missing.

Thank you for the assistence!

Screenshot 2025-08-11 at 17.44.05

The AppleScript is now integrated into the macro, I hope it is at its best place, anyhow the macro does work.

That's the main thing!

Don't forget (because I always do) that you can reference past clipboards by token -- no need here to save to the variable and delete the current clipboard. So you can delete these actions:

...and change your "Insert" action to

image

1 Like

Excellent, Nige,

It's like I'm only scraching at the surface of KM!

/okn