Hello,
I’m wondering if there’s a way to disable or hide the menubar or the applemenu from an applescript application
using xcode?
It looks like this can be done with the SystemUImode but I have no idea how to add this to an applescript application.
Is this even possible?
Do you mean the whole menu bar? I don’t know about that, but you can double click MainMenu (under “Instances”) if it isn’t already open, then select and delete what you don’t want - except the applemenu.
The whole menu bar would be nice, but I would be happy just disabling the apple menu.
The idea is to lock the user into the application, and then release them back to the finder once the application
is finished.
I don’t want the user to be able to click on something else and background the app so they can start running
other things.
Using my suggestion, you can get rid of all but the applemenu and menu extras, which at least limits options. What about the Dock, Finder, hotkeys etc? Will those be a problem too? I know there is a way to change the screen so only the current application is visible, as in AlphaBaby and other applications for children, but that is beyond me.
Why would running your app in the background be a bad thing?
The application is made to run when the user logs into a local account. (startup item)
The application provides a login box so they can type their username and password,
which thus mounts some network shares.
However, under certain circumstance, some users will fail the login and won’t continue onto the desktop.
Therefore, there’s needs to be away for the user “not” to be able to bypass the application and get to the desktop anyway.
In the past, we’ve moved the Finder.app and Dock.app into the Applications folder, and then called those apps during the login process. (if login successful, activate Finder.app, activate dock.app)
However, during the login process, the user can still click on the menu bar or apple menu and fire up “system preferences” or “recent items” and do all kinds of things.
It would be nice to block them from clicking on these things.
Did you bother reading my reply in the thread you posted to the Mac OS X Hints forums?
Do not disable the Apple Menu if it is visible to the user. If you wish to disable it, hide the entire menu bar.
To do this properly you will need to use SetSystemUIMode() with the appropriate arguments passed to it. You should also look into CGCaptureAllDisplays() and its companion, CGReleaseAllDisplays(). You’ll need to write a Cocoa method that implements the various calls you need, and then use that with “call method” inside your AppleScript.
Would it be possible to start your script with the screen lock mentioned in the thread I linked? What about a script with a delay during which your script could run externally in the backround and after which the desktop becomes accessible? (Just a couple of stabs in the dark.)
It is usually good to look for alternatives, but I should probably defer to the more knowledgeable Mikey-San, who says you can’t get there from here.
No worries. Search the archives here for some example of how to integrate Cocoa methods into AppleScript.
However, you will probably find this a difficult task, if you don’t know C or Cocoa and are new to Xcode in general. I definitely recommend giving it a shot and learning it, but you may find that in the interim, a less elegant solution (like a suggestion mentioned above) may be something on which to fall back.
. . . But it sounds like this is overkill. Why do you need to make the user wait for network shares to mount? There may be a better solution here than taking over the entire screen.