-
Notifications
You must be signed in to change notification settings - Fork 4
/
second.applescript
148 lines (147 loc) · 4.55 KB
/
second.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
-- OPEN SAFARI. GOTO PREFERENCES. CLICK PASSWORDS TAB --
-- THIS FIRST REPEAT SECTION IS JUST TO GET TO THE PASSWORDS SCREEN AND LOGIN TO ICLOUD --
repeat 1 times
tell application "Safari"
activate
delay 0.5
tell application "System Events"
-- Ensure Password Field Selected --
keystroke tab
delay 0.2
-- Type your password for you --
keystroke "PASSWORD"
delay 0.2
-- Hit enter to login --
keystroke return
delay 0.2
end tell
end tell
end repeat
-- START GRABBING PASSWORDS - SET REPEAT VALUE TO NUMBER OF PASSWORDS --
set x to 1
repeat while (x ≤ 207)
-- Switch To Safari --
tell application "Safari"
activate
delay 0.5
tell application "System Events"
-- Switch from search field to password list field (Only needs to be done once) --
if (x = 1) then
keystroke tab
delay 0.2
end if
-- Select first password in list (Field selected. but nothing highlighted) --
key code 125
delay 0.2
-- Open Right-click Menu --
tell application process "Safari"
set _selection to value of attribute "AXFocusedUIElement"
tell _selection to perform action "AXShowMenu"
end tell
-- Down arrow once to choose/highlight "Copy Website" --
key code 125
delay 0.2
-- Copy Website/URL data --
keystroke return
delay 0.2
end tell
end tell
-- Switch To TextEdit
tell application "TextEdit"
activate
delay 0.5
tell application "System Events"
-- Print a double quote --
keystroke "\""
delay 0.2
-- Paste "Website/URL" data to text file --
keystroke "v" using command down
delay 0.2
-- Print ending double quote and a comma for CSV --
keystroke "\","
delay 0.2
-- Print a double quote --
keystroke "\""
delay 0.2
-- Paste "Websites" data to text file again (For "Title" field in 1Password) --
keystroke "v" using command down
delay 0.2
-- Print ending double quote and a comma for CSV --
keystroke "\","
delay 0.2
end tell
end tell
-- Switch To Safari --
tell application "Safari"
activate
delay 0.5
tell application "System Events"
-- Open Window containing "User Name", "Password" and "Websites" fields --
keystroke return
delay 0.2
-- Move to "User Name" field --
keystroke tab
delay 0.2
-- Copy data from "User Name" field --
keystroke "c" using command down
delay 0.2
end tell
end tell
-- Switch To TextEdit --
tell application "TextEdit"
activate
delay 0.5
tell application "System Events"
-- Print a double quote --
keystroke "\""
delay 0.2
-- Paste "User Name" data to text file --
keystroke "v" using command down
delay 0.2
-- Print ending double quote and a comma for CSV --
keystroke "\","
delay 0.2
end tell
end tell
-- Switch To Safari --
tell application "Safari"
activate
delay 0.5
tell application "System Events"
-- Move to "Password" field --
keystroke tab
delay 0.2
-- Copy from "Password" field --
keystroke "c" using command down
delay 0.2
end tell
end tell
-- Switch To TextEdit --
tell application "TextEdit"
activate
delay 0.5
tell application "System Events"
-- Print a double quote --
keystroke "\""
delay 0.2
-- Paste "Websites" data to text file --
keystroke "v" using command down
delay 0.2
-- Print ending double quote and start a new line --
keystroke "\""
keystroke return
end tell
end tell
-- Switch To Safari --
tell application "Safari"
activate
delay 0.5
tell application "System Events"
-- Click "Done" button --
keystroke return
delay 0.2
end tell
end tell
set x to (x + 1)
end repeat
end run