how do you make a menu divider dynamically? i tried the following and it just used the name i gave it (im trying to get it to turn anything with a dash into a divider
if i does not contain "-" then
make new menu item at the end of menu items with properties {name:i, title:i, enabled:true}
else
make new menu item at the end of menu items with properties {separator item:true, enabled:true, title:i}
end if
Applescript code; creates a test menu in the ‘launched’ handler of the app…
on launched theObject
(* Add a menu to the main menu *)
set myMenu to make new menu at end of menus of main menu with properties {name:"myMenu", title:"myMenu"}
(* Add a menu item to the menu *)
make new menu item at end of menu items of myMenu with properties {name:"Item 1", title:"Item 1", enabled:true}
(* Add a separator Item *)
set separatorItem to call method "createSeparatorItem:" of class "JBMenu" with parameters {myMenu}
(* Add a menu item to the menu *)
make new menu item at end of menu items of myMenu with properties {name:"Item 2", title:"Item 2", enabled:true}
end launched