AppleScript help

Discussion in 'Mac Programming' started by macuser154, May 8, 2009.

  1. macuser154 macrumors 6502

    Joined:
    Jan 17, 2009
    Location:
    UK
    #1
    I am writing a simple AppleScript that will allow a user to see his/her wireless MAC address. This is what I have so far:

    This is the result:

    How can I set the script to display the result like this:

    Oh, and the Clipboard part of the script is purely to help me paste the result of the script here. It does not need to be part of the final script.

    Thankyou all in advance! :)

    I would also like to allow the user to change his/her MAC address. I know the command that has to be run in order to do this:

    But I don't know how to allow the user to simply type the new MAC address into a text box and have the above command be run with administrative privileges and with the MAC address the user has specified.
     
  2. zmttoxics macrumors 65816

    zmttoxics

    Joined:
    May 20, 2008
    #2
    Change your ifconfig line to this:
    ifconfig en1 |grep ether |cut -d' ' -f2

    Standard shell text technique. I did the ifconfig and sent the data (piped) to grep. This returned just: ether 00:14:51:63:83:02. I then sent that (again, piped) to cut delimited by a space (-d' ') and grabbed field 2 (-f2), the address.

    I would recommend you do some reading on Bash (the default shell for OS X) and shell techniques.

    Edit:
    Also, changing MAC addresses at will is NOT recommended. They are supposed to be unique from the factory preventing duplicate issues.
     
  3. macuser154 thread starter macrumors 6502

    Joined:
    Jan 17, 2009
    Location:
    UK
    #3
    Thankyou very much. I know about the dangers of MAC spoofing, I just wanted to write a script that could be used to easily change a users MAC address.
     

Share This Page