Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to run the following command continuously:

osascript -e 'tell application "System Events" to set visible of every application process to false'

Is there some sort of command with the following methodology?

repeat "enter command here"

If not, how could I do this?

share|improve this question
add comment

3 Answers

With a simple while loop, sleeping in between:

while true; do osascript -e 'tell application "System Events" to set visible of every application process to false'; sleep 1; done

If you have Homebrew, install watch (brew install watch), and then call:

watch -n1 osascript -e 'tell application "System Events" to set visible of every application process to false'

… to run it every second.

share|improve this answer
add comment

I would add a small twist to this:

while :; do clear; your_command; sleep 3; done

This clears the screen, sleeps a bit, then iterates.

share|improve this answer
add comment

If you don't want to keep forking new osascript processes, you can use AppleScript's repeat statement:

osascript -e repeat -e 'tell app "System Events" to set visible of processes to false' -e 'delay 5' -e 'end repeat'

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.