Re: NSFilesPromisePboardType

2010-01-09 Thread Nick Paulson
I ended up just using a define to easily change it later:

#define kiTunesPboardType @CorePasteboardFlavorType 0x6974756E

To anyone interested, it is a property list that contains a lot of information 
about iTunes itself and the tracks being dragged.

Thanks for the help, Jim,

--Nick

On Jan 9, 2010, at 12:08 AM, Jim Correia wrote:

 On Jan 8, 2010, at 11:33 PM, Jim Correia wrote:
 
 Ultimately, it appears that iTunes is putting bad promise data in the drag. 
 At this point it is probably best to file a bug against iTunes.
 
 Looks like this might simply be a byte order bug with the value in the 
 promisedFlavor field in the PromiseHFSFlavor data on the pasteboard (though 
 that doesn’t really help when accessing the data via NSPasteboard.)
 
 On Jan 8, 2010, at 11:37 PM, Nick Paulson wrote:
 
 I am trying to get the path of an item dropped onto a view by iTunes.
 
 iTunes seems to only do this with NSFilesPromisePboardType.  Maybe I am 
 wrong, though.
 
 The promised data isn’t really what you wanted anyway. The idea behind the 
 promise is that the drag provider *promises* to create a new file in location 
 specified in the drag receiver. It sounds like you are interested in the file 
 that is being dragged, not a copy of it.
 
 iTunes does provide all the data in the drag that you need (and more), but 
 does so through the ‘itun’ drag flavor. I haven’t seen this documented 
 anywhere as a public, supported pasteboard flavor. It has been available for 
 some time, but unless it is documented as a such, it could disappear (or 
 change) at any time. Proceed accordingly.
 
 - Jim___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.com

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSFilesPromisePboardType

2010-01-08 Thread Nick Paulson
Hello list,

Can someone please explain to me how I handle NSFilesPromisePboardType?  I 
register for the dragged types, but I don't understand exactly how to get the 
data.

Thanks,
Nick Paulson___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSFilesPromisePboardType

2010-01-08 Thread Nick Paulson
I am doing the following code:

NSArray *filenames = [sender namesOfPromisedFilesDroppedAtDestination:[NSURL 
fileURLWithPath:@/]];

However, it is getting the following lines in console:
Couldn't get a copy of an HFS Promise from the pasteboard
Looked for HFSPromises on the pasteboard, but found none.

I am dragging from iTunes in list view to my own view.

Am I making a mistake somewhere?

--Nick

On Jan 8, 2010, at 9:51 PM, Jim Correia wrote:

 On Jan 8, 2010, at 7:52 PM, Nick Paulson wrote:
 
 Can someone please explain to me how I handle NSFilesPromisePboardType?  I 
 register for the dragged types, but I don't understand exactly how to get 
 the data.
 
 Did you read the documentation?
 
 http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/DragandDrop/Tasks/DraggingFiles.html
 
 What part of the inline sample code are you having trouble understanding?
 
   NSURL *dropLocation; // Assume this exists

   - (BOOL)performDragOperation:(id NSDraggingInfo)sender
   {
   NSPasteboard *pboard = [sender draggingPasteboard];

   if ( [[pboard types] containsObject:NSFilesPromisePboardType] ) 
 {
   NSArray *filenames = [sender
   
 namesOfPromisedFilesDroppedAtDestination:dropLocation];
   // Perform operation using the files’ names, but 
 without the
   // files actually existing yet
   }
   return YES;
   }
 
 
 - Jim___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.com

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSFilesPromisePboardType

2010-01-08 Thread Nick Paulson
I am trying to get the path of an item dropped onto a view by iTunes.

iTunes seems to only do this with NSFilesPromisePboardType.  Maybe I am wrong, 
though.

--Nick
On Jan 8, 2010, at 11:33 PM, Jim Correia wrote:

 On Jan 8, 2010, at 10:24 PM, Nick Paulson wrote:
 
 I am doing the following code:
 
 NSArray *filenames = [sender namesOfPromisedFilesDroppedAtDestination:[NSURL 
 fileURLWithPath:@/]];
 
 However, it is getting the following lines in console:
 Couldn't get a copy of an HFS Promise from the pasteboard
 Looked for HFSPromises on the pasteboard, but found none.
 
 I am dragging from iTunes in list view to my own view.
 
 Am I making a mistake somewhere?
 
 A couple of things to keep in mind here…
 
 * See the comment in the documentation about having to assume the files 
 haven’t been created yet? You have to assume that, and it can complicate 
 things. (I’ve logged a lengthy bug requesting ways to simplify file promise 
 dragging, but the problem is complex because it requires system framework 
 support *and* the cooperation of applications doing the dragging.)
 
 * You specified the drop location as /. Not all users have write permissions 
 to the root of the disk, and it is unlikely that you really wanted iTunes to 
 create the files here anyway.
 
 Ultimately, it appears that iTunes is putting bad promise data in the drag. 
 At this point it is probably best to file a bug against iTunes.
 
 What is it you are actually trying to accomplish? Perhaps there is another 
 solution.
 
 Jim___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.com

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using AppleEvents to copy and past text from any application

2010-01-05 Thread Nick Paulson
If you have a solution to this, please report back.  I am interested in what 
you come up with.

--Nick Paulson
On Jan 5, 2010, at 11:10 AM, Jesse Grosjean wrote:

 I know most apps don't support AppleScript directly, but I thought
 there was some way to automatically script the menu items of most
 apps.
 
 But wait... I bet I can already call those menu items through the
 accessibility API anyway! So I guess I probably don't need
 AppleEvents. Thanks for your response, made me think just a bit
 furthur I can probably work through this solution myself now.
 
 Jesse
 
 On Tue, Jan 5, 2010 at 11:02 AM, Jean-Daniel Dupas
 devli...@shadowlab.org wrote:
 
 Le 5 janv. 2010 à 16:46, Jesse Grosjean a écrit :
 
 I'm developing a small open source app called QuickCursor.
 
 - http://www.hogbaysoftware.com/products/quickcursor/
 - http://github.com/jessegrosjean/quickcursor
 
 The idea is to replace the input manage based edit in features with
 a generic program that provides the same feature, but using public
 API's instead of input manage hacks.
 
 Right now QuickCursor works through the accessibility api to
 read/write text from the target app. This works well for many apps
 (ones that expose their text as a single writable string attribute to
 the accessibility api), but not all apps do that. And as a result
 QuickCursor doesn't work everywhere. And so I'm looking for an
 alternative idea. The accessibility api also has a problem that it
 seems to mess up the undo stack in some programs.
 
 Someone suggested that I use AppleEvents to automate select
 all/copy/paste out of and then back into the target app. That would
 seem to be a greate approach, but I'm not sure how to do it. Is there
 anyone on this list who would be willing to help?
 
 I'm not sure this is the way to go.
 You will encounter the same issue than with Accessibility API. The target
 application has to support it.
 In fact, I'm pretty sure there is far less app with scriptability enabled
 than app with accessibility available.
 -- Jean-Daniel
 
 
 
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.com

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Revolving scoreboard

2010-01-04 Thread Nick Paulson
Take a look at the first post in the following link:

http://www.cocoadev.com/index.pl?CoreAnimation

Basically, you just have the view's animator as a receiver rather than the view 
itself.  This will automatically do the default animations for you.

--Nick Paulson

On Jan 4, 2010, at 1:55 AM, gumbo...@mac.com wrote:

 Thanks Guys, that will work really well and its a nice neat solution. Can you 
 elaborate on the animation proxy a little bit or rather point me in the right 
 direction.
 Cheers
 Rob
 
 
 On 4/01/2010, at 2:29 PM, PCWiz wrote:
 
 Good point, the view subclass would be easy and clean.
 
 Independent Cocoa Developer, Macatomy Software
 http://macatomy.com
 
 
 On 2010-01-03, at 6:10 PM, Scott Anguish wrote:
 
 I don’t think using NSScrollView is at all necessary in this case. That’s 
 much more of a situation for user interaction.
 
 This sounds more like the case for creating a view subclass that contains a 
 view that displays the current score. When the score increases, insert 
 another view visually above the other ( so it’d be like 
 
 Main View
 
 New View
 
 then using an animation proxy to move the main view up and the new view up 
 as well. 
 
 
 
 On Jan 3, 2010, at 6:27 PM, PCWiz wrote:
 
 This isn't something thats extremely difficult to do. You will need to 
 create NSView subclasses for the scores at the top. You can use 
 NSAttributedString/NSMutableAttributedString to create styled text, and 
 use their drawInRect method to draw the text into the view. It would be a 
 good idea to read this:
 
 https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/Introduction.html
 
 And more specifically, this: 
 https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Text/Text.html#//apple_ref/doc/uid/TP40003290-CH209-BCIEEIGC
 
 For the scrolling scores below, you will have to put the scores into an 
 NSTableView, or an NSCollectionView (the latter is better if you want to 
 customize the display) inside an NSScrollView. As for the automatic 
 scrolling, NSScrollView has nothing built in to facilitate this. Most 
 likely you are going to have to use an NSTimer that fires every few 
 milliseconds, and uses NSScrollView's scrollToPoint: method to scroll 
 gradually until you hit the bottom.
 
 Independent Cocoa Developer, Macatomy Software
 http://macatomy.com
 
 
 On 2010-01-03, at 4:07 PM, gumbo...@mac.com wrote:
 
 I have been asked to design a revolving scoreboard for a large Sporting 
 Clays event. The plan is to have a MacBook connected to a large flat 
 screen TV in the main tent. I will pull the scores from a CSV file (which 
 is updated regularly) and sort them into arrays for display. Creating the 
 on screen graphics is something I have not done much of with Cocoa. The 
 organizers have asked for a full screen display and would like have the 
 top 5 scores at the top of the screen and then scroll the rest of the 
 field below these scores.
 I could punch this out with HTML and a bit of Javascript, but I thought 
 it might be good to do have a play with Quartz.
 Can you please tell me how you good people might approach this?
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/pcwiz.support%40gmail.com
 
 This email sent to pcwiz.supp...@gmail.com
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com
 
 This email sent to sc...@cocoadoc.com
 
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/gumboots%40mac.com
 
 This email sent to gumbo...@mac.com
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.com

___

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

Re: Looking up a NSString constant at runtime

2010-01-04 Thread Nick Paulson
The constant *is* an NSString;  essentially you could do:

NSString *constValue = NSDeviceResolution;

Though, that may be a little redundant.

--Nick Paulson
On Jan 4, 2010, at 6:09 PM, David Alter wrote:

 This would work for finding out what the name is as well as logging it.
 
 What if I'm getting a string passed in that is the name of the constant and
 I want to return the constants string value. Is there a way to do that?
 
 something like...
 NSString * constValue = [SomeToolToLookupConstants constant:@
 NSDeviceResolution'];
 
 any idea?
 -dave
 
 
 On Mon, Jan 4, 2010 at 2:19 PM, Oftenwrong Soong
 oftenwrongso...@yahoo.comwrote:
 
 On Mon, Jan 4, 2010 at 4:56 PM, David Alter alterconsult...@gmail.com
 wrote:
 Is there a way to lookup what and NString constant is at runtime?
 
 
 
 Have you tried
 
 [NSDeviceResolution description]
 
 or
 
 [NSString stringWithString:NSDeviceResolution]
 
 ?
 
 Soong
 
 
 
 ___
 
 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:
 
 http://lists.apple.com/mailman/options/cocoa-dev/alterconsulting%40gmail.com
 
 This email sent to alterconsult...@gmail.com
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.com

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com