I am following this link for custom menu https://acrobatusers.com/tutorials/add_custom_menu_items/
That is exactly what Thom Parker's tutorial just explained. Did you even try the example in that link?
Look in "Executing privileged methods through the menu" on page 47.
What does you use in the action?