Re: Paste Reference in OS 10.4
Re: Paste Reference in OS 10.4
- Subject: Re: Paste Reference in OS 10.4
- From: kai <email@hidden>
- Date: Sat, 5 Nov 2005 02:37:13 +0000
On 4 Nov 2005, at 19:38, email@hidden wrote:
I really miss the paste reference command from the edit menu of
Script Editor, it made scripting so much faster. Has this been
corrected in OS 10.4?
Evidently not yet (OS 10.4.3) - although it should be possible to
cobble together a fair imitation in the meantime...
Just in case anyone's not clear about what this command normally
does, it allows one to select an item in Finder, hit Copy - then
switch to Script Editor and choose 'Paste Reference'. Instead of
pasting the name of the copied item, this pastes it as a Finder
reference. Since Script Editor 1.9, the command has been dimmed
(unavailable):
http://docs.info.apple.com/article.html?artnum=107065
The suggested workaround is to manually type the path to the required
item. Alternatively, a script could attempt to emulate the original
command. I saved the following in /Users/UserName/Library/Scripts/
Applications/Script Editor/Paste Reference.scpt - so that, whenever
Script Editor is frontmost, a 'Paste Reference' command is available
from the Script Menu. (If you try running the script from a Script
Editor window, remember that it will attempt to paste to that window.)
---------------
on refToText(r)
try
tell application "Finder" to {item r}'s t
on error t
set tid to text item delimiters
set text item delimiters to "{"
set t to t's text from text item 2 to -1
set text item delimiters to " of application \"Finder\"}"
set t to t's text 1 thru text item -2
set text item delimiters to tid
t
end try
end refToText
tell application "Script Editor" to try
activate
set r to the clipboard as record
set the clipboard to my refToText(r's «class furl»)
tell application "System Events" to keystroke "v" using command down
delay 0.2
set the clipboard to r
on error
beep
end try
---------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden