Somebody Please Help!

Discussion in 'MacBook Pro' started by el3an, Oct 28, 2011.

  1. el3an, Oct 28, 2011
    Last edited by a moderator: Oct 29, 2011

    el3an macrumors newbie

    Joined:
    Oct 28, 2011
    #1
    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 [​IMG] 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
     
  2. Macman45 macrumors demi-god

    Macman45

    Joined:
    Jul 29, 2011
    Location:
    Somewhere Back In The Long Ago
    #2
    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.
     
  3. el3an thread starter macrumors newbie

    Joined:
    Oct 28, 2011
    #3
    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!
     
  4. Mersailios macrumors regular

    Joined:
    Oct 23, 2011
    #4
    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
     
  5. Macman45 macrumors demi-god

    Macman45

    Joined:
    Jul 29, 2011
    Location:
    Somewhere Back In The Long Ago
    #5
    Yep

    Stops the loop.
     
  6. el3an, Oct 28, 2011
    Last edited: Oct 28, 2011

    el3an thread starter macrumors newbie

    Joined:
    Oct 28, 2011
    #6
    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]
    
     
  7. Macman45 macrumors demi-god

    Macman45

    Joined:
    Jul 29, 2011
    Location:
    Somewhere Back In The Long Ago
    #7
    Failure Is In The winswitch CMD

    We would need the rest of the code. To be honest? I'd clean up.
     
  8. el3an thread starter macrumors newbie

    Joined:
    Oct 28, 2011
  9. Macman45 macrumors demi-god

    Macman45

    Joined:
    Jul 29, 2011
    Location:
    Somewhere Back In The Long Ago
    #9
    Yes But Backup First

    And Onyx should sort most of your problems. But I wouldn't let it verify or repair disk permissions. Disk utility will do a better job of that.
     
  10. el3an thread starter macrumors newbie

    Joined:
    Oct 28, 2011
    #10
    Holding CMD and drag and dropping it out the menu extras bar fixed the issue! :D
     
  11. el3an thread starter macrumors newbie

    Joined:
    Oct 28, 2011
  12. Macman45 macrumors demi-god

    Macman45

    Joined:
    Jul 29, 2011
    Location:
    Somewhere Back In The Long Ago
    #12
    Smc

    Rocks! Glad your sorted out:D
     

Share This Page