Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm designing a creative / funny prank for OSX via command line. By running in the background, most users would not notice it when she/he first starts using the computer.

Using say command with creepy voice (Deranged) is my best bet. Setting volume to very low during saying the sentences is even more creepy! My problem is, I don't know how to grab current current volume to set it to the same volume after saying.

sascript -e "set Volume 2"
say "Naaame I see you" -v Deranged -r 20
sascript -r "set Volume 0"
sleep 600
sh thisscript.sh

Can I get the current volume and store it in a variable using unix shell scripts?

share|improve this question
3  
I'm not so sure this is a good post. This is more of an open-ended subjective post. If you'd like to edit it and make it more objective, that'd be great, but I'm going to vote to close it for now. –  daviesgeek Jun 28 '13 at 19:29
1  
I think this question is off topic. BUT, I can't resist sharing this: Try fixing a piece of tape to the bottom of the user's mouse. Infared or laser won't pick up the location, so looks like their screen froze. –  ckpepper02 Jun 28 '13 at 19:29
    
I intent to be ask a open ended question. Just like this –  Mohsen Jun 28 '13 at 19:39
1  
As mentioned, this is a list/poll style question that is not as productive or educational as the ones that we have allowed in the past. –  Nathan Greenstein Jun 28 '13 at 19:48
2  
@Mohsen I love that avatar. Hit us up in Ask Different Chat and we might see about a blog post on pranks. I bet we could use the chat rooms to make some discovery and put it on the blog. I'd even help promote the chat room since it's summer and a little fun can't hurt if it's in the right place. Heck, the site owners often do hat contests and such so we could try a new way to have fun, no? –  bmike Jun 28 '13 at 21:02
show 2 more comments

1 Answer

You could always get the volume, change the volume, say your line, and then restore the volume within the AppleScript:

#!/usr/bin/osascript
set currentVolume to output volume of (get volume settings)
set volume output volume 1
say "Hello" using "Deranged"
set volume output volume currentVolume
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.