-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotify.applescript
64 lines (63 loc) · 1.9 KB
/
notify.applescript
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
56
57
58
59
60
61
62
63
64
on q(str)
return "\"" & str & "\""
end q
on notify(rec) # params: title, description, sticky, icon of application
if is_installed() then
if is_running("Growl") then
set params to "tell application id \"com.Growl.GrowlHelperApp\" to notify with "
try # application name
set reg_name to |application name| of rec as text
on error
set reg_name to app_name
end try
if reg_name is missing value then
set reg_name to (get name of current application)
end if
try # notification
set n to |name| of rec
on error
try
set n to item 1 of notifications
on error
set n to "default"
end try
end try
register(reg_name, app_icon, {n})
if n is in notifications or n is notifications then
set params to params & " name " & q(n)
else
error "unknown notifications " & n
end if
try # title
set params to params & " title " & q(title of rec as text)
end try
try #description
set params to params & " description " & q(|description| of rec as text)
on error
set params to params & " description \"\""
end try
try # sticky
set params to params & " sticky " & (sticky of rec as text)
on error # default value
set params to params & " sticky false"
end try
try # icon of application
set params to params & " icon of application " & q(|icon of application| of rec as text)
on error
try
set params to params & " icon of application " & q(app_icon)
app_icon
end try
end try
try # icon of file
set params to params & " icon of file " & q(|icon of file| of rec as text)
end try
try # icon of file
set params to params & " image from location " & q(|image from location| of rec as text)
end try
set params to params & " application name " & q(app_name)
#display dialog params
run script params
end if
end if
end notify