Log It, v1.0
This macro provides a method to quickly save plain text snippets to one or more log files. A user can add snippets quickly because the macro writes directly to the text log files, i.e., the user is not required to interact with a separate macOS application.
In addition, using Settings included on the main dialog of the macro, a user can customize the logging behavior:
Define the Content to preload: Nothing; Clipboard; SafariURL; SafariTitle SafariURL; Clipboard SafariURL; [SafariTitle](SafariURL); [Clipboard](SafariURL)
Optionally change the log file each day.
Replace, prepend, or append to an existing log file.
Optionally add a timestamp prefix to every snippet saved.
Optionally apply markdown syntax: Bold; Italic; Bold Italic; Blockquote; Inline code; Syntax Highlighting
Optionally shorten a URL.
Specify a content suffix which effectively acts as a delimiter between captures snippets.
The main dialog also provides a field that allows the user to change the log file name.
Logged entries can be confirmed with: Nothing; Sound; Dialog; Sound & Dialog
If Dialog or Sound & Dialog is chosen, the user can then opt to: Do Nothing; Select the log file in the Finder; open the log file using TextEdit.
When reading webpages, a user could save several excerpts by simply copying portions of each webpage and invoking this macro after each copy.
(Optional) From any macOS, copy some text.
Launch this macro. The main dialog will be displayed.
(Optional) Change one or more settings in the main dialog.
Select the one of three buttons: Cancel; Save Settings Only; or OK (default)
If the confirmation dialog was specified to appear, select one of three buttons: Open (o); Select (s); No (default)
The following video includes more information including five example uses of Log It: youtu.be/Zp-8BHhxPLY
By default, this macro will save log files to: /iCloud Drive/Log It. This can be changed using the local__Folder variable (just below this comment).
Many of the variable values set in the main dialog persist from one use to the next. To reset Log It to the default values, launch it by adding ⌥ (the Option key).
- Big Sur, v11.2.1
- Keyboard Maestro, v9.2
1.0 - Initial version
Even if you have no use for the Log It features as described above, if you are a Keyboard Maestro beginner, you might find that this macro is a useful learning tool. It includes actions that:
- set default values for macro settings; these settings are global variables, i.e., variables that retain their values between macro invocations
- determines if the macro trigger included ⌥; if so, reset the macro settings to default values
- check if a file previously exists
- remove a trailing slash in a folder path (if it includes one)
- check if a folder exists; check if it contains 0, 1, or more files
- check if a file can be written to a folder
- check if a filename is in format: YYYY-MM-DD
- check if a filename is in format: YYYY-MM-DD some suffix
- check if a folder includes additional files, i.e., files in addition to the text file being currently used
- display a main dialog that is context sensitive (displays differing text; addition variable fields; different variable choices)
- can conditionally shorten a URL using tinyurl.com (without requiring an API)
Log It includes many Keyboard Maestro standard actions; in addition, it includes several simple uses of the Run Shell Script and the Run AppleScript actions
Log It.kmmacros (110 KB)