Hey guys,
so i just started really programming with AppleScriptObjC on Sunday and I read this awesome tutorial on here and a lot of other stuff on the internet but now i got stuck on something.
I the user to choose in the preferences of my programm if they want to run it in the background with a menu bar icon or also with a dock icon with a checkbox. So I already know you can pre-define it with lsuielement in the plist file.
What I have for now is when the user puts the checkmark not to run it in the background
But what I also want is that its changes the lsuielement in the plist file. I found some code but none of them is working
Thanks in advance
CodeWarrior
Model: MacBook Pro 3.06Ghz
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)
Hey thanks
sadly its still not workin but what I’m trying to do is in here: http://www.jonn8.com/html/MenuApp.html just in AppleScriptObjC, there is also a AppleScriptObjC of this app: http://www.jonn8.com/html/MenuApp_ASOC.html but it doesnt support the change on the go without changing the value in the plist.
What I have right now is, the app is running in background as default so in the plist LUIElement is on 1 and i want to make it run in the dock on the next start if a checkbox is checked because I know you can’t change while its running my for that is now:
do shell script "defaults write com.MenuBar.plist LSUIElement 0"
which is running as soon as I click a button (I wanted to start easy, as soon as it works I will replace it with a checkbox)
Thanks for your help again!
Here’s a handler that works for me. Note the two properties at the top. The handler toggles your App’s LSUIelement, repairs any permissions issues that may have happened in toggling it, and then kills your app and relaunches it to effect those changes.