This AppleScript Stopped Working (past 3 months)

Hi folks.

I was on vacation for 2.5 months (hehe) and this script no longer works for some reason. It works from the AppleScript Editor, but not from Mail.app. Any insight appreciated how to fix it.

Cheers

tell application "Safari" to set myLoc to the URL of document 1
set the clipboard to myLoc
tell application "Mail" to activate
tell application "System Events" to tell process "Mail" -- GUI Scripting
	keystroke "v" using command down -- ⌘V to paste the URL
	keystroke return
	keystroke return
	-- keystroke return
end tell

What is it supposed to do?

Grab the current url in Safari and paste it into the current location in the frontmost outgoing email.

You can try something like this:


tell application "Safari" to set myLoc to the URL of document 1
tell application "Mail"
	activate
	set mymail to make new outgoing message at the beginning of outgoing messages with properties {content:myLoc & return & return}
	set visible of mymail to true
	activate
end tell

OK, that creates a new message. That’s not what I want to do. I want this:

“current viewable URL right here where my cursor is in this current outgoing email, plus two carriage returns”

Cheers

How are you running it from the Mail app? I ran it from the scripts menu and it works fine. Is Enable access for assistive devices still checked?

Ah, good question. Launchbar. Launchbar can run scripts while my focus is in any application.

FYI, this original script used to work.

Tried some other stuff, and it’s still not working. Using a dialog display, the clipboard gets the value. I ask Mail to become active, but it won’t paste.