Issues with hooking on to AppleScript pop-up menu

I am having difficulty with a timed macro I’m trying to create and hoped someone might have the answer. I’m trying to automate some of my Omnifocus routine lists bases on time, using the templates.scpt applescript. I have everything, but one piece set up. Keyboard maestro doesn’t seem to recognize the applescript pop-up menu that templates.scpt generates for me to choose the template. I tried using menu item, but the macro gets all the way to the applescript menu part and then stops.

Any suggestions on how to hook on to this menu?

Hey There,

Do you mean an AppleScript choose-from dialog?

The way to handle that is to make sure Omnifocus is frontmost and make sure the choose-from is wrapped in a tell application “Omnifocus” block.

set myChooseFromList to {"one", "two", "three", "four", "five", "six"}

tell application "Omnifocus"
  set myChoice to choose from list myChooseFromList with title ¬
    "This is a Choose-From Dialog" with prompt ¬
    "Pick One:" default items {item 1 of myChooseFromList} ¬
    multiple selections allowed true ¬
    without empty selection allowed
end tell

-Chris

Much appreciated! I will try this out. I’m new with keyboard maestro and didn’t know if I was going to have to script that or not. Thank you so much!

I actually didn’t write the script and it’s pretty large. I tried to implement what you are saying, but I’m not sure if I need to modify the original script or create a brand new one. The current script creates a choose-from dialog that’s populated by whatever is in a folder in Omnifocus with the name “Template”. When the script is executed, depending on what you have in the notes section it triggers a series of choose-from dialogs. I still can’t figure out how to select from these.

I’m considering just writing something with JXA to do it because I know JavaScript, however I think this should be much more straightforward. I don’t want to alter the AppleScript because I didn’t write it and don’t know AppleScript so well and fear breaking it.

Send me the script and your macro, and I’ll take a look.

kmforum@thestoneforge.com

-Chris

Thanks Chris. Will do.