Re: Adding HTML data to the general pasteboard
Re: Adding HTML data to the general pasteboard
- Subject: Re: Adding HTML data to the general pasteboard
- From: Kyle Sluder <email@hidden>
- Date: Fri, 27 May 2011 23:02:20 -0700
On Thu, May 26, 2011 at 11:43 PM, Patrick Robertson
<email@hidden> wrote:
> I currently have an application which pastes objects from a given list of
> saved objects (basically strings) to wherever the mouse if focused.
> What I'm looking to do is paste these objects in RT format into various text
> editors. Most notably - URL strings (e.g. http://example.com) such that they
> are formatted as clickable links.
>
> In order to paste the objects (I'll concentrate on URLs), I add them to the
> generalPasteboard with a type 'Apple URL pasteboard type'. Then I use some
> carbon to simulate ⌘V.
1. If you're running on 10.6, you should use the new pasteboard API.
NSURL conforms to NSPasteboardWriting, and all you have to do is write
your NSURL to the pasteboard using -[NSPasteboard writeObjects:]. It
will use all the correct representations.
2. You're seriously simulating keystrokes to paste things in places?
This is fraught with peril. I know a number of users who re-map Cmd-V
to "Paste and Match Style" using System Preferences.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden