Reputation: 3
I have created a template for send out emails to clients of the new user I have created.
The current code have it to remove the space and add a period. For Example: John Smith will be turned into [email protected]
StringReplace, UserID, UserID, %A_SPACE%, . , All
I would like to create a script to remove the space and letters up to the first letter creating [email protected]
Here is the current script I have:
InputBox, ClientE, Client Name, Please type the name of Company
if ClientE = test
{
EmailE = test.com
}
if (A_hour >= 12) {
InputBox, UserID, User's Name, Please type the user's name
InputBox, PASSWE, Password, Please type the password
sleep, 700
Send, Good Afternoon ,{Enter 2}This e-mail is to inform you that the requested new user account for{space}
Send, ^b
Send, %UserID%
Send, ^b
Send, {space}has been created as follows;{ENTER 2}
StringReplace, UserID, UserID, %A_SPACE%, . , All
Send, Desktop user name = %UserID% {ENTER}E-mail address = %UserID%@%EmailE%{SPACE} {ENTER}Password = {SPACE}{ENTER 2}Please let me know if you need anything further.{ENTER 2}Best regards,{ENTER 2}Garrett Haggard
}
else
{
InputBox, UserID, User's Name, Please type which user
sleep, 700
Send, Good Morning ,{Enter 2}This e-mail is to inform you that the requested new user account for{space}
Send, ^b
Send, %UserID%
Send, ^b
Send, {space}has been created as follows;{ENTER 2}
StringReplace, UserID, UserID, %A_SPACE%, . , All
Send, Desktop user name =
Send, ^b
Send, %UserID%
Send, ^b
Send, {ENTER}E-mail address = %UserID%@%EmailE%{SPACE} {ENTER}Password =
Send, ^b
Send, %PASSWE%
Send, ^b
Send, {SPACE}{ENTER 2}Please let me know if you need anything further.{ENTER 2}Best regards,{ENTER 2}
}
return
Upvotes: 0
Views: 143
Reputation: 3
Here is the code with the updated/additional scrit
{
if (A_hour >=12)
{
RTYH = Good Afternoon
}
Else
{
RTYH = Good Morning
}
InputBox, ClientE, Client Name, Please type the name of Company
InputBox, UserID, User's Name, Please type the user's name
;InputBox, PASSWE, Password, Please type the password
sleep, 700
Send, %RTYH% ,{Enter 2}This e-mail is to inform you that the requested new user account for{space}
Send, ^b
Send, %UserID%
Send, ^b
Send, {space}has been created as follows;{ENTER 2}
if ClientE = test
{
UserID := UserID
stringSplit, user_first_last, UserID, %A_Space%
StringLeft, first_initial, user_first_last1, 1
UserID4 := first_initial . user_first_last2
UserID5 := first_initial . user_first_last2 . "@test.com"
}
if ClientE = testing
{
UserID := UserID
stringSplit, user_first_last, UserID, %A_Space%
StringReplace, UserID4, UserID, %A_SPACE%, . , All
UserID4 := UserID4
UserID5 := UserID4 . "@testing.com"
}
Send, Desktop user name =
Send, ^b
Send, %UserID4%
Send, ^b
Send, {ENTER}E-mail address = %UserID5%{SPACE} {ENTER}Password ={SPACE}{ENTER 2}Please let me know if you need anything further.{ENTER 2}Best regards,{ENTER 2}
}
return
Upvotes: 0
Reputation: 712
UserID := "John Smith"
stringSplit, user_first_last, UserID, %A_Space%
StringLeft, first_initial, user_first_last1, 1
email := first_initial . user_first_last2 . "@test.com"
msgbox, %email%
return
Upvotes: 1