From: Alexander Nestorov on
I want to get the path of a file that has been copied (it's in the
clipboard).
In linux I'm doing [selection get -type UTF8_STRING -selection
CLIPBOARD] and I get file:///some/path
But I can't do it in Mac OS. Can anyone help me?

Thanks
From: Kevin Walzer on
On 2/2/10 7:37 PM, Alexander Nestorov wrote:
> I want to get the path of a file that has been copied (it's in the
> clipboard).
> In linux I'm doing [selection get -type UTF8_STRING -selection
> CLIPBOARD] and I get file:///some/path
> But I can't do it in Mac OS. Can anyone help me?
>
> Thanks


Can you post a larger code snippet so we can try to reproduce what you
are seeing?


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
From: Alexander Nestorov on
In fact, I'm testing the code in amsn (tcl/tk based app). I'm writing
a plugin that will get the content of the clipboard
and if the content is a file, it will send it to the person that
you're talking with.
So, if you'd like to test some code, I can send you the plugin, and
you can get amsn.

Or maybe, I can send you the plugin, and you could write some little
test app? (an empty 50x50 window that will receive
the paste event.

However, I have tried everything from the TK docs, and I can't get
anything more than errors.
[clipboard get -type FILE_STRING] should return the path of a file
from the clipboard, but instead of that I get an error
message saying "CLIPBOARD selection doesn't exist or form
'FILE_STRING' not defined.". Someone in #tcl said that this
could be a bug.(?)
From: Kevin Walzer on
On 2/3/10 7:10 AM, Alexander Nestorov wrote:
>
> However, I have tried everything from the TK docs, and I can't get
> anything more than errors.
> [clipboard get -type FILE_STRING] should return the path of a file
> from the clipboard, but instead of that I get an error
> message saying "CLIPBOARD selection doesn't exist or form
> 'FILE_STRING' not defined.". Someone in #tcl said that this
> could be a bug.(?)


Looking at tkMacOSXClipboard.c, I see this comment:

"Retrieve the specified selection from another process. For now, only
fetching XA_STRING from CLIPBOARD is supported. Eventually other types
should be allowed."

It appears that only -type STRING is supported on OS X. Copying a file
to the clipboard and then running [clipboard get -type STRING], I get
the name of the file (not its full path).

Is FILE_STRING only supported under X11? Does your code work on Windows?

Also, looking at the clipboard man page, I see that you can define a
custom type: perhaps you could implement FILE_STRING yourself for OS X.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
From: Gerald W. Lester on
Kevin Walzer wrote:
> On 2/3/10 7:10 AM, Alexander Nestorov wrote:
>>
>> However, I have tried everything from the TK docs, and I can't get
>> anything more than errors.
>> [clipboard get -type FILE_STRING] should return the path of a file
>> from the clipboard, but instead of that I get an error
>> message saying "CLIPBOARD selection doesn't exist or form
>> 'FILE_STRING' not defined.". Someone in #tcl said that this
>> could be a bug.(?)
> ...
> Also, looking at the clipboard man page, I see that you can define a
> custom type: perhaps you could implement FILE_STRING yourself for OS X.

And if you do, please submit it as a patch to the Core!


--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+