Workflows

Comments

6 Comments »

Pages: [2] 1 » Show All

  1. 6.

    Works perfectly for me. Thank you Todd!

    Comment by francesca — June 1, 2010 @ 5:25 am

  2. 5.

    To get around the directory structure problems:

    1) Start Automator 2) Create a custom script (if it asks you) 3) Drag the “Ask for Finder Items” action to the work area (Be sure to check the box for “Allow Multiple Selection”) 3) Drag the “Run Applescript” action to the work area 4) Enter the following AppleScript:

    on run {input, parameters} — create a PKZip archive of the selected Finder item(s) — if no destination folder is specified, the archive will be placed in the same location — input: a list of Finder items to archive — output: a list of Finder items archived

    set output to {}
    set SkippedItems to {} -- this will be a list of skipped items
    set DestinationFolder to missing value -- a Finder path to a destination folder if different
    
    repeat with SomeItem in the input -- step through each item in the input
        try
            set SomeItem to SomeItem as text
            if the last character of SomeItem is in {":", "/"} then set SomeItem to text 1 thru -2 of SomeItem
            set ArchiveSource to POSIX path of SomeItem
            if DestinationFolder is missing value then -- save the archive to the same location
                set ArchiveName to ArchiveSource & ".zip"
            else -- save the archive to the specified folder
                set TheName to name of (info for SomeItem as alias)
                set ArchiveName to (POSIX path of DestinationFolder) & TheName & ".zip"
            end if
            do shell script "ditto -ck " & (quoted form of ArchiveSource) & space & (quoted form of ArchiveName)
            set the end of the output to (POSIX file ArchiveName) as alias -- success
        on error ErrorMessage number ErrorNumber
            log ErrorMessage
            set the end of SkippedItems to SomeItem
        end try
    end repeat
    
    if SkippedItems is not {} then -- handle skipped items
        set TheCount to (count SkippedItems) as text
        display alert "Error with Archive action" message TheCount & " items(s) were skipped - workflow will continue"
        (*
            choose from list SkippedItems with title "Error with Archive action" with prompt "The following items were skipped:" with empty selection allowed
        if result is false then error number -128 -- user cancelled
            *)
    end if
    
    return the output -- pass the result(s) to the next action
    

    end run

    5) Click File->Save As-> Application 6) Run the Application that you just created.

    TB

    Comment by Todd Brown — May 11, 2009 @ 8:52 am

  3. 4.

    i dragged and dropped some widgets to the app and it ran without any error. however i dont see my zip archives either in the original widget folder or where the app is stored. any advice?

    Comment by AceNeerav — November 3, 2008 @ 8:04 am

  4. 3.

    I’m having the same problem. Does anyone know a way to not have all of the preceding folders.

    Comment by Curt — February 28, 2008 @ 6:19 pm

  5. 2.

    In Leopard this workflow now creates an archive that includes the full path folder structure from the root directory. How would one use this workflow to create an archive of selected files without the preceding folders(i.e. from the selection forward).

    Comment by Jason Lazzara — December 5, 2007 @ 12:07 pm

Pages: [2] 1 » Show All

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>