Activate Normal IsActive Macros Actions IsActive IsDisclosed MacroActionType Comment Text NOTE: You should not _need_ to change this variable, but if you want to change where the images are saved, this is the variable to change. See also SC_FOLDER, below. SC_PARENT = Screen Capture Parent Folder = this is the main folder into which sub-folders will be created. By default this is "~/Pictures/screenshot-journal/" but you can change it to anything you want. THIS PATH MUST BE COMPLETE! However you can use ~/ to refer to your $HOME directory. IMPORTANT: This folder will be created, if needed, but its "parent" folder will not. For example: if you set this to ~/Pictures/screenshot-journal/ then Keyboard Maestro will create "~/Pictures/screenshot-journal/" but ONLY IF the folder ~/Pictures/ already exists. This should only be a problem if you decide to use something like ~/Pictures/AnotherFolder/screenshot-journal/ in which case you would need to make sure that ~/Pictures/AnotherFolder/ already exists. Got it? If not, just ask! WHEN IN DOUBT: Create the folder(s) you want to use manually, and then let Keyboard Maestro handle creating the sub-folder using the SC_FOLDER variable. Title SC_PARENT IsActive IsDisclosed MacroActionType SetVariableToText Text ~/Pictures/screenshot-journal/ Variable SC_PARENT IsActive IsDisclosed MacroActionType Comment Text NOTE: You should not _need_ to change this variable, but if you want to change where the images are saved, this is the variable to change. See also SC_PARENT, above. DEFINITION AND SUMMARY EXPLANATION: SC_FOLDER = Screen Capture Folder = this is a sub-folder of SC_PARENT. By default, it will be today's date in YYYY-MM-DD format, so, for example, March 28th would be 2013-03-28. Assuming that SC_PARENT is left as the default ~/Pictures/screenshot-journal/, all of the images from March 28th would be saved to ~/Pictures/screenshot-journal/2013-03-28. This folder will be created if needed. You _could_ change this to something else if you wanted to, but I'm not sure why you'd want to. If you do, you should probably change SC_FILENAME to start with the date so you can sort them in the Finder (or elsewhere). WHEN IN DOUBT: Leave this one alone. Change SC_PARENT if you want to move where images are stored, and then make sure that the folder/directory defined in SC_PARENT actually exists. Title SC_FOLDER IsActive IsDisclosed MacroActionType SetVariableToText Text %ICUDateTime%yyyy-MM-dd% Variable SC_FOLDER IsActive IsDisclosed MacroActionType Comment Text NOTE: You do not need to change this variable, but if you want to change the automatically-generated-names of the files located inside SC_FOLDER (which is located inside SC_PARENT), then you should change DEFINITION AND SUMMARY EXPLANATION: SC_FILENAME = Screen Capture Filename = this is what the actual filenames will be called when they are created inside the folder SC_FOLDER which is inside the folder SC_PARENT. By default, this is set to: %ICUDateTime%HH.mm.ss%.%Application%1% (%WindowName%1%) %Application%2% %ICUDateTime%HH.mm.ss% = hour.minute.second (where 1pm = 13) %Application%1% = The currently active application name (%WindowName%1%) = The name of the front window from the current app (shown in parenthesis for easier visual scanning in Finder) %Application%2% = the application that you were using before you started using this one. NOTE THAT THERE IS NO FILENAME EXTENSION SPECIFIED. THAT IS NOT AN ACCIDENT. WHEN IN DOUBT: Leave this one alone. If you do not want the application and window information, set SC_FILENAME to %ICUDateTime%HH.mm.ss% If you are comfortable using Keyboard Maestro, this one is highly configurable. See the "Insert Token" option in Keyboard Maestro's "Set Variable to Text" action. Title SC_FILENAME Conditions ConditionList ConditionType FrontWindow FrontWindowConditionType Exists FrontWindowTitle IsFrontApplication ConditionListMatch All ElseActions IsActive IsDisclosed MacroActionType SetVariableToText Text %ICUDateTime%HH.mm.ss%.%Application%1% (No Window) Variable SC_FILENAME IsActive IsDisclosed MacroActionType IfThenElse ThenActions IsActive IsDisclosed MacroActionType SetVariableToText Text %ICUDateTime%HH.mm.ss%.%Application%1% (%WindowName%1%) Variable SC_FILENAME TimeOutAbortsMacro IsActive IsDisclosed MacroActionType Comment Text SC_FILENAME cannot have any "/" or ":" or "\" characters in it, so we run three "Search and Replace" processes to change any occurrences of them to "-" instead. Note that as of v 6.2, Keyboard Maestro will silently fail to write a file if an "illegal" character like / is in the filename. Title Search and Replace (3x) Action IgnoreCaseString IsActive IsDisclosed MacroActionType SearchReplaceVariable Replace - Search / Variable SC_FILENAME Action IgnoreCaseString IsActive IsDisclosed MacroActionType SearchReplaceVariable Replace - Search \ Variable SC_FILENAME Action IgnoreCaseString IsActive IsDisclosed MacroActionType SearchReplaceVariable Replace - Search : Variable SC_FILENAME IsActive IsDisclosed MacroActionType Comment Text This will create the folder defined (above) as "SC_PARENT". By default this is ~/Pictures/screenshot-journal/ Keyboard Maestro will create it if it does not exist. If it already exists, Keyboard Maestro will just continue on. IMPORTANT: If nothing seems to happen when you run this Keyboard Maestro macro, try creating this folder manually. Title Create New Folder: %Variable%SC_PARENT% Destination %Variable%SC_PARENT% IsActive IsDisclosed MacroActionType NewFolder IsActive IsDisclosed MacroActionType Comment Text Keyboard Maestro 6.2 can only create one folder level at a time, so after we create SC_PARENT now we have to create SC_FOLDER Title Create New Folder: %Variable%SC_PARENT%/%Variable%SC_FOLDER% Destination %Variable%SC_PARENT%/%Variable%SC_FOLDER% IsActive IsDisclosed MacroActionType NewFolder IsActive IsDisclosed MacroActionType Comment Text The "If / Then" block below determines exactly what is done, based on current conditions. See comments below for more details. Title HERE'S WHERE WE ACTUALLY DO STUFF! Conditions ConditionList ConditionType Calculation Text SCREENSAVER() ConditionType Calculation Text IDLE() > 119 ConditionListMatch Any ElseActions IsActive IsDisclosed MacroActionType Comment Text OK, if we get here then the screensaver is NOT on (and the screen IS on) AND we are not IDLE for more than the defined number of seconds. THAT MEANS WE ARE ACTIVE! YAY! Let's record what we are doing by taking a screenshot! Note that we have to do this in 2 steps: 1. Save the screenshot to a clipboard 2. Write the contents of the clipboard to a file We use a "named" clipboard for Step #1 so we don't overwrite the system clipboard. The clipboard we use is named SCREENCAPTURE. If you use more than one screen, this will capture all of them Title !! ELSE !! DestinationNamedClipboardRedundantDisplayName SCREENCAPTURE DestinationNamedClipboardUID 0BA631FC-7556-4B39-8D52-6DE3D3418D5E DestinationUseNamedClipboard IncludeShadows Index 2 IsActive IsDisclosed MacroActionType ScreenCapture Source ScreenAll WindowName IsActive IsDisclosed MacroActionType Comment Text OK, so we have saved a screenshot of our monitor(s) to a special clipboard named SCREENCAPTURE, and now we need to save the contents of that clipboard to a file. You have several options for image formats. I chose GIF because it creates MUCH smaller files than JPG or PNG. For example, in my test with my MacBook Pro hooked to an external monitor, the GIF was 256 KB, the JPG was 586 KB, and the PNG was 708 KB! Title Write Named Clipboard to File Append Destination %Variable%SC_PARENT%/%Variable%SC_FOLDER%/%Variable%SC_FILENAME%.gif Encoding UTF8 Format GIF IsActive IsDisclosed MacroActionType WriteFile Name 0BA631FC-7556-4B39-8D52-6DE3D3418D5E RedundandDisplayName SCREENCAPTURE Source NamedClipboard Text Variable Variable IsActive IsDisclosed MacroActionType IfThenElse ThenActions IsActive IsDisclosed MacroActionType Comment Text This condition says that IF the screensaver is on OR if the computer has been IDLE for more than 119 seconds, then go into this section. OTHERWISE, go into the "ELSE" section below. See note under SCREENSAVER() below Title SCREENSAVER() or IDLE() > 119 Conditions ConditionList ConditionType Calculation Text SCREENSAVER() ConditionListMatch All ElseActions IsActive IsDisclosed MacroActionType Comment Text If we get here, then we tested for two conditions: either A) the screensaver is on, or B) the IDLE time has been exceeded, and then we further tested and found that the screensaver is not on, THEREFORE we must be idle. Note this tip from http://www.keyboardmaestro.com/documentation/6/calculations.html "IDLE time is based on the Human Interface (HID) system, and so notices only HID device activity like mouse movement or keyboard presses, not things like disk access or movies playing." By default this macro will run once a minute, so if we have been idle (no mouse or keyboard) in more than 119 seconds (aka 2 minutes) then we don't need to take another screenshot because it seems unlikely that the screen has changed in any significant ways. This also prevents the script from taking screenshots if you are watching Netflix or something via VLC, etc. We create an empty file and add the word "idle" at the end of the filename so we know why the file is empty instead of being a screenshot. Title If IDLE, then Write Text To File (Create Empty File) Append Destination %Variable%SC_PARENT%/%Variable%SC_FOLDER%/%Variable%SC_FILENAME%.idle.txt Encoding UTF8 Format PlainText IsActive IsDisclosed MacroActionType WriteFile Name C5768098-138D-4E9C-BE57-5128CBA7DFE6 RedundandDisplayName Default Clipboard Source Text Text Variable Variable IsActive IsDisclosed MacroActionType IfThenElse ThenActions IsActive IsDisclosed MacroActionType Comment Text {Comment About The Above}: If the screen is turned OFF (either via Energy Saver or "Hot Corner"), then that is considered the same as the screensaver being ON. That is good for us as we want to do the same thing under either condition here. Title {Above} SCREENSAVER() = True if the screensaver is ON or if the screen is powered OFF IsActive IsDisclosed MacroActionType Comment Text {Comment About The Below} - SC_FILENAME does not need to mention the current or previous application if the screensaver is active, so we re-define SC_FILENAME to just include the time. Title {Below} Simplify SC_FILENAME IsActive IsDisclosed MacroActionType SetVariableToText Text %ICUDateTime%HH.mm.ss% Variable SC_FILENAME IsActive IsDisclosed MacroActionType Comment Text If the screensaver is on (or screen is off, as explained above), then we do not take a screenshot, because that would just be a waste of space. So instead we create an empty file and add the word "screensaver" at the end so we know why the file is empty instead of being a screenshot. Title If Screensaver, then Write Text To File (Create Empty File) Append Destination %Variable%SC_PARENT%/%Variable%SC_FOLDER%/%Variable%SC_FILENAME%.screensaver.txt Encoding UTF8 Format PlainText IsActive IsDisclosed MacroActionType WriteFile Name C5768098-138D-4E9C-BE57-5128CBA7DFE6 RedundandDisplayName Default Clipboard Source Text Text Variable Variable TimeOutAbortsMacro TimeOutAbortsMacro IsActive ModificationDate 405496843.55299997 Name Screenshot Journal Triggers FireType Pressed KeyCode 20 MacroTriggerType HotKey Modifiers 2560 ExecuteType While MacroTriggerType Time Repeat RepeatTime 60 TimeFinishHour 23 TimeFinishMinutes 0 TimeHour 6 TimeMinutes 30 WhichDays 127 FireType2 Activate MacroTriggerType Application RepeatTime 60 Target Front UID F841FC38-6228-4C5F-9230-274C5B64C955 Name Global Macro Group UID DA8512F7-F323-46B1-8319-752E0495CFD0