|
|
10.4: Tiger version
mbdayton posted that this no longer works in Tiger. I have the following working in 10.4.
I have this script: ~/bin/fus
It is basically the same code as before but it can take a userid (501 for example) or username (unix short name in Mac parlance) as an argument. It also first checks to see if you are changing to the current user.
Then I create a symlink to ~/bin/fus in ~/Library/Scripts:
Now I can select "Login Window" from the AppleScript menu to switch to a different user.
To be able to switch to some particular user without going through the Login Window first, I make this script too: ~/Library/Scripts/.fus
It starts with a dot (.) so that it does not show-up in the AppleScript menu. If you make links to .fus it will call fus with whatever name you gave to the link. (Remember that you need to make both fus and .fus executable.)
Now for every user that I want to be able to switch to directly from the AppleScript menu I do the following in the Terminal:
Where "foo" is the username of the user. It is very important that you make a hardlink instead of a symlink because for whatever reason when you run the script from the AppleScript menu the symlink is resolved to the .foo file and then the .foo script has no way of knowing which user to switch to.
Then from the AppleScript menu I can choose "foo" and up pops the panel asking for the user password.
Zombie processes
I have been using this for a quile and I just noticed that in Tiger at least this approach leaves many zombie process around beacause SystemUIServer never reaps the exit status of the .fus and fus shell scripts.
That is a bug. Here is a work around. If the scripts in the ~/Library/Scripts folder are AppleScripts instead of Bourne shell scripts, then there is no exit status to reap, and hence no zombie processes remain.
First remove these files (remember that Login Window is a link to fus so it is important to delete these first):
Now for every user that you created a link to .fus for, do a command like this but replace "foo" with the approppriate username:
Create this AppleScript ~/Library/Scripts/.fus.scpt:
Again the name begins with a dot (.) so that it does not appear in the AppleScript menu. This AppleScript calls fus with its own name (minus the .scpt extension) in a similar vein as .fus originally worked.
Now we need to create the "Login Window" script in the AppleScript menu. It too cannot be a link to a Bourne shell script anymore because there will be zombie processes remaining. But since the name trick is not being played with it, this AppleScript is very straigh forward. Here is my '~/Library/Scripts/Login Window.scpt':
Remember to make links to .fus.scpt for each user you want to switch to directly like so:
Now you would have an entry in the AppleScript menu for the user "foo". The ".scpt" extension will not show-up in the AppleScript menu so you might as well use it. If you do not want to use the extension that is fine too, the .fus.scpt will deal with that as well. Just do not use any other extension because then it will not work.
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|