Re: System Events "Show Clipboard" Bug?
Re: System Events "Show Clipboard" Bug?
- Subject: Re: System Events "Show Clipboard" Bug?
- From: "Jonathan Levi, M.D." <email@hidden>
- Date: Fri, 18 Jul 2003 18:49:45 -0400
Rob Jorgensen <email@hidden> wrote:
Is this better?
tell application "Finder"
activate
set the clipboard to POSIX path of ,
((folder of front window) as string) as string
display dialog "clipboard:" & return & (the clipboard) --OK
tell application "System Events" to tell process "Finder" to ,
tell menu bar 1 to click menu item "Show Clipboard" of ,
menu "Edit" --"Clipboard contents: unknown"
end tell
Ah, that did it, thank you! See the following:
tell application "Finder"
activate
get class of POSIX path of ,
((folder of front window) as string)--Unicode text
get class of (POSIX path of ,
((folder of front window) as string) as string)--string
end tell
And John Delacour wrote:
You haven't told us what the fault is! It works
fine here, but I'd do it differently...
But I did! The clipboard didn't recognize and couldn't display its contents:
tell application "System Events" to tell process "Finder" to ,
tell menu bar 1 to click menu item "Show Clipboard" of ,
menu "Edit" --"Clipboard contents: unknown"
Your script will work if the folder has a path
that can be written as a string, but if it's got
Hebrew, for example, in the pathname, then
you'll get your "unknown" result, which is
probably because the Clipboard window is as
stupid as 'display dialog' when it comes to
Unicode -- in which case a bug ought to be filed.
Good point: the clipboard should be able to
recognize Unicode. I'll send a bug report to
Apple.
See what you get from this:
set fU to "/tmp/Clipboard"
set f to POSIX file fU
tell app "Finder" to set _file to target of window 1 as Unicode text
set the clipboard to (POSIX path of _file)
open for access f with write permission
set eof f to 0
write (the clipboard) to f as <<class utf8>> -- !! change to angle quotes
close access f
tell app "System Events" to tell process "Finder"
set frontmost to true
click last menu item of menu "Edit" of menu bar 1
end
do shell script "open -e " & fU
The last menu item of menu "Edit" is just "Show
Clipboard" of course -- which still fails. I
suppose that for now, displaying it as a /tmp
file is a good way to work around the Unicode
issue.
Jonathan
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.