Jump to content

Use Text To Get initials and last 4 of id


Recommended Posts

I'm not sure exactly what to call it but, I work at a place that deals with a persons initials and an social security number and am looking to make something that will take a 9 digit social security number and a persons full name and out put the first,middle, and last initials then the last for of thier social security number.

Example:

1) 123-45-6789 Bo John Hoe (john hoe bo)

creates

jhb6789

the reason behind this is I work at a college and have to input this information in a computer daily, and the names come to me in last first middle name form along with the full social and am looking to make a file that takes the info *minus* the "(john hoe bo)" and output the initials and last for of the social. Its not hard to do it manually but when you have to do it with 100 different names a day it'd help to not have to do it each time.

again if this is out there or a form is, then point me to it please Im not sure exactly what to call this and would like to hear the pros and cons involved in ME making this....unless its already made

Link to comment
Share on other sites

...the names come to me in last first middle name...

The social is easy, names are another beast.

How does this info "come to you"?

Via paper or software*?

1) 123-45-6789 Bo John Hoe

2) 321-54-9876 Van Der Lee-Jones Jo Anne

-MSP-

edit: *Is the last name already split out in a software field?

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I'm not sure exactly what to call it but, I work at a place that deals with a persons initials and an social security number and am looking to make something that will take a 9 digit social security number and a persons full name and out put the first,middle, and last initials then the last for of thier social security number.

Example:

1) 123-45-6789 Bo John Hoe (john hoe bo)

creates

jhb6789

the reason behind this is I work at a college and have to input this information in a computer daily, and the names come to me in last first middle name form along with the full social and am looking to make a file that takes the info *minus* the "(john hoe bo)" and output the initials and last for of the social. Its not hard to do it manually but when you have to do it with 100 different names a day it'd help to not have to do it each time.

again if this is out there or a form is, then point me to it please Im not sure exactly what to call this and would like to hear the pros and cons involved in ME making this....unless its already made

$Txt = StringSplit("123-45-679 Bo John Hoe", Chr(32))

$Num = StringRight($Txt[1], 4)
$First_Init = StringLeft($Txt[3], 1)
$Scnd_Init = StringLeft($Txt[4], 1
$Thrd_Init = StringLeft($Txt[2], 1))

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

it comes from a program but then I can transfer it to a notpad or word document

ps just to clearify myself a little more

1) 123-45-6789 lastname Firstname Middlename is how it comes to me

i need it:

FML6789

(letters are Firstname Middlename Lastname initials)

Link to comment
Share on other sites

it comes from a program but then I can transfer it to a notpad or word document

ps just to clearify myself a little more

1) 123-45-6789 lastname Firstname Middlename is how it comes to me

i need it:

FML6789

(letters are Firstname Middlename Lastname initials)

Well you see - that makes it much easier - no need to use notepad, just let AutoIt "read" the fields of interest for you. That way, AutoIt will already know that "Van Der Lee-Jones" is one single last name.

Next it would help to know if the software uses "Controls" that AutoIt's ControlGetText can see. You can use the "AutoIt Window Info" tool to check that out.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Dang that's alot of string play .. I just had a go at doing it with 1 entry in an input box.. it worked but geez I need to learn more about working with strings..lol

$input = InputBox("Number & Name", "", "", "", -1, -1, -1, -1)
Dim $initials[1]
$sp = StringSplit($input, ' ')
$sr = StringRight($sp[1], 4)
For $i = 2 To $sp[0]
    $sl = StringLeft($sp[$i], 1)
    $initials[0] = $initials[0] & $sl
Next
$stl = StringTrimLeft($initials[0], 1) 
$sl1 = StringLeft($initials[0], 1)
MsgBox(0,'', $stl & $sl1 & $sr)

Link to comment
Share on other sites

wow, that looks like it will work but im UBER NOOB at this stuff and dont know how to start this or how to input different names ( I usually get about 100 a day)

That is why we (and the help file) are here.

AutoIt should be able to get the info from the one software application and send it to the other application (or display it). Whichever you need.

The most reliable way to get the names/number from the first app is via AutoIt's Control functions. If those don't happen to work for you, there are other ways.

Anyone know of a good tutorial on the use of Control functions?

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Dang that's alot of string play .. I just had a go at doing it with 1 entry in an input box.. it worked but geez I need to learn more about working with strings..lol

$input = InputBox("Number & Name", "", "", "", -1, -1, -1, -1)
Dim $initials[1]
$sp = StringSplit($input, ' ')
$sr = StringRight($sp[1], 4)
For $i = 2 To $sp[0]
    $sl = StringLeft($sp[$i], 1)
    $initials[0] = $initials[0] & $sl
Next
$stl = StringTrimLeft($initials[0], 1) 
$sl1 = StringLeft($initials[0], 1)
MsgBox(0,'', $stl & $sl1 & $sr)
test it against 321-54-9876 Van Der Lee-Jones Jo Anne

"Van Der Lee-Jones" is the last name

:-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

No offence taken :)

lol, Wow I wasn't trying anything that advanced such as detecting 'Van Der Lee-Jones' as being a last name.

I didn't even take into acount that names can contain more then just spaces for that matter.

As you said earlier names can be a beast to string manipulate to the correct format.

I was happy enough with just getting a simple name to output correctly with crude string management on my behalf :D

Link to comment
Share on other sites

1) 123-45-6789 Bo John Hoe

2) 321-54-9876 Van Der Lee-Jones Jo Anne

Go for it GEO :-)

Not tonight I won't. :)

I was looking at the example and not at the possibilities and I was thinking just a text input. I sent you the solution for that but if it's all in an Access database then it's easy using my ADO.au3 UDF or in the case that it's in a SQL then the SQL UDF

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

...ADO.au3 UDF or in the case that it's in a SQL then the SQL UDF

I was thinking something simple like:
Run("control.exe timedate.cpl")
WinWait("Date and Time Properties")
Sleep(999)

$h = ControlGetText("Date and Time Properties", "Current", "Edit3")
$m = ControlGetText("Date and Time Properties", "Current", "Edit4")
$s = ControlGetText("Date and Time Properties", "Current", "Edit5")

MsgBox(0, "", $h & ":" & $m & ":" & $s)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Just as a general SysAdmin tip: US Employees/Students whose social security number or "last 4" get compromised by company/school polices can and do sue the organization involved when they become the targets of identity theft. It is a federal offense under the Privacy Act for any government agency, and a civil liability for anyone else to not keep the SSN strictly confidential. Using any part of the SSN in username/logon is bad policy no matter how small your organization.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

Just as a general SysAdmin tip: US Employees/Students whose social security number or "last 4" get compromised by company/school polices can and do sue the organization involved when they become the targets of identity theft. It is a federal offense under the Privacy Act for any government agency, and a civil liability for anyone else to not keep the SSN strictly confidential. Using any part of the SSN in username/logon is bad policy no matter how small your organization.

:)

The last 4 of the social is no big deal.

An example: If you've ever filed for bankruptcy, the last four of your social is public information (along with your address) at the courthouse.

To the OP, I am not sure what the issue is here that you may still be having... the returning of the information you want is actually quite easy and can be done a multitude of ways.

$sInfo = "321-54-9876 Van Der Lee-Jones Jo Anne"
$sFileName = _SocialGetFileName($sInfo)
MsgBox(0, 'Info', $sFileName)

Func _SocialGetFileName($sString)
    Local $aArray, $sSocial, $aSplit, $sFileName
    $aArray = StringRegExp($sString, '-(\d{4})', 1)
    If IsArray($aArray) = 0 Then Return SetError(1, 0, '')
    $sSocial = $aArray[0]
    $sString = StringTrimLeft($sString, StringInStr($sString, $sSocial) + 4)
    $aSplit = StringSplit($sString, ' ')
    $sFileName = StringLeft($aSplit[UBound($aSplit) - 2], 1) & _
        StringLeft($aSplit[UBound($aSplit) - 1], 1) & _
        StringLeft($aSplit[1], 1) & $sSocial
    Return StringLower($sFileName)
EndFuncoÝ÷ ØGb·b'q«¶«z+'¢hvW¢+bjPèx&¢»`j¬"»§{h¶¬jYmëbëaËzk-¡·­ë}ë-®­z+ZÊ0¢}ýµ©e£î²ÝjºezÛ^®«¨µø¥zÈ­Â)e­ën®v§zºè­©Ýi¹ZK-®)àjëh×6#include <array.au3>
$sInfo = "321-54-9876 Van Jo"
$sFileName = _SocialGetFileName($sInfo)
MsgBox(0, 'Info', $sFileName)

Func _SocialGetFileName($sString)
    Local $aSocial = StringRegExp($sString, '-(\d{4})', 1)
    If IsArray($aSocial) = 0 Then Return SetError(1, 0, '')
    $sString = StringTrimLeft($sString, StringInStr($sString, $aSocial[0]) + 3)
    Local $aName = StringRegExp($sString, ' ([a-zA-Z])', 3), $nUBound = UBound($aName)
    If IsArray($aName) = 0 Or $nUBound < 2 Then Return SetError(2, 0, '')
    If $nUBound < 3 Then Return StringLower(StringLeft($aName[$nUBound - 1], 1) & StringLeft($aName[0], 1) & $aSocial[0]);If no middle initial
    Return StringLower(StringLeft($aName[$nUBound - 2], 1) & StringLeft($aName[$nUBound - 1], 1) & _
        StringLeft($aName[0], 1) & $aSocial[0])
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

:) SmOke's back! :D

Where you been hiding, and who've you been hiding from...?

:D

I've been here every day :D ... Mainly just watching the AutoIt USP group :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I've been here every day :D ... Mainly just watching the AutoIt USP group :D

I get it. Think the black helicopters can't find you there. But we know where you are now... :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks guys for all the time you've spent working with this. The information that I need does origianally come from a database, BUT I have absolutley no access to that database I'm simply given a list of socials and full names in paper or word document form and am told to input them into another database which I have some access to. I'm not sure exactly what it is I know its sent back into access but the .exe we use isnt access. Im not sure how the 2 are connected but I need this to take text no fields or cells and rearrange them in the needed order.

thanks again for the effort put into this

Chad

Link to comment
Share on other sites

Ok I just stumbled on a way to convert the information I get into an excel document with the data divided into cells where a space is. Which I think will make it easier because Ill be able to call a specific cell and get its specific data.

another question is there a way to take the "-" symbol like that in a social security number and create it into a space? Because this would allow me to have the numbers like this

123 45 6789 which could then be used in excel to divide the 3 groups into different columns. Then I could use AI to search a specific cell and write its content out.

So I need 2 things:

Directions on how to use AI to print out a cells data

and

how to replace the - with a *space* quickly

I'll keep looking but if anyone has any ideas I'd really appreciate the help

I'm off to bed so Ill continue this tomorrow

Edited by RAMMRODD
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...