Skip to content
Browse files

Add volume setting script.

  • Loading branch information...
1 parent 47e7f1c commit c06321817817a630b85eee431a126e008e53f332 @SaberUK committed Nov 8, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 bin/volume
View
17 bin/volume
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+# ==============================================================================
+# SaberUK's Dot Files <https://github.com/saberuk/dotfiles/>
+# ==============================================================================
+# Copyright (C) 2012 Peter "SaberUK" Powell <petpow@saberuk.com>
+# ==============================================================================
+if ARGV.size < 1
+ puts "Syntax: #{File.basename($PROGRAM_NAME)} <volume>"
+ exit 1
+elsif /^\d+(?:\.\d+)?$/ !~ ARGV[0]
+ puts 'Error: volume must be a valid decimal number between 0 and 100!'
+ exit 1
+elsif Float(ARGV[0]) < 0 || Float(ARGV[0]) > 100
+ puts 'Error: volume must be a valid decimal number between 0 and 100!'
+ exit 1
+end
+system('osascript', '-e', "set volume output volume #{ARGV[0]}")

0 comments on commit c063218

Please sign in to comment.
Something went wrong with that request. Please try again.