I view KM and scripting as complementary tools. Which tool is easiest to use for any specific job depends on the job and the user.
Another way to look at it is that the KM Execute an Script actions (KM Wiki) are a way to easily extend the bulit-in, native features of KM.
Having said that, here are some thoughts off the top of my head.
2017-09-05 20:47 CT
Things Better Done in Scripts
- Array and Record Handling
- KM can’t really do this, at least not as well as AppleScript. All KM Variables are text, with some limited support for pseudo numeric arrays, using CSV.
- KM recently added support for pseudo text arrays.
- Complex navigation of the UI
- Complex formulas
- Complex string handling (except for RegEx)
- Complex clipboard manipulations
Things Better Done in KM
(some things can be done only in KM)
- AppleScript does not have any native RegEx support. Requires use of Satimage.osax or more complex ASObjC.
- JXA has a great RegEx engine, but the visual RegEx setup in KM is excellent
- Assigning of shortcuts (hotkeys) to Macros (set of Actions)
- Scripts can’t do this. Requires 3rd party tools like FastScripts
- Processing of Files/Folders in Finder Selection
- While this can be done in scripts, KM makes it very easy for everyone
- Actions based on image recognition
(like Move or Click Mouse action (KM Wiki), based on Found Image)
- Scripts can’t do this at all without some 3rd party image tools
- Basic UI Control – very easy in KM
- Select and/or Show Menu Items
- Get Status of Menu Items, Buttons, Checkboxes
- Extensive Window management/manipulation
- Extensive use of Mouse (not available at all in AppleScript)
- Some of this stuff can be done in AppleScript and Shell Scripts, but, for the most part, it is far easier to do in KM.
- Date Handling/Formatting
I’m sure there are more. I’ll update when/if I think of them.
So, if you have skills in KM and scripting, then you will generally know which is the best tool for the job. If you’re not sure, you can always post in this KM forum to get advice/suggestions.
I have three tools I consider essential to my Mac automation work:
- AppleScript and JXA