I am looking for a way to click on a KBM macro and somehow copy THAT MACRO'S appleScript trigger to the clipboard. Since I have to go through the process for many macros, I would prefer not to have to do it manually.
I use that script to trigger the KBM macro in my iPad hard palette (created via accessibility keyboard)
I think that there is a misunderstanding.I am referring to the appleScript which triggers the macro, not the appleScript of an action in the macro.
Example: I am creating a scrivener specific accessibility keyboard aka KBM hard palette using an old iPad.
Each button in the panel triggers a specific apple script via a .script file which contains that macro's TRIGGER appleScript.
Since I have many buttons to create it becomes a bit tedious to click on each macro → copy its trigger appleScript → create new .script file and paste AppleScript into it → put in the right directory.
I wrote a macro to do the following : create new .script file and paste AppleScript into it → put in the right directory.
What is am missing is some way to automatically copy the trigger AppleScript to the clipboard when I click on a macro in the macro list. In other words, I would like to click on the macro → run a macro or script → end up with that macro's trigger AppleScript in the clipboard. After that I am fine.
Since the script for running KM macros via AppleScript is always the same, all you need is a way of grabbing a macro's UUID for the do script part, which KM already provides via the Edit > Copy menu, after which it's fairly easy to assemble the script trigger in KM. Here's one way to go about that:
The CLIPBOARDSEED function is a way KM provides to check whether the clipboard's contents have changed or not. The first action sets a variable to the clipboard seed's current integer before performing the copy operation, then checks the clipboard seed against that variable after the copy operation has been performed to ensure that the copy operation was successful. This sort of check is already built in to KM's Cut and Copy actions, but we can also use it manually this way to ensure that the clipboard's contents will be what we want them to be whenever a macro needs to copy something.