Jump to content

mac format convertor


pcjunki
 Share

Recommended Posts

I'm trying to make a simple gui that helps me convert mac address formats

on windows the mac address is displayed as 00-00-00-00-00-00

cisco switches show the mac address displayed as 00:00:00:00:00:00

so here is my thought process on how I would like this to happen

I'm already in the command prompt doing a "arp /a" to show mac address

I highlight the mac address and copy it to the clipboard

now from the gui I'm creating, I would like to press the button "clipget" and have it paste that data into $input1

I then press "convert" which will change the value from 00-00-00-00-00-00 to 00:00:00:00:00:00 into $input2

then pressing clipput will put $input2 into the windows clipboard

hope this makes sense

here is the code I've started, but I'm clueless on how to manipulate data

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("mac convertor", 555, 210, 267, 362)
$Input1 = GUICtrlCreateInput("00-00-00-00-00-00", 8, 64, 193, 21)
$Button1 = GUICtrlCreateButton("clipget", 8, 96, 81, 49)
$Input2 = GUICtrlCreateInput("00:00:00:00:00:00", 316, 66, 193, 21)
$Button2 = GUICtrlCreateButton("convert", 199, 96, 81, 49)
$Button3 = GUICtrlCreateButton("clipput", 316, 96, 81, 49)
$Label1 = GUICtrlCreateLabel("orginal mac address", 32, 32, 98, 17)
$Label2 = GUICtrlCreateLabel("converted mac address", 312, 32, 115, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $button1
               ClipGet()




         Case $button3
               ClipPut()




    EndSwitch
WEnd
Link to comment
Share on other sites

I figured out how to create a variable and put that data into $input1

I think I'm getting a little closer, but could be going about this the wrong way

here is my changes....

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

$clipget1 = ClipGet()


$Form1 = GUICreate("mac convertor", 555, 210, 267, 362)
$Input1 = GUICtrlCreateInput ($clipget1, 8, 64, 193, 21)
$Button1 = GUICtrlCreateButton("clipget", 8, 96, 81, 49)
$Input2 = GUICtrlCreateInput("00:00:00:00:00:00", 316, 66, 193, 21)
$Button2 = GUICtrlCreateButton("convert", 199, 96, 81, 49)
$Button3 = GUICtrlCreateButton("clipput", 316, 96, 81, 49)
$Label1 = GUICtrlCreateLabel("orginal mac address", 32, 32, 98, 17)
$Label2 = GUICtrlCreateLabel("converted mac address", 312, 32, 115, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $button1
               ClipGet()




         Case $button3
               ClipPut()




    EndSwitch
WEnd
Link to comment
Share on other sites

yay, I figured it out, thanks to reading the help files

I got it to do exactly what I need

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

$clipget1 = ClipGet()
$final = StringReplace ($clipget1, "-" , ":" )




$Form1 = GUICreate("mac convertor", 555, 210, 267, 362)
$Input1 = GUICtrlCreateInput ($clipget1, 8, 64, 193, 21)
$Input2 = GUICtrlCreateInput($final, 316, 66, 193, 21)
$Button3 = GUICtrlCreateButton("clipput", 316, 96, 81, 49)
$Label1 = GUICtrlCreateLabel("orginal mac address", 32, 32, 98, 17)
$Label2 = GUICtrlCreateLabel("converted mac address", 312, 32, 115, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

;~

         Case $button3
               ClipPut($final)




    EndSwitch
WEnd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...