Not Able To Read The Next Line In The Notepad
problem : i want to read the next lien from a notepad which hgas a matrix for example 1 1 1 0 1 1 1 1 1 After the first loop i want the str2 to be 0 1 1 ?Ho can we do that .any pointer plz.....or if u see nay fault in my code.....reply back at your earliest convenience. thanks
Dim x, y, z As Integer Dim fname As String, str3(10, 10) As Integer, str2 As String, col1 As Integer fname = "C:sss1foxoutput.txt" Open fname For Input As #3 y = 1
While Not EOF(3) Line Input #3, str2 str2 = Replace(str2, " ", "")
For x = 1 To Len(str2) str3(y, x) = CInt(Mid$(str2, x, 1))
Next x y = y + 1
Wend MsgBox str3(2, 1)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Read 1 Line At A Time From A Notepad File
Hello,
I am making a program that I need to read 1 line of text from a notepad.exe file...
The current code I am using is:
VB Code:
Private Sub Command4_Click()Dim strLine As String Open App.Path & "/myFile.txt" For Input As #1 While Not EOF(1) Line Input #1, strLine Text1.Text = strLine WendClose #1End Sub
Now everytime I click on command4 I need the program to go to the next line of text in the app.path /myfile.txt and display it in the text1 text box...
How do I get it to read and output line 1 and then when I click it again read and output line 2, and so on?
Thanks and let me knwo if you need any more info!
(Pending Research) How To Read To End Of Line "Notepad Application"
I'm working with Gerber files and trying to re-format the files to an Excel workbook and five worksheets. Worksheets are going to be named "Top Copper", "Bottom Copper", "READ-ME", "Drill" and "Data Ready".
To import the data straight to Excel is fairly easy to do, but I need to use a program to place parts of the file into sections "cells" and "rows". I haven't been able to code a program to define a logic statement agreement to impliment this yet.
Heres just one example.
Code:
X-1800Y+3000D01*
You see a line of G-code. All lines consist of X and Y" in some state, where "X" can be -X, +X and "Y" can be -Y, +Y.
My idea is to do something as follows:
(A1,1) = X-
(B1,1) = 1800 "Note leading zeros are suppressed"
(C1,1) = Y+
(D1,1) = 3000 "Note leading zeros are suppressed"
(E1,1) = D03
Some ideas? I tried using "If" statements, but that just returned the string. I'm now trying to use a set of case statements, but that seems to make the the problem harder. Now the code is very large and without problem solving capabilities included, such as (E1,1).
I having so many problems with all the different things going on with the format that I don't know where to start coding the application - Please refer to my other thread of the g code sample.
Line Input #1, Line...how Do I Read Ahead One Line (or Back Up One Line)
I am loading a file line by line using the LIne Input but at one point i need to look ahead at the next line to decided what to do on the current line...how do i look ahead one line? or how do i use the line Input function and then back up? Any help would be greatly appreciated.
Shane Thomas
p.s. please email replys in addition to the reply of post too
shathoma@nmsu.edu
Reading From Notepad Line By Line
i have to read from a note pad file which may contain
dillon bob his geo 02/04/05
graham georgy chem geo his bio 06/05/65
However i have to make it so that it reads one line, then the next, then the next etc, not all at once
Can anyone help?
Read From Notepad
is there a way using vb to edit the text in a notepad document, and later on view it.
example: you could enter text in a textbox and on the click of a button that text is inserted into a new line of a notepad document. also, with the click of another button, any text in the notepad document can be viewed in a listbox.
Line By Line Text File Read And Correct Each Line
Can anyone help me create a small program or have any pointers
on pieces of code that reads a text file from folder "unfixed" then
fix the contents and then store the corrected contents
in another folder "fixed" and then move the file in folder "unfixed" to folder "old"
Details of contents.
There is a space infront of each line that should be removed.
Between the first group of numbers and the second there should be a zero for every space.
Then after the second group of numbers there should be just one space and the rest trimed off.
011531015222360000500355 3350505212004 50122
011531015222360000500363 5336305212004 6255
011531015222360000503465 2404505212004 50022
011531015222360000503463 1345205212004 50025
02153101522236 13 1503256
The @ symbol represents where a space should be.
I would like to read the file and then correct it and then
place the fixed contents in another folder with the original name.
Below is how I would like it to look.
01153101522236000050035500000003350505212004@
01153101522236000050036300000005336305212004@
01153101522236000050346500000002404505212004@
01153101522236000050346300000001345205212004@
021531015222360000000013@
Read From XLS And Write To A Notepad
Hi,
I am trying to read from an xls file columns 1,3,4,5 and write that to a notepad excluding the headers in xls (exclude the first row). Help me out in achieving this.
I am from legacy environment. So please try to make your code with comments as far as possible. Something from the scratch would be of great help to me.
Thank You.
Change 1 Line On A Notepad
i was just wondering if you could just change 1 line on a notepad instead of rewriting it..
maybe you could save the notepad temporialy and then change the certain line and then rewrites the notepad..
writenote(note.txt,2,"example")
Read And Manipulate Text In Notepad
Hello
I have a bunch of files opened in notepad (15 to be exact). What I would like to be able to do is to parse the text and use what I find as the name of the file when I save it.
I'm currently using the following code to save and close the files.
Code:
For d = 0 To 15
AppActivate ("notepad")
SendKeys "%FA", True
SendKeys "SeeTriangle[" & d & "]", True
'SendKeys "%TT", True
'SendKeys "%N", True
SendKeys "%S", True
SendKeys "Y", True
SendKeys "%FX", True
SendKeys "N", True
Next
I then open them back up in my app and do the parse and save them with the new name. I would like to cut out the extra step and just parse the file in Notepad and close it with the proper name.
I haven't been able to see a way to do this so far. So, my question is, Can I parse the text in notepad?
Thanks
David
VB Read Notepad Then Input To Excel
Situation: am reading a Notepad file to extract data to input into an Excel spreadsheet
When I find the data I need, I use this code to put it into the spreadheet:
wkbNewBook.ActiveSheet.Range("A4").Value = Mid$(textline, 4, 2)
Looking for a way via VB code to iterate the "A4" to "A5" then "A6", etc.
Any ideas?
Please Read This About My Question About Edit In Notepad.
Make the menu on the main form as normal, but make the top-most item invisible.
Eg
mnuMyCustom "Custom Menu"
--mnuEditInNotepad "Edit In Notepad"
--mnu... "....."
--etc etc etc
Then, when you want the menu to popup - normally in a mousedown event;
PopUpMenu [formname].mnuMyCustom
Look up help for PopUpMenu for more information.
When the menu item is selected from the popupmenu any code attached to the Click event of the menu is run (as normal). However, this isn't ideal as you normally want to write the code in the function that pops the menu up - in that case this is what I do..
On the form where the menu is (normally the main form) - for this example it is frmMain.
Public MenuSelected as Integer
In each click event of the items on the customer menu;
MenuSelected= [unique number]
In the code where you want the menu to popup;
frmMain.MenuSelected=-1
PopUpMenu frmMain.mnuMyCustom
select case frmMain.MenuSelected
case -1
(no items were selected from the menu)
case 1
(do whatever you want the menu item where you set menuselected=1 to do)
case 2
....
etc
End Select
Hope this make sense..
------------------
Mark "Buzby" Beeton
VB Developer
BuzbyB@HotMail.Com
Able To Read My Binary File In Notepad?
I've been experimenting with binary files and noticed that the file I created in "binary" mode, is readable in notepad? I thought that this mode put every character in terms of a "0" or "1"? Or maybe I'm doing something wrong..
I created a UDT... myRecord
...
' add some strings to myRecord
...
Open myfile for binary as #1
put #1,, myRecord
close #1
....
(I'm trying to protect sensitive data. Next step is encryption.)
any help is appreciated!
Kenny
VB Read Notepad Then Input To Excel
Situation: am reading a Notepad file to extract data to input into an Excel spreadsheet
When I find the data I need, I use this code to put it into the spreadheet:
wkbNewBook.ActiveSheet.Range("A4").Value = Mid$(textline, 4, 2)
Looking for a way via VB code to iterate the "A4" to "A5" then "A6", etc.
Any ideas?
Open Notepad At A Line Number
I have a program that reads data in from a txt file, but first it reads the file to check for any inconsitancies, if one is found it doesn't execute the routine and tells them that there is an inconsitancy and what line number it is on. I then ask if they want to open notepad to view it. I was wondering if there is a way that I can get notepad to open with the cursor already on that line number. My thought was that there must be some sort of command line argument or switch.
Thanks for any help.
Derek
Open With Notepad To Last Line In File
IF possible can anyone tell me how to open a file with notepad so you are viewing the last line ?
I don't want to just slam a bunch of page down sendkeys at it...
I need a scrolling display of the progress of a bunch of macros in Excel. Since Excel Application.ScreenUpdating = False I can't just write the messages to a cell, and msgbox stops the proceedure, hence the notepad idea...Also I keep having to re-open notepad as It doesn't view the file in real time as written:
UIhandle = FindWindow(vbNullString, "UserInfo.txt - Notepad")
PostMessage UIhandle, WM_SYSCOMMAND, SC_CLOSE, 0&
Open "C:StockBookUserInfo.txt" For Append As #1
Print #1, MESSAGE & " " & Format(Now, "hh:mm dd/mmm/yy")
Close #1
Shell "Notepad.exe " & "C:StockBookUserInfo.txt", 3 'somehow to last line of file
Maybe someone has a whole different approach...Else how open notepad to last line in file ??
tkx folks
Line Numbers In Notepad Clone?
hi, i want to make a notepad clone, but want to have the line numbers running down the side of it, and i really dont know how to do it..any ideas?
and also how do i get it to scroll if i use a textbox or rich-txt-box and a label down the side? pls help me!
Thanks,
Mag-Net
Opening A Notepad On A Pirticular Line From A Form...
VB gurus.... pls help me with this..
I 've a form with a command button on it.
When I click on this button it should open notepad with a pirticular file opened in it( assume some doc1.txt) and position the cursor to a line in the file, (linenumber specified at runtime ).
Pls lemme know , any pointers...
TIA
Gr8N
Read, Find A Line And Delete The Line In Text File
Hi, I am writing codes to do the following things: read a line from a text file, if this is a matched line, delete the line and go to the next line.
Can any one give me some direction? Such as access mode, method to use, etc.
Thanks.
.Input ( Read Contentsof Text File - Line By Line )
I'm trying to import Data from a text file, which includes the following,
Vessel Name
000115600
000025600
000000000
000089000
000019000
000000000
6670.43
The above file is updated every five minutes and I wish to retreive this data in
order to perform calc's and then display a completion time for a process on the
User Form.
code:-----------------------------------------------------------------------------
---
Open "YourFile.txt" For Input As #1
While Not EOF(1)
Input #1, YourVariable
List1.Additem YourVariable
Wend
Close #1
--------------------------------------------------------------------------------
Instead of adding to a list as in the above example, I want to process it Line by
Line ( How do I achieve this using .Input ).
Help
Read A Word In A Line Of Text And Delete That Line
I have some aim logs that I'm going to put in .txt format, and I want to be able to delete the text that the other person has written.
Is there a way for me to specify a screen name and have the program delete that line of text?
Thanks,
Brad
How To Read Rich Text Box Content Line By Line
Hi all. I got a rich text box and i wonder how i can read each line of it one by one. For example i want to read each line of it and display it in massage box.
Furthermore, if i have 10 line of content in textbox how i can refrence each line and display it in massage box?
I be happy if some one show me how this can be done.Thanks
Run Time Error When Read File Line By Line
I'm trying to read a txt file line by line that I can stop reading at any place I want.
Below is the code:
VB Code:
Do While Not EOF(1) Line Input #1, fString Text1.Text = Text1.Text + fString + vbCrLfLoop
The problem is, if the txt file has empty lines at the end of it, it will have run time error : "Input past end of file".
Does anyone know how to solve this problem?
Thanks in advance!
Read Line By Line Problem && Question
have a text file that I need to read line by line. This text file is very large (upwards of 1.5GB). The problem with this is that the lines are not separated by normal vbCRLFs but by Unix line feeds which means I can't use the normal Open Blah as #1.
I have tried reading the file in and changing the vbLF to vbCRLF which works for small files and even putting the thing into an array and splitting on the vbLF, but it just won't work. The file is so large that I can't just read the whole thing into memory because it will kill the system.
I know other people may have experienced this because this is an Apache web log and I am hoping someone has some insight or knows of another way or even a custom ReadLine Function that is out there that someone else has built to solve this.
Thanks in advance.
How To Read Text File Line By Line?
Dears Friends,
I am coding a program to read emails.
Is there a way to read the email body text line by line ? if not possible, how can I set the bodytext to a text file and use that text file to read line by line?
Here is my psuedocode for reading email line by line:
With .bodytext
Loop from line 1 to EOF
If line x has string "Hello" then
If line x + 1 has "Money" then
forward this to youare@somewhere.com
end if
end if
End loop
End with
Here is my psuedocode for set .bodytext to file.
dim sFirststring as string
dim sSecondstring as string
With .bodytext
save the .bodytext to a file name A.txt
sFileName = " C:A.txt"
Open sFileName For Input As #1
Do Until EOF(1)
Input#1, sFirststring, sSecondstring
If Mid(sFirststring, 1, 1) = "Hello" Then
If Mid(sSecondstring, 1, 1) = "Money" Then
forward this to youare@somewhere.com
End IF
End If
Loop
Thanks,
Bil
Read Line By Line Problem && Question
I have a text file that I need to read line by line. This text file is very large (upwards of 1.5GB). The problem with this is that the lines are not separated by normal vbCRLFs but by Unix line feeds which means I can't use the normal Open Blah as #1.
I have tried reading the file in and changing the vbLF to vbCRLF which works for small files and even putting the thing into an array and splitting on the vbLF, but it just won't work. The file is so large that I can't just read the whole thing into memory because it will kill the system.
I know other people may have experienced this because this is an Apache web log and I am hoping someone has some insight or knows of another way or even a custom ReadLine Function that is out there that someone else has built to solve this.
Thanks in advance.
Read Text File Line-By-Line
I need to take a text file, read it line by line, and put certain lines into an array...
I need some help on the reading line by line part...
Can anyone steer me in the right direction? I don't need to read it all into an array, just 1 line at a time, and if the line meets certain criteria, put THAT LINE in an array...(I can handle the "if it meets certain criteria" part...)
Thanks!!
How To Read 1st Variable Line By Line From A .txt File
1st question. Is it easier if I use a database I assume?
Say for example I have a file named test.txt which looks like this
"Test1"
"Tst2"
"tt3"
And I do a search for "Tst2" how would I go through file to find that?
Open test.txt for input #1
white not EOF(1)
????
I am totally lost here. And are there any thorough tutorials online for visual basic 6 or a GOOD quality book that would touch on things like this an DBGrid's? The only one I have is too basic.
Thanks in advance and I apologize for the question but I can't find a resolution anywhere.
Open File And Read Line By Line
how would i open a file and read line by line?
i have it opening and reading this way
FNum = FreeFile()
Open fileIn For Binary Access Read As #FNum
FBuf = Space$(LOF(FNum))
Get #FNum, , FBuf
correction = FBuf
Close #FNum
but i want to be able to read each sentence at a time and for there to be a loop for the whole text file that goes through sentence by sentence
the file looks like this
<blah blah blah>
<blah blah blah>
...
basically i want to read each <blah blah blah> at a time
Any ideas??
Read A File Line By Line
Hi,
I am making a program to read from a file and write to another. I have done following:
--------------------------------------------
Dim strRead As String
Open "abc.txt" For Input As #1
Open "abcen.enc" For Output As #2
Do While NOT EOF(1)
Input #1, strRead
Write #2, strRead
Loop
Close #2
Close #1
---------------------------------------------
But, it read only the first line of the source file and writes it too. How will it come to next line till the EOF.
Read String Line By Line
if the original string is
aaaa
bbbb
cccc
dddd
eeee
ffffff
if i want to convert it as
a(1) = aaaa
a(2) = bbbb
a(3) =cccc
a(4) = dddd
sorry for a naive question !
Read TXT Line By Line From Website
I know how to read line by line from a txt file on my computer, but what about reading line by line of a txt file on a website? (www.website.com/example.txt)
How To Read Text And Use It Line By Line
Hallo everyone,
I need help if its not so hard.
I am in a challenge site and one mission is to make a brute forcer
for a page like this www.site.com/../../../password=
I need a part of this project
So...
1) how can i make a button to read a .txt file and pass it into a listbox or anything else (excel or sth i dont know) in the form?
And after that
2) how can i make the program read the listbox line by line?
Thanks in advance for your time.
Greets
Read Txt File Line By Line
Have a txt file and i want to read line by line...
Only a prob. the dimension is 49 mb !!!!
EXistis a best way to read in very fast time?
HELP!
Read File Line By Line And...
I want the user to be able to write like http://www.google.com in one
textBox and Google in an other textBox.
Than I want the user to press a button when done. The text will then be past
like http://www.google.com,Google in to a file.
I want the user to be able to send as many links with names as they want to
that file. Then I want my program to be able to read from that file as I
start the program from a button at my form and use it in the program.
I am using MS Agent and I want the user to be able to write down links like
i described and then when I start the agent I want the agent to "build"
this:
All the names the user wrote:
Merlin.Commands.RemoveAll
Merlin.Commands.Add "Google", "Google", "Google"
Merlin.Commands.Add "Lunarstorm", "Lunarstorm", "Lunarstorm"
Merlin.Commands.Add "Back", "Back", "Back"
Merlin.Commands.Add "Forward", "Forward", "Forward"
Merlin.Commands.Add "Close", "Close", "Close"
The Names and the URL the user wrote down:
Select Case UserInput.Name
Case "Google"
URL= "http://www.google.se"
objInternet.Navigate Adress
Case "Lunarstorm"
URL= "http://www.lunarstorm.se"
objInternet.Navigate Adress
Case "Back"
objInternet.Back
Case "Forward"
objInternet.Forward
Case "Close"
objInternet.Quit
End Select
I want to do something like this:
Read the file line by line split the line at the "," and pot the left and
right string in an array and then go to the next line and add that to the
array as well and so on.
Then I want to use it in the MS Agent as this, to be able to use the links:
(As the Link names is the odd numbers I will just write out the odd
numbers.)
for (i=1, i<= aryLength(aryLink[i]), i=+2)
{
Merlin.Commands.Add "aryLinks[i]", "aryLinks[i]", "aryLinks[i]"
}
Merlin.Commands.Add "Back", "Back", "Back"
Merlin.Commands.Add "Forward", "Forward", "Forward"
Merlin.Commands.Add "Close", "Close", "Close"
Then here it is a little harder, the Case Is the odd numbers in the Array
and the URL is the even numbers.
Select Case UserInput.Name
Case "Google"
URL= "http://www.google.se"
objInternet.Navigate URL
Case "Lunarstorm"
URL= "http://www.lunarstorm.se"
objInternet.Navigate URL
These are not taken from the file:
Case "Back"
objInternet.Back
Case "Forward"
objInternet.Forward
Case "Close"
objInternet.Quit
End Select
As you can see is this not a language that exist... I don't know how to do
it in VB 6 It is not the same as using PHP with mySQL...
I'm a newbe to VB and some other languages as well...So it's all a bit
confusing...
Plz show me in the right direction to get this to work :-)
Read A File Line By Line
What I need to know is, if I had a text file with the following:
Code:
Apples
Bananas
Peaches
How would I get the program to read the first line, put it in a string variable, ead the second line, place it in another string variable, and do the same for the third. I know howto read files, but notline by line.
Thanks!
Read Line By Line Of Text File And Move Content To Excel Record By Record
Hi,
i am trying to move the selective information in the text file to Excel sheet record by record using VB.Can u help me in this regard.
The contents in text file is like:
"http://www.commerx.com/contact.html","inforequest@commerx.com"
"http://www.commerx.com/contact.html","ClientSupport@commerx.com"
"http://www.commerx.com/services-intranets.html","intranets@commerx.com"
"http://www.davacosourcing.com/company/","bignews@davacosourcing.com"
"http://www.davacosourcing.com/company/","careers@davacosourcing.com"
.
.
.
.
.
.
The above information need to be moved in Excel sheet record by record as:
http://www.commerx.com/contact.html inforequest@commerx.com
http://www.commerx.com/contact.html ClientSupport@commerx.com
http://www.commerx.com/services-intranets.html intranets@commerx.com
http://www.davacosourcing.com/company/ bignews@davacosourcing.com
http://www.davacosourcing.com/company/ careers@davacosourcing.com
.
.
.
.
..
Please do help in this regard as there are more than 1000 information that has to moved in the above pattern.
Thanx
babu
Copy All Text From Textbox, Open Notepad, And Automatically Paste To New Notepad Shee
Hello everyone.
I am trying to copy all text, that is already in the textbox, to a new notepad sheet.
Example:
Step 1. Copy all text in Text1 box to clipboard.
Step 2. Open Notepad
Step 3. Paste clipboard to notepad.
All this should be done with one click of a button.
I get as far as copying everything to the clipboard, and it even opens up notepad, but I still have to manually paste (CTRL-V) into notepad.
I would even like it to ask me what name to save it as as well as where to save it at...just like the Save As function in Word or something.
Here is what I have so far.
Private Sub cmdCopytoClipboard_Click()
Dim MyAppID
Clipboard.Clear
Clipboard.SetText Text1.Text
MyAppID = Shell("NOTEPAD.EXE", 1)
AppActivate MyAppID
MyAppID = Clipboard.GetText()
End Sub
Notepad To Access,Grid And Back To Notepad
Hi,
i hav a notepad where there are many lines stored in it.
i need it to separate it as each word(; as separtor).
actually there are 50 columns in Access as backend with various datatypes(49 for data and 1 for end of file........two boxes).
so after 50 countings are identified, it is considered as first record. and then data for second record starts.
after saving to the backend Access, i need to view the content in DataGrid(VB6) where editing of records is permitted.so after editing and while saving it to Access,i need the change to be reflected in Notepad also(with the same format as ; as separator between records and two boxes for end of record).
Plz help me to solve this...............its really urgent!!!
NOTE: Attached one.txt for sample and the backend Access table.
How To Read Line 29 From A .txt ?
Hi
I'm trying to figure out how I can read one single line (say for instance line number 29) in an .txt, without opening the entire document. (we are talking about a 10 mb .txt)
Any idea guys ?
- Preben
|