I try to automate some repetitive tasks with xdotool. In one task I want to automatically save a website to a file. While printing on Firefox there is a progress bar which looks like this:
I want to start a new task when the printing window has been closed (it closes automatically after saving the file). My current workaround is to use something like sleep 10 to prevent the next task from beginning to early. How can I get the event that the printing window has been closed?
(I am a Linux Mint user.)
Bash script
# Get window id (Firefox)
FIREFOX_ID=$(xdotool search --name "Mozilla Firefox" | head -n1)
# Activate window (Firefox)
xdotool windowactivate "$FIREFOX_ID"
# Open print dialog
xdotool key "ctrl+p"
# Get window id (print dialog)
DIALOG_ID=$(xdotool search --name "Print") # Change name to your language
# Activate window (print dialog)
xdotool windowactivate "$DIALOG_ID"
# Click "Print" button
xdotool mousemove 1240 790 click 1 # Change coordinates to yours

waitcommand? Please also add some code example.wait.