Lowyat.NET Forums

Welcome Guest ( Log In | Register )

 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> Open muitiple text files with Notepad at once, Which is the best way to do it?

terrylau
post Jul 2 2009, 11:08 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #1


Newbie
*

Group: Junior Member
Posts: 33
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Aug 2005





Is it possible to select all text files and open them simultaneously using Notepad? In windows we can do that by going into the selected folder, highlight all the text files and right-click Open, and all the files will be open at once in separate Notepads.

I know it's possible to read all the content of the files and write them into a single text file - but that'll be the last option if there's no way for me to do this.

I guess the flow of the process shud be something like this :

Iterate in folder until all the text files finished (no matter what the quantity of the text files)
For every file found, launch a Notepad to open it

Need your suggestion guys, as I'm still new to VB. Would appreciate it if have some code snippets to start me off. If VB is not suitable, try to suggest other alternatives - batch, perl, C/C++, etc.

Thanks.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
everling
post Jul 2 2009, 01:22 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #2


Enthusiast
*****

Group: Senior Member
Posts: 778
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2008




Unless there's some specific need for scripts or programs to do it, I think using Windows Explorer, selecting the desired files and hitting enter is the best.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dkk
post Jul 3 2009, 06:30 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #3


Casual
***

Group: Junior Member
Posts: 471
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003




Is there a reason you must use Notepad? Text editors (notepad replacement) can open multiple files, each in their own separate tab. Exactly as you described. No need for any VB programming. I use ConTEXT.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
terrylau
post Jul 3 2009, 09:21 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #4


Newbie
*

Group: Junior Member
Posts: 33
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Aug 2005





QUOTE(dkk @ Jul 3 2009, 07:30 AM)
Is there a reason you must use Notepad? Text editors (notepad replacement) can open multiple files, each in their own separate tab. Exactly as you described. No need for any VB programming. I use ConTEXT.
*



Ic... I think any text editors programs that opens multiple files will do. If that is the case, how do I go about it creating the batch file?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
tan_pang
post Jul 5 2009, 12:22 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #5


Look at all my stars!!
*******

Group: Senior Member
Posts: 3,038
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jun 2005





QUOTE(terrylau @ Jul 3 2009, 09:21 AM)
Ic... I think any text editors programs that opens multiple files will do. If that is the case, how do I go about it creating the batch file?
*


CODE
for %%a in (*.txt) do (notepad %%a)

I only can think of this... But it only open the next text file after the current open text file been closed... sad.gif

I do have another one, which is in VBScript
CODE
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set folder = objFSO.GetFolder(".")
Set files = folder.Files

For Each file in files
filteringText = Split(file.Name, ".")
filteredText = filteringText(UBound(filteringText))

If filteredText = "txt" Then
 objShell.Run "notepad " & file
End If
Next

This will open all the text file in Notepad at once.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 25th November 2009 - 01:19 PM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)