Download : Check item size and type of items for emailing – Automator Service workflow

Download : Check item size and type of items for emailing - Automator Service workflow

A workflow to go with a stackoverflow.com question.

http://stackoverflow.com/questions/13331821/automator-accepts-files-and-zips-folders-warn-about-sizes

A proof of concept. And the final stage of adding files to email is left to you. You should also note that there is no checking for packages of applications/bundles. Which on a Mac will be seen as a file but else where as a folder.

There is a lot going on in the service workflow. (To test the workflow in Automator ADD a ‘Get Selected Finder Items’ as the first Action. But it runs a lot faster when run as a service)

But the basics are:

Service receives selected : files or folders in “finder”

1, Run Applescript.

It takes the selected items and passes them onto an applescript that checks the size and then displays a dialogue if all items are larger than 20M. ( note the du command seems to round down some what). If user hits ok then we move on. If cancel the workflow will stop. No dialogue will display if less than 20M. It will just move on.

2,Set value of Variable

Store the full list in the Storage Variable and pass it on to the next action.

3, Filter Finder Items

filter for ‘kind’ is ‘folder’ pass the result to next action.

4, create Archive.

I have left this to save on the desktop. But I suggest you do it to the users temp folder.

pass the result down to the next action. ( path of the zip file if any.)

5,Set value of Variable

Stores the path to the zip file in the Archive Variable (if one was created ) Do not pass it on to the next action.

6,Get value of Variable

(Does not take result of last action.) Get the Storage Variable value. pass the result to next action.

7, Filter Finder Items

filter for ‘kind’ is not ‘folder’ pass the result to next action.

8, Set value of Variable

Store the file list in the files Variable. ….

From here on you have two Variable. file and Archive

you can use them to send the items they reference files and zip to you email ..

And remember this is just a proof of concept.

One Reply to “Download : Check item size and type of items for emailing – Automator Service workflow”

Hi, Please Leave a Reply