Jump to content

Function for reading a text file


Syed23
 Share

Recommended Posts

Hi Friends,

I have a text file with the single word information(like., BitlockerON). I would like to read this information from the text file with the function (File Read and FileReadLine) but it is not consistent as i expected. Does anyone have an idea how to read the text file consistently or do we have any other function for it...

Thanks in advance.Posted Image

Regards,

K.Syed Ibrahim.

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

syedibrahim87,

but it is not consistent as i expected

In what way is the reading of the file "not consistent"? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

syedibrahim87,

In what way is the reading of the file "not consistent"? ;)

M23

Global $BitValue = FileRead("C:\temp\Bitlock.txt")

_Bit($BitValue)

Func _Bit($BitValue)

If $BitValue == "YES" Then

MsgBox(0,"Test",$BitValue)

ElseIf $BitValue == "EncryptionPercentage" Then

MsgBox(0,"Test",$BitValue)

Else

MsgBox(0,"Test",$BitValue)

EndIf

EndFunc

If i use it in a sample program the conditions works fine. But if i use the same function in 1000 line code it is not working ... only the Else part works not the If or elseif part.. Am i making clear... can you help me ?

For your reference i have attached the text file. you can modify that file accordingly and you can check it..

Edited by syedibrahim87

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

syedibrahim87,

Apologies, I missed your reply earlier today. Blame the dynamic forum! :shocked:

Of course you will not find the specific "YES|EncryptionPercentage|NO" text doing it that way. FileRead reads in the entire text of the file - so asking if the whole text == "something short" will never work if the file is 1000 lines long. ;)

What we need to do is find a way to identify the particular part of the file which is likely to contain the text you want to identify. Although "EncryptionPercentage" is pretty likely to be unique, the same cannot be said for "YES" and "NO". :)

Could you please post a copy of the file in question (or at least the part which includes the text you are looking for) so we can see if there is something we can use as an anchor for the search? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba23,

No Problem. I am glad that you are helping me. some how i fixed the issue, but i don't how it isPosted Image. As you asked i have attached my entire script below. please have a look.

Thank you,

Regards,

K.Syed Ibrahim.

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...