Are there any advantages of one method over the other?
Or is there a better way?
### WHICH IS BEST? ###
set currentApp to path to frontmost application as text
# OR
tell application "System Events"
set currentApp to name of first application process whose frontmost is true
end tell
--- For use with Dialogs like this ---
tell application currentApp
display dialog "some message"
end tell
If you can do something without involving a target app, you’re potentially avoiding an authorization dialog for an applet (depending on the rest of the script, of course). That would be the clincher for me.