0

I'm building a mac-app for people to organise files. One of the things I allow people to do is to move or copy files to specific directories from within my app. I use FileManagers 'moveItem(at:to:)' or 'copyItem(atPath:toPath:)' to do so, which also allows me to catch errors. Based on these errors, I can of course create custom alerts for specific edge cases.

However, since Finder already provides alerts for such occasions, I was wondering if I could prompt Finders default alerts instead of having to re-create them.

I'm especially interested in the alert shown when multiple files already exist at the location the user tries to move/copy files to and Finder allows to 'Keep both', 'Stop' or 'Replace' these files. Because this alert also includes a 'Apply to all'-checkbox unusual place for a custom NSAlert.

Thanks!

  • I ended up making a custom alert in such a way that I can use it whenever I need to prompt a modal/sheet to inform the user or ask for specific details. I am planning on publishing this in a separate project in the near future – frankster5000 Feb 07 '19 at 09:03

1 Answers1

0

You can use apple script to move file.

tell application "Finder"
    move POSIX file "/Users/xyz/fileName" to POSIX file "/Users/xyz/test"
end tell

This will display finder alert.

Parag Bafna
  • 22,812
  • 8
  • 71
  • 144