UI Selection

There is a “Try” around Copy.

If the copy does not happen, then the action will time out and the ActionResult token will contain the results. You can control the length of the timeout and the timeout behaviour in the Gear menu.

Thanks for the info, Peter.

I just ran a little test, and I may have to change my approach for testing for selection. I think using a Copy Action timeout of 2 sec should be adequate in most cases, and then just test the %ActionResult% for ≠ "OK" (then no selection was made).

###Copy Action Settings

1 Like

OK, thanks. But I still get a sound alert when I run a macro the macro tries to Copy. I am in desperate need of macro that will return an empty string if there is no selection, without any sound alert.

My external speakers connected to my Samsung 27" monitor, connected to my MacBook Pro by way of a Thunderbolt-DVI cable does not respond to volume or muting controls. And even if it did, Toggle System Sound Mute is not right because the user may have mute on.

It appears that KM offers no way to read the system sound volume or set it to a specific value.

Will have to look to see if there is an AppleScript or ObjC way to (a) read the current volume setting. Worse comes to worse I think I can do this on the command line. Then I can save the volume, set it to 0, Copy, and restore the volume. This is pretty ugly, but it would work.

But none of that will turn the sound off when I am using my external monitor.

I need the Copy because I want to copy, modify the clipboard, and paste, In particular to “Apply Style to Named Clipboard”.

The only option for that is to use the Menu condition, and that will only work in some (most normal) applications. OS X simply does not offer any other alternatives.

SYSTEMVOLUME() function.
Set System Output Volume action.

Unfortunately, you cannot use a calculation in the Set System Output Volume action, so to actually do it would be an interesting challenge (it can be done using XML, but it is difficult). There is also the option of using AppleScript for this which would be relatively straight forward. But you said “does not respond to volume or muting controls” so there may not be any point in that.

Is the problem false negatives (Copy dimmed even though there is a selection) or false positives (Copy not dimmed even though there is no selection)?

You are our application guru, since you have seen all and done all regarding state in OS X :relieved:.

You get a sound ONLY if no selection was made by the user.
IMO, this should rarely be the case, so it’s not worth spending a lot of time worrying about the sound.

If the macro expects the user to have made a selection before running the macro, then I want a sound, and an alert msg, advising the user, if no selection was made.

There are applications without the Copy menu, and there are applications that do not update their menus which can lead to false negatives and positives.

I have moved the macro I posted above to a new topic in the "macro" category: