You will want some of these menu item applications to show their icon in the Dock until finished, while others should not appear in the Dock.
If you DO NOT want the menu item to appear in the Dock, then use this template for it's application:
-- this application located in /Application/Contents/Resources/MenuItemAppls/
-- compile with LSUIElement = true, does NOT show icon in Dock.
on run
tell application "Finder" to set hostAppl to (container of container of container of container of (path to me)) as text
ignoring application responses
launch application hostAppl
tell application hostAppl to runMenuItem("Inspect")
end ignoring -- quits immediately, does not wait for runMenuItem to respond.
end run -----------------------------
If you DO want the menu item to appear in the Dock, then use this template for it's application:
-- this application located in /Application/Contents/Resources/MenuItemAppls/
-- compile with LSUIElement = false, does show icon in Dock.
on run
tell application "Finder"
activate -- so this appls menubar will not show. (May activate another appropriate application.)
set hostAppl to (container of container of container of container of (path to me)) as text
end tell
with timeout of 100000 seconds -- a very long time. Avoids the 2 min warning.
launch application hostAppl
tell application hostAppl to runMenuItem("Burn")
end timeout -- quits only after 'Burn.scpt' has finished.
end run -----------------------------