Jump to content

Recommended Posts

Posted

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?

Posted

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"))
Posted (edited)

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
Posted

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
Posted

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?

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
  • Recently Browsing   0 members

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