Jump to content

Word Searching (Fun Little program)


Recommended Posts

I have this very simple but possibly quite complicated idea for a program. It is kind of a rip of the "Find" function used in many programs and really is in a way a re-create. The problem is it take ages for the program to process the information and that is on a good PC (i5-6600, 16GB DDR4, SSD). The question, why? Why cant it work just like the find function, and how does the find function in many programs work so efficiently?

Website for the words file as only allowed 4MB and it is 5MB :rolleyes:https://raw.githubusercontent.com/dwyl/english-words/master/words.txt 

Code:

#include <File.au3>

$Letters = InputBox("Letters","Input the letters you have.","","")
If @error Then Exit

$File_Words = @ScriptDir&"\words.txt"
$Words = "Words:"

$Amount = StringLen($Letters)

$lines = _FileCountLines($File_Words)
ProgressOn("Searching...","","")
ProgressSet(0)

For $i = 0 To $Amount
    $string = StringTrimRight($Letters,$i)
    For $j = 1 To $lines
        ProgressSet($lines/$j)
        If FileReadLine($File_Words,$j) = $string Then
            $Words = $Words&@CRLF&$string
        EndIf
    Next
Next
MsgBox(0,'',$Words)

 

Link to comment
Share on other sites

@kingjacob90 , this is what I prefer. Simple code to do weird stuff... you dont have to be complex in you code. 

Well done on this one... 

btw, you have another user named @kingjacob280.. with the same profile picture and everything... that also you? 

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

1 hour ago, kingjacob90 said:

Why cant it work just like the find function

Becose you're not using String compare

 

1 hour ago, kingjacob90 said:

and how does the find function in many programs work so efficiently?

They just do string comparaison on some simple sub string with maybe 500 - 1000 Entry

Dont forget that a page with 1 500 words can have 200 different words only... maybe less... 

 

If you got a file with all existing words. 200 000 Words for english language. 

 

It will take a bit more time to compare :yawn: ... Pretty obvius ? (particulary if you want to have all know words with same characters. that's more calcul./././ )

 

 

.... and say the real purpose of your script. 

What do you want to do exactly ? Find all possible words of given characters to be able to play scrabble online  ?

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I think it would be faster if you read all lines to an array and then work with it instead of reading line by line from the file for each query you make.

Also, maybe ditch the string trim, and use stringinstr.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...