Advertisement
Advertisement
| 06.24.2008 at 02:04PM PDT, ID: 23512646 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: |
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If intStep = 0 Then
intStep = 1
Label1.Text = "Step 1"
Label2.Visible = True
TextBox1.Visible = True
Button1.Visible = True
Button3.Visible = True
Label3.Visible = False
ElseIf intStep = 1 Then
If TextBox1.Text = "" Then
MsgBox("Please select the update file before pressing Next.")
Else
If OpenFileDialog1.CheckFileExists = True Then
strFilename = TextBox1.Text
intStep = 2
Label1.Text = "Step 2"
Label2.Visible = False
TextBox1.Visible = False
Button1.Visible = False
TextBox2.Visible = True
Label4.Visible = True
Button4.Visible = True
howManyLines()
Else
MsgBox("This File does not exist, please select the correct file.")
End If
End If
ElseIf intStep = 2 Then
If TextBox2.Text = "" Then
MsgBox("Please select the update file before pressing Next.")
Else
intStep = 3
Label1.Text = "Step 3"
TextBox2.Visible = False
Label4.Visible = False
Button4.Visible = False
Label5.Visible = True
Button2.Visible = False
Button5.Visible = True
outFilePath = TextBox2.Text
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If intStep = 1 Then
intStep = 0
Label1.Text = ""
Label2.Visible = False
TextBox1.Visible = False
Button1.Visible = False
Button3.Visible = False
Label3.Visible = True
ElseIf intStep = 2 Then
intStep = 1
Label1.Text = "Step 1"
Label2.Visible = True
TextBox1.Visible = True
Button1.Visible = True
TextBox2.Visible = False
Label4.Visible = False
Button4.Visible = False
ElseIf intStep = 3 Then
intStep = 2
Label1.Text = "Step 2"
TextBox2.Visible = True
Label4.Visible = True
Button4.Visible = True
Label5.Visible = False
Button2.Visible = True
Button5.Visible = False
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
FolderBrowserDialog1.ShowDialog()
TextBox2.Text = FolderBrowserDialog1.SelectedPath
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Label5.Visible = False
Label6.Text = "Processing"
ProgressBar1.Visible = True
Label6.Visible = True
'variable declarations
Dim Data As String 'Reads line of data
Dim Data2 As String 'in case data is on 2 lines
Dim callNumber As String 'contains call number
Dim category As String 'contains letter for category
Dim pubYear As String 'contains year published
Dim linkID As String 'used to make link
Dim LINK As String 'contains link to article
Dim title As String 'contains title
Dim author As String 'contains name of author
Dim switch As Integer 'used to control loop
Dim Loc As Integer 'contains location of / in string
'---------------------
Button3.Visible = False
Label6.Visible = True
Label1.Visible = False
FileOpen(1, strFilename, OpenMode.Input) 'open update file for input
Data = LineInput(1) 'read blank line
intCurrent = 1 'increment what line we are on
Do While Not EOF(1) 'Start EOF Loop Here
Data = LineInput(1) 'read callnumber and year published
intCurrent = intCurrent + 1
callNumber = Mid(Data, 2, 41) 'get call number
callNumber = Trim(callNumber) 'clean up blank space
category = Mid(callNumber, 1, 1) 'get category
pubYear = Mid(Data, 43, 4) 'get published year
Data = LineInput(1) 'read LinkID
intCurrent = intCurrent + 1
linkID = Trim(Data) 'get linkID
LINK = "http://146.229.56.51/uhtbin/cgisirsi/x/0/0/5?user_id=GUEST&searchdata1=" + linkID
Data = LineInput(1) 'read title/author
intCurrent = intCurrent + 1
switch = 0
Label6.Text = "Processing."
Do While switch = 0
Data2 = LineInput(1)
intCurrent = intCurrent + 1
If Data2 = "" Then
switch = 1
Else
Data = Data + Data2
End If
Loop
Label6.Text = "Processing.."
Loc = InStr(Data, "/")
title = Mid(Data, 1, Loc - 1)
title = Trim(title)
author = Mid(Data, Loc + 1)
author = Trim(author)
getCat(category) 'gets filename from category
FileCopy(outFilename, outFilename + "_working")
FileOpen(2, outFilename + "_working", OpenMode.Input)
Kill(outFilename)
FileOpen(3, outFilename, OpenMode.Output)
'loop to find where data goes
Data = LineInput(2)
Do While Not (Data = "/// Start")
If Data = "/// Start" Then 'copy data until stop is found
Else
PrintLine(3, Data)
Data = LineInput(2)
End If
Loop
Label6.Text = "Processing..."
PrintLine(3, "/// Start")
PrintLine(3, "<item>")
PrintLine(3, "<title>" + title + "</title>")
PrintLine(3, "<link>" + LINK + "</link>")
Print(3, "<description>" + "Author: " + author + vbNewLine + "Call Number: " + callNumber + vbNewLine + "Year Published: " + pubYear + "</description>" + vbNewLine)
PrintLine(3, "</item>")
Do While Not EOF(2)
Data = LineInput(2)
PrintLine(3, Data)
Loop
FileClose(2)
Kill(outFilename + "_working")
FileClose(3)
ProgressBar1.Value = 100 / intLines * intCurrent
Label6.Text = "Processing"
Loop 'End EOF Loop Here
Label6.Text = "Done"
End Sub
End Class
|