├── .gitignore
├── Paste as Plain Text.workflow
└── Contents
│ ├── Info.plist
│ └── document.wflow
├── Make Transparent Copy.workflow
└── Contents
│ ├── Info.plist
│ └── document.wflow
├── README.md
└── LICENSE.md
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.DS_Store
2 | **/Contents/QuickLook
3 |
--------------------------------------------------------------------------------
/Paste as Plain Text.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSBackgroundColorName
9 | background
10 | NSIconName
11 | NSActionTemplate
12 | NSMenuItem
13 |
14 | default
15 | Paste as Plain Text
16 |
17 | NSMessage
18 | runWorkflowAsService
19 | NSReturnTypes
20 |
21 | public.utf8-plain-text
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Make Transparent Copy.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSBackgroundColorName
9 | background
10 | NSIconName
11 | NSActionTemplate
12 | NSMenuItem
13 |
14 | default
15 | Make Transparent Copy
16 |
17 | NSMessage
18 | runWorkflowAsService
19 | NSRequiredContext
20 |
21 | NSApplicationIdentifier
22 | com.apple.finder
23 |
24 | NSSendFileTypes
25 |
26 | public.image
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Mac Automation
2 |
3 | A set of Automator workflows to solve interesting problems on macOS.
4 |
5 | ## Workflows
6 |
7 | - **Make Transparent Copy** – create a transparent copy of image file by making the first pixel slightly transparent, if not already. This way you can share pixel-perfect uncompressed images on social media like Twitter.
8 |
9 | - **Paste as Plain Text** – paste unformatted text from clipboard where *Paste and Match Style* may not be available. It is recommended to assign the same shortcut as *Paste and Match Style* and *Paste and Match Formatting*.
10 |
11 | You can run file workflows from the selection context menu in Finder.
12 |
13 | ## Installation
14 |
15 | 1. [Download ZIP](https://github.com/vmdanilov/mac-automation/archive/master.zip) and unpack the archive.
16 | 2. Double click an Automator workflow to install.
17 |
18 | The workflows will be installed to `~/Library/Services` and available through *Main Menu > **Application** > Services* or context menu on selection, if applicable. You can assign shortcuts to workflows in *System Preferences > Keyboard > Shortcuts > Services*.
19 |
20 | ## License
21 |
22 | The BSD 3-Clause License.
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2017 Vlad Danilov. All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | * Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/Paste as Plain Text.workflow/Contents/document.wflow:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMApplicationBuild
6 | 444.38
7 | AMApplicationVersion
8 | 2.9
9 | AMDocumentVersion
10 | 2
11 | actions
12 |
13 |
14 | action
15 |
16 | AMAccepts
17 |
18 | Container
19 | List
20 | Optional
21 |
22 | Types
23 |
24 | com.apple.applescript.object
25 |
26 |
27 | AMActionVersion
28 | 1.0.2
29 | AMApplication
30 |
31 | Automator
32 |
33 | AMParameterProperties
34 |
35 | source
36 |
37 |
38 | AMProvides
39 |
40 | Container
41 | List
42 | Types
43 |
44 | com.apple.applescript.object
45 |
46 |
47 | ActionBundlePath
48 | /System/Library/Automator/Run AppleScript.action
49 | ActionName
50 | Run AppleScript
51 | ActionParameters
52 |
53 | source
54 | on run {input, parameters}
try
set input to the clipboard as text
on error
beep
return -128
end try
return input
end run
55 |
56 | BundleIdentifier
57 | com.apple.Automator.RunScript
58 | CFBundleVersion
59 | 1.0.2
60 | CanShowSelectedItemsWhenRun
61 |
62 | CanShowWhenRun
63 |
64 | Category
65 |
66 | AMCategoryUtilities
67 |
68 | Class Name
69 | RunScriptAction
70 | InputUUID
71 | 2DC4B5F7-C7C3-4FF2-8FE3-45B6C92FFABA
72 | Keywords
73 |
74 | Run
75 |
76 | OutputUUID
77 | 1BE8CAD6-8C3D-45C8-8E90-D9076BFE972B
78 | UUID
79 | 11378D1D-35A4-4AD8-8CD5-0F815883E725
80 | UnlocalizedApplications
81 |
82 | Automator
83 |
84 | arguments
85 |
86 | 0
87 |
88 | default value
89 | on run {input, parameters}
90 |
91 | (* Your script goes here *)
92 |
93 | return input
94 | end run
95 | name
96 | source
97 | required
98 | 0
99 | type
100 | 0
101 | uuid
102 | 0
103 |
104 |
105 | isViewVisible
106 |
107 | location
108 | 514.500000:368.000000
109 | nibPath
110 | /System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib
111 |
112 | isViewVisible
113 |
114 |
115 |
116 | connectors
117 |
118 | workflowMetaData
119 |
120 | applicationBundleIDsByPath
121 |
122 | applicationPaths
123 |
124 | inputTypeIdentifier
125 | com.apple.Automator.nothing
126 | outputTypeIdentifier
127 | com.apple.Automator.text
128 | presentationMode
129 | 11
130 | processesInput
131 | 0
132 | serviceInputTypeIdentifier
133 | com.apple.Automator.nothing
134 | serviceOutputTypeIdentifier
135 | com.apple.Automator.text
136 | serviceProcessesInput
137 | 0
138 | systemImageName
139 | NSActionTemplate
140 | useAutomaticInputType
141 | 0
142 | workflowTypeIdentifier
143 | com.apple.Automator.servicesMenu
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/Make Transparent Copy.workflow/Contents/document.wflow:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMApplicationBuild
6 | 444.38
7 | AMApplicationVersion
8 | 2.9
9 | AMDocumentVersion
10 | 2
11 | actions
12 |
13 |
14 | action
15 |
16 | AMAccepts
17 |
18 | Container
19 | List
20 | Optional
21 |
22 | Types
23 |
24 | com.apple.cocoa.url
25 |
26 |
27 | AMActionVersion
28 | 1.1.1
29 | AMApplication
30 |
31 | Finder
32 |
33 | AMParameterProperties
34 |
35 | AMProvides
36 |
37 | Container
38 | List
39 | Types
40 |
41 | com.apple.cocoa.url
42 |
43 |
44 | AMRequiredResources
45 |
46 | ActionBundlePath
47 | /System/Library/Automator/Duplicate Finder Items.action
48 | ActionName
49 | Duplicate Finder Items
50 | ActionParameters
51 |
52 | BundleIdentifier
53 | com.apple.Automator.DuplicateFinderItems
54 | CFBundleVersion
55 | 1.1.1
56 | CanShowSelectedItemsWhenRun
57 |
58 | CanShowWhenRun
59 |
60 | Category
61 |
62 | AMCategoryFilesAndFolders
63 |
64 | Class Name
65 | AMDuplicateFinderItemsAction
66 | InputUUID
67 | EE0C37E2-8372-4F01-90EA-939107EFB9B5
68 | Keywords
69 |
70 | Duplicate
71 | File
72 | Copy
73 |
74 | OutputUUID
75 | 972B3C06-EB8A-423C-866E-EFA108B993DF
76 | UUID
77 | 78F56EB7-4A88-4BD1-ACDD-8ACCAF11D880
78 | UnlocalizedApplications
79 |
80 | Finder
81 |
82 | arguments
83 |
84 | conversionLabel
85 | 0
86 |
87 |
88 |
89 | action
90 |
91 | AMAccepts
92 |
93 | Container
94 | List
95 | Optional
96 |
97 | Types
98 |
99 | public.image
100 |
101 |
102 | AMActionVersion
103 | 1.1.1
104 | AMApplication
105 |
106 | Preview
107 |
108 | AMParameterProperties
109 |
110 | imageType
111 |
112 |
113 | AMProvides
114 |
115 | Container
116 | List
117 | Types
118 |
119 | public.image
120 |
121 |
122 | ActionBundlePath
123 | /System/Library/Automator/Change Type of Images.action
124 | ActionName
125 | Change Type of Images
126 | ActionParameters
127 |
128 | imageType
129 | PNG
130 |
131 | BundleIdentifier
132 | com.apple.Automator.ChangeImageType
133 | CFBundleVersion
134 | 1.1.1
135 | CanShowSelectedItemsWhenRun
136 |
137 | CanShowWhenRun
138 |
139 | Category
140 |
141 | AMCategoryPhotos
142 |
143 | Class Name
144 | AMChangeImageTypeAction
145 | InputUUID
146 | 5B63079F-FA2C-4FE7-A196-DD8D3B036BDC
147 | Keywords
148 |
149 | Image
150 | Photo
151 | Change
152 | Convert
153 | Set
154 |
155 | OutputUUID
156 | 0F338EAE-A35B-462B-B98C-D2E0DB76882E
157 | UUID
158 | FA225B9E-6735-4AEA-B7AF-40400D37CB39
159 | UnlocalizedApplications
160 |
161 | Preview
162 |
163 | arguments
164 |
165 | 0
166 |
167 | default value
168 | TIFF
169 | name
170 | imageType
171 | required
172 | 0
173 | type
174 | 0
175 | uuid
176 | 0
177 |
178 |
179 | conversionLabel
180 | 0
181 | isViewVisible
182 |
183 | location
184 | 514.500000:291.000000
185 | nibPath
186 | /System/Library/Automator/Change Type of Images.action/Contents/Resources/Base.lproj/main.nib
187 |
188 | isViewVisible
189 |
190 |
191 |
192 | action
193 |
194 | AMAccepts
195 |
196 | Container
197 | List
198 | Optional
199 |
200 | Types
201 |
202 | com.apple.applescript.object
203 |
204 |
205 | AMActionVersion
206 | 1.0
207 | AMApplication
208 |
209 | Automator
210 |
211 | AMParameterProperties
212 |
213 | source
214 |
215 |
216 | AMProvides
217 |
218 | Container
219 | List
220 | Types
221 |
222 | com.apple.applescript.object
223 |
224 |
225 | ActionBundlePath
226 | /System/Library/Automator/Run JavaScript.action
227 | ActionName
228 | Run JavaScript
229 | ActionParameters
230 |
231 | source
232 | function run(input, parameters) {
var app = Application.currentApplication();
app.includeStandardAdditions = true;
ObjC.import('AppKit');
input.forEach(function(item) {
var path = item.toString();
var image = $.NSImage.alloc.initWithContentsOfFile(path);
var bitmap = $.NSBitmapImageRep.alloc.initWithData(image.TIFFRepresentation);
233 | bitmap.setAlpha(true);
var color = bitmap.colorAtXY(0, 0);
color = color.colorWithAlphaComponent(Math.min(color.alphaComponent, 254/255));
bitmap.setColorAtXY(color, 0, 0);
var data = bitmap.representationUsingTypeProperties($.NSPNGFileType, $.NSDictionary.dictionary);
data.writeToFileAtomically(path, true);
});
return input;
}
234 |
235 | BundleIdentifier
236 | com.apple.Automator.RunJavaScript
237 | CFBundleVersion
238 | 1.0
239 | CanShowSelectedItemsWhenRun
240 |
241 | CanShowWhenRun
242 |
243 | Category
244 |
245 | AMCategoryUtilities
246 |
247 | Class Name
248 | RunJavaScriptAction
249 | InputUUID
250 | 25589A92-93D1-48E7-80BB-FA976F1A44AB
251 | Keywords
252 |
253 | Run
254 | JavaScript
255 |
256 | OutputUUID
257 | 1A6747FD-1B9C-46A9-9A2E-10E8414B3A99
258 | UUID
259 | D0B336B8-9BFE-49C1-A804-3A4AD461C52A
260 | UnlocalizedApplications
261 |
262 | Automator
263 |
264 | arguments
265 |
266 | 0
267 |
268 | default value
269 | function run(input, parameters) {
270 |
271 | // Your script goes here
272 |
273 | return input;
274 | }
275 | name
276 | source
277 | required
278 | 0
279 | type
280 | 0
281 | uuid
282 | 0
283 |
284 |
285 | isViewVisible
286 |
287 | location
288 | 514.500000:684.000000
289 | nibPath
290 | /System/Library/Automator/Run JavaScript.action/Contents/Resources/Base.lproj/main.nib
291 |
292 | isViewVisible
293 |
294 |
295 |
296 | connectors
297 |
298 | 1AD48F18-22E8-4A36-98FD-D6635CFF6A2D
299 |
300 | from
301 | FA225B9E-6735-4AEA-B7AF-40400D37CB39 - FA225B9E-6735-4AEA-B7AF-40400D37CB39
302 | to
303 | D0B336B8-9BFE-49C1-A804-3A4AD461C52A - D0B336B8-9BFE-49C1-A804-3A4AD461C52A
304 |
305 | 48BBEC12-0C96-42B2-9FA4-7343FF71F46D
306 |
307 | from
308 | 78F56EB7-4A88-4BD1-ACDD-8ACCAF11D880 - 78F56EB7-4A88-4BD1-ACDD-8ACCAF11D880
309 | to
310 | FA225B9E-6735-4AEA-B7AF-40400D37CB39 - FA225B9E-6735-4AEA-B7AF-40400D37CB39
311 |
312 |
313 | workflowMetaData
314 |
315 | applicationBundleID
316 | com.apple.finder
317 | applicationBundleIDsByPath
318 |
319 | /System/Library/CoreServices/Finder.app
320 | com.apple.finder
321 |
322 | applicationPath
323 | /System/Library/CoreServices/Finder.app
324 | applicationPaths
325 |
326 | /System/Library/CoreServices/Finder.app
327 |
328 | inputTypeIdentifier
329 | com.apple.Automator.fileSystemObject.image
330 | outputTypeIdentifier
331 | com.apple.Automator.nothing
332 | presentationMode
333 | 15
334 | processesInput
335 | 0
336 | serviceApplicationBundleID
337 | com.apple.finder
338 | serviceApplicationPath
339 | /System/Library/CoreServices/Finder.app
340 | serviceInputTypeIdentifier
341 | com.apple.Automator.fileSystemObject.image
342 | serviceOutputTypeIdentifier
343 | com.apple.Automator.nothing
344 | serviceProcessesInput
345 | 0
346 | systemImageName
347 | NSActionTemplate
348 | useAutomaticInputType
349 | 0
350 | workflowTypeIdentifier
351 | com.apple.Automator.servicesMenu
352 |
353 |
354 |
355 |
--------------------------------------------------------------------------------