-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote_vol_adjust
55 lines (38 loc) · 1.14 KB
/
remote_vol_adjust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/osascript
-- Remotely Control the Volume on Your Mac
--
-- *** INSTRUCTIONS ***
--
-- to run: sh remote_vol_adjust [ARG]
--
-- options: mute mutes the computer
-- unmute unmutes
-- x between -100 and 100
-- changes the volume by x percent
--
on run argv
-- get the user's command
set command to (item 1 of argv)
-- mute volume
if command is equal to "mute" then
set _muted to (get (output muted of (get volume settings)))
if _muted is false then
set volume with output muted
else
set volume without output muted
end if
-- unmute volume
else if command is equal to "unmute" then
set volume without output muted
else
-- only process input that is a valid integer
try
set adjust_by to command as integer
adjust_volume(adjust_by)
end try
end tell
end run
on adjust_volume(adjust_by)
set vol to output volume of (get volume settings)
set volume output volume (vol + adjust_by)
end adjust_volume