Re: System Events "Show Clipboard" Bug?
Re: System Events "Show Clipboard" Bug?
- Subject: Re: System Events "Show Clipboard" Bug?
- From: John Delacour <email@hidden>
- Date: Fri, 18 Jul 2003 18:50:18 +0100
- Mac-eudora-version: 6.0a27
At 8:26 am -0400 18/7/03, Jonathan Levi MD wrote:
Would someone be so kind as to look at the following brief script
and tell me whether the fault is mine or System Events:
--script "FW Path (POSIX).scpt"
tell application "Finder"
activate
set the clipboard to POSIX path of ,
((folder of front window) 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
You haven't told us what the fault is! It works fine here, but I'd
do it differently
You ought not to convert pathnames to 'string' because they are
Unicode text and besides you can change a 'file specification'
directly to a 'posix path'. 'display dialog' will not display
Unicode, but that's beside the point.
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.
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
JD
.
_______________________________________________
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.