Announcement

Collapse
No announcement yet.

IF statement for mac address ideas

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IF statement for mac address ideas

    What I am wondering is ...
    How would I write an IF statement around a corrupt MAC address? ex. on occasion the network card can show ok in device manager but the mac address is either all "FF-FF-FF-FF-FF-FF" or Ive seen "AA-AA-AA-AA-AA-AA" I need to detect that the mac has all the same characters but I cant see myself writing a different IF statement for every possible A-Z combination is there a way to find from a string that all characters are the same? maybe to cut up the string since it should only come back as one set/word if (character) ch1 = ch2 and ch1 = ch3 and ch1 = ch4 etc...point me in the right direction here,,,,,

  • #2
    Re: IF statement for mac address ideas

    Some ideas:

    - if you need to strip out the hyphens first, use a String.Replace action to replace "-" with "".

    - you could use a loop to get one character at a time and compare that it's the same

    - you could get the first character, and then replace every occurence of it in the string with "", and see if your string is empty...or replace every occurrence with something else like "-" and see if it's all hyphens after.

    - you could chop the string in half with a String.Left and a String.Right action, and then compare the two halves in the IF statement (%left_half% = %right_half% sort of thing).

    That last method is how I'd do it. I wouldn't bother removing the hyphens; just get the left-most 8 characters, and the right-most 8 characters, and compare them.
    --[[ Indigo Rose Software Developer ]]

    Comment


    • #3
      Re: IF statement for mac address ideas

      That "right-left" string trick seems to work 100%, I reversed the parameters to test with an IF "right != left" seeing I dont have a corrupt card to play with here, but at least I know where to start/go with this now. Thanks for the help

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎