JustinReno Posted January 31, 2008 Share Posted January 31, 2008 (edited) I got bored the other day and wondered if it would be easy to make a dictionary, but first I searched the forum and saw only one person (NerdGirl) made a dictionary that was what I wanted to make, but I didn't like the structure of the code or the way it handled the words (No Offence). So, I decided to make my own with Koda. I was successfull. So, if any of you are interested: Features: 1. Search 2. Add/Delete/Edit Entry 3. Pronouce the entry name. 4. Pronounce the entry definition. Todo: 1. Read the entrie's definition. 2. Get word wrap working on the Edit Control. I just finished the two Todo's! expandcollapse popup#Include <GUIListBox.au3> Global $Ini = @ScriptDir & "\Dictionary.ini" Global $Found Global $WordCount IniWrite($Ini, "Dictionary", "", "") $GUI = GUICreate("Dictionary", 474, 336) GUICtrlCreateLabel("Search:", 0, 0, 48, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $SearchInput = GUICtrlCreateInput("", 0, 16, 121, 21) $Search = GUICtrlCreateButton("Search", 120, 16, 43, 21, 0) GUICtrlCreateLabel("Dictionary Entries:", 0, 40, 89, 17) $DictionaryEntries = GUICtrlCreateList("", 0, 56, 121, 279) $AddEntry = GUICtrlCreateButton("Add Entry", 120, 56, 75, 25, 0) $DeleteEntry = GUICtrlCreateButton("Delete Entry", 120, 88, 75, 25, 0) $EditEntry = GUICtrlCreateButton("Edit Entry", 120, 120, 75, 25, 0) $PronounceEntryName = GUICtrlCreateButton("Pronounce Entry Name", 200, 56, 123, 25, 0) $PronounceEntryDefinition = GUICtrlCreateButton("Pronouce Entry Definition", 200, 88, 123, 25, 0) GUICtrlCreateLabel("Entry Definition:", 120, 152, 78, 17) $EntryDefinition = GUICtrlCreateEdit("", 120, 169, 353, 163, 0x0004) $About = GUICtrlCreateButton("About", 398, 0, 75, 25, 0) _PopulateDictionaryList() GUISetState(@SW_SHOW) While 1 WinSetTitle($GUI, "", "Dictionary - "&$WordCount&" words present.") Switch GUIGetMsg() Case - 3 Exit Case $DictionaryEntries _GetDefinition() Case $Search _Search() Case $AddEntry _NewEntry() Case $DeleteEntry _DeleteEntry() Case $EditEntry _EditEntry() Case $PronounceEntryName $Speak = ObjCreate("Sapi.SPVoice") $Speak.Speak(GUICtrlRead($DictionaryEntries)) Case $PronounceEntryDefinition $Speak = ObjCreate("Sapi.SPVoice") $Speak.Speak(GUICtrlRead($EntryDefinition)) Case $About MsgBox(64, "About", "Dictionary copyright Justin Reno 2008.") EndSwitch WEnd Func _PopulateDictionaryList() If FileExists($Ini) Then If $WordCount <> "" Then $WordCount = "" $GetEntries = IniReadSection($Ini, "Dictionary") GUICtrlSetData($DictionaryEntries, "") For $A = 1 To $GetEntries[0][0] $WordCount += 1 _GUICtrlListBox_AddString ($DictionaryEntries, $GetEntries[$A][0]) Next EndIf EndFunc ;==>_PopulateDictionaryList Func _GetDefinition() If FileExists($Ini) Then $GetEntries = IniReadSection($Ini, "Dictionary") For $B = 1 To $GetEntries[0][0] If $GetEntries[$B][0] = GUICtrlRead($DictionaryEntries) Then GUICtrlSetData($EntryDefinition, $GetEntries[$B][1]) Next EndIf EndFunc Func _Search() If FileExists($Ini) Then $GetEntries = IniReadSection($Ini, "Dictionary") For $C = 1 To $GetEntries[0][0] If GUICtrlRead($SearchInput) = $GetEntries[$C][0] Then $Found = $GetEntries[$C][0] Next If $Found <> "" Then _GUICtrlListBox_SetCurSel ($DictionaryEntries, _GUICtrlListBox_SelectString ($DictionaryEntries, $Found)) EndIf EndFunc ;==>_Search Func _NewEntry() $GUI = GUICreate("New Entry", 122, 106, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("Entry Word:", 0, 0, 60, 17) $EntryWord = GUICtrlCreateInput("", 0, 16, 121, 21) GUICtrlCreateLabel("Entry Definition:", 0, 40, 78, 17) $EntryDefinition = GUICtrlCreateInput("", 0, 56, 121, 21) $AddEntry = GUICtrlCreateButton("Add Entry", 0, 80, 121, 25, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case - 3 GUIDelete($GUI) ExitLoop Case $AddEntry If FileExists($Ini) Then $GetEntries = IniReadSection($Ini, "Dictionary") For $D = 1 To $GetEntries[0][0] If $GetEntries[$D][0] = GUICtrlRead($EntryWord) Then MsgBox(16, "Error", "Word to be added already exists!") GUIDelete($GUI) ExitLoop EndIf Next EndIf IniWrite($Ini, "Dictionary", GUICtrlRead($EntryWord), GUICtrlRead($EntryDefinition)) If @Compiled = 0 Then Run(@AutoItExe & " " & FileGetShortName(@ScriptFullPath)) If @Compiled = 1 Then Run (@ScriptFullPath) Exit EndSwitch WEnd EndFunc ;==>_NewEntry Func _DeleteEntry() If GUICtrlRead($DictionaryEntries) <> "" Then IniDelete($Ini, "Dictionary", GUICtrlRead($DictionaryEntries)) _PopulateDictionaryList() EndFunc Func _EditEntry() $GUI = GUICreate("Edit Entry", 123, 106, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("Entry Word:", 0, 0, 60, 17) $EntryWord = GUICtrlCreateInput(GUICtrlRead($DictionaryEntries), 0, 16, 121, 21) GUICtrlCreateLabel("Entry Definition:", 0, 40, 78, 17) $EntryDefinition = GUICtrlCreateInput("", 0, 56, 121, 21) $SaveEntry = GUICtrlCreateButton("Save Entry", 0, 80, 121, 25, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case - 3 GUIDelete($GUI) ExitLoop Case $SaveEntry IniWrite($Ini, "Dictionary", GUICtrlRead($EntryWord), GUICtrlRead($EntryDefinition)) _PopulateDictionaryList() GUIDelete($GUI) If @Compiled = 0 Then Run(@AutoItExe & " " & FileGetShortName(@ScriptFullPath)) If @Compiled = 1 Then Run (@ScriptFullPath) Exit EndSwitch WEnd EndFunc ;==>_EditEntry Here is a premade dictionary with 250 words, name it Dictionary.ini in the same directory: [Dictionary] = Corrupted=Venal, Dishonest Soothsayer=A person who professes to foretell events. Improverished=Reduced to poverty. Imperious=Urgent Haggard=In falconry, an untamed adult hawk. Insolence=Contemptuously rude or impertinent. Contemptible=Obsolete. Malevolently=Wishing evil or harm on another. Hello=A form of greeting used to meet someone. Volume=The loudness or quietness of an object. Melancholy=A gloomy state of mind, non emotional. Also a form of depression. Dictionary=A book or computer software containing one language's words with definitions attached. Thesaurus=A dictionary of synonyms and antonyms. Encyclopedia=A book or set of books containing articles on various topics. Text=A collection or group of words. Computer=A machine made to compute data in various ways. Software=The programs used to direct the operation of a computer. State=1. The condition of a person or thing. 2. A politically unified people occupying a definite territory. Speaker=1. One who speaks. 2. Loudspeaker. Soap=A substance used for washing and cleansing purposes. Test=The trial of the quality of something. Piety=Righteous by virtue of being pious. Nunnery=A community of nuns. Bubonic Plague=A common form of plague. Ravenous=Extremely hungary. Scourge=A whip used to inflict punishment. Florid=Elaberately or excessivly ornament. Obdurate=Showing unfeeling resistance to tender feelings. Ruthless=Without mercy or pitty. Somber=Grave or gloomy in character. Bleak=Offering little or no hope. Falconer=One that breads and/or trains falcons. Pompous=Marked by aggressive self esteem. Fatigue=Physical or mental tiredness. Exuberant=Full of unrestrained joy. Dispension=Something given out. Coronation=Act of crowning a king or queen. Vigorous=Strong, Active, and robust. Placid=Pleasantly peacefull. Coax=Persuade or attempt. Noble=Admirable high quality. Indifferent=Without interest of concern. Governess=A woman employed to educate. Betrothal=A mutral promise to marry. Kirtle=A women's dress or skirt. Tapestry=A heavy cloth with elaberate patterns. Litter=An enclosed or curtained couch. Inconstant=Changing or varying. Loathing=Great dislike. Inconsolable=Impossible or difficult to console. Wary=Not on guard, not alert. Yuletide=The Christmas Season. Rigorous=Characterized by or acting with rigor. Gracious=Marked by kindness and warm quarantine. Adjacent=Near, next to, adjoining. Alight=To get down from, step down from, to come down from the air, lighted up. Barren=Not productive, bare. Disrupt=To break up, disturb. Dynasty=A powerful family or group of rulers. Foretaste=An advance indication, sample, warning. Germinate=To begin to grow, come into being. Humdrum=Ordinary, dull, routine, without variation. Hurtle=To rush violently, dash headlong, to fling or hurl forcefully. Insinuate=To suggest or hint slyly, to edge into something indirectly. Intermidable=Endless, so long as to seem endless. Interrogate=To ask questions, examine. Recompense=To pay back, to give reward, a payment for loss. Renovate=To repair or restore. Resume=1. To continue from a pause. 2. A brief report summarizing past jobs. Sullen=Silent or brooding because of ill humor, anger or resentment. Trickle=To flow or fall by drops or in a small stream, irregular quantity of something. Trivial=Not important, minor, ordinary. Truce=A pause in fighting, temporary peace. Vicious=Evil, bad, spitefull. Available=Ready to use. Cater=To satisfy needs of, try to make things easy and pleasant, to supply food and service. Customary=Usual, expected, routine. Dissuade=To persuade not to do something. Entrepreneur=A person who starts up and takes the risk of a bussiness. Firebrand=A piece of burning wood, a toublemaker, an extremely energetic or emotional person. Hazard=Risk, peril, to expose in danger or harm. Homicide=The killing of one person by another. Indifference=A lack of interest or concern. Indignant=Filled with resentment or anger over something unworthy. Indispensable=Absolutely necessary. Lubricate=To apply oil or grease, to make smooth, slippery. Mutual=Shared, felt, or shown equally. Pelt=To throw a stream of things, to strike successively. Plague=An easily spread disease causing a large number of deaths. Poised=Balanced, suspended, calm or controlled. Regime=A government in power, a form of system of rule or managment. Retard=1. To make slow, delay, hold back. 2. A person regarded as idiotic. Transparent=Allowing light to pass through, easily recognized or understood. Unscathed=Wholly unharmed, not injured. Populate=To fill with/up. Media=Any form of entertainment, news. Wireless=Without cord, cordless intrument. Hard=1. The nonmaluablility of an object. 2. Not easy. New=The opposite of old, present. Abet=To aid, help, or encourage. Acumen=1. Keen insight. 2. Shrewdness. Banal=1. Dull. 2. Trite. 3. Commonplace. Cajole=1. To urge. 2. To coax. 3. To persuade by flattery. Cloying=Sickeningly sweet. Conundrum=1. A puzzle or problem. 2. A riddle with an answer that involves a pun or a play on words. Curtail=1. To cut short. 2. To lesson or reduce. Dearth=1. A scarcity. 2. A lack of something. Dirge=A mournful song, especially for a funeral. Dither=1. To be indecisive. 2. A state of flustered excitement or fear. Hapless=1. Unlucky. 2. Unfortunate. Inane=1. Silly and meaningless. 2. Lacking sense. Knell=The solemn sound of a bell, often indicating death or funeral. Respite=1. A break. 2. Rest. Brusque=Abrupt, rough, blunt, or rude in manner or speech. Caricature=A picture or description in which natural characteristics are exaggerated or distorted. Encumber=To hinder or impede with obstacles. Eschew=1. To keep clear of. 2. To avoid. Flagrant=1. Shocking. 2. Openly scandalous. Glazier=A person who cuts and fits panes of glass for windows. Hirsute=1. Hairy. 2. Shaggy. Imminent=1. Likely to occur soon. 2. Close at hand. Junta=A small group in charge after the overthrow of the former government. Kimono=A loose, wide-sleeved robe, fastened at the waist with a wide sash, originally Japanese. Obsequious=1. Extreme compliance or deference to the wishes or needs of another. 2. Fawning. Laggard=One who falls behind. Parity=Equality in amount, status, or character. Commingle=1. To mix or mingle together. 2. To blend. Massive=1. Large. 2. Bulky. 3. Heavy looking. Perfunctory=1. Half-hearted. 2. Lacking interest. 3. Indifferent. Photometry=The measurement of the intensity of light. Quandary=1. Uncertainly about what to do. 2. Perplexity. Respository=A place where goods are stored. Salient=1. Important. 2. Prominent. 3. Conspicuous. Abrogate=To abolish, usually by formal or official means. Scurrilous=1. Vulgar. 2. Coarse. 3. Abusive. Succinct=1. Expressed in few words. 2. Concise. Tortuous=1. Twisting. 2. Winding. 3. Crooked. Transgress=To violate law, command, or moral code. Whimsical=1. Fanciful. 2. Unpredictable. Zenith=The highest point. Vapid=2. Lacking liveliness. 2. Dull; flat. Panacea=1. A remedy for all ills or difficulties. 2. A cure all. Paucity=1. Scarcity. 2. Small in quanity. Nadir=1. The lowest point. 2. Point of despair. Noisome=Unpleasant, disgusting, or offensive, especially the sense of smell. Limpid=1. Clear. 2. Transparent. Insipid=1. Dull; boring. 2. Without any distinctive or interesting qualities. Recapitulate=1. To sum up. 2. To repeat. Semicolin=Separates closely related sentences or list items that contain commas. Absquatulate=Flee, make off; abscond. Agelast=One who never laughs. Aglet=The plastic tip on the end of a shoelace. Agrestic=Characteristic of the country, rustic; also, unpolished or uncouth. Akimbo=Of the arms, with the hands on the hips and the elbows bent outward. Anadromous=Of fish, migrating up rivers from the sea to spawn in fresh water. Anile=Like a doddering, foolish old woman. Anserine=Goose-like; also, silly, foolish, or stupid. Anthropophagy=Cannibalism. Apolaustic=Wholy devoted to the seeking of enjoyment. Arcadian=Idyllically pastoral, simple, or untroubled. Avuncular=Of or pertaining to an uncle; also, uncle-like. Barratry=The offense of frequently stirring up lawsuits or quarrels; also, in maritime law, fruad or gross criminal negligence by a captain or crew at the expense of a ship's owner or of the owner of a ship's. Bastinado=Torture by beating on the soles of the feet. Bezonian=A scoundrel. Bibcock=A faucet that is bent downward. Bibliobibuli=Those who read too much. Biffy=A toilet or outhouse. Bodewash=Dried buffalo dung, used as fuel for fire. Boeotian=Stupid, dull, obtuse; also, such a person. Bolus=A large medicinal pill; also, a mass of chewed food. Boondoggle=An unnecessary activity or wasteful expenditure. Borborygmic=Pertaining to the rumbling of one's stomach or intestine's. Bosky=Having an abundance of trees of shrubbery. Brobdingnagian=Enormous, immense. Brummagem=Cheap and showy but inferior and worthless. Buccal=Of or pertaining to the cheek or the mouth. Bugaboo=Something that causes baseless fear or worry. Bumf=Toilet paper; also, worthless paperwork, literature, or junk mail. Caseifaction=The act of turning into cheese. Cataglottism=Kissing with the tongue. Cerumen=Earwax. Cicisbeo=A male escort or lover of a married woman. Collation=A light meal. Contumelious=Insolently abusive or humiliating. Corrigendum=A mistake to be corrected, especially an error in a printed book. Crapulous=Given to, characterized by, or suffering from gross excess in eating and drinking. Cynosure=A center of attraction or admiration. Dandle=To dance on one's knees; the action taken by a dandler. Deasil=Clockwise. Defenestrate=To throw out of a window. Dendrochronology=The study of growth rings on trees. Dipsomania=Uncontrolable craving for alcohol. Doddle=Something easy or requiring little effort. Donnybrook=A brawl of heated public dispute. Dottle=The blug of unburned tobacco left in a pipe after smoking. Draggly=Make wet and dirty by dragging on the ground. Duff=Decaying matter in a forest. Ecdysiast=Stripper. Eesome=Pleasing to the eye. Emollient=Characteristic of that which softens or soothes the skin. Enantiodromic=Characteristic of something that has become its opposite. Eructation=Belching; also, discharge from a volcano. Esprit D'Escalier=A remark that occurs to someone later, after it should have been said. Estivate=To spend the summer. Esurient=Hungry. Evancalous=Pleasant to embrace. Exsanguinate=To drain blood from. Factotum=Employee or assistant who does just about everything. Fantods=A state of nervous irritability; the fidgets. Fernticle=Freckle. Fescue=A small stick used to point out letters to a child learning to read. Flews=The pendulous corners of the upper lip of certain dogs, such as the bloodhound. Floccinaucinihilipilification=The categorizing of something as worthless. Flummery=Meaningless chatterl also, deceptive language. Footle=To talk or act foolishly; to waste time. Friable=Easily cumbled; crumbly. Frisson=An emotional thrill; a shudder of emotion. Funambulist=A tightrope walker. Geck=A dupe. Genuflect=Bend the knee and lower the body, especially in reverence. Gleek=To joke or jest. Gobbledygook=Windy gibberish or jargon. Gormless=Dull, stupid, clumsy. Gound=The gunk that collects in the corners of the eyes during sleep. Gowpen=Two hands placed together to form a bowl-shape. Graustark=An imaginary place of high romance. Hallux=Big toe. Hangdog=Shamefaced, brownbeaten, or intimidated. Hebdomedal=Weekly. Hirple=To hobble or walk lamely. Hornswoggle=Bamboozle, deceive. Hoyden=A carefree girl, a tomboy. Infucate=To apple cosmetics. Inglenook=A nook by a fireplace. Insufflate=To blow on or breathe into. Jillick=To skip a stone across water. Jocoserious=Combining serious and humorous matters. Jugulate=To slit the throat. Kalopsia=The delusion that things are more beautiful than they really are. Katzenjammer=A loud, discordant noise; also, a hangover; also, a state of depression or bewilderment. Lapidate=To stone to death. Latrinalia=Graffiti found in restrooms. Legerdemain=Slight of hand; magic tricks. Liripipe=A long scarf or cord attached to and hanging from a hood. Ludic=Characterized by playfulness. Macerate=To make or become soft by steeping in a liquid; also, to waste away by fasting. Madefy=Moisten. Maffick=To rejoice with an extravagant and boisterous public celebration. Malinger=Pretend to be ill in order to avoid work or shirk duty. Have fun, and comments are appreciated. And people giving me credit and not stealing my code would be appreciated. Thanks. Edited February 4, 2008 by JustinReno Link to comment Share on other sites More sharing options...
gseller Posted January 31, 2008 Share Posted January 31, 2008 Very Nice Justin... **stealing code** Haha, you sure do get caught up in that ownership. I like the idea of someone using any code I make. Manipulating it, making it work for other projects. That is why we share, and btw.. Thanks for sharing... Link to comment Share on other sites More sharing options...
Linux Posted January 31, 2008 Share Posted January 31, 2008 Yeah! thats the fun of sharing! You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
JustinReno Posted February 1, 2008 Author Share Posted February 1, 2008 Thanks, Gesller! Link to comment Share on other sites More sharing options...
Achilles Posted February 1, 2008 Share Posted February 1, 2008 Nice work on what you have so far! The GUI organization seems a bit weird 'cause of the huge space for the definition and the blank space on the right. Also, if you add a word that already exists it adds a "0" to the list. I would look for a way of inserting the new item rather the restarting the whole program because that looks kind of weird when the program flashes. In you Definition.ini you have a blank item at the top which causes there to be an blank item at the top of the list. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
rasim Posted February 1, 2008 Share Posted February 1, 2008 Interesting script, all work fine, but need little GUI correction, because some elements crawl on to other elements expandcollapse popup#Include <GUIListBox.au3> Global $Ini = @ScriptDir & "\Dictionary.ini" Global $Found Global $WordCount IniWrite($Ini, "Dictionary", "", "") $GUI = GUICreate("Dictionary", 474, 336) GUICtrlCreateLabel("Search:", 5, 0, 48, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $SearchInput = GUICtrlCreateInput("", 5, 16, 121, 21) $Search = GUICtrlCreateButton("Search", 130, 16, 43, 21, 0) GUICtrlCreateLabel("Dictionary Entries:", 5, 40, 89, 17) $DictionaryEntries = GUICtrlCreateList("", 5, 56, 121, 279) $AddEntry = GUICtrlCreateButton("Add Entry", 130, 56, 75, 25, 0) $DeleteEntry = GUICtrlCreateButton("Delete Entry", 130, 88, 75, 25, 0) $EditEntry = GUICtrlCreateButton("Edit Entry", 130, 120, 75, 25, 0) $PronounceEntryName = GUICtrlCreateButton("Pronounce Entry Name", 210, 56, 130, 25) $PronounceEntryDefinition = GUICtrlCreateButton("Pronouce Entry Definition", 210, 88, 130, 25) GUICtrlCreateLabel("Entry Definition:", 130, 152, 78, 17) $EntryDefinition = GUICtrlCreateEdit("", 130, 169, 340, 163, 0x0004) $About = GUICtrlCreateButton("About", 395, 5, 75, 25, 0) _PopulateDictionaryList() GUISetState(@SW_SHOW) While 1 WinSetTitle($GUI, "", "Dictionary - "&$WordCount&" words present.") Switch GUIGetMsg() Case - 3 Exit Case $DictionaryEntries _GetDefinition() Case $Search _Search() Case $AddEntry _NewEntry() Case $DeleteEntry _DeleteEntry() Case $EditEntry _EditEntry() Case $PronounceEntryName $Speak = ObjCreate("Sapi.SPVoice") $Speak.Speak(GUICtrlRead($DictionaryEntries)) Case $PronounceEntryDefinition $Speak = ObjCreate("Sapi.SPVoice") $Speak.Speak(GUICtrlRead($EntryDefinition)) Case $About MsgBox(64, "About", "Dictionary copyright Justin Reno 2008.") EndSwitch WEnd Func _PopulateDictionaryList() If FileExists($Ini) Then If $WordCount <> "" Then $WordCount = "" $GetEntries = IniReadSection($Ini, "Dictionary") GUICtrlSetData($DictionaryEntries, "") For $A = 1 To $GetEntries[0][0] $WordCount += 1 _GUICtrlListBox_AddString ($DictionaryEntries, $GetEntries[$A][0]) Next EndIf EndFunc ;==>_PopulateDictionaryList Func _GetDefinition() If FileExists($Ini) Then $GetEntries = IniReadSection($Ini, "Dictionary") For $B = 1 To $GetEntries[0][0] If $GetEntries[$B][0] = GUICtrlRead($DictionaryEntries) Then GUICtrlSetData($EntryDefinition, $GetEntries[$B][1]) Next EndIf EndFunc Func _Search() If FileExists($Ini) Then $GetEntries = IniReadSection($Ini, "Dictionary") For $C = 1 To $GetEntries[0][0] If GUICtrlRead($SearchInput) = $GetEntries[$C][0] Then $Found = $GetEntries[$C][0] Next If $Found <> "" Then _GUICtrlListBox_SetCurSel ($DictionaryEntries, _GUICtrlListBox_SelectString ($DictionaryEntries, $Found)) EndIf EndFunc ;==>_Search Func _NewEntry() $GUI = GUICreate("New Entry", 122, 106, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("Entry Word:", 0, 0, 60, 17) $EntryWord = GUICtrlCreateInput("", 0, 16, 121, 21) GUICtrlCreateLabel("Entry Definition:", 0, 40, 78, 17) $EntryDefinition = GUICtrlCreateInput("", 0, 56, 121, 21) $AddEntry = GUICtrlCreateButton("Add Entry", 0, 80, 121, 25, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case - 3 GUIDelete($GUI) ExitLoop Case $AddEntry If FileExists($Ini) Then $GetEntries = IniReadSection($Ini, "Dictionary") For $D = 1 To $GetEntries[0][0] If $GetEntries[$D][0] = GUICtrlRead($EntryWord) Then MsgBox(16, "Error", "Word to be added already exists!") GUIDelete($GUI) ExitLoop EndIf Next EndIf IniWrite($Ini, "Dictionary", GUICtrlRead($EntryWord), GUICtrlRead($EntryDefinition)) If @Compiled = 0 Then Run(@AutoItExe & " " & FileGetShortName(@ScriptFullPath)) If @Compiled = 1 Then Run (@ScriptFullPath) Exit EndSwitch WEnd EndFunc ;==>_NewEntry Func _DeleteEntry() If GUICtrlRead($DictionaryEntries) <> "" Then IniDelete($Ini, "Dictionary", GUICtrlRead($DictionaryEntries)) _PopulateDictionaryList() EndFunc Func _EditEntry() $GUI = GUICreate("Edit Entry", 123, 106, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("Entry Word:", 0, 0, 60, 17) $EntryWord = GUICtrlCreateInput(GUICtrlRead($DictionaryEntries), 0, 16, 121, 21) GUICtrlCreateLabel("Entry Definition:", 0, 40, 78, 17) $EntryDefinition = GUICtrlCreateInput("", 0, 56, 121, 21) $SaveEntry = GUICtrlCreateButton("Save Entry", 0, 80, 121, 25, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case - 3 GUIDelete($GUI) ExitLoop Case $SaveEntry IniWrite($Ini, "Dictionary", GUICtrlRead($EntryWord), GUICtrlRead($EntryDefinition)) _PopulateDictionaryList() GUIDelete($GUI) If @Compiled = 0 Then Run(@AutoItExe & " " & FileGetShortName(@ScriptFullPath)) If @Compiled = 1 Then Run (@ScriptFullPath) Exit EndSwitch WEnd EndFunc ;==>_EditEntry Link to comment Share on other sites More sharing options...
JustinReno Posted February 4, 2008 Author Share Posted February 4, 2008 Ok, I updated the premade Dictionary.ini with 150 new words. 250 now. And, thanks Rasim. Link to comment Share on other sites More sharing options...
GEOSoft Posted February 4, 2008 Share Posted February 4, 2008 Ok, I updated the premade Dictionary.ini with 150 new words. 250 now.And, thanks Rasim.Do you want me to send you a Scrabble dictionary?? I just provide the word list, you do the rest. 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 More sharing options...
JustinReno Posted February 5, 2008 Author Share Posted February 5, 2008 Do you want me to send you a Scrabble dictionary?? I just provide the word list, you do the rest. Haha @PianoMan:Yeah, the GUI does look a bit odd. I just noticed the bug that adds the 0=0 last night when I was adding new words, I'll fix it.And the restarting I had to put because when you add a new word, it wouldn't show the definitions for some words, which was fixed only by restarting.And, I had to put a blank entry in the Ini because sometimes when you added/edited/deleted etc. words, or even click on them, it would give an error if there were no ini. Thanks for the suggestions/bugs. And feedback. Link to comment Share on other sites More sharing options...
HeffeD Posted February 5, 2008 Share Posted February 5, 2008 I can't get my head around a dictionary that I have to add words to. Why not make a GUI front-end for one of the online dictionaries? Granted, you would need to be online, but to make your script useful, you'd need to spend an awful lot of time building the lexicon. Link to comment Share on other sites More sharing options...
JustinReno Posted February 5, 2008 Author Share Posted February 5, 2008 It is useful, its an add your own word dictionary? Link to comment Share on other sites More sharing options...
smashly Posted February 5, 2008 Share Posted February 5, 2008 Nice work and thank you for sharing. Does your script suffer the 32kb ini limit? If so then going by the scale of 250 words/definitions, dictionary.ini = 13kb Then it would only work upto around 700+- words/definitions. Regardless I still like your dictionary script. Cheers Link to comment Share on other sites More sharing options...
JustinReno Posted February 6, 2008 Author Share Posted February 6, 2008 Yes, it does, I thought about that constantly while I was creating it, I will look up some threads to get around that. Thanks. And, thanks for the feedback. Link to comment Share on other sites More sharing options...
smashly Posted February 6, 2008 Share Posted February 6, 2008 Hi, Suggestions: I know it'll take a little bit more effort and a mild format change of dictionary.ini... Instead of using an ini , maybe look into _FileReadToArray() and use stringsplit() to get the word/definition from the line. This way you wont be capped @ 32kb or have to play ini trickery to bypass 32kb limit. Also maybe spread the GUI inputs and buttons a little more. When looking at your gui in default XP windows theme some inputs, list and buttons seem to overlap each other and yet the gui has plenty of room to accommodate the controls without overlapping . The gui still works but it makes it cosmetically look non polished. (No disrespect meant by this comment) Cheers Link to comment Share on other sites More sharing options...
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