Jump to content
Sign in to follow this  
datatek

Name converting

Recommended Posts

datatek

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?

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
datatek

How can I get it that the user types in the name that is then converted? And the resultant username should be a variable that can then be "send()"ed to the OS.

Edited by datatek

Share this post


Link to post
Share on other sites
dbzfanatic

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

Share this post


Link to post
Share on other sites
datatek

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?

Share this post


Link to post
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
Sign in to follow this  

×