-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathNV-CopyToNV.applescript
47 lines (43 loc) · 1.27 KB
/
NV-CopyToNV.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
--- copy text from the window of the current application
--- (example: an open email, text from a code editor, etc)
--- paste copied text as a new note in notational velocity
--- with a dialog box allowing you to choose a name for you new note
tell application "System Events"
set w1 to the name of first application process whose frontmost is true
tell w1
tell application "System Events"
key code 0 using command down
key code 8 using command down
set bodytext to the clipboard
set the clipboard to bodytext as string
tell application "nvALT"
activate
tell application "System Events"
key code 9 using {command down, shift down}
end tell
end tell
end tell
end tell
end tell
tell application "nvALT"
set newnote to display dialog "Create a NV note" default answer ""
set newnote to text returned of newnote
tell application "Finder" to set the clipboard to newnote as text
tell application "nvALT"
activate
tell application "System Events"
key code 15 using command down
tell application "nvALT"
activate
tell application "System Events"
key code 9 using command down
key code 36
key code 36
key code 36
key code 36
end tell
end tell
end tell
end tell
end tell
--- http://www.github.com/unforswearing