Press Authorize 1Password CLI macro Window

I created a macro to logs me in my Citrix session when the session is locked. So it types my password when trigger a hotkey macro only for the Citrix Viewer Window when it exists.

But after a time 1Password ask me to Authorize the 1Password CLI for Keyboard Maestro again, i have to click or press enter for the marco to continue. But it doesn't find this Front Window for this 1Password Access Requested.

So tried a if this then macro so when it finds the Window of the 1Password question with the Authorize button it should press Enter.

So if the 1Password question appears it should press enter and continue and when the 1Password question is not shown it also must continue.

That's a "background process" window, so will be difficult to target as a "front window" in a KM action.

Try this "Execute an AppleScript action instead -- put it immediately before the action that uses 1Password CLI:

Allow 1Pass CLI Access.kmactions (1000 Bytes)

image

It runs asynchronously, so your macro immediately moves on to the CLI action without waiting for the AppleScript to finish. The AS itself waits for 1 second to give the access request time to appear, and if it does (the 1Password process has a window called "1Password") it simulates pressing the Return key (key code 36) to "Authorize" access.

Im trying to figure out how to use this in my macro

Because im using a variable in my script

Put it between the "Pause" and "Execute Shell Script" actions.

That doesn't matter -- all the AppleScript does is wait a beat in case the 1Pass "Allow" dialog appears, and if it does it simulates you pressing the Return key. If the dialog doesn't appear the script exits without doing anything.

Meanwhile your shell script is trying to get the password. If 1Pass CLI requires you to "Allow" it waits for you to do so -- at which point the AS "presses" the button for you.

Thank you, it works now!

Is there a other way to make it more proof? Because when 1password cli reacts slower then the enter given by de script has already took place.

Increase the number in the AppleScript's line one delay statement, but keep it below the CLI command's own timeout (10 seconds?).

@Nige_S The script runs great on my external monitor and my macbook in clamshell mode with external keyboard , then the touch id is disabled and get the authorize button.

But working on my macbook without clamshell mode it get an the touch id option and the script press enter then i have to give in me password.

Is there a detection option so that your script checks to run when in clamshell mode or detect if touch id available?

Enter pressed

Hello @B0rg :wave:

Try branching your routines based on your Mac‘s Name and Screencount as well as if any Screencount‘s value is internal screen or not.

That will be the easiest method which requires nothing more than a few native functions of KM without any scripting.

Greetings from Germany :de:

Tobias

i can detect clamshell mode using if this then.. ioreg -r -k AppleClamshellState | awk -F'= ' '/AppleClamshellState/ { print $2 }' which output yes or no

The thing is when at work i have a Keyboard with touch is, then when i detect the clamshell mode is enabled it still triggers the script and give and gives the enter.

Easiest way is to test the size of the internal display -- it will be 0,0 when the lid is closed. To put that another way:

image

Thank you @Nige_S
And i need somehting to detect if the MX is present, i created this:

/opt/homebrew/bin/blueutil --connected
address: xx-xx-xx-42-62-0e, connected (master, 0 dBm), not favourite, paired, name: "MX Master 3", recent access date: 2025-08-01 12:28:57 +0000
address: xx-xx-xx-79-7c-3e, connected (master, 0 dBm), not favourite, paired, name: "MX KEYS S MAC", recent access date: 2025-08-01 12:28:57 +0000

/opt/homebrew/bin/blueutil --connected | awk -F'name: ' '/MX KEYS S MAC/ { print ""MX KEYS S MAC"" }'

"MX KEYS S MAC"

But it doesnt work, it keeps saying false when evaluating condition while the lid is closed and mx keys is connected. Why i still get a false?