Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Getting Row From CSV File?


Is there a way to retrieve the row number from accessing a CSV file? below is the snippit of the coding im using to access the files:

Code:
   Dim DB As Database
   Dim RS As Recordset
   Dim StrSQL As String
   Dim ao As Currency
   Dim sa As Currency
   Dim ti As Integer
 Debug.Print "listitem stats started..."
   StrSQL = "SELECT Buyer, [Order ID] as orderID, [Sale Amount] AS Sale, [Artist Owed] AS Owed FROM buyers.csv WHERE item = '" + lsItem + "'"

   Set DB = OpenDatabase("d:dataread", False, False, "Text;")
   Set RS = DB.OpenRecordset(StrSQL, dbOpenDynaset)

   IR_Buyers.Clear
   IR_BuyersID.Clear
   Do While Not RS.EOF
      IR_Buyers.AddItem RS!Buyer
      IR_BuyersID.AddItem RS!OrderId
      ao = ao + RS!owed
      sa = sa + RS!Sale
      ti = ti + 1
      RS.MoveNext
   Loop

   RS.Close
   DB.Close



The OrderID proved not to be unique for each item, but a single number assigned to all items purchased in that order. I'm looking for a way to retrieve the row where the current item is so that I can do a query to get additional information from that record. Any ideas on how to go about getting the Row the item on?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Import Csv File In Vb Without Converting Csv File Into Text Or Excel File.
i have to import data of csv file in vb.i had converted csv file into text or excel and then imported the data from text or excel file.But i want to import data of csv file without conveting it into excel or text file.

thanks for help in advance.

File Support With My App (clicking On A File Opens The Program And Then The File)
Hey peeps , i am wondering how to create a program that has supports files , with this i mean double clicking on a icon make my program run itself and then open the file , how to do this?

How To Install A Dll File By Executing A Batch File Or Vb Script File
how to installed a dll using regsrv32 without manually type .i would like to installed it using a batch file or vb script file . can anyone show me how to do it.



 

Show The File Properties Of File In The File List Box.
Hai, guys. I need some help here. i got a file list box that show the contain of a folder. The folder contain wave file. The file list box display the file name of the file contained in the folder. What i need is the file list box to show the time and data properties of the file. some like this:

WaveFile 001 31/01/2002 13:03.

here is my code for the file list box:

Private Sub File1_Click()
File1.Path = "C:VMBVoice"
strFile = File1.Path & "" & File1.FileName
End Sub

Private Sub Form_Load()
File1.Path = "C:VMBVoice"

End Sub

Private Sub Timer1_Timer()

File1.Refresh
End Sub

This is some thing like when we set the file views in Window explorer to details, window explorer will display the time and date of the file. can i do the same with file list box. Pls provide some help and code sample. Thanks And Have A Nice Days.

Copy File A To File B(TEMP FILE)
Can any of you GURU's send me a snippet that copies my actual file to a TempFile
, also a code that removes it (The original) from my App.Path.
and copies my temp back to my original

file_a(original)-->file_b (tmp file)
file_b(tmp file)-->a(original)

thanks

How To Make The VB6 Setup File Into One File?Like Acrobat Reader Setup File
how to make the VB6 setup file into one file?Like Acrobat Reader setup file, just one file only

Reading Text File And Rename File Listed In Text File
Great boards, been browsing for a while but this is my first post.

I'm trying to read from a CSV text file and then renaming an image from said text file.

2 fields in the text file will be used and cycled through, 1 field is an image number: mcc_001.jpg and 1 field will be the new name: 056950-000-002700-00000-2A20051201.JPG

I'm stuck where to start, any help would be greatly appreciated.

Thanks!

Set End Of File Or Convert The VB-file Access Number To A API-file Access Handle
Hi,

I've opened a file with binary access. The size of the file is x.
Now I want to cut the file to get a shorter size (new size < x), but I don't
want to close the file, delete it, create it again and write the shorter content to it. There is a C-API-function SetEndOfFile(), is there any VB-pendant ?

Or how to convert the VB-file access number to a API-file access handle ?

Thanks,
Andy from europe (Germany)

Find File Size Of Remote File Ie Http://www.noteme.com/wokawidget/tickicon.gif
Say there was a file on a web site:

http://www.noteme.com/wokawidget/tickicon.gif

For example.

Is there any VB code that would allow me to find out it's size?
Oh, the SystemFileObject doesn't do remote files, just thought I'd point that out


Woka

Recurse Subfolders To Open 1 Xl File && Copy 1 Wksht To Master Summmary File
Hi all.

I need a bit of help in writing code to recurse sub-folders, open the only XL file in there & copy the master sheet of that file (which has the same name as the sub-folder) to a master summary file.

Here is the over all scenario.

I am the financial manager for a small company and I down load our bank accounts, visa accounts & payments made by direct credit (DC’s) thru Internet Banking as CSV files. This is no problem as I have macros that import & format the data as required to the requirements of the account type.

The DC’s are slightly different as I may have up 10 CSV files per month, one per transaction which may have up to 30 creditors per transaction. I use a macro to import the CSV file/sheet into a summary XL file for the month.

Here is my challenge – I now want to summarise these monthly summaries into one annual summary for collation & reporting purposes.

To do this I need to the following - But I am not sure if this “pseudo-code” is possible or I am on the right track.


1.    Open the Master annual summary (MAS) file
2.    ascertain & record in an array the all the subfolders
3.    Loop thru the subfolders & open the required work book
4.    Copy the summary sheet (the copied CSV sheets are still in the summary file) of the workbook
5.    Close the monthly summary workbook
6.    Paste the sheet into MAS
7.    After looping thru & save the MAS.

But I am not sure if this “pseudo-code” is possible or I am on the right track.

I have code that recurses & lists files, copies files, backup files, rename files, but not actually open files in the sub-folders & do things by looping thru.

I think I read some where that an array cannot actually open files in subfolders but you loop thru the sub-folders, use the array to go to the individual sub-folders and open the file to do stuff.

Added info - the structure I have is like this

Folder structure - DCPayments8 (where 08 is August & all the folders are named as mm & the summary file is “DC0708.xls”
Cheers

Lionel Downunda

Excel - On A Button Event, Open Another Closed File, Post Changes, Close File
Really new to VBA but coming along.

I hope that this hasn't been addressed already in this forum, I looked but didn't find it ...

The issue I can't resolve is this: I have a shared workbook with multiple sheets, essentially counting instances of answers from lists (lots of 'em) across all sheets. These are being summed in my 'summary' sheet (countif). Upon a button event (available on each sheet), I am posting from the summary to the summary2 sheet ... using the following:

Sub GetAns()
Sheets("Summary2").Select
Range("D5").Select
Selection.Offset(0, 0) = Application.Sum(Sheets("Summary").Range("D5").Value, Sheets("Summary2").Range("D5").Value)
Selection.Offset(1, 0) = Application.Sum(Sheets("Summary").Range("D6").Value, Sheets("Summary2").Range("D6").Value)
.+
.+

Long story, but I have Summary (current tally) and Summary2 (total tally)

The thought is this - this book is to be shared by 50+ users who will update it periodically yet constantly. What I would like to accomplish, essentially, would be to to have 'summary2' as an external closed book that accepts the posting from each save from the open books 'summary' sheet ... using vba (ActiveWorkbook.Save) in my GetAns sub ... basically 'on save, add this value to that value in that book' ... 'that' book will be a running tally of all users answers ...

Sorry, I hope this makes sense ... Can anyone help ?

The _lopen Function Opens An Existing File And Sets The File Pointer To The Beginning Of T
Private Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long
Private Declare Function lClose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Function IsFileAlreadyOpen(FileName As String) As Boolean
    Dim hFile As Long
    Dim lastErr As Long
    hFile = -1
    lastErr = 0
    hFile = lOpen(FileName, &H10)
    If hFile = -1 Then
        lastErr = Err.LastDllError
    Else
        lClose (hFile)
    End If
    sFileAlreadyOpen = (hFile = -1) And (lastErr = 32)
End Function
Private Sub Form_Load()
    MsgBox IsFileAlreadyOpen("c:autoexec.bat")
End Sub

This Example work with 16bit machine, How work with WindowsXP

Thankth
buildersoft@angelfire.com

Advice Sought - Using A DB To Store File Contents Vs Reading Text File Straight Into VB
Hello -

I have an approx 300 line comma separated and hierachically arranged text file and am currently duplicating the comma separated bits into various Access database tables and reading it into VB from there. I'm not too keen on duplicating the info and am looking for a neat way to either parse the original file straight into my VB GUI's memory space or some how tokenise the file. I know that this can be done with lex/yacc and c++ and am wondering what the best VB route to go down would be.

Any advice would be gratefully received!!!
Thanks,
Mairi

How Can I Join Multiple Vedio File In Single File. Is Ther Any Command Or Code In VB
Please Help me Sir

I have many vedio file in diferent format like DAT, MPEG,MPEG1,MPEG2,Divx,AVI,SWF in listbox

Sir i want combine all files in single file. or add in first file in list box ,
Please guide me how it will be possible i want only simple and smalest code in few line how i will combine i will add in my project
or any command in VB for join multiple vedio files
Thanx

Can I Copy Excel File To Phase On Notepad Text File By Script??
Hello, I want to know that can I copy the excel file to notepad text file automatically????? By script,ok??

File List Box Reading Long File Names As Short Filenames
The file list box converts filenames to the MS-DOS short version but:
1) apparently randomly
2) only when running under Windows NT4 and not 98.
I first noted it with a subdirectory containing a space ("Level 1"). I changed the name to "Level1" and filenames appeared in the long version. However, the problem re-occurred with another sub-directory named "References" so the presence of the space does not seem to be the problem. It cannot be the length of the name because I don't have the problem with other directories.
If I use the List property to read in filenames, the program crashes when it tries to open the file. If I use Dir, the filenames are read in correctly but in a different order. I haven't used the API function for the same reason but also because I want to use the box's Selected property.
Has anyone else had this problem and found a solution?

FileExists() And Opening File In Excel Doesn't Work - Although File Exists
Hey there,

I have a little helper tool (written in vb6) that opens an excel file specified via the Command-variable, works a little with the content and closes it again. The path the file resides is e.g.: "D:.Net DevelopmentVisual Studio 2005ProjectsSynchronize_VersionPlanVP-Helper ransfer.xls"


Prior to do doing anything, I check whether the file specified via the Command-variable exists:


VB Code:
Dim tmpFSO As FileSystemObject mod_global_var.ExcelFile = CommandSet tmpFSO = CreateObject("Scripting.FileSystemObject") If mod_global_var.ExcelFile = "" Then    'logout - can't continue    MsgBox ("This tool cannot be called directly - closing now!")    'logout user    If Not mod_global_var.objSession Is Nothing Then        mod_global_var.objSession.logout    End If     End ElseIf tmpFSO.FileExists(mod_global_var.ExcelFile) = False Then    MsgBox ("Transfer File not found! Please run the main synchronization tool again to (re-)create a valid transfer file!")    cmd_go.Enabled = FalseElse'do the real work...End


However, the problem is that whenever I call the tool in the directory mentioned above, the Messagebox from the "ElseIf tmpFSO.FileExists[...]" statement pops up - even though the file does exist!

Copying the .exe and .xls file e.g. to the d: main directory and call the tool works perfectly - no more messagebox etc. Why's this? I mean.. why doesn't the FileExist work properly with a path like the one mentioned above?


Best regards and thanks in advance,
-Joerg

75 Path/file Access Error , When I Try To Write The File As A Standard User
Hi ,
I am using Windows-xp o.s . i was tried to run the following code in 3 different group membership
1. standard user
2. Restricted user
3. others(Administrators)
i am able to run the code in others(administrator) only but not in standard user & restricted user ie i am getting exception "75 :path/file access error". but i am able to create file as a standard user through windows ie) ( rightclick->new->new text document ) but not through this vb code.why this conflict is happening ? if anyone know the answer kindly reply it ? . thanks in advance.
=================================================
form1
=====
'Creates a file called test1.txt and writes some text into it.
Private Sub Form_Load()

Open "f:Test1.txt" For Output As #1
Write #1, "This is some sample text"
Write #1, "Programmershelp.co.uk"
Close #1

End Sub

====================================================

Path/File Access Error. Unable To Read Or Write The Specified File
Hi,


I am getting the following error

"Path/File Access Error. Unable to Read or write the specified file.

Unable to Display the Image"


Following is the Code i am using .
With ImgEdit1
.Image = gStrFilePath & "" & pImagefile
.Page = 1
.Display
.FitTo 1
End With


The OS is windows 2000 and i am using ImageEdit control

the variable gStrFilePath contains the Path of the file
PImagefile contains the Image Name . Image is Tiff image.


If i click OK on the error messages the application closes. If i run the application again i am able to display the same Image.


Pls Help me

Converting A Comma Delimited File To An Inline Text File For Import
I'm looking for a way to convert a text file like this:-

INVNO,DATE,AMOUNT
1,06/10/2002,100
2,07/10/2002,150
3,08/10/2002,215
4,09/10/2002,100
5,10/10/2002,654
6,11/10/2002,12

into something like this:-

INVNO
DATE
AMOUNT
#MCBG
1
06/10/2002
100
#MCBG
2
07/10/2002
150 etc

#MCBG is a separator in the package i am using.

I've only just started this and kind of know what I am doing but its going to take a lot of playing around so any help would be grateful.

Thanks
Richard

Change File Access Rights/permissions To NTFS File System
No I don't want to hack files, however, my clients wants me to allow pdf viewing and printing from with my VB program but wants to exclude the same logged in users access to the same files from outside of the program?

Any ideas?

Question On Multiple File Simultaneous File Transfers Usin Winsock.
ive been usin the below code to send multiple file transfers usin winsock. but ive gotten a few problems. first of all recently it sometimes stops in the middle of a file if its really small or sometimes at the very end of it. it stops at diferent spaces i think. and when i have more than one file transfer goin at a time it will stop one of them until the other is finished or stops in the middle (i dont use the same winsock for the file transfers). does anyone know why these things might be hapenin?

Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim lcounter As Long

Public Sub SendFile2(FileName As String, wins1 As winsock)

Dim FreeF2 As Integer
Dim LocData2() As Byte
Dim LenData2 As Long
Dim sendloop2 As Long

FreeF2 = FreeFile

Open FileName For Binary As #FreeF2 ' Open file

ReDim LocData2(1 To 2048) As Byte ' Work in 2kb chunks

LenData2 = LOF(FreeF2) ' Get length of file

For sendloop2 = 1 To LenData2 2048 ' Go through file


Get #FreeF2, , LocData2 'Get data from the file nCnt is from where to start the get
wins1.SendData LocData2 'Send the chunk
lcounter = lcounter + 1
If lcounter Mod 50 = 0 Then DoEvents
Next

If LenData2 Mod 2048 <> 0 Then ' If there is any left over at the end

ReDim LocData2(1 To LenData2 Mod 2048) As Byte ' Clear up the leftovers

Get #FreeF2, , LocData2 'Get data from the file nCnt is from where to start the get

wins1.SendData LocData2 'Send the chunk

End If

Close #FreeF2 ' Close the file

DoEvents ' Let computer catch up


End Sub


Public Function oPD(Text As String) As String
'Use this if you get your data in Binary into any textbox
'this turns all the chunk into the Ascii numbers use the rpd
'function to restore it.
'If you open binary into a text box the chances that you'll get
'an Out Of Memory error are high.

Dim TextC As String * 3
Dim G As Long
Dim TextX As String
Dim X As Long

G = Len(Text)

For X = 1 To G
TextC = Asc(Mid(Text, X, 1))
TextX = TextX & TextC
Next X
oPD = TextX
End Function

Public Function rPD(Text As String) As String
Dim TextC As String * 3
Dim G As Long
Dim TextX As String
Dim X As Long

G = Len(Text)

For X = 1 To G
On Local Error Resume Next
TextC = Chr(Mid(Text, X, 3))
TextX = TextX & TextC
Next X
rPD = TextX
End Function

How Do I Make This Possible "double Clicking A File Runs My VB Generated .exe File
Hello there all,

although I am quite a newbie to VB, after much toil I have managed to make an MPEG player with VB 6. Now I want any file with an mpeg extension, when double clicked, will open up my application and pass the file name to my application's playCommand_click() subroutine

I can handle the first bit which is associating .mpeg/.mpg files to my application but how do I pass name of the file to my playCommand_click() subroutine. FYI, I have made an exe file for my project and want the file name to be passed to the exe file.

Thanks in Advance

Make A Backup Copy Of Excel File, While The Particular File Is Open Through A Macro
I am working on excel file ABC.xls. While the file is still open I want to run a macro which will make a copy of the current ABC.xls as Backup ABC.xls and save it in the same folder and then I can continue to work on ABC.xls. I tried following code for a macro, but it did not work. I ran the macro from ABC.xls. I am going to use it in an excel based application that I am developing.
Sub Macro1()
'

Dim Filename

Dim Dest

Dest = "E:My DocumentsBackupABC.xls"

Filename = "E:My DocumentsABC.xls"

FileCopy Filename, Dest
End Sub
Please guide me.

Drag And Drop File Opens Program With Droped File Loaded?
Hi Guys I wonder if any one can help me.

  I am making a simple program with an OLE control set to wave files. I would like to be able to drag and drop a file into the programs icon and have the file loaded and playing in the OLE control when the progran opens. I would also like the wave to begin playing when the wave file is dropped into the OLE container after the program opens automatically. I tried this by placing OLE1.DoVerb 0 into the sub, OLE1_DragDrop but to no avail it will not play after dropped.

  So far I can drag the file into the ole control after the program is already open the sound plays through the sub Ole1_MouseMove and the sound stops with a Command button.

Any and all help would be greatly appriciated.
Thanks,
Skorkpup

Here is my code so far:

Option Explicit

Private Sub Command1_Click()
    'stop the sound
    OLE1.Action = 9
End Sub

Private Sub Command2_Click()
    'close the program
    Unload Me
End Sub

Private Sub OLE1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   'play the sound
   OLE1.DoVerb 0
End Sub


Skorkpup

Printdialog Control-print To File Check Box Wont Write File
Commondialog1 control - Printerdialog-Showprinter
I need help with the printerdialog control, my problem is I cannot get the "Print To Write"
function in the "Showprinter" part of the control, to write the prn file when the box is
checked. I tried using the "ShowSave" part (even in a call to a subroutine) but this did
not work either. I'm new to this area of this control. I need a better direction and would
greatly appreciate a code example. Thanks

      

Open File && Start Reading From Mid File / Resolved / Solution Posted
Hello,

Thanks for the input. My application reads the file line by line, sends the code to the buffer on a Motion Controller card and then temporarily goes into the by-pass mode. When the buffer has received the code then the Looping file resumes writing.

What I was wanting to do, and now can do, is to scroll down to a line of code in the G code window and start the cycle from that point. By the way the text in the yellow banner is always current with the line of code ( shown NotePad ) that is being processed. The code shown in Notepad was derived from the G code shown in the black window. Not only am I reading the code I'm also re-writing it as it's being read. I'm also reading the G code text ( yellow text ) and making some low level commands as it scrolls.

Now I'm sure that you understand all of this. Right?

Servo


Code: If FileLoaded = True Then
  fnum = FreeFile
  Open App.Path & "File.dmc" For Input As #fnum
    Do While Not EOF(fnum)
      DoEvents
        FileRunning = True
        If StopFile Then FileRunning = False: Close #fnum: Exit Sub
        If DoLoop = True Then GoTo NextLine Else GoTo Pass
NextLine:
        Line Input #fnum, dmcLine
        dmcLine = Trim(dmcLine)
        If Mid(dmcLine, 1, 1) = "N" Then
          If Val(Mid(dmcLine, 2, InStr(dmcLine, ":") - 2)) >= LN Then DoWrite = True
          dmcLine = Replace(dmcLine, Mid(dmcLine, 1, InStr(dmcLine, Chr(32))), "")
        End If
        If DoWrite = False Then GoTo Pass
        If InStr(dmcLine, "M30") Then
          M30 = 1
          If Not Locked And InStr(dmcLine, "P") Then Locked = True: _
          Repeat = Val(Mid(dmcLine, 5, InStr(dmcLine, ":") - 1))
          dmcLine = Mid(dmcLine, InStr(dmcLine, ":") + 1, Len(dmcLine))
        End If
        If Mid(dmcLine, 1, 2) = "G5" Then
          strG50 = " " & Mid(dmcLine, 1, InStr(dmcLine, ":") - 1)
          dmcLine = Mid(dmcLine, InStr(dmcLine, ":") + 1, Len(dmcLine))
        End If
        cBuffer.Append dmcLine & vbCrLf: 'txtDMCBuffer = cBuffer.ToString
        If Mid(dmcLine, 1, 2) = "AM" Then
          dmcLine = ""
          DoLoop = False
          If n = 0 Then n = 1: dmcShell1.DMCCommand = "Download=1": gLines = gLines - 1
        End If
Pass:
    Loop
    FileRunning = False
    Close #fnum





Edited by - ServoWizard on 11/23/2004 9:51:24 AM

Convert Common Delimited File To Right Justified Fixed Lenght File
Hi,
 I have a common delimited file like this:

1000,000000012345,100,200020202
10,000002,2345,100,2000202020
1,000002,238945,100,2000202020

 It needs to be converted to fixed length right justified file like this:
1000,000000012345, 11211,100, 200020202
    10, 000002, 2345,100,2000202020
      1, 000002,238945,100,2000202020


The problem I have is I need to find out the max. lenght for each column, then putting prefix empty string to make it right justifed fixed length column, and I don't want to read the file two times for this purpose since it is very big.

I am wondering what's the best to way to do this in VB6? any build in function like convert delimited file to fixed lenght file?

Any suggestion?

Thanks.
David

From MS Access (VBA), Retrive List Of File From FTP Server And Check If File Exists In DB
Please help with this issue:

I am working in MS Access XP environment. I need to connect to FTP server and check if the file in my database exists on the FTP server. Compare by filename.
Return boolean is fine (1 - file exists on server, 2 - file not on server).

What is the best way to do it?


Your help will be highly appreciated. Tank you.

Extracting Imbedded .jpgs From A Word File To Copy Into A .html File... How?!
Hi all,

What im trying to do is parse through a Word file and extract certain blocks of text to paste into a .html file. This all works fine, but along with the text, i want to extract the pictures from the word file, turn them into a .jpg, and insert the picture into the .html file as well. When i look throught the Word.Document object, i cant find a Picture(s) property and im wondering on how to do this

If anyone out there has an idea please let me know

Thanks in advance

W.

Wurm

Using ADO Recordset, Read From An Access Database File And Write To A Text File
Using the ADO data control and the recordset property I am reading records from an Access data base file, selecting and manipulating records, and then trying to write to a text file. I know how to get the records from the database file, but I need sample code for how to write out to a text file.
Thanks

cruella69

How To Develop File Sharing Application For Share The File From The Other Computers Through The Loca
i want to know how to develop a file sharing application such like network neighborhood that share the file from the other computers through the LAN

Access File Linked To Excel File Error Msg:Couldn't Find Installable ISAM
I created an Access File (mdb1) LINKED TO (not IMPORTED FROM) an excel File (xls1). I then used a data control in my vb6 form to read mdb1 and display the data in a textbox placed in the same form. When I run the vb6 program, a "Couldn't Find Installable ISAM" message appears on the screen. I think the message is telling me to install/download a program update into vb6 to enable it to read the excel file. What should i install? Or more appropriately, what should I do? Thanks!

Reading Lines From Input File And Output Contents To New File
TO All VB Programmers

can anyone show me how to add header lines to a existing output file by reading it from an input file.

the program goes like this

1. Read through the master file and located the 52 header lines and the line that contains V4_PL1.

2. Once header and line is located, open and print to another output file the line that starts with the header and that start's with V4_PL1 and all the contents below it till it reaches line that contains "Manual" character.

3. Then output file that contains line from V4_PL1 to Manual (inclusive) is closed and created in a directory. (eg. PL1.scr)

4. Close master file.

5. Open master file again to locate and read line that contains the header lines and the subsequent line that contains V5_PL2 till the next line that contains "MANUAL" character.

6. Create a new output file( eg. PL2.scr) and put the contents capture in No. 5 into it and file is closed.

7. This output file creation for each Pull line station (PL) is repeated till end of master file. (eg. PL3, PL4....)

extract of master/input file and output file.

master file

;AutoCAD script generated on 4/27/2004 11:28:07 AM
;Product Name:
LIMITS -1,-1 25,25
ZOOM ALL
LAYER MAKE BORDER
LAYER SET BORDER
COLOR WHITE
RECTANG 0,0 16.5,10.25
RECTANG 14.5,9.25 16.5,10.25
RECTANG 0,0 4,0.5
RECTANG 4,0 9.25,0.5
RECTANG 9.25,0 11.75,0.5
RECTANG 11.75,0 13.5,0.5
RECTANG 13.5,0 15,0.5
RECTANG 15,0 15.75,0.5
RECTANG 15.75,0 16.5,0.5
TEXT 14.78,9.4 0.1 20.00000 DOC CONTROL STAMP
TEXT 0.05,0.15 0.1 0.00000
TEXT J C 6.625,0.3 0.1 0.00000 AREA
TEXT J C 10.5,0.3 0.1 0.00000 PRODUCT FAMILY
TEXT J C 12.625,0.3 0.1 0.00000 PBA NUMBER
TEXT J C 14.25,0.3 0.1 0.00000 DOC. TRACKING #
TEXT J C 15.375,0.3 0.1 0.00000 PAGE
TEXT J C 16.125,0.3 0.1 0.00000 ISSUE
TEXT J C 16.125,0.075 0.100 0 1
COLOR GREEN
TEXT J C 12.625,0.075 0.100 0
TEXT J C 10.500,0.075 0.100 0
TEXT J C 14.25,0.075 0.100 0 N/A
ZOOM EXTENTS
COLOR WHITE
RECTANG 12.25,2.5 13.75,2.75
RECTANG 13.75,2.5 15,2.75
RECTANG 15,2.5 16.25,2.75
RECTANG 12.25,2.75 13.75,3
RECTANG 13.75,2.75 15,3
RECTANG 15,2.75 16.25,3
RECTANG 12.25,3 13.75,3.25
RECTANG 13.75,3 15,3.25
RECTANG 15,3 16.25,3.25
RECTANG 12.25,3.25 13.75,3.65
RECTANG 13.75,3.25 15,3.65
RECTANG 15,3.25 16.25,3.65
TEXT J C 13,3.36 0.1 0.00000 PRODUCT CODE
TEXT J C 14.375,3.36 0.1 0.00000 AA NUMBER
TEXT J C 15.625,3.36 0.1 0.00000 PBA NUMBER
COLOR RED
RECTANG 12.17,2.42 16.33,3.73
COLOR GREEN
TEXT J C 13,3.075 0.100 0 BE
TEXT J C 14.375,3.075 0.100 0 C39561-102
TEXT J C 15.625,3.075 0.100 0

LAYER MAKE V4_PL1
LAYER MAKE V4_PL1_Silk
LAYER SET V4_PL1
COLOR WHITE
LAYER OFF BORDER
LAYER SET V4_PL1
LAYER MAKE V4_PL1
LAYER MAKE V4_PL1_Silk
LAYER SET V4_PL1
COLOR BLUE
; C3C3
CIRCLE 7.00687,7.70815 0.07668
COLOR WHITE
TEXT J C 6.625,0.075 0.100 0 Manual Pull Line Station 1
TEXT J C 15.375,0.075 0.100 0 V4

LAYER ON BORDER
LAYER SET BORDER
LAYER OFF V4_PL1
LAYER OFF V4_PL1
LAYER OFF V4_PL1_Silk


output file

AutoCAD script generated on 4/27/2004 11:28:07 AM
;Product Name:
LIMITS -1,-1 25,25
ZOOM ALL
LAYER MAKE BORDER
LAYER SET BORDER
COLOR WHITE
RECTANG 0,0 16.5,10.25
RECTANG 14.5,9.25 16.5,10.25
RECTANG 0,0 4,0.5
RECTANG 4,0 9.25,0.5
RECTANG 9.25,0 11.75,0.5
RECTANG 11.75,0 13.5,0.5
RECTANG 13.5,0 15,0.5
RECTANG 15,0 15.75,0.5
RECTANG 15.75,0 16.5,0.5
TEXT 14.78,9.4 0.1 20.00000 DOC CONTROL STAMP
TEXT 0.05,0.15 0.1 0.00000
TEXT J C 6.625,0.3 0.1 0.00000 AREA
TEXT J C 10.5,0.3 0.1 0.00000 PRODUCT FAMILY
TEXT J C 12.625,0.3 0.1 0.00000 PBA NUMBER
TEXT J C 14.25,0.3 0.1 0.00000 DOC. TRACKING #
TEXT J C 15.375,0.3 0.1 0.00000 PAGE
TEXT J C 16.125,0.3 0.1 0.00000 ISSUE
TEXT J C 16.125,0.075 0.100 0 1
COLOR GREEN
TEXT J C 12.625,0.075 0.100 0
TEXT J C 10.500,0.075 0.100 0
TEXT J C 14.25,0.075 0.100 0 N/A
ZOOM EXTENTS
COLOR WHITE
RECTANG 12.25,2.5 13.75,2.75
RECTANG 13.75,2.5 15,2.75
RECTANG 15,2.5 16.25,2.75
RECTANG 12.25,2.75 13.75,3
RECTANG 13.75,2.75 15,3
RECTANG 15,2.75 16.25,3
RECTANG 12.25,3 13.75,3.25
RECTANG 13.75,3 15,3.25
RECTANG 15,3 16.25,3.25
RECTANG 12.25,3.25 13.75,3.65
RECTANG 13.75,3.25 15,3.65
RECTANG 15,3.25 16.25,3.65
TEXT J C 13,3.36 0.1 0.00000 PRODUCT CODE
TEXT J C 14.375,3.36 0.1 0.00000 AA NUMBER
TEXT J C 15.625,3.36 0.1 0.00000 PBA NUMBER
COLOR RED
RECTANG 12.17,2.42 16.33,3.73
COLOR GREEN
TEXT J C 13,3.075 0.100 0 BE
TEXT J C 14.375,3.075 0.100 0 C39561-102
TEXT J C 15.625,3.075 0.100 0

LAYER MAKE V4_PL1
LAYER MAKE V4_PL1_Silk
LAYER SET V4_PL1
COLOR WHITE
LAYER OFF BORDER
LAYER SET V4_PL1
LAYER MAKE V4_PL1
LAYER MAKE V4_PL1_Silk
LAYER SET V4_PL1
COLOR BLUE
; C3C3
CIRCLE 7.00687,7.70815 0.07668
COLOR WHITE
TEXT J C 6.625,0.075 0.100 0 Manual Pull Line Station 1


this is the unfinished script which i hope someone can HELP!
QUestion : How can i add the 52 header lines into the script

Dim iPlNum As Integer ' integer to hold the current pull line number
Dim smaster As String ' string to hold the master file name
Dim sOutputdata As String ' string to hold the output data
Dim iFileNum As Integer ' integer to hold the master file number
Dim iOutFile As Integer ' integer to hold the output file number
Dim sRawData As String ' string to hold the raw data read from the master file
Dim sLookFor As String ' string to hold the value we're looking for
Dim bOutput As Boolean ' flag to determine if we're within a pl block

'smaster gets set by your prog.
'this function assumes that soutput and smaster are set already
smaster = "c: estmaster.txt"
sOutfile = "c:PL"
bOutput = False
iPlNum = 1
iFileNum = FreeFile

Open smaster For Input As iFileNum
Do While Not EOF(iFileNum) ' keep doing till end of file

Line Input #iFileNum, sRawData 'get line of data

sLookFor = "V4_PL" & iPlNum 'set the pl we're looking for

sRawData = UCase(sRawData) 'convert to uppercase - just because I find it better for string searches

If Not bOutput Then 'if we're not capturing the data for output already

If InStr(sRawData, sLookFor) > 0 Then 'check and see if the pl number is in the line
bOutput = True 'it is, so start capturing to the output variable
sOutputdata = sRawData & vbCrLf
End If
Else ' we're in output capture mode
If InStr(sRawData, "MANUAL") < 1 Then 'if the line doesn't contain the MANUAL keyword
sOutputdata = sOutputdata & sRawData & vbCrLf 'add it to our output variable
Else ' the line contains the MANUAL keyword
bOutput = False ' stop capturing to the output variable
iOutFile = FreeFile
sOutputdata = sOutputdata & sRawData 'add the last line to the output variable
Open sOutfile & iPlNum & ".scr" For Output As iOutFile 'open the output file
Print #iOutFile, sOutputdata 'save the output data to the file
Close iOutFile 'close the file
sOutputdata = "" 'reset the output data to nothing
iPlNum = iPlNum + 1 'add 1 to the pl number to continue searching
End If
End If
Loop ' do it again
Close iFileNum 'close the file


Thanks a million

Couple Quick Questions (file Encoding / File Editing)
okay.... simple enough.....

I want to encode files, they are regular .txt files, but i renamed them .dat so they are alittle less obvious, but still readable by notepad...

most of the files are filled with just text



also file editing....


I need to tell the program to remove the last thing from the list.....

better yet...


I have a list like so:

item1
item2
item1
item3

i want to make the 2nd Item1 to be removed....

thats what i really could use.... but just removing the last one will do...

How To Avoid Open File Failure While The File Is In Saving Process?
Hello, Everyone,
I have two application. One writes data to a file, the other need to open the file. How can I make them no confliction? It is also fine for me to open a copy of the file. I added: On error resume next in writing. So, there is no problem in writing. But when I read the file, it encouter: file not available. How can I avoid this situation? Would someone be kind to come up with a good idea?
Thank you very much!
Charlie

EXPORT Contents Of Textbox To A .txt File && IMPORT A .txt File Onto A Form?
I have searched the forums high and low and cannot find something to match my description - maybe it is not general enough...

I am sorry if this is in the wrong section but I am classing this as "Reporting", and I believe although its based around textboxes I MAY still need to write to the database, depending on your answer(s)...

So here goes:


My problem is...

I have a form which I must EXPORT the contents of to a .txt file (alternatively, maybe I could also Export it to a Word .doc file, or maybe give the user a choice? I don't know yet)...


I have a form with the following layout:

(Start of form)

REPORTID: (user fills in a value into txtReportID textbox here)

USERID: (user fills in their UserID into a txtUserID textbox here)

DETAILS: (user fills in details of the report into a big textbox txtDetails here eg. textbox has around 50 lines of space)*

SAVEFILENAME: (textbox txtSaveFileName where user can specify filename to save this report to)**

[also 2 buttons at the bottom of the form - IMPORT and EXPORT]

(End of form)

*NOTE DETAILS: If in the Details textbox the user should use any special formatting eg. Leave a line space and then start typing a new paragraph, I do not want to lose this formatting - which is why I believe I need to export to a .txt or .doc rather than save to a field in the database, but maybe I am wrong?

**NOTE SAVEFILENAME: The database and .txt files will be held on a central server, therefore the user will simply enter a filename (eg. REPORT001.txt) and it will be saved to the default directory on the server.


When the data has been entered, I wish the user to press the EXPORT button, and this will EXPORT the data that the user has entered in the above mentioned fields to a .txt file (or a Word .doc file).


Any user should then later be able to press the IMPORT button, select the previously created textfile REPORT001.txt, and the data held in REPORT001.txt will then be mapped onto the appropriate fields of the form.
Maybe I am getting too complicated with this I am not sure?


Can anyone help me out or guide me in the right direction on how to do this?

Thanks in advance for any suggestions

Saving On Newest File Of Two Files In Differing Locations With Same File Name
Hi folks,

OK, first off I'm really, really new to VB so any help would be much appreciated.

We are currently runing two servers in 2 different offices and what i'd like to do is copy the files from a specific folder (these folder have identical names on the two servers) on each server (these are called server1 & server2), to a folder in a seperate location (somewhere on my C drive for example), making sure that only the newest file (by date and time) is actually copied into this folder, thus giving me a folder which has the most current file from either server.

Hope this makes sense

Damian

Insert Data Into Allready Built Exe File Without Corrupting Exe File?
What I want to do is create a setup program that only needs 1 file.

so is it possible to append or insert extra useless data into an exe file without corrupting the file?

Read Chinese From Text File - Input Past End Of File
I have a text file with content of Chinese character which is store as ANSI format. When i call the function below, it give me error "Run-Time Error '62'. Input past end of file".

sFileName3 = "abc.txt"
sFilePath = sParentPath & sFileName3
Open sFilePath For Input As #1
sBasicDesc = Input(LOF(1), #1)
Close #1

I tested on 9 PC but 2 PC fail.
Do i miss out any component or the code is not compatible?
Please help.
Thankyou.

Opening A File, Extract Data And Send A File Via Infrared
Dear Friends,

I am new to this forum and also new to Visual Studio. I need to produce a program which does the following...

1.Use System File Watcher to know that a file has been received in a particualr directory from a mobile phone.

2.Open that file with notepad (the file is not opened by notepad by default), Find the word 'Body:' and save the string found after it.

3.Send via infrared, a file '.jpg' loacated in a particular directory with the same string name as the one stored.

Can you kindly suggest to me some coding?
or at least some website where I can get some tips, tutorials, help.... Cause I don't have the MSDN help installed!

The coding I require is on how to open the file (which is arrived and systemfile watcher noted) with notepad..and how to extract data from it.

Thanks,
Franklin

Scanning A Directory For Certain File Types And Checking For File Size?
Hi everyone. This is my first post here, I hope I put it in the right place.

I'm working on a program that's a download manager for a game. It's coming along great, but there's one thing I don't know how to do. How do you open all the files in a directory (In this case bmp), check their file size, and if they aren't the right size move them into the same directory as the application? The file size that I need is either 17 KB or 65 KB (There's two acceptable values). I've tryed searching here, but I couldn't find anything that helped me. Thanks in advance for any help you all can provide!

Copying A File Using A Progress Bar To Show Percent Of File Complete
Basically, I'm trying to find a method other than FileCopy so I can see how many bytes have transferred so I can update my progressbar. I have the progressbar working fine. I just need to know how I can go about it?

Cheers

After Using (Drive,Dir,File) Controls, How To Display Selected File Contents?
Hi, I have figured out how to take the following controls (Drive,Dir,File), place'em each in form then use DriveListBox to select a drive, from there use DirListBox and select a folder, from there go to FileListBox and select a file from that folder ... finally pressing a command button (cmdDisplayPathName) to display the complete pathname in (picDisplayPathName). All work fine. Here's what I want to do next:

Press another command button (cmdDisplayFileContents) to display the selected files' contents into a textbox (txtDisplayFileContents).

My code so far:
Code:
Private Sub DriveListBox_Change()
'This is the Drive List Box control
DirectoryListBox.Path = DriveListBox.Drive
End Sub


Private Sub DirectoryListBox_Change()
'This is the Directory List Box control
FileListBox.Path = DirectoryListBox.Path
End Sub


Private Sub FileListBox_Click()
'This is the File List Box control
End Sub


Private Sub cmdDisplayPathName_Click()
'When button is pressed, complete path displays
picDisplayPathName.Cls
picDisplayPathName.Print DirectoryListBox.Path;
If Right(DirectoryListBox.Path, 1) <> "" Then
picDisplayPathName.Print "";
End If
picDisplayPathName.Print FileListBox.FileName
End Sub


Private Sub picDisplayPathName_Click()
'Displays the complete pathname of selected file.
End Sub


Private Sub cmdDisplayFileContents_Click()
'When this button is pressed, the selected files' contents display into "txtDisplayFileCont.text"
** This is where I do not know how to code, tried a couple hokey ways, was totally incorrect.
** Need help in this area.
...........
Else
'Error message
MsgBox "Unable to display contents."
End If
End Sub


Private Sub txtDisplayFileContents_Change()
'Displays the contents of selected file.
End Sub
Three Questions

(1) What do I code in the 'cmdDisplayFileContents_Click()' portion in the above code?

(2) Once coded I know displaying a textfile is easy and will show up in textbox (txtDisplayFileContents), but what about other file types? Does a viewer of some sort need to be used to show file contents if not a straight text file? --- If so, how is this coded/implemented?

(3) In using (Drive,Dir,File) to browse around and select a file, I end up with three separate controls on the form ... is there now a shortcut (one control?) somewhere that can do the same thing? If so, what is it?

Thank you for any help and direction(s).
~ Juanita

Search For A File In All Drives And Retrieve The First Path In Which The File Is Foun
i need the code for searching a file from the drives and storing the path of the file in a variable. Say the file name is input.exe. i just need to search this particular file alone in my drives and retrieve the path in a variable.

Advice On Open A File Using Paths Obtained From A Config File
Folks,

I am trying to open a file using a path obtained from a config file and also using another string which is the file name:

ie I open the config file and read the path into variable dirpath and the name of the file that i wanted too open is stored in the variable location.

how would i use the open statemet to obtain this file..

I am also tring to display a certain line from the file in a label...is my code ok?

I have tried the following statement but I get an error that it cannot find the file:


Code:
FF = FreeFile()
Open (dirpath & "" & location) For Input As #FF
Do While Not EOF(FF)
Counter = Counter + 1
If Counter = 2 Then
Line Input #FF, strData
Label3.Caption = strData
Exit Do


rgds

colin

How To Copy A File From SFTP Server To Local PC Using Batch File.
Hi,

How to copy a file from SFTP server to local PC using Batch file.
Please consider that SFTP server is installed in Linux OS NOT in Windows OS.

i.e. I need Batch file script to do the above job.

Many thanks in Advance
Radhakrishnan

Newbie Question; Recognising Different File Types And Displaying The File; Plz Help!
Hello All,

Just needed some advice.

There are some .qef (Query files) in a directory. Could someone please tell me how to search through my directories to only select files of this type and to display the query in Access?

I have to use the File System Object but I am unsure how to do this.

Thanks in advance

Carlos

Copy File From Resource File To Hard Drive As VbHidden
Is it possible to copy a file from the resource to the hard drive as vbHidden ?

I've made a Graphical User Interface for several commandline tools.
I want to include the commandline tools in a resource file and then
when the user starts the GUI, the commandline tools get extracted
to the hard drive as vbHidden.

Most people don't have "Show hidden files and folders" enabled.
This way it looks like there is only one app, instead of a GUI with
all kinds of extra apps, because that looks ugly (in my opinion).

This is the code I'm using now for one commandline tool.


VB Code:
Private Sub Form_Load()    Dim sBuffer As String    sBuffer = StrConv(LoadResData(101, "CUSTOM"), vbUnicode)    Open App.Path & "WhoLockMe.exe" For Output As #1    Print #1, sBuffer    Close #1End Sub

Copyright © 2005-08 www.BigResource.com, All rights reserved