If if two strings are equal (words/sentences not numbers) - Can't figure out how to trigger then
Posted: 12 Jul 2019, 12:27
Hi all,
I can't figure out why "if (userinput=word)" is not triggering It's corresponding "then".
Here is my code -
file := "M:My\txtfile\location.txt" ; location of word list
FileRead, LoadedText, %file% ; load list
Sort, LoadedText, random ; randomize words in list
Stringsplit, Array, LoadedText,`n ; Split into array
Loop, ; Get words one at a time
{
Word = % Array%A_Index%
Loop, ; Prompt the current word
{
InputBox, UserInput,%Word%,, , 300,100,0,880
if (Userinput = "End") ; Provide an exit
Exitapp
if (userinput=word) ;**Move on to the next word
Break
else ;Continue prompting same word
Continue
}
}
Exitapp
The goal is to make a flashcard script that takes words from a text file, prompts them in a random order, and moves onto the next word only after writing the prompted word into the userinput box (if it was real flashcards the front and the back would have the same words on them). I want to use the script to practice custom text expansions.
I've tried every combination of %'s and :='s and searched for the solution in as many ways as I can think to phrase it with no success if someone could point me in the right direction I'd greatly appreciate it!
I can't figure out why "if (userinput=word)" is not triggering It's corresponding "then".
Here is my code -
file := "M:My\txtfile\location.txt" ; location of word list
FileRead, LoadedText, %file% ; load list
Sort, LoadedText, random ; randomize words in list
Stringsplit, Array, LoadedText,`n ; Split into array
Loop, ; Get words one at a time
{
Word = % Array%A_Index%
Loop, ; Prompt the current word
{
InputBox, UserInput,%Word%,, , 300,100,0,880
if (Userinput = "End") ; Provide an exit
Exitapp
if (userinput=word) ;**Move on to the next word
Break
else ;Continue prompting same word
Continue
}
}
Exitapp
The goal is to make a flashcard script that takes words from a text file, prompts them in a random order, and moves onto the next word only after writing the prompted word into the userinput box (if it was real flashcards the front and the back would have the same words on them). I want to use the script to practice custom text expansions.
I've tried every combination of %'s and :='s and searched for the solution in as many ways as I can think to phrase it with no success if someone could point me in the right direction I'd greatly appreciate it!