vinnyMS Posted November 11, 2020 Posted November 11, 2020 i need a script that can add text from words in a sentence. the text added will be added from a list of word definitions. example: in green is the text added before: today is a good day. after: today is a good day. today means this present day and is good means to be desired or approved of a day meaning a period of twenty-four hours as a unit of time. in red is extra text that is added to connect the definitions definitions are added from a list four (4) times per word only today: this present day good: is to be desired or approved of day: a period of twenty-four hours as a unit of time. it has to point at a txt file and save the result text to another file source.txt to result.txt expandcollapse popup#Region INCLUDE #include <GuiConstantsEx.au3> #EndRegion INCLUDE #Region GUI GUICreate("Define", 400, 108) GUISetIcon(@SystemDir & "\notepad.exe", 0) #EndRegion GUI #Region INPUT1 GUICtrlCreateInput("", 10, 10, 380, 20) GUICtrlSetTip(-1, '#Region INPUT1') #EndRegion INPUT1 #Region INPUT2 GUICtrlCreateInput("", 10, 33, 380, 20) GUICtrlSetTip(-1, '#Region INPUT2') #EndRegion INPUT2 #Region INPUT3 GUICtrlCreateInput("", 10, 56, 380, 20) GUICtrlSetTip(-1, '#Region INPUT3') #EndRegion INPUT3 #Region BUTTON GUICtrlCreateButton("Start", 10, 78, 50, 20) GUICtrlSetTip(-1, '#Region BUTTON') #EndRegion BUTTON #Region GUI MESSAGE LOOP GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() #EndRegion GUI MESSAGE LOOP
abberration Posted November 11, 2020 Posted November 11, 2020 I think you have at least two decent options, depending on the scope of your project: 1. If your project is small and simple, use StringReplace to just substitute "today" with "today means this present day and is good means to be desired or approved of a day meaning a period of twenty-four hours as a unit of time." 2. If your project is going to be large (which I suspect, considering it is defining words), you may want to look into the _SQLite_... functions mentioned in the help file or you could build a database with Microsoft Access (an easier option, in my opinion). One thing to point out is using files to store data and work with them is inefficient (source.txt, result.txt, definition_list.txt). I much prefer arrays to work with data because are so much faster. If this is going to be a large project, you will want to use arrays. You would have to load the data into the arrays from a text file or database first, then work with the data in the array. It is good you included code, but it is superficial. It does not tell us what you are trying to accomplish. What is your ultimate goal? Easy MP3 | Software Installer | Password Manager
vinnyMS Posted November 13, 2020 Author Posted November 13, 2020 The ultimate goal is to add text from definition of words from a file after the end of every phrase after ". " period
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now