You can't do this with applescript. You need to build your own window in a cocoa application and then hook into the NSTextField's methods to do this. It's not too difficult but it requires a whole different set of skills than applescript.
Autocomplete/suggest functionality in an applescript input box
-
27-11-2021 - |
Question
I am trying to build an applescript dialog that helps me keep track of the things I am working on. To make it really effective I'd like to have it look up items from my todo list and suggest them as I type a la google suggest or other javascript autocomplete functionality.
I was thinking it would be fairly simple if I just captured the input of the @ key, which I wanted to use to denote project or the # key for tasks and at that point started matching the input to my list of tasks or projects. For example, lets say I type:
"Worked on feature for @"
At this point the input of the @ would start capturing keyboard input and try to suggest one of the projects on my todo list. This is where I am stuck. It seems like I should be able to attach a listener or something to my input box but I can't seem to find any examples or reference to such functionality.
Solution