3 Likes
I think I have solved the daily textedit Automation for Mr. Sargent. Here is a bash script to trigger the automation with Keyboard Maestro’s “Time of Day” trigger.
#!/bin/bash
# Get the current day of the week (e.g., Mon, Tue, etc.)
DAY_OF_WEEK=$(date +%u)
# Check if it's a weekday (Monday=1, Friday=5)
if [[ $DAY_OF_WEEK -ge 1 ]] && [[ $DAY_OF_WEEK -le 5 ]]; then
# Format the date as YYYYMMDD
DATE_SLUG=$(date +%Y%m%d)
# Create the file path
FILE_PATH="YourFilePath/Ram_$DATE_SLUG.txt"
# Create an empty file with the specified name
if [ ! -f "$FILE_PATH" ]; then
touch "$FILE_PATH"
# Open the file with the default text editor (TextEdit)
open "$FILE_PATH"
fi
fi
The Bash script will do the following:
- Use the open and touch Bash commands to create and open a .TXT file.
- It will name it “Ram_” and add the date in this format 20231225
- You’ll have to modify it with your file path to where the file is saved
Cron or Another App
- Cron jobs have never worked for me to wake the Mac, it would wait it but only for a few seconds not enough to run anything but maybe others have better luck.
- I’d recommend Power Manager to wake the Mac but it does cost money.
I was considering doing the same thing, but with the Wake trigger, since he mentioned he was having trouble with a scheduled 3:00 AM macro.
1 Like
Haven’t finished this episode yet, but Mikah said he wished there was a way to put an iPad in “hibernate” mode. This idea from the MPU forum has been working pretty well for me, thought I’d make sure he knew about it.
2 Likes