Re: recycleURLs doesn't enable Put Back or Undo in Finder
On 2015 Jan 19, at 23:23, Steve Mills sjmi...@mac.com wrote: Now if anyone has any ideas on how to get the AppleScript solution mentioned earlier in this thread to work, I'd be most appreciative. To clarify Steve’s question: Is there any way to compile the following as an NSAppleScript and execute it from a *sandboxed* app? with timeout 15 seconds tell application Finder delete POSIX file “/path/to/whatever end tell end timeout (It’s easy in a non-sandboxed app.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
I figured it out. I was watching the session video Secure Automation Techniques in OS X when Chris Nebel got to the part about sending Apple Events from one app to another. His example uses com.apple.security.temporary-exception.apple-events instead of com.apple.security.scripting-targets. From the docs, it sounds like the first is older and the second is newer and preferred. But then the docs also say: Note: Before you can use this entitlement, the scriptable app must provide scripting access groups. If it does not, you can still control the app, but you must use a temporary exception, as described in Apple Event Temporary Exception. So even though I provided the scripting access group for com.apple.finder, it didn't work. Either that or I used the wrong actions within that group. But nowhere does it list the actions Finder provides. man 5 sdef shows access-group as a way to provide entitlements to sandboxed apps, yet when I list the sdef for Finder.app (or iTunes.app, which is specifically mentioned in the video), I see no access-group anywhere. Mail.app (also mentioned in the video), however, *does* have such things. So this must be a new thing that they didn't feel the need to implement everywhere. In the end, I deleted the com.apple.security.scripting-targets entitlement and kept the com.apple.security.temporary-exception.apple-events. I can now trash the files, it makes the *krish* sound when the files land in the trash, and *I can go to Finder and Undo or Put Back exactly like I should be able to do*. -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 20, 2015, at 11:13 , Steve Mills sjmi...@mac.com wrote: I can go to Finder and Undo or Put Back exactly like I should be able to do … I can go to Finder and Undo or Put Back exactly like I perversely want to be able to do …” There. I fixed your typo for you. ;) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 20, 2015, at 13:29:30, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jan 20, 2015, at 11:13 , Steve Mills sjmi...@mac.com wrote: I can go to Finder and Undo or Put Back exactly like I should be able to do … I can go to Finder and Undo or Put Back exactly like I perversely want to be able to do …” There. I fixed your typo for you. ;) Bahaha. :) -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 19, 2015, at 15:25:42, Kyle Sluder k...@ksluder.com wrote: On Jan 19, 2015, at 11:52 AM, Steve Mills sjmi...@mac.com wrote: My main point was that Put Back doesn't get enabled when you use recycleURLs. *THAT* is the part that sucks. I'm not focusing on whether or not Undo gets enabled in the Finder. I was thinking it should, since it does when you trash a file in Finder, or if you trash it via AppleScript. Ah. You should certainly file a bug on Put Back. radar://19529280 Now if anyone has any ideas on how to get the AppleScript solution mentioned earlier in this thread to work, I'd be most appreciative. -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On 2015 Jan 18, at 23:34, Steve Mills sjmi...@mac.com wrote: Is there any way to ensure that NSWorkspace recycleURLs:completionHandler: will let the user go to the Finder and Put Back or Undo? I'm very surprised that it doesn't work right. True, the documentation says that -[NSWorkspace recycleURLs:completionHandler] acts in the same manner as the Finder”, but they didn’t say “exactly”. The way to get it to work exactly like Finder is to AppleScript the Finder. This also gives you an additional “bonus” - the trash-can sound effect :) See code in my method -[NSFileManager(SomeMore)trashPath:scriptFinder:error_p:] which is in here: http://github.com/jerrykrinock/CategoriesObjC/blob/For_BkmkMgrs_Ver_2/NSFileManager+SomeMore.m Look at line 294 etc. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 19, 2015, at 13:06:02, Greg Parker gpar...@apple.com wrote: Are you sure you want the Finder's Undo command to undo an action taken inside your app? That sounds like a very strange user experience. Yes. Finder is the app that *I* think of when it comes to file management. It owns the trash. When you empty the trash in iPhoto (which is essentially moving the file from its own private trash to the real Trash), you can not undo it from iPhoto. It even warns you about that. -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Mon, Jan 19, 2015, at 01:22 PM, Steve Mills wrote: On Jan 19, 2015, at 13:06:02, Greg Parker gpar...@apple.com wrote: Are you sure you want the Finder's Undo command to undo an action taken inside your app? That sounds like a very strange user experience. Yes. Finder is the app that *I* think of when it comes to file management. It owns the trash. When you empty the trash in iPhoto (which is essentially moving the file from its own private trash to the real Trash), you can not undo it from iPhoto. It even warns you about that. I understand where you're coming from, but this is not how apps behave on the Mac. If deleting something in your app altered the Undo stack in Finder, it would also wipe Finder's Redo stack, causing data loss. So I agree with Greg: you shouldn't do this. If the user wants to restore a file deleted in your app, they can open up the Trash, select the file, and choose Put Back. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 19, 2015, at 13:42:18, Kyle Sluder k...@ksluder.com wrote: I understand where you're coming from, but this is not how apps behave on the Mac. If deleting something in your app altered the Undo stack in Finder, it would also wipe Finder's Redo stack, causing data loss. So I agree with Greg: you shouldn't do this. If the user wants to restore a file deleted in your app, they can open up the Trash, select the file, and choose Put Back. My main point was that Put Back doesn't get enabled when you use recycleURLs. *THAT* is the part that sucks. I'm not focusing on whether or not Undo gets enabled in the Finder. I was thinking it should, since it does when you trash a file in Finder, or if you trash it via AppleScript. -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 18, 2015, at 11:34 PM, Steve Mills sjmi...@mac.com wrote: Is there any way to ensure that NSWorkspace recycleURLs:completionHandler: will let the user go to the Finder and Put Back or Undo? I'm very surprised that it doesn't work right. Not even NSFileManager's trashItemAtURL:resultingItemURL:error: does that. I'm trying it in 10.10. Are you sure you want the Finder's Undo command to undo an action taken inside your app? That sounds like a very strange user experience. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 19, 2015, at 10:34:37, Jerry Krinock je...@ieee.org wrote: True, the documentation says that -[NSWorkspace recycleURLs:completionHandler] acts in the same manner as the Finder”, but they didn’t say “exactly”. The way to get it to work exactly like Finder is to AppleScript the Finder. This also gives you an additional “bonus” - the trash-can sound effect :) See code in my method -[NSFileManager(SomeMore)trashPath:scriptFinder:error_p:] which is in here: I was thinking of doing it with AppleScript. Thanks. Perhaps Apple expects the application calling recycleURLs will keep track of the returned urls and put them on its own undo stack. That seems kinda goofy. And in case anyone else runs across this thread and runs into Application isn't running errors, I needed to add AppleScript entitlements to my sandboxed app in order for this to work. -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 19, 2015, at 12:15:18, Steve Mills sjmi...@mac.com wrote: I was thinking of doing it with AppleScript. Thanks. Perhaps Apple expects the application calling recycleURLs will keep track of the returned urls and put them on its own undo stack. That seems kinda goofy. And in case anyone else runs across this thread and runs into Application isn't running errors, I needed to add AppleScript entitlements to my sandboxed app in order for this to work. Arg. Just adding the entitlements wasn't enough. I'm still getting A privilege violation occurred. This Sandbox stuff is getting to be really annoying. So what else do I need to do so I can tell Finder to move files to the trash? The parent folder in this case has even had startAccessingSecurityScopedResource called on its url. The app has the com.apple.security.assets.pictures.read-write entitlement set to YES, and my test files are in subfolders of Pictures. -- Steve Mills Drummer, Mac geek ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: recycleURLs doesn't enable Put Back or Undo in Finder
On Jan 19, 2015, at 11:52 AM, Steve Mills sjmi...@mac.com wrote: My main point was that Put Back doesn't get enabled when you use recycleURLs. *THAT* is the part that sucks. I'm not focusing on whether or not Undo gets enabled in the Finder. I was thinking it should, since it does when you trash a file in Finder, or if you trash it via AppleScript. Ah. You should certainly file a bug on Put Back. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com