Greetings, all!
The part of my script that is hanging is designed to simply open a page in Safari and copy the contents to the clipboard. The copy functionality was working just fine when that was all there was, but now that I’ve added a loop to open any object dragged onto the script before copying them, it has started hanging inside the convertFrontSafariWindow function on the GUI elements, until I bring any other application to the foreground, at which point it complains that Safari isn’t in front anymore. Any ideas why this might have stopped working?
on open of finderObjects -- "open" handler triggered by drag'n'drop launches
repeat with i in (finderObjects) -- in case multiple objects dropped on applet
tell application "Safari"
activate
make new document at beginning of documents
open i as alias
end tell
convertFrontSafariWindow( )
end repeat --each finderobject dropped
end open
on convertFrontSafariWindow( )
--copy all text of Safari front window to clipboard
tell application "Safari"
activate
set windowTitle to name of window 1
end tell
tell application "System Events"
tell process "Safari"
click menu item "Select All" of menu "Edit" of menu bar 1
click menu item "Copy" of menu "Edit" of menu bar 1
end tell
end tell
tell application "Safari"
close window 1
end tell
(* do other stuff *)
end convertFrontSafariWindow
Thanks for your help! I’m still using Jaguar, if that matters (I don’t think it should…).