Can anyone help me to understand why the Conflict Palette doesn't work for this Macros!

I made this 2 test macros to generate a conflict palette. Individually works fine but when both are activated, the conflict palette show up as expected but clicking the name or typing the number do nothing and just disappear.

I tried to set the triggers to "is down" but in this case the CP doesn't show up and both scripts execute.

Basically what I want to do is to have 2 different triggers that run two different applescript in the some macro. Thanks in advance.

CP-Help Macros.kmmacros (10.2 KB)

When a script is triggered with a hotkey you can use the %TriggerValue% token to get the key(s) pressed. But when a script is triggered via a palette (which is triggered by a shared hotkey) then the "trigger type" is "Palette" and %TriggerValue% only contains the modifier key held when the palette was clicked.

(And note that you can't use the Option key in this case, because Option-clicking a macro in a palette means "Open this macro for editing".)

At least, that's my understanding from the Wiki and a quick play in KM.

Then you want one macro, which decides what to do based on the hotkeys the triggered it. Something like this, maybe?

Nige_S many thanks for the reply.

I am trying your suggestion but I can't write the "option modifier key" in the input "is" field. How did you do that?

Also the "otherwise" option is not what I am looking for. Need to be a specific trigger hopefully the "control".

I am trying to use this concept to simplify my workflow.

  1. excute a script with the "option modifier key"
  2. locate and open the some script for editing.

Copied if from another macro, and pasted it in! But if you look in KM's "Macro Library" you'll find a Group called "Menu Glyphs" that'll help you add funky characters in any text field.

This is a specific trigger if the macro is triggered by hotkeys. If you use any other method, eg KM's Run button, then yes it will default to the second part. If you want to be more precise then split it into two separate "If" actions, like you did in your original macro.

Do you mean you want to have it so that, for example, Ctrl-N runs a macro but Opt-N opens it in KM for editing? In which case:

Script Choice.kmmacros (3.9 KB)

Summary

Unfortunately the "Script Choice" macro you posted has the some result of my original one. Please note that the issue happen only when conflicting, as for my very first post. Without a conflict, the macro just run as expected with both triggers.

Nearly:
Ctrl-N execute a file.scpt
Opt-N execute an applescript "test script action" which locate the file.scpt and open it in my default applescript Script Debugger Editor for editing.

This 2nd Example will clarify better.
CP-Example_2.kmmacros (4.6 KB)

I guess I could avoid conflicts as that is the issue but I don't understand why the CP doesn't works in this case but works just fine in any single trigger macros.

Many thanks for your time.

OK, I see my problem -- I thought you were using "macro" and "script" interchangeably, but you actually mean "a macro that then runs an AppleScript file".

Because, as I said before, when you run a macro from a palette -- even the Conflict palette -- the trigger token is palette-related and not the hotkeys you used to make the Conflict palette appear. And you can't Opt-click the palette because that opens up the macro for editing. You could use Opt-Shift-click -- which would make sense because you're editing (Opt) but the .scpt file (Shift) rather than the macro.

So your workflow would be:

  • Crtl-N -- opens the Conflict palette
    then
  • Click or otherwise select the macro to run it, which runs the .scpt file
  • Option-click the macro to edit it
  • Shift-Option-click the macro to edit the .scpt file in Script Debugger

Would that make sense?

Tried that but unfortunately some result. I even changed the Opt-click to Cmd-click but no eval.

I got the feel that CP can't handle double conflict. In fact if I set the macros's triggers to "is down" instead of "is pressed", the CP doesn't show up at all but will execute both scripts which is not desirable. May there is other way to do this but I am very very new to KM.

This is what I mean -- image of only N1, N2 is the same except uses "N2" in speech and dialog:

Nige N Tests Macros.kmmacros (8.3 KB)

  • With both macros enabled, either Opt-N or Ctrl-N will bring up the Conflict palette
  • If you click an entry on the Conflict palette the selected macro will run "normally" and give you the on-screen dialog -- your "run my .scpt file" mode
  • If you hold down the Option key and click the palette, the macro will open in KM ready for editing (standard behaviour)
  • If you hold down the Option and Shift keys while clicking the Conflict palette the macro will run in what for you would be "edit .scpt mode" and speak some dialog

Once the Conflict palette is invoked it is the modifier keys held down while selecting the macro from the Conflict palette that count, and not anything you've done previously.

1 Like

That's the trick then. EXCELLENT !!
Starting to learn KM :grinning:

Many thanks again Nige.