8 Replies Latest reply: May 3, 2012 6:27 PM by twtwtw
good_nature Level 1 Level 1 (0 points)

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)
  • 1. Re: Applescript - Folder Actions Setup
    twtwtw Level 5 Level 5 (4,690 points)

    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"
  • 2. Re: Applescript - Folder Actions Setup
    good_nature Level 1 Level 1 (0 points)

    Thank you.

     

    I have this:

     

     

    set destFolder to (":dx1070:Workflows:Sheetfed:")

     

    on adding folder items to this_folder after receiving added_items

              try

                        tell application "Finder"

      move added_items to folder destFolder

                        end tell

              end try

    end adding folder items to


    But still not doing it yet.

     

    Took off the leading colon on destFolder ie ":dx1070:Workflows:Sheetfed:", still no.

     

    Any more help would be great!

  • 3. Re: Applescript - Folder Actions Setup
    twtwtw Level 5 Level 5 (4,690 points)

    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.

  • 4. Re: Applescript - Folder Actions Setup
    good_nature Level 1 Level 1 (0 points)

    console gives me:

     

    5/3/12 4:12:14.576 PM AppleScript Runner: CPSGetFrontProcess(): This call is deprecated and should not be called anymore.

     

    Nothing else.

  • 5. Re: Applescript - Folder Actions Setup
    twtwtw Level 5 Level 5 (4,690 points)

    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?

  • 6. Re: Applescript - Folder Actions Setup
    good_nature Level 1 Level 1 (0 points)

    Formatted for windows.

  • 7. Re: Applescript - Folder Actions Setup
    good_nature Level 1 Level 1 (0 points)

    I've used move locally on this machine with no issues, so I do believe you're right, I've got the path wrong.

    Not sure what, though.....

  • 8. Re: Applescript - Folder Actions Setup
    twtwtw Level 5 Level 5 (4,690 points)

    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).