SmartShot automates the task of organizing and renaming screenshots in a specified folder on macOS. It uses the built-in Automater app to auto-detect when new screenshots are taken and runs a script to rename them.
- Set OpenAI API Key as an Environment Variable:
-
Open your Terminal.
-
Edit your
.zshrc
file by typingnano ~/.zshrc
. -
Add the following line at the end of the file:
export OPENAI_API_KEY='your-api-key'
-
- Place the Python Script:
- Save the provided Python script (e.g.,
renamer.py
) to a directory, such as/Users/[YourUsername]/[some_folder]/screenshot-renamer/
.
- Save the provided Python script (e.g.,
- Modify DIRS inside renamer.py
-
Modify the DIRS for your screenshot folder:
DIRS = [ "/Users/username/path_to_screenshots", "/Users/username/some_folder/screenshot-renamer/processed.log"]
-
-
Create a Folder Action:
- Open Automator and select "Folder Action."
- Choose the folder where screenshots are saved (e.g.,
~/Desktop
or~/Documents/Screenshots
).
-
Configure the Folder Action:
- Add the "Run Shell Script" action.
- Input the following command:
chmod +x /Users/[YourUsername]/[some_folder]/screenshot-renamer/renamer.py source ~/.zshrc /usr/local/bin/python3 /Users/[YourUsername]/[some_folder]/screenshot-renamer/renamer.py
- Adjust the path to the Python executable and the script as necessary.
-
Save and Activate:
- Save the Automator action with a meaningful name, like "SmartShot Action."
- Take a screenshot and ensure it's saved to the folder monitored by Automator. The script should automatically analyze and rename the screenshot.
- API Key Access: If the script cannot access the API key, verify the
.zshrc
file's configuration and the environment variable export. - GPT4 Rate Limit With GPT4V preview, you only 100 requests per day.
- Automator Configuration: Confirm the correct paths in Automator and ensure the Python script has the necessary execution permissions.