Jump to content

Name converting


datatek
 Share

Recommended Posts

I am making a script that adds active directory users in Windows Server 2003.

If a user's name is John Smith, the username would be j.smith

If a user's name is Jane Doe, the username would be j.doe

and so on.

How do I get Auto It to make this conversion?

Link to comment
Share on other sites

I am making a script that adds active directory users in Windows Server 2003.

If a user's name is John Smith, the username would be j.smith

If a user's name is Jane Doe, the username would be j.doe

and so on.

How do I get Auto It to make this conversion?

Func Convert($NAME)
    Local $RESULT = ""
    $SPLIT = StringSplit($NAME," ")
    If IsArray($SPLIT) Then
        $RESULT = StringLower(StringLeft($SPLIT[1],1) & "." & $SPLIT[2])
    EndIf
    Return $RESULT
EndFunc

MsgBox(0,"John Smith",Convert("John Smith"))
MsgBox(0,"Jane Doe",Convert("Jane Doe"))

When the words fail... music speaks.

Link to comment
Share on other sites

You really need to do a bit of research,people aren't going to hold your hand forever.

$name = InputBox("Name","Input Name: ","")
$converted = Convert($name)
Send($converted)

Func Convert($NAME)
    Local $RESULT = ""
    $SPLIT = StringSplit($NAME," ")
    If IsArray($SPLIT) Then
        $RESULT = StringLower(StringLeft($SPLIT[1],1) & "." & $SPLIT[2])
    EndIf
    Return $RESULT
EndFunc
Link to comment
Share on other sites

You really need to do a bit of research,people aren't going to hold your hand forever.

I don't need anyone to hold my hand, but if my own research doesn't answer my question, then I don't see a problem with posting in a SupporT forum.

$voller_name = ($vorname & " " & $nachname)
$Name_conv = StringLower(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($voller_name,"ü","ue"),"ö","oe"),"ä","ae"),"ß","ss"),"Ü","Ue"),"Ö","Oe"),"Ä","Ae"))

If StringInStr($Name_split[$Name_split[0]], '-') Then
    $var = StringSplit($Name_split[$Name_split[0]], '-')
    $Name_split[$Name_split[0]] = $var[$var[0]]
EndIf
$bname = StringLeft($Name_split[1], 1) & "." & $Name_split[$Name_split[0]]

In the above code first name and surname are split and, if there is a hypen in the name, the second part selected for $bname.

I need to have the first part before the hypen, instead of the second.

Could someone help?

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...