Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This was the ONLY place that I could find information that I could use to resolve the problem. So thanks once again to member TomSark and the SQL forum!..."

Geography

Where in the world do Tek-Tips members come from?
sbarber007 (IS/IT--Management)
17 Aug 12 5:30
Basicly I want to add to my vb6 code. At the bottom I have marked in red below what I require.

Private Sub Form_Load()
Dim textfile As String

Open "C:\users\administrator\dirnames.txt" For Input As #1
Do While Not EOF(1)
Input #1, textfile
FolderCreator.Combo1.AddItem (textfile)
Loop
Close #1

' Show Date on main screen.
'Label3.Caption = DateValue(Now)

' Fire Rx Event Every Two Bytes
MSComm1.RThreshold = 1 ' Is this correct
' When Inputting Data, Input 2 Bytes at a time
MSComm1.InputLen = 13 ' Is this correct

' 9600 Baud, No Parity, 8 Data Bits, 1 Stop Bit
MSComm1.Settings = "9600,N,8,1"
' Disable DTR
MSComm1.DTREnable = False

' Open COM1
MSComm1.CommPort = 1
MSComm1.PortOpen = True
MSComm1.InBufferCount = 0 ' Do I need this
End Sub


Private Sub MSComm1_OnComm()

'
' Assumes RTHreshold Property is set to a value > 0
' (Recommended value is 1)
'
Static strBuffer As String
Dim strData As String
Dim strRX As String
Dim boComplete As Boolean
Select Case MSComm1.CommEvent
Case comEvReceive
strData = MSComm1.Input
strBuffer = strBuffer & strData
Do
If Len(strBuffer) >= 13 Then
strRX = Mid$(strBuffer, 1, 13)
'
' rest of your code goes here - strRX contains the 13 characters sent
' After you've done all your processing add the following code

' START OF MY SCRIPT

Label8.Caption = strData
'MSComm1.Output = strData
Dim wshThisShell As WshShell
Dim lngRet As Long
Dim strShellCommand As String
Dim strBatchPath As String
'label8.caption = ""
Set wshThisShell = New WshShell
strBatchPath = "c:\deletevert.bat"
'the path for the batch file you're using
strShellCommand = Chr$(34) & strBatchPath & Chr$(34)
'the ridiculous number of quotation marks is necessary
'when there is a space in one or more of the folder names
lngRet = wshThisShell.Run(strShellCommand, vbNormalFocus, vbTrue)
'set 3rd argument above to vbFalse for asynchronous
'execution of the batch file.
'label8.caption = ""
'label9.caption = ""
If Dir$("e:\" & strData, vbDirectory) = "" Then

Label9.Caption = "Directory does not exist."
MkDir "e:\" & strData
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(0)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(1)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(2)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(3)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(4)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(5)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(6)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(7)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(8)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(9)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(10)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(11)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(12)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(13)
MkDir "e:\" & strData & "\" & FolderCreator.Combo1.List(14)

Shell ("net use Z: " & "\\ENDOFLINE\STORAGE\" & strData & " /persistent:yes")
Shell ("net use Z: " & "\\ENDOFLINE\STORAGE\" & strData & " /persistent:yes")
MSComm1.Output = strData

Else

ViewRejects.ViewList.AddItem strData & " REJECTED ON " & Now
Label5.Caption = ViewRejects.ViewList.ListCount
Label9.Caption = "Directory exists."
Shell ("net use Z: " & "\\ENDOFLINE\STORAGE\" & strData & " /persistent:yes")
Shell ("net use Z: " & "\\ENDOFLINE\STORAGE\" & strData & " /persistent:yes")
MSComm1.Output = strData
I want to create a text file here called "SHIFT 06:30 - 14:30.txt" to capture the strdata from every engine between this time and then create another text file call "SHIFT 14:30 - 22:30.txt" to capture the strdata from every engine between this time and then create another text file call "SHIFT 22:30 - 06:30.txt" to capture the strdata from every engine between this time I know how to create the text file with data the bit i dont understand is setting the time limits for each shift.
Open "e:\REJECTS.txt" For Append As #1
' For I = 0 To Lis't1.ListCount - 1
Print #1, strData & " REJECTED ON " & Now
' Next
Close #1

Open "e:\" & strData & "\REJECTS.txt" For Append As #2
' For I = 0 To Lis't1.ListCount - 1
Print #2, strData & " REJECTED ON " & Now
' Next
Close #2
End If
End If
' THE REST OF YOUR SCRIPT got compile error below

If Len(strBuffer) = 13 Then
strBuffer = ""
boComplete = True
Else
strBuffer = Mid$(strBuffer, 14)
End If
Else ' I get Compile Error Else Without IF
boComplete = True
End If
Loop Until boComplete = True
End Select
End Sub

Kind Regards

Steve

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close