0

I created an automator service that runs a very simple applescript:

on run {input, parameters}

tell application "Finder"
    set theFile to selection
    set theFolder to choose folder
    move theFile to theFolder
end tell

return input

end run

It works, but there are a couple of issues that I would like to fix if possible.

When I run the service and the choose folder dialog box pops up, a spinning cog-wheel looking icon appears in the menu bar and messes things up. It goes away when the dialog box closes but leaves a gap in the menu bar icons. Minor, but annoying. Is there anyway to prevent this behavior?

The second is more major and has to do with how the file I want to move is selected. The desired behavior is that I right (ctl)-click on the file, choose the service and destination directory and the file is moved.

As the script is written, I have to first left-click on the file to "fully" select it, then right-click to choose the service. If I just right-click on the file without first left-clicking, the parent directory is moved. Not what I want to happen. Would it be possible to write something like "set theFile to the_file_selected_by_right-click"?

0

I don't know how to prevent that menu bar gap, but the solution to the second problem is to set "Service receives selected" to "files or folders" and pass the files as input to the script:

on run {input}
    tell application "Finder" to move input to (choose folder)
end run
  • Perfect! Thanks! I suppose that I can live with the spinning wheel in the menu bar. – error_404 Mar 23 '14 at 19:06
  • Found a script here: discussions.apple.com/message/21591358#21591358 Added it to the top of the workflow and it works perfectly. No more messed-up menu bar! – error_404 Mar 23 '14 at 20:06
  • The script just terminates Automator Launcher in a really noob way. You could replace it with just killall Automator\ Launcher. – Lri Mar 24 '14 at 11:33
  • Thanks! My final script is: on run {input} do shell script "killall 'Automator Launcher'" tell application "Finder to move input to (choose folder) end run. Created another service with 'duplicate' instead of 'move' to copy the selection to a chosen folder. Works great! – error_404 Mar 25 '14 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.