Note that the entire middle chunk of code is only used when gender is neutral. Maybe that is effecting the lower regexReplace??
Code: Select all
#SingleInstance
MyEntry =
(
Pat uses [e]/[m] when describing [m]self. [e] likes the freedom to express [s] rights. The choice is [r].{Enter}Then [e] waltzes across the room.{Enter}[e] passes all expectations.{Enter}[e] usually washes [s] hands after using the restroom.{Enter}[e] watches the teacher.{Enter}[e] sits up front and watches the teacher.{Enter}[e] reads well.{Enter}[e] fixes the mistakes on [s] papers.{Enter}[s] goes to the resource room.{Enter}[e] studies hard.{Enter}[e] plays in the band.
)
;Gender := "male"
;Gender := "female"
Gender := "neutral"
IfEqual, Gender, male
{
varHeShe = he
varHimHer = him
varHisHer = his
varHisHers = his
}
IfEqual, Gender, female
{
varHeShe = she
varHimHer = her
varHisHer = her
varHisHers = hers
}
IfEqual, Gender, neutral
{
varHeShe = they
varHimHer = them
varHisHer = their
varHisHers = theirs
}
MyEntry := StrReplace(MyEntry,"[n]",StudentName) ; Makes the replacements.
MyEntry := StrReplace(MyEntry,"[e]",varHeShe) ; Gender pronouns.
MyEntry := StrReplace(MyEntry,"[m]",varHimHer)
MyEntry := StrReplace(MyEntry,"[s]",varHisHer)
MyEntry := StrReplace(MyEntry,"[r]",varHisHers)
IfEqual, Gender, neutral ; This part gets skipped if gender = male or female.
{
MyEntry := StrReplace(MyEntry,"they is","they are") ; Fix gramar if gender neutral.
MyEntry := StrReplace(MyEntry,"they has","they have")
MyEntry := StrReplace(MyEntry,"they was","they were")
MyEntry := RegExReplace(MyEntry, "U)([Tt]hey\s)(.*?)ies\b", "$1$2y")
MyEntry := RegExReplace(MyEntry, "U)([Tt]hey\s)(.*?)([s|z|sh|ch|x|o])es\b", "$1$2$3")
MyEntry := RegExReplace(MyEntry, "U)([Tt]hey\s)(.*?)s\b", "$1$2")
}
MyEntry := RegExReplace(MyEntry, "^\w|(?:\.|:)[\s|\R|\Q{Enter}\E]+\K\w", "$U0") ; Makes sure most sentences are capitalized.
MyEntry := StrReplace(MyEntry,"{Enter}","`n") ; This line was added for the forum post.
MsgBox, TEXT SENT:`n`n%MyEntry%
ExitApp
EDIT: I just noticed that this U)([Tt]hey\s)(.*?)([s|z|sh|ch|x|o])es\b is not catching all the things it's supposed to either.TEXT SENT:
Pat uses they/them when describing themself. tHey likes the freedom to express their rights. The choice is theirs.
Then they waltzes across the room.
tHey passes all expectations.
tHey usually washes their hands after using the restroom.
tHey watches the teacher.
tHey sits up front and watches the teacher.
tHey reads well.
tHey fixes the mistakes on their papers.
tHeir go to the resource room.
tHey study hard.
tHey play in the band.