Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

el3an

macrumors newbie
Original poster
Oct 28, 2011
6
0
Code:
#!/bin/sh
#
# Activate WinSwitch.command
# Script to activate WinSwitch in current user account
# $Id: activate-winswitch.command 43 2004-09-08 09:07:00Z wincent $

tool="/Library/Menu Extras/WinSwitch.menu/Contents/Resources/menu-extra-tool"
 
# deactivate Apple's menu extra, MenuCracker and WinSwitch
"${tool}"                                       \
  -r com.apple.menuextra.appleuser              \
  -r net.sourceforge.menucracker                \
  -r com.wincent.WinSwitch
  
/bin/sleep 3

# must kill SystemUIServer to force it to reload the new WinSwitch bundle
/usr/bin/killall -SIGHUP SystemUIServer
  
# open MenuCracker; will relaunch SystemUIServer if it did not respawn already
/usr/bin/open \
  "/Library/Menu Extras/WinSwitch.menu/Contents/Resources/MenuCracker.menu"
  
# allow time for SystemUIServer to relaunch
/bin/sleep 5
  
# activate WinSwitch, adding to right-hand end of menu bar
"${tool}"                                       \
  -a "/Library/Menu Extras/WinSwitch.menu"      \
  -p -1

# retry if error reported on first try (system under heavy load may take longer to respawn SystemUIServer)
if [ $? -ne 0 ]; then
  /bin/sleep 5
  "${tool}" -a "/Library/Menu Extras/WinSwitch.menu" -p -1
fi

# don't check the exit status (spurious errors reported due to conflict with Unsanity MEE?)
exit 0


The above code is from a .command file that my brother downloaded from here, it's an issue we've been trying to undo, the problem it caused was duplicates of each item in the top menu bar
f1mkxe.png
I'm running Lion on a late 2011 MacbookPro, please forgive me if I posted this in the wrong forum. I just need help, and I'm eager to read your reply and solutions.

-Domminic
 
Last edited by a moderator:
It Would

The retry will cause a loop. Are you good with code and SMC? If so change those two lines if not.

Download Onyx for Lion (assuming you are running Lion) from:
http://www.macupdate.com/app/mac/11582/onyx

FIRST AND FOREMOST

Backup everything to an external hdd or optical media.

Open onyx and follow the instructions for repair of permissions and execution of scripts.

When it asks you to reboot it MEANS reboot....It will take a while but with disk verification you should be ok.
 
What do you mean by retry cause a loop?
I'd rather edit the code than download anything else lol. Plus, I'm having issues with backup at the moment that's why I don't want to do any back up. If you're able to guide me through it I'd appreciate it.
Thanks for the prompt reply!
 
What happens if you remove the following lines of code from the file?

Code:
# retry if error reported on first try (system under heavy load may take longer to respawn SystemUIServer)
if [ $? -ne 0 ]; then
  /bin/sleep 5
  "${tool}" -a "/Library/Menu Extras/WinSwitch.menu" -p -1
fi
 
Stops the loop.
If I remove that line and execute the file it'll undo the duplicates?

EDIT
I removed it and executed the file, didn't do anything :(

Code:
-MacBook-Pro:~ ****$ /Users/Shared/Activate\ WinSwitch.command ; exit;
Deactivating menu extra with identifier "com.apple.menuextra.appleuser" ... Success.
Deactivating menu extra with identifier "net.sourceforge.menucracker" ... Success.
Deactivating menu extra with identifier "com.wincent.WinSwitch" ... Success.
Activating menu extra with bundle path "/Library/Menu Extras/WinSwitch.menu" after item number -1 ... Failure.
Error: fatal error while adding bundle "/Library/Menu Extras/WinSwitch.menu" aborting processing
logout

[Process completed]
 
Last edited:
Failure Is In The winswitch CMD

If I remove that line and execute the file it'll undo the duplicates?

EDIT
I removed it and executed the file, didn't do anything :(

Code:
-MacBook-Pro:~ ****$ /Users/Shared/Activate\ WinSwitch.command ; exit;
Deactivating menu extra with identifier "com.apple.menuextra.appleuser" ... Success.
Deactivating menu extra with identifier "net.sourceforge.menucracker" ... Success.
Deactivating menu extra with identifier "com.wincent.WinSwitch" ... Success.
Activating menu extra with bundle path "/Library/Menu Extras/WinSwitch.menu" after item number -1 ... Failure.
Error: fatal error while adding bundle "/Library/Menu Extras/WinSwitch.menu" aborting processing
logout

[Process completed]

We would need the rest of the code. To be honest? I'd clean up.
 
Holding CMD and drag and dropping it out the menu extras bar fixed the issue! :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.