Dynamically adding a separator menu item

I’m having trouble adding a menu separator item to a popup menu on the fly. This doesn’t work:

make new menu item at the end of menu items of menu of thePopUpMenu with properties {separator item:true}

What is the proper way to do this?

Hi,

I’ve been trying all morning to set this property and haven’t suceeded. I think you can only make a separator by dragging from the cocoa menu in Interface Builder. Dynamically just make a new menu item:

tell menu of popup button 1 of theObject
make new menu item at end of menu items with properties {title:“”, enabled:false}
end tell

I would like to see how you can use the ‘separator item’ property to accomplish this also.

Edit: editted the statements.

gl,

This should be in the AppleScript Studio forum.

Making a menu item without a title isn’t the best idea since it will still be highlighted as the user goes over it. I haven’t had good luck creating new separator items using AppleScript alone (you can use a call method to create a new separator item pretty easily, though). I find when I’m doing this over and over that the easiest thing to do is to create a popup button someplace off screen in my window with a single separator item and then when I launch the app, I assign that menu item to a property. Now, whenever I need a separator, I just duplicate that property to the end of the menu of any popup button in question:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]