Detect Spotlight search field selected/contents

I find it hard to check whether my Spotlight text field (upper right) is selected and what the contents are.
This is the hierarchy that I found:

application “SystemUIserver”
menu extra (menu bar item -2147483648)
AXMenu:AXSpotlightSearchGroup (menu 1)
group (group 1)
search text feild (text field 1)

…but how to refer to that in Applescript…?

Hi Eelco;

Unless, for some reason, it’s very important to detect what’s in the Spotlight dropdown, you can perform the same search from an AppleScript thus:

set A to do shell script "mdfind -onlyin / 'Eelco Houwink'"

I wrote an article about that in MacScripter.net/unScripted/

Adam,

Whilst not exactly my issue, this is certainly useful for other pruposes.
Thanks!

Eelco