i'm trying to create a program that let's the user type a word in an input field (gui) and when a button is pressed the letters of the word are replaced by 1 word each from a list of words in a text file
each letter of a word should be replaced by a word from a text file
the text file is a source for replacing letters is a file with 2 columns separated by tab that contains the entire alphabet (26 rows)
input a word and replace it's letters as output
input a word and replace it's letters as output
- Attachments
-
- Screenshot_1.png (4.99 KiB) Viewed 3068 times
Re: input a word and replace it's letters as output
Nice to know. Support your supporters, ask a question!
Re: input a word and replace it's letters as output
sorry i wasn't clear
i need help to create it, the screenshot is not a finished program it's an example of how the program could look
please help if possible
post some code to begin with, thanks in advance
i need help to create it, the screenshot is not a finished program it's an example of how the program could look
please help if possible
post some code to begin with, thanks in advance
Re: input a word and replace it's letters as output
please help
if someone can help me create this program i would be really grateful
if someone can help me create this program i would be really grateful
Re: input a word and replace it's letters as output
I would do a StringSplit on the submitted word to break it into each letter.
Then just parse those letters (Loop them) to construct a new string with either If=letter statements or having loaded up your text file into an array and using those values. For the array (see Object; associative array), if you did something like array:={"a":"airplane","b":"boy"} then you could do string.=array[letter%A_Index%] in a loop with the pseudo-array prefix letter from the StringSplit. The .= is the concatenate-assign operator.
Then just parse those letters (Loop them) to construct a new string with either If=letter statements or having loaded up your text file into an array and using those values. For the array (see Object; associative array), if you did something like array:={"a":"airplane","b":"boy"} then you could do string.=array[letter%A_Index%] in a loop with the pseudo-array prefix letter from the StringSplit. The .= is the concatenate-assign operator.
Re: input a word and replace it's letters as output
i have this code so far for the gui:
please i would be really thankful if someone can post a working example with all the options and added code source
please help if possible
Code: Select all
Gui,Add,Edit,x9 y5 w500 h21,TestString
Gui,Add,Edit,x9 y30 w500 h350
Gui,Add,Button,x424 y386 w86 h23,Find
Gui,Show
return
please help if possible
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: input a word and replace it's letters as output
Since I've been looking for something to code today...
Word_List.txt: - Comma separate each random word you'd like to choose from, only put one word if you don't want it to be random.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
SetBatchLines, -1
Letters := []
Loop, Read, Word_List.txt
{
IF (A_LoopReadLine) {
temp := StrSplit(A_LoopReadLine, "`t")
Letters[temp[1]] := []
Loop, Parse, % temp[2], `,
Letters[temp[1]].Push(A_LoopField)
}
}
Gui,Add,Edit,x9 y5 w500 h21 vTestString
Gui,Add,Edit,x9 y30 w500 h350 vDisplay
Gui,Add,Button,x424 y386 w86 h23 gFind Default,Find
Gui,Show
return
Find:
Gui, Submit, NoHide
output := ""
Loop, Parse, TestString
{
IF (isObject(Letters[A_LoopField])) {
Random,r,1,% Letters[A_LoopField].MaxIndex()
output .= Letters[A_LoopField][r] . " "
}
}
Display .= output . "`n"
GUIControl,,Display, %Display%
GUIControl,,TestString,
Return
Code: Select all
A Apple,Always
B Ball
C Cat
D Dog
E Elephant
F Frog
G Goat
H House
I Ice
J Jogging
K Kitten
L Long
M Mouse
N Net
O Oxen
P People
Q Quick
R Right
S Stupid
T This
U Unknown
V Vertical
W West
X Xylophone
Y Yes
Z Zebra
Re: input a word and replace it's letters as output
thank you so much
it works
thanks again
it works
thanks again
Re: input a word and replace it's letters as output
hi
can anyone modify this script above from Nightwolf85 and make it so the program replaces words to words instead of letters to words?
please help if possible
it has to replace words with words with a text list of words
can anyone modify this script above from Nightwolf85 and make it so the program replaces words to words instead of letters to words?
please help if possible
it has to replace words with words with a text list of words
Re: input a word and replace it's letters as output
You could change the word list so the left column isn't just letters. Then you just need to change Loop, Parse, TestString under the Find: label to use the delimiters you like (probably a space; I'd denote it as Loop, Parse, TestString, %A_Space% myself.
I have not run Night's code, and of course not any modifications I suggested. So apologies if that doesn't resolve it. I may have overlooked some logic in the original code that also needs to be changed to accommodate word->word.
I have not run Night's code, and of course not any modifications I suggested. So apologies if that doesn't resolve it. I may have overlooked some logic in the original code that also needs to be changed to accommodate word->word.
Who is online
Users browsing this forum: doodles333, Google [Bot], vysmaty and 243 guests