Mac – Take webcam picture and screenshot at the same time

command linemacscreen captureterminalwebcam

I'm trying to combine these two commands:

while :;do screencapture -x ~/Desktop/$(date +%y%m%d%H%M%S).png;sleep 300;done 

and

imagesnap -t 300

I want to make a screenshot and a webcam photo at the same time every 5 minutes. It's my first time using the terminal, so I'm very new to this. It's probably very simple but I just can't figure it out.

Thank you for helping!

Best Answer

Something to try, add an ampersand to the end of your commands.

imagesnap -t 300&

The idea here is that the ampersand will cause the command to run in the background allowing the loop to continue to the next step.

As an example, if you were to run the following in Terminal you'll see that the second sleep reports out before the first one.

sleep 10&; sleep 5&;

I hope this helps