Sign in to follow this  
Followers 0
strik3r0475

Search a text file using random letters

4 posts in this topic

I want to be able to enter random letters into the input box and then have it search a text file for all

words that contain only the letters entered into the input box.

I have no clue how to search the text file in that way. If someone could point me in the right direction.

#include <GUIConstants.au3>
#include <File.au3>
Global Const $WM_COMMAND = 0x0111
Global Const $LBN_SELCHANGE = 1
Global Const $LBN_DBLCLK = 2
$Dictionary = "dictionary.txt"
GUICreate("GUI Title", 179, 402, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_TOPMOST)
$Group = GUICtrlCreateGroup("", 10, 10, 160, 380)
$Button = GUICtrlCreateButton("GO", 20, 30, 40, 20)
$Input = GUICtrlCreateInput("", 70, 30, 90, 20, $ES_LOWERCASE)
$List = GUICtrlCreateList("", 30, 60, 120, 305)
GUICtrlSetData(-1, "List1|List2|List3|List4|List5|List6|List7|List8|")
GUICtrlSetLimit(-1, 200)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState(@SW_SHOW)
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
   $msg = GUIGetMsg()
   Select
      Case $msg = $Button
         $Info = GUICtrlRead($Input)
         MsgBox(0, "Input", GUICtrlRead($Input))
   EndSelect
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
   $nNotifyCode = BitShift($wParam, 16)
   $nID = BitAND($wParam, 0x0000FFFF)
   $hCtrl = $lParam
   If $nID = $List Then
      Switch $nNotifyCode
         Case $LBN_DBLCLK
           ;Send(GUICtrlRead($List) & "{ENTER}")
            MsgBox(0, "List", GUICtrlRead($List))
            Return 0
      EndSwitch
   EndIf
EndFunc  ;==>MY_WM_COMMAND

dictionary.txt

Share this post


Link to post
Share on other sites



Well a GUI command is not going to read the .txt file... There are some things that you need to look at...

FileOpen()

FileRead()

FileWrite()

FileWriteLine()

_FileReadToArray()

For/Next Loops

Those are the correct 'Pointers', hopefully by point you didn't mean write.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

StringInStr might be helpful too.

Share this post


Link to post
Share on other sites

StringInStr might be helpful too.

Oh, sorry, I was just covering the 'F'(s) :)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0