Skip navigation

Applescript - Folder Actions Setup

558 Views 8 Replies Latest reply: May 3, 2012 6:27 PM by twtwtw RSS
good_nature Calculating status...
Currently Being Moderated
May 3, 2012 2:54 PM

trying to make a folder action to move anything dropped in a folder to shared folder on another device.  code as follows:

 

 

set destFolder to (":" & (path to desktop as string) & "Workflows:Sheetfed:")

 

display dialog destFolder

 

on adding folder items to this_folder after receiving added_items

 

          try

                    tell application "Finder"

  move added_items to destFolder

                    end tell

          end try

end adding folder items to

 

Nothing happens.

 

Note:  I added the display to see the path when I was hand running.

 

Do I need to use posix path for this, or maybe use command line??  Not sure what's best - easiest - most reliable

 

Any assistance is greatly appreciated.

applescript, Mac OS X (10.7.3)
  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    May 3, 2012 3:12 PM (in response to good_nature)

    two problems:

    1. the path to a shared folder (in colon delimited form) will be SharedVolumeName:Workflows:Sheetfed:.  SharedVolumeName will be the name of the mounted volume as it appears on the desktop, but you don't want to specify the path to the desktop, just start with the volume.
    2. the move command takes a folder object for its 'to' parameter, so if you're using a string path you'll want to say "move added_items to folder destFolder"
  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    May 3, 2012 4:05 PM (in response to good_nature)

    interesting.  taking off the leading colon is the correct move, and that should have worked.  are you seeing any errors in Console.app?  the only two possible errors I can think of are (1) that the Finder doesn't like the file format folder actions is sending to it, or (2) you've messed up destination path.  both of those would show in console, though.

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    May 3, 2012 4:29 PM (in response to good_nature)

    well, I've tested the finder 'move' command and it works fine in that context on my machine, so the problem must be with the path you're specifying.  You have a mounted volume called dx1070 with the correct folder hierarchy? Is this volume a HFS volume, or is it formatted for Windows or unix?

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    May 3, 2012 6:27 PM (in response to good_nature)

    well, I don't have a Windows share that I can test; best I can do is set up a windows-formatted disk image and test that, and that seems to work fine.  You might try changing the syntax.  In the Finder you can say:

     

                        move added_items to folder "Sheetfed" of folder "Workflows" of disk "dx1070"

     

    as long as the disk is mounted that should work.  otherwise you're going to have to start debugging with display dialog commands and/or try blocks (remember that from Folder Actions you may need to put display dialog commands inside a Finder or System Events tell block - I don't think you can display a dialog straight from applescript in a folder action).

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.