Multiple text files
Hey I have an issue and I'm hoping Java can help me.
Currently at work we have a list of text files in a directory, I want java to be able to:
open every file in the directory (file names can change daily)
append every line beginning with a number to one file
in this file I want the sum of all footer lines (lines begin with a F) added to the end of the new text file.
Is this possible in Java or is there a better program out there?
any tips onthis would be great too as I'm trying to learn java.
Regards
Chris
tscw1 wrote:
Is this possible in JavaYes.
or is there a better program out there?Not really. Either way you have to do some programming.
any tips onthis would be great too as I'm trying to learn java.[http://www.google.com/search?q=learn+java]
Similar Messages
-
Setting Font for converting multiple text files into PDF using VB 6.0
Dear All,
Am converting multiple text files into PDF using VB6.0. Currently, am unable to control the font face and size for the generated files. Below is the procedure am using for each file;
Public Sub proc_convert_to_PDF(srcFilename As String, destFilename As String)
Dim p_AcroApp As CAcroApp
Dim p_VDoc As CAcroAVDoc
Dim p_DDoc As CAcroPDDoc
Dim IsOk As Boolean
Set p_AcroApp = CreateObject("AcroExch.App")
Set p_VDoc = CreateObject("AcroExch.AVDoc")
Call p_VDoc.Open(srcFilename, "")
Set p_VDoc = p_AcroApp.GetActiveDoc
If p_VDoc.IsValid Then
Set p_DDoc = p_VDoc.GetPDDoc
' Fill in pdf properties.
p_DDoc.SetInfo "Title", Format(Date, "dd-mm-yyy")
p_DDoc.SetInfo "Subject", srcFilename
If p_DDoc.Save(1 Or 4 Or 32, destFilename) <> True Then
MsgBox "Failed to save " & srcFilename
End If
p_DDoc.Close
End If
'Close the PDF
p_VDoc.Close True
p_AcroApp.Exit
'Clear Variables
Set p_DDoc = Nothing
Set p_VDoc = Nothing
Set p_AcroApp = Nothing
End Sub
What I need;
1) to be able to set the font face of the destination file ( destFilename)
2) to be able to set the font size of the destination file ( destFilename)
Am using Adobe Acrobat 7.0 Type Library
Kindly Help.
Thanks in advanceWe didn't say it doesn't work. We said it isn't supported.
There are a number of other ways to make a PDF. The one which would
give the most control is if your application directly printed to GDI,
controlling the font directly. This could print to Adobe PDF.
You could look for an application that gives control of font for
printing.
You could use a text-to-PostScript system and distill the result. You
could even look for a non-Adobe text-to-PDF.
Working in the unsupported and dangerous world you chose, the font
size for text conversion is set (and this is very bad design from
Adobe) in the settings for Create PDF > From Web Page. There is no API
to this.
Aandi Inston -
Generating multiple text files.
Dose anyone know how to output multiple text files using XSLT.
Dear Rony,
I am facing the same problem, have u got the sollution. if u resoled please let me know.
requesting you
Thanks&Regards
Srini -
Read multiple text files and sort them
I am trying to read multiple text files and store the data from the file in vector.
but for days. I am with no luck. anyone can help me out with it? any idea of how to sort them will be appreciated.
Below is part of the code I implemented.
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
public packet(int timestamp0,int user_id0, int packet_id0,int packet_seqno0, int packet_size0)
timestamp = timestamp0;
user_id=user_id0;
packet_id=packet_id0;
packet_seqno=packet_seqno0;
packet_size=packet_size0;
public void setTime(int atimestamp)
this.timestamp=atimestamp;
public void setUserid(int auserid)
this.user_id=auserid;
public void setPacketid(int apacketid)
this.packet_id=apacketid;
public void setPacketseqno(int apacketseqno)
this.packet_seqno=apacketseqno;
public void setPacketsize(int apacketsize)
this.packet_size=apacketsize;
public String toString()
return timestamp+"\t"+user_id+"\t"+packet_id+"\t"+packet_seqno+"\t"+packet_size+"\t";
}Here is the data from part of the text files. ( the first column is timestamp, second is userid, third is packetid.....)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512Here's a standard idiom for object-list-sorting:
/* cnleafdata.txt *********************************************
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
import java.util.*;
import java.io.*;
public class Packet implements Comparable<Packet>{
private int timeStamp;
private int userId;
private int packetId;
private int packetSeqno;
private int packetSize;
public Packet(int timeStamp0, int userId0, int packetId0,
int packetSeqno0, int packetSize0) {
timeStamp = timeStamp0;
userId = userId0;
packetId = packetId0;
packetSeqno = packetSeqno0;
packetSize = packetSize0;
public Packet(String timeStamp0, String userId0, String packetId0,
String packetSeqno0, String packetSize0) {
this(Integer.parseInt(timeStamp0), Integer.parseInt(userId0),
Integer.parseInt(packetId0), Integer.parseInt(packetSeqno0),
Integer.parseInt(packetSize0));
public Packet(String[] a){
this(a[0], a[1], a[2], a[3], a[4]);
public void setTime(int aTimeStamp){
timeStamp = aTimeStamp;
public void setUserId(int aUserId){
userId = aUserId;
public void setPacketId(int aPacketId){
packetId = aPacketId;
public void setPacketSeqno(int aPacketSeqno){
packetSeqno = aPacketSeqno;
public void setPacketSize(int aPacketSize){
packetSize = aPacketSize;
public int getUserId(){
return userId;
public String toString(){
return String.format
("%2d %2d %2d %2d %4d", timeStamp, userId, packetId, packetSeqno, packetSize);
public int compareTo(Packet otherPacket){
return userId - otherPacket.getUserId();
/* main for test */
public static void main(String[] args){
String line;
ArrayList<Packet> alp;
alp = new ArrayList<Packet>();
try{
BufferedReader br = new BufferedReader(new FileReader("cnleafdata.txt"));
while ((line = br.readLine()) != null){
// if (! recordValid(line)){
// continue;
String[] ar = line.split("\\s");
alp.add(new Packet(ar));
catch (Exception e){
e.printStackTrace();
System.out.println("[original]");
for (Packet p : alp){
System.out.println(p);
System.out.println();
Collections.sort(alp);
System.out.println("[sorted by user ID]");
for (Packet p : alp){
System.out.println(p);
} -
Scheduling multiple tab BO XI3 report needs to save into multiple text file
Hi,
I have BO XI 3 Desktop Intelligence reports, those reports contains multiple tabs. Once after scheduling these reports the output needs to save as different text files (each tab as separate text file). Generally when select output as text file we will get the text file with the data of current tab, but in this scenario I want all the tabs data into different text files. I guess we can do this with macro. But I am not good in macro development, hope somebody can help me.
Could you please help out for the same!
Thanks,
RamaThanks Dan.. I made chenges in code as per your suggestion.. its working fine in DeskI -> local PC
But this is not working in InfoView level... when i scheduled the same report its not saving into multiple text files... can you please have look...
macro code as follows:-
Public Sub SaveAsText()
Dim StrTxtPath As String
Dim BusDoc As busobj.Document
Set BusDoc = ThisDocument
Dim BusRep As Report
Dim I As Integer
On Error GoTo ErrHandler
'StrTxtPath = "
xxxx.xxx.xxx.com\common\Reporting\"
StrTxtPath = "D:\Business Objects\Test_Macro\"
For I = 1 To BusDoc.Reports.Count
Set BusRep = BusDoc.Reports.Item(I)
BusRep.ExportAsText (StrTxtPath & BusRep.Name)
Next I
ErrHandler:
Exit Sub
End Sub
When i run this macro through DeskI.. its saving the report as multiple .txt files with respective number of tabs... but the same thing is not working when i tried in scheduling...
Can you please suggest me what are the changes needs to be done...
Thanks in Advance
Thanks,
Rama -
I don't know if anyone else has experienced this, but often, when I want to place multiple Word files, it places the same text.
Even just now, I changed my preferences to link to the files so I can see the name of the file I was placing in the Links palette, and if I look at articles 35 and 37 for example, the link is to the right file but the text imported is exactly the same (text from article 35). Even article 39 has the text from 35. But others are fine and have the right text imported.
A while ago when I first experienced this, I realised that if I checked Show import options in the Place dialog box, it would actually import all the different texts, but it didn't seem to work this time. Maybe I clicked OK too fast at each of the Import options dialog boxes (quite annoying actually, I just don't see why it has to come up for every file, once is enough).
Any idea how to fix this?
The place multiple feature is great, but only if it works correctly.A shortcut to perhaps the prolem is to go "around" the live-edit workflow and just focus on the .indd file.
Take a look att this plug-in, http://www.ctrl-ps.com/products/ctrlcrosstalk -
How to i read multiple text files one bye one
hi all
I need to select the text files multiple times and read files one by one
some how i managed to select the one text file and scan the data in the text file
i need to do this for mutiple files at the same time
please help me
Solved!
Go to Solution.gowthamggk wrote:
i sucessfully reading one text file through this VI
but as like this .. i need for multiple files
Why are you not using For loop???
gowthamggk wrote:
also shld read the text line by line
You can right click the 'Read from Text File' function and select 'Read Lines'. Refer to below code snippet.
I am not allergic to Kudos, in fact I love Kudos.
Make your LabVIEW experience more CONVENIENT. -
Use splitter to create multiple text file
Hello I have one view as source and would like to create multiple target text files based on different condition. What I am doing is that I am using SPLITTER which contain one INGRP1 and three OUTGRP( nameley TR1, TR2 and TR3) and one default REMAINING_ROWS ( what is the purpose of the REMAINING_ROWS?). So I mapped view to INGRP1 of the splitter and then added the different SPLITT condition in the condition wizard, for example :
for TR1
COMMISSION_TYPE='P' and
rownum <= 65000
for TR2
COMMISSION_TYPE='P' and
rownum > 65000
and for TR3
COMMISSION_TYPE='A'
After this since I have to create 3 comma delimted text files, I have used 3 expression for each individual splitt condition. In the expression what I am doing is that I am just concating all the fileds and then output of each expression goes to three different text files.
When I am deploying the mapping, it is coming up several errors such as :
1): PLS-00201: identifier 'COMMISSION_TYPE' must be declared
(2): PL/SQL: Statement ignored
(3): PLS-00201: identifier 'COMMISSION_TYPE' must be declared
(4): PL/SQL: Statement ignored
(5): PLS-00201: identifier 'COMMISSION_TYPE' must be declared
(6): PL/SQL: Statement ignored
(7): PLS-00201: identifier 'START_INDEX' must be declared
(8): PL/SQL: Statement ignored
(9): PLS-00201: identifier 'T_EXPR_ASSET_1_OUTPUT_ASSET$0' must be declared
(10): PL/SQL: Item ignored
(11): PLS-00201: identifier 'T_ROWKEY_SPLIT_2' must be declared
(12): PL/SQL: Item ignored
(13): PLS-00201: identifier 'T_CPPASSET_0_OUTPUT_ASSET$0' must be declared
(14): PL/SQL: Item ignored
(15): PLS-00801: internal error [21076]
(16): PL/SQL: Item ignored
(17): PLS-00801: internal error [21076]
(18): PL/SQL: Item ignored
(19): PLS-00801: internal error [21076]
(20): PL/SQL: Item ignored
Why I am getting these errors, why OWB generated code could not identify COMMISSION_TYPE filed?
Please help me.
SuhailI am really very very sorry, its my fault. I was not mapping COMMISSION_TYPE from view to splitter.
-
How do I create multiple text files from a list in another file?
I have a text file with data in it:
1. Bristol
2. Bath
3. Exeter
etc
I want to run an action which outputs the following files:
1.txt (contents: 1 Bristol)
2.txt (contents: 2.Bath)
3.txt (contents: 3.Exeter)
I can't work ou how to do this, any help appreciated. Thanks
DaveHi mate, thanks for the suggestion. I saw that section in the user guide - but it is only for copying from one library to another - I want to copy from an FCP library to a file structure OUTSIDE FCP. I have had problems with FCP losing media when copying to another library so I just want the files in the Finder where I can see them...
Stephen -
Write data to multiple text files after specific size
Hello,
I wrote a code that contineously writes data to a text file. The problem is I am running this VI for long time and therefore this text file is being bigger in size e.g. more than 10MB. I want to split writing data in this text file after max 1MB size. Can anyone help ????
thanks in advance.CMW.. wrote:
You could use the "File/Directory Info Function" in the Advanced File VIs and Function palette to check the size. If the file is too big. close it and create a new one.
I would use the Get File Position since this won't cause Windows to have to do so much. Assuming you are just writing and not setting the file position manually, this will return the size of the file in bytes (file position will always be at the end of the file).
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Looping Multiple Text files in SSIS
Hi,
I have a requirement in which i have 100 text files having one row each in it. Now i need to load Each row of data into a SQL table using SSIS and i dont want to stop the package even though it fails for any reason ( like inapporiate Data something like
that ). How can i configure the SSIS package with error handling.. Please guide me on this..!
Thanking you in advance..!
Balaji - BI DeveloperIf you have pre-2014 SSIS, you have to loop through all the files in a folder.
http://www.sqlis.com/sqlis/post/Looping-over-files-with-the-Foreach-Loop.aspx
http://www.mssqltips.com/sqlservertip/2874/loop-through-flat-files-in-sql-server-integration-services/
Now, in 2014, you can do this same thing, and do it even easier than what's mentioned in the links above.
http://www.dotnetfunda.com/articles/show/1196/looping-through-all-the-files-in-a-folder-and-loading-data-to-sql-ssis
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
Hi! I've got several archived text files - 040107.txt,
040207.txt, 040307.txt, for example - and I want to be able to
build a dynamic link which loads whichever file is selected into
the Flash movie. This list needs to be able to build itself as I
write new files every day and add the old ones to the archive. I'm
stumped. How can I do this?If you are using XML to load data, then use the CDATA to wrap
the html text.
If you are using LoadVars to load data, be sure you do not
have any & in the text content. If you do convert to hex.
Bottom line is you need to trace the text you load to see
what you are getting.
Flash should show HTML if you have the
TextField.htmll
property set to true which is also done in IDE with "Render Text as
HTML". But you must use the
TextField.htmlText
property to set the text.
Finally malformed HTML in Flash TextFields generally dies
like you describe.
You should be able to test the display of data in dynamic
TextFields with a simple Flash movie containing the TextField and
the text stored in a variable and then loaded into the htmlText
property. If it is not working there then you have to look at the
data. -
Hey!
Does anybody can help me to make an Excel VBA macro code in order to import data from text files into one Excel spread sheet? I want to create User Form with dropdown list where user can select start and end date of interest and macro code
will import bunch of text files depending on user demands... I am thinking to omit time tail (meaning that user can only specify date and I will add filename tail in macro code).
My text files are named: 20130619004948DataLog.txt (meaning: yyyy mm dd hh mm ss). Text file contains recordings for each 15 seconds... It would be great to omit time tail (meaning that user can only specify date) and make additional macro to add the time
tail to the file name, since it does not change from day to day. Text files for one day of interest (I have text files covering whole year):
20130619004948DataLog.txt
20130619014948DataLog.txt
20130619024948DataLog.txt
20130619034948DataLog.txt
20130619044948DataLog.txt
20130619054948DataLog.txt
20130619064948DataLog.txt
20130619074948DataLog.txt
20130619084948DataLog.txt
20130619094948DataLog.txt
20130619104948DataLog.txt
20130619114948DataLog.txt
20130619124948DataLog.txt
20130619134948DataLog.txt
20130619144948DataLog.txt
20130619154948DataLog.txt
20130619164948DataLog.txt
20130619174948DataLog.txt
20130619184948DataLog.txt
20130619194948DataLog.txt
20130619204948DataLog.txt
20130619214948DataLog.txt
20130619224948DataLog.txt
20130619234948DataLog.txtI am pretty sure this same question was asked about 2 weeks ago, and that one never got an answer. How about this?
Sub Read_Text_Files()
Dim sPath As String
Dim oPath, oFile, oFSO As Object
Dim r, iRow As Long
Dim wbImportFile As Workbook
Dim wsDestination As Worksheet
'Files location
sPath = "C:\Test\"
Set wsDestination = ThisWorkbook.Sheets("Sheet1")
r = 8
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oPath = oFSO.GetFolder(sPath)
Application.ScreenUpdating = False
For Each oFile In oPath.Files
If LCase(Right(oFile.Name, 4)) = ".txt" Then
'open file to impor
Workbooks.OpenText Filename:=oFile.Path, Origin:=65001, StartRow:=1, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True
Set wbImportFile = ActiveWorkbook
For iRow = 1 To wbImportFile.Sheets(1).UsedRange.Rows.Count
wbImportFile.Sheets(1).Rows(iRow).Copy wsDestination.Rows(r)
r = r + 1
Next iRow
wbImportFile.Close False
Set wbImportFile = Nothing
End If
Next oFile
End Sub
Or, this.
Sub TxtImporter()
Dim f As String, flPath As String
Dim i As Long, j As Long
Dim ws As Worksheet
Application.DisplayAlerts = False
Application.ScreenUpdating = False
flPath = ThisWorkbook.Path & Application.PathSeparator
i = ThisWorkbook.Worksheets.Count
j = Application.Workbooks.Count
f = Dir(flPath & "*.txt")
Do Until f = ""
Workbooks.OpenText flPath & f, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
Space:=False, Other:=False, TrailingMinusNumbers:=True
Workbooks(j + 1).Worksheets(1).Copy After:=ThisWorkbook.Worksheets(i)
ThisWorkbook.Worksheets(i + 1).Name = Left(f, Len(f) - 4)
Workbooks(j + 1).Close SaveChanges:=False
i = i + 1
f = Dir
Loop
Application.DisplayAlerts = True
End Sub
That's just a generic sample. So, basically, I'd modify the code like this.
Sub TxtImporter()
Dim f As String, flPath As String
Dim i As Long, j As Long
Dim ws As Worksheet
Application.DisplayAlerts = False
Application.ScreenUpdating = False
'flPath = ThisWorkbook.Path & Application.PathSeparator
flPath = "C:\Users\Ryan\Desktop\Dates\"
i = ThisWorkbook.Worksheets.Count
j = Application.Workbooks.Count
f = Dir(flPath & "*.txt")
VAL1 = ThisWorkbook.Sheets("Sheet1").Cells(1, 1).Value
VAL2 = ThisWorkbook.Sheets("Sheet1").Cells(1, 2).Value
f = Left(f, 8)
If f = VAL1 And f = VAL2 Then
Do Until f = ""
Workbooks.OpenText flPath & f, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
Space:=False, Other:=False, TrailingMinusNumbers:=True
Workbooks(j + 1).Worksheets(1).Copy After:=ThisWorkbook.Worksheets(i)
ThisWorkbook.Worksheets(i + 1).Name = Left(f, Len(f) - 4)
Workbooks(j + 1).Close SaveChanges:=False
i = i + 1
f = Dir
Loop
End If
Application.DisplayAlerts = True
End Sub
That will NOT work, because I don't know how you want to handle the time and 'DataLog.txt' part of the file name. Just decide what you want to do with that part of it, and modify the code appropriately.
Also, I'm assuming the dates (without times) are in A1 and B1 in Sheet1.
I think this gets you 99% of the way there. Post back if you have specific questions.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
Reading multiple text files and writing them to one text file
Hi,
I'm trying to read a number of text files and write them to a single master file. My program reads all the files but only writes the last one to the master file.
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
// Input/Output Classes
import java.util.Scanner;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import java.awt.GridLayout;
public class Actor implements ActionListener
public static String DataRoot = "I:\\JAVA\\UBP\\DAT
public static JFrame SW = new JFrame();
public static JTextField txtSPath;
public static JTextArea txtTable;
public void actionPerformed( ActionEvent e )
String Command = e.getActionCommand();
if (Command.equals("Process") )
SetupWin();
ProcessAll();
public void SetupWin()
SW.setTitle("void");
SW.setSize(300,400);
SW.setLayout(new GridLayout(6,1));
txtSPath = new JTextField(40); SW.add(txtSPath);
txtTable = new JTextArea(10, 40); SW.add(txtTable);
SW.setVisible(true);
public void ProcessAll()
Process("Dunstable","Finance");
Process("Dunstable","Production");
Process("Dunstable","Sales");
public void Process(String Town, String Dept)
String SPath = DataRoot + Town + "
" + Dept + ".txt";
String MPath = DataRoot + "masterFile" + ".txt";
txtSPath.setText(SPath);
String message = "Trying " + SPath;
System.out.println(message);
String SlaveTable=message;
try// if following fails an exception is thrown
Scanner Slave = new Scanner(new FileInputStream(SPath)); // reads slave file
PrintWriter outputStream = null;
outputStream = new PrintWriter(new FileOutputStream(MPath));
while ( Slave.hasNextLine() ) // reads text line by line
//Read and output next record
String PartRecord = Slave.nextLine();
String FullRecord = Town + " " + PartRecord;
System.out.println(FullRecord);
outputStream.println(FullRecord);
Slave.close();
outputStream.close();
txtTable.setText(SlaveTable);
//An Exception Error would be THROWN by above & CAUGHT below
catch(FileNotFoundException e)
message = "Could Not Find " + SPath;
System.out.println(message); //console
txtSPath.setText(message); //window
catch(IOException e)
System.out.println("Slave I/O Problem " + SPath);
}Edited by: Ardour on Mar 4, 2008 1:53 PMI haven't looked closely, but my spidey sense tingles at this:
new FileOutputStream(MPath)This will clobber (erase) the previous contents of the file. Open in append mode:
new FileOutputStream(MPath, true)Of course, if the file exists before you run this code, you will end up append to the original contents. If that is not wanted, consider using File's delete method first. -
Average Data from multiple text files
I am new to labVIEW hence a little help is appreciated:
I have a 100 txt files with two columns (tab separated) for X and Y value.
I need to average the Y values to generate one single txt file and generate X versus Y graph.
So how do I read the data from these text files? (without having to select each one of them individually) and how to average the data and create a XY graph from it?
Thanks in advance
Solved!
Go to Solution.Use X-Y Graph.
You were able to get two arrays of X and Y points from text file right?
Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved. -
VBScript for parsing multiple text files
Hi,
I have around 175 text files that contain inventory information that I am trying to parse into an Excel file. We are upgrading our Office platform from 2003 to 2010 and my boss wants to know which machines will have trouble supporting it. I found a script
that will parse a single text file based upon ":" as the delimiter and I'm having trouble figuring out how to change it to open an entire folder of text files and write all of the data to a single Excel spreadsheet. Here is an example of the text
file I'll be parsing. I'm interested in the "Memory and Processor Information" and "Disk Drive Information" sections mainly.
ABEHRENS-XP Computer Inventory
OS Information
OS Details
Caption: Microsoft Windows XP Professional
Description:
InstallDate: 20070404123855.000000-240
Name: Microsoft Windows XP Professional|C:\WINDOWS|\Device\Harddisk0\Partition1
Organization: Your Mom
OSProductSuite:
RegisteredUser: Bob
SerialNumber: 55274-640-3763826-23029
ServicePackMajorVersion: 3
ServicePackMinorVersion: 0
Version: 5.1.2600
WindowsDirectory: C:\WINDOWS
Memory and Processor Information
504MB Total memory HOW CAN I PULL THIS WITHOUT ":" ALSO
Computer Model: HP d330 uT(DG291A)
Processor: Intel(R) Pentium(R) 4 CPU 2.66GHz
Disk Drive Information
27712MB Free Disk Space ANY WAY TO PULL THIS WITHOUT ":"
38162MB Total Disk Space
Installed Software
Here is the start of the script I have so far. . .
Const ForReading = 1
Set objDict = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Test\test.txt" ,ForReading)
WANT THIS TO BE C:\Test
Do Until objTextFile.AtEndOfStream
strLine = objTextFile.ReadLine
If Instr(strLine,":") Then
arrSplit = Split(strLine,":") IS ":" THE BEST DELIMITER TO USE?
strField = arrSplit(0)
strValue = arrSplit(1)
If Not objDict.Exists(strField) Then
objDict.Add strField,strValue
Else
objDict.Item(strField) = objDict.Item(strField) & "||" & strValue
End If
End If
Loop
objTextFile.Close
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intColumn = 1
For Each strItem In objDict.Keys
objExcel.Cells(1,intColumn) = strItem
intColumn = intColumn + 1
Next
intColumn = 1
For Each strItem In objDict.Items
arrValues = Split(strItem,"||")
intRow = 1
For Each strValue In arrValues
intRow = intRow + 1
objExcel.Cells(intRow,intColumn) = strValue
Next
intColumn = intColumn + 1
Next
Thank you for any help.You are The Bomb.com! I had to play around with it to pull some additional data (model and processor) and then write a quick macro to remove the unwanted text and finally I wanted the data to write in columns instead of rows so this is what I ended up with:
Option Explicit
Dim objFSO, objFolder, strFolder, objFile
Dim objReadFile, strLine, objExcel, objSheet
Dim intCol, strExcelPath
Const ForReading = 1
strFolder = "c:\Test"
strExcelPath = "c:\Test\Inventory.xlsx"
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
intCol = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
For Each objFile In objFolder.Files
intCol = intCol + 1
Set objReadFile = objFSO.OpenTextFile(objFile.Path, ForReading)
Do Until objReadFile.AtEndOfStream
strLine = objReadFile.ReadLine
If (InStr(strLine, "Computer Inventory") > 0) Then
objSheet.Cells(intCol, 1).Value = Left(strLine, InStr(strLine, "Computer Inventory") - 2)
End If
If (InStr(strLine, "Total memory") > 0) Then
objSheet.Cells(intCol, 2).Value = Left(strLine, InStr(strLine, "Total memory") - 2)
End If
If (InStr(strLine, "Computer Model:") > 0) Then
objSheet.Cells(intCol, 3).Value = (strLine)
End If
If (InStr(strLine, "Processor:") > 0) Then
objSheet.Cells(intCol, 4).Value = (strLine)
End If
If (InStr(strLine, "Total Disk Space") > 0) Then
objSheet.Cells(intCol, 5).Value = Left(strLine, InStr(strLine, "Total Disk Space") - 2)
End If
If (InStr(strLine, "Free Disk Space") > 0) Then
objSheet.Cells(intCol, 6).Value = Left(strLine, InStr(strLine, "Free Disk Space") - 2)
End If
Loop
Next
objExcel.ActiveWorkbook.SaveAs strExcelPath
objExcel.ActiveWorkbook.Close
objExcel.Quit
Thanks again!
Hi ,
I am have very basic knowledge about VB scripting, but this code could be the perfect solution i am looking for. could you guide me exactly how to run and test the same , i would be really thankful for your kind and generous support on this.
Thanks ,
Veer
Maybe you are looking for
-
Import: 8.1.6 to 8.1.5
Is it possible to import an export from a version 8.1.6 database (NT) into a version 8.1.5 database(UNIX)? Below are the results of my attempts: Connected to: Oracle8i Enterprise Edition Release 8.1.5.0.0 - Production With the Partitioning and Java o
-
Windows handle of the Main Window of the SAPGUI
Hi experts, i need to have the window handle value of the window of the Main MDI window of the SAP GUI from ABAP, does anyone know a FunctionModule or something like this to retrieve this information? I need to retrieve information about the geometry
-
Configuring Apach(ORA-12705: Cannot access NLS data files .. )
Hello, I receive this error while configure an HTTP Server for Oracle XE Database. ORA-604 LogOn ORA-00604: error occurred at recursive SQL level 1\nORA-12705: Cannot access NLS data files or invalid environment specified The database NLS parameters
-
Cannot install fcp because of lack of rights
Although I am the only user on my MacBookPro I cannot enter and store the serial upon installation of FCP. I am repetedly told that I do not have sufficient user rights for this. So FCP is installed, asks for a serial upon start and quits because of
-
Who is using AIFF or Apple Lossless (ALAC) files on iTouch?
Those that use AAC files, kindly do not respond. I am tracking a possible bug. I am trying to get an idea of who listens to the high quality files on their Touch. If you do, please tell me if you hear anything strange in the high frequency range of t