Jump to content

Recommended Posts

Posted

May help

$sFileName = '';Filename here
$sWord = '';Se the word here

$sText = FileRead($sFilename,FileGetSize($sfilename))
MsgBox(0,'',StringInStr($sText,$sWord))
Posted

#Include <GUIConstants.au3>


$sFileName = 'dansk-engelsk.html'
$sWord = 'aftenandagt'

$sText = FileRead($sFilename,FileGetSize($sfilename))
MsgBox(0,'',StringInStr($sText,$sWord))

it gives me the error o in the msgbox, is it because it cant find the file, or the word in the .html file?

for eksample, i want it so search for a word in the .html document, and then show it on the msgbox, if it finds it!

Posted

Maybe a caps problem?

#Include <GUIConstants.au3>
$sFileName = 'dansk-engelsk.html'
$sWord = 'aftenandagt'

$sText = FileRead($sFilename,FileGetSize($sFileName))   <------------
MsgBox(0,'',StringInStr($sText,$sWord))
Posted

I just tested:

$sFileName = 'c:\boot.ini';Filename here
$sWord = 'part';Se the word here

$sText = FileRead($sFilename,FileGetSize($sfilename))
MsgBox(0,'',StringInStr($sText,$sWord))

And it worked. Can you show a little more?

Posted

There is not more :idiot:

When i run your script, i get "59" why that?

<{POST_SNAPBACK}>

I adjusted the code a little.

$sFileName = 'c:\boot.ini';Filename here
$sWord = 'part';Se the word here

$sText = FileRead($sFilename,FileGetSize($sfilename))
If StringInStr($sText,$sWord) Then MsgBox(0,'', "Word is found in file!")
Posted

O, okay.. i tried to make a GUI aout of it, but it doesn't seem to work

#include <GUIConstants.au3>

global $sText

GUICreate("Dictionary search", 300, 225)
GUISetState(@SW_SHOW)

$search = GUIctrlcreateinput("input search word",10,30, 150, 25)

$button = GUICtrlCreateButton("Start Search", 10, 60, 70, 20)








while 1

       $msg = GUIGetMsg()
       if $msg = $GUI_EVENT_CLOSE then
       exitloop
       endif
      
       if $msg = $button then
       

       $sFileName = 'c:\fil.htm'
       $sWord = '(GUIread)$search'

       $sText = FileRead($sFilename,FileGetSize($sfilename))
       If StringInStr($sText,$sWord) Then MsgBox(0,'', "Word is found in file!")
       endif      
      
       If $sText = -1 Then
       MsgBox(0, "Error", "Unable to open file.")
       endif


wend

Can i get it to write the line were it found the word?

thx for your help

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
×
×
  • Create New...