
set NL to ASCII character 10
tell application \"System Events\"
set thisApp to name of first process whose frontmost is true
tell process thisApp
set appName to (name of menu 2) of menu bar 1
end tell
end tell
tell application \"Script Editor\"
launch
make new document
set paragraph 1 of contents of document 1 to \"tell application \\"\" & appName & \"\\"\" & NL & \"--do some stuff\" & NL & \"end tell\"
try
compile document 1
end try
activate
set selection to (characters 2 thru 16 of paragraph 2) of document 1
end tell
It looks like you're new here. If you want to get involved, click one of these buttons!