Re: Bug in 10.6 NSPasteboard API? (was: Sending a list of path strings to the Finder via Scripting Bridge)

2012-05-27 Thread Ken Thomases
On May 26, 2012, at 4:41 AM, Peter wrote: > thank you very much for your enlightening and in-depth explanation! You're welcome. > With the old API I could (and still do) put a list of path strings with empty > elements on the pasteboard, e.g. four paths, the third one empty as in > > /path1/i

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Shane Stanley
On 27/05/2012, at 12:30 AM, Peter wrote: > Just for clarification: > > This AS handler would then live in a .applescript file in my project wrapped > in > > script ASClassInstance Yes. > And on of the above calls would live in a .m file containing > > #import //no need to put this in mai

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Stephen J. Butler
On Fri, May 25, 2012 at 1:56 AM, Peter wrote: > I'd like to reveal/select multiple items in the Finder. > NSWorkspace only handles single files as in > >            [[NSWorkspace sharedWorkspace] selectFile:currentFilePath >                             inFileViewerRootedAtPath:currentFilePath]; >

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
Thank you! You might want to add this to an appendix of your book some time. Am 26.05.2012 um 14:58 schrieb Shane Stanley: > On 26/05/2012, at 10:25 PM, Peter wrote: > >> On the other hand I have never seen/never tried to call AppleScript from >> Cocoa in AppleScriptObjC terms - if this wording

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Shane Stanley
On 26/05/2012, at 10:25 PM, Peter wrote: > On the other hand I have never seen/never tried to call AppleScript from > Cocoa in AppleScriptObjC terms - if this wording makes sense at all. I don't > remember reading about this in your book, which focuses of course on > accessing Cocoa from AppleS

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
Am 26.05.2012 um 13:07 schrieb Shane Stanley: > On 26/05/2012, at 8:24 PM, Peter wrote: > >> In partial rehabilitation of the Scripting Bridge, I should add that it >> certainly makes life A LOT easier than using NSAppleScript when pulling out >> data from a scriptable application: just try to

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Shane Stanley
On 26/05/2012, at 8:24 PM, Peter wrote: > In partial rehabilitation of the Scripting Bridge, I should add that it > certainly makes life A LOT easier than using NSAppleScript when pulling out > data from a scriptable application: just try to make sense of the > NSAppleEventDescriptor NSAppleScr

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
In partial rehabilitation of the Scripting Bridge, I should add that it certainly makes life A LOT easier than using NSAppleScript when pulling out data from a scriptable application: just try to make sense of the NSAppleEventDescriptor NSAppleScript returns, even given the flaws I pointed out

Re: Bug in 10.6 NSPasteboard API? (was: Sending a list of path strings to the Finder via Scripting Bridge)

2012-05-26 Thread Peter
Ken, thank you very much for your enlightening and in-depth explanation! This is what I hoped somehow to receive back in February... Over the next days I will try and put your approach to practice. If it works as I hope I will certainly withdraw my comment about the new API being a half-baken

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
David, thank you, but no, this will not work. I should have stated this explicitly: '*** -[SBElementArray init]: should never be used.' is the exception I get when using the method proposed by you. In my experience, all other alloc-init variants fail in the same way. It is impossible to alloc

Re: Bug in 10.6 NSPasteboard API? (was: Sending a list of path strings to the Finder via Scripting Bridge)

2012-05-26 Thread Ken Thomases
On May 26, 2012, at 2:42 AM, Peter wrote: > One more half-baked technology from Apple (as is the new pasteboard API in > its current implementation even if it looks very elegant on the surface - I > guess quite a good deal of people will be bitten by it if it becomes > compulsory, since it prev

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
Answering my own post: After much experimentation I come to the conclusion that this is impossible using Scripting Bridge. Interestingly, a code example from Apple called SBSetFinderComment, which illustrates setting Finder comments using Scripting Bridge includes a "Reveal in Finder" function

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Charles Srstka
On May 25, 2012, at 2:24 AM, Shane Stanley wrote: > On 25/05/2012, at 4:56 PM, Peter wrote: > >> If all fails I'll have to convert the path strings to hfs paths and >> string-assemble a script to run using NSAppleScript in code > > If you do end up using NSAppleScript, you can still avoid HFS p

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Peter
Thanks Shane! This is indeed a nice trick - and it's so obvious, once you are told. ;-) Am 25.05.2012 um 09:24 schrieb Shane Stanley: > On 25/05/2012, at 4:56 PM, Peter wrote: > >> If all fails I'll have to convert the path strings to hfs paths and >> string-assemble a script to run using NSAp

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Quincey Morris
On May 25, 2012, at 00:14 , Peter wrote: > I am supporting OS 10.5, so I still have to find a way for it. Isn't there a solution using a sequence starting with: [[NSWorkspace sharedWorkspace] selectFile:currentFilePath [0] inFileViewerRootedAtPath: [currentFilePath stringByDeletingLastP

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Shane Stanley
On 25/05/2012, at 4:56 PM, Peter wrote: > If all fails I'll have to convert the path strings to hfs paths and > string-assemble a script to run using NSAppleScript in code If you do end up using NSAppleScript, you can still avoid HFS paths: just use 'POSIX file "/Users/fred/whatever.txt"'. --

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Peter
Am 25.05.2012 um 09:09 schrieb Quincey Morris: > On May 24, 2012, at 23:56 , Peter wrote: > >> I'd like to reveal/select multiple items in the Finder. >> NSWorkspace only handles single files as in >> >>[[NSWorkspace sharedWorkspace] selectFile:currentFilePath >>

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Quincey Morris
On May 24, 2012, at 23:56 , Peter wrote: > I'd like to reveal/select multiple items in the Finder. > NSWorkspace only handles single files as in > >[[NSWorkspace sharedWorkspace] selectFile:currentFilePath > inFileViewerRootedAtPath:currentFilePath]; How

Sending a list of path strings to the Finder via Scripting Bridge

2012-05-24 Thread Peter
Hi, I'd like to reveal/select multiple items in the Finder. NSWorkspace only handles single files as in [[NSWorkspace sharedWorkspace] selectFile:currentFilePath inFileViewerRootedAtPath:currentFilePath]; I searched Google and tried to pick up every scra