-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_white_balance.py
40 lines (28 loc) · 1.11 KB
/
auto_white_balance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# script to automatically use shortcuts on lightroom to set the white balance using the same spot in every photo
# preferred to doing white balance programatically because cropping and lighting is easier in lightroom,
# and you have to do white balance before doing cropping
import keyboard
import pyautogui
import time
def perform_actions():
for i in range(3104):
pyautogui.press("right") # Press right arrow key
time.sleep(2)
pyautogui.press("w") # Press 'w' key
time.sleep(0.5)
pyautogui.click() # Simulate a mouse click
time.sleep(0.5)
# Flag to check if the actions are currently being performed
performing_actions = False
def toggle_actions():
global performing_actions
performing_actions = not performing_actions
if performing_actions:
print("Actions started. Press 'esc' to stop.")
perform_actions()
else:
print("Actions stopped. Press Ctrl + ` to start again.")
# Define the hotkey (Ctrl + backtick) and the function to call
keyboard.add_hotkey("ctrl + `", toggle_actions)
# Keep the program running
keyboard.wait("esc")