I did not get this working,
So I tried this Menulet introduction.
Which I think is the same type of thing this thread is about, (noob talking)
Please let me know if I should start this as a new thread.
I got most of it working, but I am stuck with the drop down menu from the icon.
I can not tell if my Ipmenulet is connected to the NSMenu1 which I suspect is the problem.
It say’s
I build and Go - no errors.
But the menu does not drop down from the icon??
Also I changed the Ip url to “http://www.whatismyip.org” as the one provided did not work that well.
I could not build withou errors with (dealloc:) in, so I took it out.
As you can see the icon menu is outside the function (that may sound like I know what I am talking about, don’t be fooled. :), when I put it inside I got the correct info in the inspector.
It is annoying that it compiles with no errors when there are, but I guess thats the nature of the beast.
I also notice that the intro url doe not really help in the structure of how the script should be laid out.
Hi Stadsman,
Do you know any good links to show me how I attach an applescript script to the menu.
Also my applescript opens up in Script Editor? I can not find a pref to keep it in xcode??
Do you want an AppleScript connected to the Menulet menu? Or to do that within a Xcode project. The first I don’t know, the second one is set in Xcode using ‘on choose menu item’.
To make an AppleScript with Xcode you have to select >New Project>AppleScript Application. Xcode can’t work with just the AppleScript. Once you are in Xcode, you can double click the Applescript file within Xcode which then opens its own AS editor.
S.
Edit: Check out the Task List example is Xcode’s ApleScript Studio examples for setting menu items.
That example is not for adding menu items to the menulet. There is a Apple Technical Note that describes the howto, but I can’t get it working. What I did manage is to get an AppleScript using ‘on should quit theObject’. If you then use the ‘terminate:’ action the script embedded in ‘on should quit theObject’ gets called. It works but is not a proper solution.
I also found this link, but also couldn’t get it to work.
Also found this which looks promising, haven’t tried it yet…
Hi Stadsman,
I will have a look at does links, thanks
Because I wanted the app to be dock-less, I had a play in adding a ‘Quit’ menu item at the bottom.
it could not be easier.
(from the intro url I added this <key>LSUIElement</key>
<string>1</string>
in the info.plist
In the MainMenu.nib
select (in this case) the ‘External Ip’ item and while holding down the option key drag it down to create a new item
Rename it ‘Quit’
while holding down the ctrl key, drag it to the first responder class.
In the inspector, connect it to the ‘terminate’
Did you get the Timer to build?? I keep getting errors.
EDIT Forget that, got the first part of it working.
the had IPMenulet.m (awakeFromNib:) in part of the code , but it was not in bold so I thought it was part of the code to add, rather than where to add it.
Did anyone manage to come up with a way to add to this Menulet after it has been created, via AppleScript? That would be extremely useful for me right now!
Since the application is a menulet and the main menu and dock icon aren’t shown, I just connected the menu outlet to the main menu instead of NSMenu1 Then I modified the main menu to be what I needed. AppleScript works just fine with that menu.