Conflict Palette Bug Not Better and Seems Worse with version 9.02 of KM

I didn't do enough testing, so rely on @medienmeister, not me. It seems probable that my solution will simply generate another type of conflict

@medienmeister @JMichaelTX

I thought of a backup plan. I tested and can trigger KM macros with Alfred.

If I want to create a macro that deactivates - reactivates a macro group (I would create an action for each of the usual culprit macro group, would the macro simply look like this ?

thank you

Sorry @ronald, I don't understand your workflow or objective with this, so I an unable to offer any help.
Does the Show Palette of Macros action not work for you?

1 Like

because, as also reported by @medienmeister , there is an 80% improvement, but still occasions where it provokes the bug.

I am looking for some quick solution to those situations where the bug appears.
For the moment, I have to go to KM and quit → relaunch the engine.
Something fast like triggering a deactivate → activate macro group macro from alfred. That being said, I don't know if KM would even respond.
Even better would probably be an appleScript or automator action that quits and relaunches the KM engine.

I created this script with UI browser, but it does not work: quotes are wrong ?

I was thinking of running 2 scripts in succession, one to quit and the other to relaunch the KM engine.

activate application process "Keyboard Maestro"
tell application "System Events"
tell process "Keyboard Maestro"
click menu item "Quit Engine"  of menu 1 of menu bar item "File"  of menu bar 1 of application process "Keyboard Maestro"
end tell
end tell

you can see the red error line

image

@JMichaelTX

OK the UI Browser developer told me to take out the word process

Just a short update from my side. After using the workaround with an additional macro containing only one "Show Palette of Macros" action (as described in my last post) for over two days, the conflict palette bug has not bitten me once. So, at least for my use case it is 100 % improvement – or just plain luck.

On your applescript: I tried to shuffle some of the elements in the menu hierarchy and came up with a version that works on my machine:

activate application "Keyboard Maestro"
tell application "System Events"
	tell application process "Keyboard Maestro"
		tell menu bar 1
			tell menu bar item "File"
				click menu item "Quit Engine" of menu 1
			end tell
		end tell
	end tell
end tell

Roland

thank you. How would you quit ... und dann restart the engine. I don't know how to script sequential events.

Just use delay and then click again.

activate application "Keyboard Maestro"
tell application "System Events"
	tell application process "Keyboard Maestro"
		tell menu bar 1
			tell menu bar item "File"
				click menu item "Quit Engine" of menu 1
				delay 3
				click menu item "Launch Engine" of menu 1
			end tell
		end tell
	end tell
end tell
1 Like

@ronald, you don't need to use the KM Editor app at all.
This simple AppleScript will do the job:

tell application "Keyboard Maestro Engine" to reload

Save this in a .scpt file in the macOS Scripts folder.
You can then run using either the macOS Scripts menu, or with FastScripts (recommended).

1 Like

@medienmeister @JMichaelTX

thank you for a superb script @JMichaelTX

@medienmeister : I think that @JMichaelTX script is preferable because there is no delay. it's funny at the exact time I read @JMichaelTX 's script, I had a conflict palette crash, so it was the ideal circumstance to test it, and it worked perfectly. So thanks very much !

I just wonder why:

  • I don't keep it in my KBM dropbox scripts folder which has all my scripts and you had recommended I create.
  • I bought script debugger which you suggested and I am very happy with. Why would I buy Fastscripts (I don't really need another set of shortcuts), instead of triggering the script with alfred or make an automator app?
    I am not questioning or trying to save money. I am just asking.
    thanks again

Because both Apple and FastScripts require that it be in the macOS Scripts folder.
The KM Scripts folder is for scripts that are executed by KM Macros.

SD and FS are apples and oranges. The ONLY purpose of FS is to quickly run an AppleScript, and to provide a means to assign hot keys to the scripts. If you want to run the script by any other tool that's fine. FS is only $10, and very easy to use.

1 Like

I will follow your instructions. thank you. I greatly appreciate your didactic replies.

I would have liked to have the best of both worlds, ie Mac OS Scripts Folder + Fastscripts with all the advantages of Dropbox syncing across devices, and I then discovered that you had addressed the same issue. So I can get both.

I tested 2 scripts: the KBM engine and a simple Popclip appear script. Both work in a Dropbox folder

I tried to decipher your explanation but it's too difficult.

I read in multiple sources that symlinks and aliases are not recommended with Dropbox. I am not questioning your approach. I am trying to understand.

No problem. This is a difficult subject to get your head around.

Let's look at this image:

image

The key is that ALL of the folder in the DropBox are normal folders.
They are just the target of symlinks and aliases in you ~Library folder.
So, for example, you would MOVE the Scripts folder in ~/Library to a Dropbox folder.
Then create an alias of that folder in DB, and move the alias to ~/Library.

Make sense?

This setup does not require any support of aliases and symlinks by DB.
It does require that you have setup the root Dropbox folder in the same location on all of your Macs.

BTW, starting with macOS Mojave, the macOS no longer supports SymLinks for the ~Library/Script Libraries folder. So, unfortunately, we can no longer use Dropbox (or any Cloud sync) to keep our script libraries in sync. You will have to do that manually.

1 Like

I'm way behind Mojave. How does this appear for the user? Is there a symlink that just fails silently, a prompt when attempting to make the symlink, etc.?

The issue seems to be mostly (solely?) with AppleScript Script Libraries that use AppleScriptObjectiveC (ASObjC). I was occasionally seeing this type of error:

Error Number: -1708

NSRegularExpression doesn’t understand the “regularExpressionWithPattern_options_error_” message.

which is an invalid error for the code being used.

For details, see this thread:

I bought fastscripts and am looking into the structure you propose. Great idea. thank you.

I now get the point of fastscripts, and at the same time am perplexed that KBM users would want to create / learn yet another multitude of keyboard shortcuts (forget about clicking around from the menu bar). In addition, I tend to do everything to keep my keyboard shortcuts in KBM where it's so easy to pin down shortcut conflicts.

1- the fastscripts concept of application specific scripts mirrors the KBM idea of an application specific palette that we use all the time. Do you see any way to create a fastscripts palette for different applications to integrate fastscripts into KBM and do away with the need for fastscripts shortcuts ?

2- it is not necessary to reinvent the wheel. Are there fastscripts script libraries that you know of ? Or in other terms any application specific script libraries ? I so often get the impression I am working on the same problem that many people have solved in the past. Googling to search for scripts takes a lot of time and is often unproductive.

thanks again

To be clear, I rarely use FS.
The main use case I have for FS is to have a way to very quickly run an AppleScript that is independent of KM.
Unfortunately, the method KM uses to execute an AppleScript is much slower, sometime 10X+ slower, than via FS.
And, of course, there are some cases where we just can't use KM. :wink:

This could probably be done, but I would NOT do it.
As I stated above, my use of FS is to be independent of KM.
So, if you follow that approach, you should have very few FS, maybe only one for now: Toggle the KM Engine.

FS is NOT a script library. It is simply a means to quickly execute an individual script.
The script it executes may, like KM, use script libraries, but that has nothing to do with FS or KM.

Good point, good question.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NOTE: After I wrote the below, and reread it, this jumped out at me: You and most KM users should NOT have a need for any AppleScript Script Libraries, unless you are provided a script that requires them. Script Libraries for mostly intended for serious AppleScript developers, who are active in developing a lot of scripts.

Chris @ccstone, @DanThomas, Rob @ComplexPoint, myself, and a few others have published a number of scripts in the KM "Macro Library" (and elsewhere), either as standalone scripts or a part of a KM Macro. I'd suggest searching the KM Forum first for whatever functionality you want before going down the path of creating your own scripts from scratch.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

First, I should say that I have my own personal script library that I have been building and adding to since I started using AppleScript many years ago. I rely a lot on the scripts (called "handlers" (aka functions)) in my lib on a daily basis.

Then there have been a number of reliable script libraries that have been published, and that are maintained, by expert, experienced, professional AppleScript developers. The most significant of which are those built and published by the world-renowned AppleScript guru Shane Stanley. IMO, he is the best there is.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Shane Stanley Script Libraries

You may want to read through his entire list at the above link, but here are the one's I have found most useful. But that's mostly driven by my particular interest in things.
YMMV.

RegexAndStuffLib v1.0.6

RegexAndStuffLib is a script library providing some basic string manipulation commands. There are commands for changing case, splitting and joining strings, various encoding and decoding commands, a range of regular expression commands, and more. Version 1.0.6 supports passing lists of strings to regex change and regex batch commands.

FileManagerLib v2.3.5

FileManagerLib provides commands for file management tasks like duplicating, copying, moving, renaming, deleting, and trashing files, as well as creating folders and alias files, getting the contents and entire contents of folders, and sorting lists of files. Version 2.3.x adds comparison commands and commands for dealing with date properties. (updated May 27, 2020)

SQLite Lib 1.0.0 and SQLite Lib2 1.1.0

SQLite Lib2 and SQLite Lib are libraries for fast and efficient SQLite programming from AppleScript, based on the well-known open-source FMDB Framework. If you ever need to access SQLite databases, or need a simple database for your scripts, one of these is the answer. Functionally similar, SQLite Lib2 requires macOS 10.11 or later and includes a terminology dictionary, whereas SQLite Lib uses traditional handlers, and works under macOS 10.10 and later. Note that scripts using SQLite Lib and SQLit Lib2 cannot be edited in Script Editor in Mojave or later because of security settings. You need to use Script Debugger. See Catalina Security and Script Libraries for Catalina installation details. (Updated July 17, 2020.)

Bridge Plus 1.3.3

BridgePlus is an AppleScript script library that includes a collection of handlers based on the functionality of ASObjC Runner.app. For AppleScriptObjC users, there are commands that support improved bridging between AppleScript and Cocoa, as well as direct access to the extended functionality. The AppleScriptObjC manual is on-line here.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2 Likes

Wow ! It's like hitting the jackpot ! thanks so much !
So it's KM macro library first, and then if really stuck one of the above libraries.

1 Like