Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

URL Grabber

Posted by Circuit Negma on March 6, 2006


This is my first project in VB6.

The project consist of a small program that grab a sequenced files on the internet and download them to a local computer. There are some bugs in the software.

For example:

lec1.pdf, lec2.pdf, lec3.pdf …. lecn.pdf.

The program will automatically download all nth files to local computer, thus saving time and efforts to the user.

——————————————————————————————————————————-

File #: 1 —> MainPanel.frm

VERSION 5.00
Object = “{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0”; “COMDLG32.OCX”
Object = “{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0”; “MSINET.OCX”
Begin VB.Form MainPanel
   Appearance      =   0  ‘Flat
   BackColor       =   &H80000005&
   BorderStyle     =   1  ‘Fixed Single
   Caption         =   “Url Grabber”
   ClientHeight    =   8205
   ClientLeft      =   150
   ClientTop       =   720
   ClientWidth     =   10380
   LinkTopic       =   “Form1”
   MaxButton       =   0   ‘False
   ScaleHeight     =   8205
   ScaleWidth      =   10380
   StartUpPosition =   3  ‘Windows Default
   Begin VB.Frame Frame1
      Appearance      =   0  ‘Flat
      BackColor       =   &H80000005&
      Caption         =   “Main Control Panel”
      ForeColor       =   &H80000008&
      Height          =   7935
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   10095
      Begin MSComDlg.CommonDialog OpenDialog
         Left            =   9600
         Top             =   0
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
         DialogTitle     =   “Open File”
         Filter          =   “Text files (*.txt)|*.txt”
      End
      Begin InetCtlsObjects.Inet Inet1
         Left            =   5760
         Top             =   6600
         _ExtentX        =   1005
         _ExtentY        =   1005
         _Version        =   393216
      End
      Begin VB.Frame Frame6
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Output Panel”
         ForeColor       =   &H80000008&
         Height          =   3975
         Left            =   2520
         TabIndex        =   18
         Top             =   2160
         Width           =   7335
         Begin VB.TextBox OutputText
            Appearance      =   0  ‘Flat
            Height          =   3615
            Left            =   120
            MultiLine       =   -1  ‘True
            ScrollBars      =   2  ‘Vertical
            TabIndex        =   23
            Text            =   “MainPanel.frx”:0000
            Top             =   240
            Width           =   6255
         End
         Begin VB.CommandButton Command1
            Appearance      =   0  ‘Flat
            BackColor       =   &H0000FF00&
            Caption         =   “Clear”
            Height          =   495
            Left            =   6480
            MaskColor       =   &H80000001&
            Style           =   1  ‘Graphical
            TabIndex        =   9
            Top             =   1200
            Width           =   735
         End
         Begin VB.CommandButton butt3
            Appearance      =   0  ‘Flat
            BackColor       =   &H000040C0&
            Caption         =   “Copy”
            Height          =   495
            Left            =   6480
            MaskColor       =   &H80000001&
            Style           =   1  ‘Graphical
            TabIndex        =   8
            Top             =   480
            Width           =   735
         End
      End
      Begin VB.Frame Frame5
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Ext. Control Panel”
         ForeColor       =   &H80000008&
         Height          =   1695
         Left            =   240
         TabIndex        =   17
         Top             =   4200
         Width           =   1815
         Begin VB.ListBox Extlist
            Appearance      =   0  ‘Flat
            Height          =   1200
            ItemData        =   “MainPanel.frx”:000F
            Left            =   120
            List            =   “MainPanel.frx”:0022
            TabIndex        =   7
            Top             =   360
            Width           =   1575
         End
      End
      Begin VB.Frame Frame4
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Tag Control Panel”
         ForeColor       =   &H80000008&
         Height          =   1695
         Left            =   240
         TabIndex        =   16
         Top             =   2280
         Width           =   1815
         Begin VB.ListBox TagList
            Appearance      =   0  ‘Flat
            Height          =   1200
            ItemData        =   “MainPanel.frx”:0042
            Left            =   120
            List            =   “MainPanel.frx”:004F
            TabIndex        =   6
            Top             =   360
            Width           =   1575
         End
      End
      Begin VB.Frame Frame3
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Activation Panel”
         ForeColor       =   &H80000008&
         Height          =   975
         Left            =   7080
         TabIndex        =   12
         Top             =   6840
         Width           =   2895
         Begin VB.CommandButton butt2
            Appearance      =   0  ‘Flat
            BackColor       =   &H00FFFF80&
            Caption         =   “Clear”
            Height          =   375
            Left            =   1440
            MaskColor       =   &H80000001&
            Style           =   1  ‘Graphical
            TabIndex        =   21
            Top             =   360
            Width           =   975
         End
         Begin VB.CommandButton Butt1
            Appearance      =   0  ‘Flat
            BackColor       =   &H00C0C0C0&
            Caption         =   “Run”
            Height          =   375
            Left            =   240
            MaskColor       =   &H80000001&
            Style           =   1  ‘Graphical
            TabIndex        =   20
            Top             =   360
            Width           =   975
         End
      End
      Begin VB.Frame Frame2
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Control Panel”
         ForeColor       =   &H80000008&
         Height          =   1695
         Left            =   240
         TabIndex        =   10
         Top             =   360
         Width           =   9615
         Begin VB.CommandButton ButtAdvanced
            Appearance      =   0  ‘Flat
            BackColor       =   &H0000FFFF&
            Caption         =   “Advanced”
            Height          =   375
            Left            =   6240
            MaskColor       =   &H80000001&
            Style           =   1  ‘Graphical
            TabIndex        =   26
            Top             =   720
            Width           =   1095
         End
         Begin VB.CheckBox downloadCheck
            Appearance      =   0  ‘Flat
            BackColor       =   &H80000005&
            Caption         =   “Download Images”
            ForeColor       =   &H80000008&
            Height          =   375
            Left            =   6360
            TabIndex        =   22
            Top             =   1200
            Width           =   1575
         End
         Begin MSComDlg.CommonDialog SaveDialog
            Left            =   8760
            Top             =   1200
            _ExtentX        =   847
            _ExtentY        =   847
            _Version        =   393216
            CancelError     =   -1  ‘True
            DialogTitle     =   “Save File”
            Filter          =   “Text files (*.txt)|*.txt|All Files (*.*)|*.*”
            InitDir         =   “c:\”
         End
         Begin VB.CommandButton Command2
            Appearance      =   0  ‘Flat
            BackColor       =   &H0000C000&
            Caption         =   “Save”
            Height          =   405
            Left            =   8280
            MaskColor       =   &H80000001&
            Style           =   1  ‘Graphical
            TabIndex        =   5
            Top             =   720
            Width           =   1095
         End
         Begin VB.TextBox endNumText
            Alignment       =   2  ‘Center
            Appearance      =   0  ‘Flat
            Height          =   285
            Left            =   4560
            TabIndex        =   4
            Top             =   1200
            Width           =   1215
         End
         Begin VB.TextBox startnumText
            Alignment       =   2  ‘Center
            Appearance      =   0  ‘Flat
            Height          =   285
            Left            =   1680
            TabIndex        =   3
            Top             =   1200
            Width           =   1215
         End
         Begin VB.TextBox FilenameText
            Appearance      =   0  ‘Flat
            BeginProperty DataFormat
               Type            =   0
               Format          =   “0”
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
            Height          =   285
            Left            =   1200
            TabIndex        =   2
            Top             =   765
            Width           =   3015
         End
         Begin VB.TextBox urlAddText
            Appearance      =   0  ‘Flat
            Height          =   285
            Left            =   1200
            TabIndex        =   1
            Top             =   360
            Width           =   8175
         End
         Begin VB.Label Label4
            Alignment       =   2  ‘Center
            Appearance      =   0  ‘Flat
            BackColor       =   &H80000005&
            Caption         =   “Ending Number:”
            ForeColor       =   &H80000008&
            Height          =   255
            Left            =   3240
            TabIndex        =   15
            Top             =   1200
            Width           =   1335
         End
         Begin VB.Label Label3
            Alignment       =   2  ‘Center
            Appearance      =   0  ‘Flat
            BackColor       =   &H80000005&
            Caption         =   “Starting Number:”
            ForeColor       =   &H80000008&
            Height          =   255
            Left            =   240
            TabIndex        =   14
            Top             =   1200
            Width           =   1335
         End
         Begin VB.Label Label2
            Alignment       =   2  ‘Center
            Appearance      =   0  ‘Flat
            BackColor       =   &H80000005&
            Caption         =   “FileName:”
            ForeColor       =   &H80000008&
            Height          =   255
            Left            =   240
            TabIndex        =   13
            Top             =   780
            Width           =   855
         End
         Begin VB.Label Label1
            Alignment       =   2  ‘Center
            Appearance      =   0  ‘Flat
            BackColor       =   &H80000005&
            Caption         =   “Url Address:”
            ForeColor       =   &H80000008&
            Height          =   255
            Left            =   240
            TabIndex        =   11
            Top             =   360
            Width           =   855
         End
      End
      Begin VB.TextBox Text1
         Appearance      =   0  ‘Flat
         Height          =   1335
         Left            =   120
         MultiLine       =   -1  ‘True
         ScrollBars      =   2  ‘Vertical
         TabIndex        =   19
         Text            =   “MainPanel.frx”:0077
         Top             =   6480
         Width           =   6615
      End
      Begin VB.Label lblFace
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000001&
         Caption         =   “Label5”
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   6840
         TabIndex        =   25
         Top             =   6480
         Width           =   10
      End
      Begin VB.Label lblBack
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  ‘Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   6840
         TabIndex        =   24
         Top             =   6480
         Width           =   3135
      End
      Begin VB.Line Line3
         X1              =   120
         X2              =   9960
         Y1              =   6360
         Y2              =   6360
      End
      Begin VB.Line Line2
         X1              =   120
         X2              =   2280
         Y1              =   4080
         Y2              =   4080
      End
      Begin VB.Line Line1
         X1              =   2280
         X2              =   2280
         Y1              =   2160
         Y2              =   6120
      End
   End
   Begin VB.Menu mnuFile
      Caption         =   “&File”
      Index           =   1
      NegotiatePosition=   1  ‘Left
      WindowList      =   -1  ‘True
      Begin VB.Menu mnuFileOpen
         Caption         =   “&Open”
         Shortcut        =   ^O
      End
      Begin VB.Menu mnuFileBar
         Caption         =   “-“
      End
      Begin VB.Menu mnuFileExit
         Caption         =   “E&xit”
         Index           =   3
         Shortcut        =   ^E
      End
   End
   Begin VB.Menu mnuHelp
      Caption         =   “&Help”
      Index           =   2
      NegotiatePosition=   3  ‘Right
      Begin VB.Menu mnuHelphelp
         Caption         =   “&Help”
         Index           =   4
         Shortcut        =   ^H
      End
      Begin VB.Menu mnuHelpBar
         Caption         =   “-“
      End
      Begin VB.Menu mnuHelpAbout
         Caption         =   “&About”
         Index           =   5
         Shortcut        =   ^A
      End
   End
End
Attribute VB_Name = “MainPanel”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

‘ Progress Bar Variables
Private m_iMin As Long ‘ min value
Private m_iValue As Long ‘ current counter value
Private m_iMaxValue As Long ‘ max counter value
Private m_sWidth As Single ‘ progress bar width

‘ Url Grabber Variables
Public strtag As String
Public endtag As String
Public strext As String
Private urlString As String
Private urlStringStr As String
Private urlStringEnd As String
Private urlflag As Boolean
Private FileName As String
Public FileNameAll As String
Public FileNameStart As String
Public FileNameEnd As String
Public FileNameFlag As Boolean
Private i As Integer
Private iloc As Integer
Private nloc As Integer
Private s As String
Private strdirectorypath As String
Private saveFlag As Boolean
Private Strcomplete As String

Private Sub About_Click(Index As Integer)
frmAbout.Show 1
End Sub

Private Sub Butt1_Click()
‘ Declear some variables and constants
Dim urlAddressString As String
Dim startnum As Integer
Dim endnum As Integer
Dim inturl As Integer

‘ Declear the Progress Bar Variables
Dim l As Long ‘ index variable
Dim j As Long ‘ index variable
Dim iMin As Long ‘ Max value
Dim iMax As Long ‘ Min value

‘ Declear The Server Variables
Dim strHTML As String
Dim strServer As String

If InStr(urlAddText.Text, “[“) = 0 Then

    ‘Check if the url address hold “http://”
        urlAddressString = urlAddText.Text      ‘ Optain the url Address
        urlString = Left(urlAddressString, 7)   ‘ Optain the “http://” from the inputed address
        urlflag = False
        If urlAddressString = “” Then           ‘ Check if the User has entered an URL Address
            MsgBox “Please, Enter an Url Address”, vbCritical
            Exit Sub
        Else
            If Len(urlAddressString) < 5 Then
            MsgBox “Please Note, your url Address is less than 5 characters”, vbCritical
            Exit Sub
        Else
            If Not urlString = “http://&#8221; Then
                urlAddressString = “http://&#8221; & urlAddressString   ‘ Can use either [&] or [+]
            End If
        End If
    End If
   

Else

    ‘Check if the url address hold “http://&#8221;
        i = InStr(urlAddText.Text, “[“)
        iloc = InStr(urlAddText.Text, “-“)
        nloc = iloc – i – 1
        urlflag = True
        MsgBox Mid(urlAddText.Text, i + 1, nloc), vbCritical
        ‘MsgBox Val(Mid(urlAddText.Text, i + 1, nloc)), vbCritical
       
        urlStringStr = Left(urlAddText.Text, i – 1)
        urlStringEnd = Right(urlAddText.Text, Len(urlAddText.Text) – i – 1)
        urlString = Left(urlStringStr, 7)   ‘ Optain the “http://&#8221; from the inputed address
        If urlStringStr = “” Then           ‘ Check if the User has entered an URL Address
            MsgBox “Please, Enter an Url Address”, vbCritical
            Exit Sub
        Else
            If Len(urlStringStr) < 5 Then
            MsgBox “Please Note, your url Address is less than 5 characters”, vbCritical
            Exit Sub
        Else
            If Not urlString = “http://&#8221; Then
                urlStringStr = “http://&#8221; & urlStringStr   ‘ Can use either [&] or [+]
            End If
        End If
    End If
End If

If urlflag = False Then
        ‘ Check if the url ends with ‘/’
        inturl = Len(urlAddressString)
        If Right(urlAddressString, 1) = “/” Then
            urlAddressString = Left(urlAddressString, inturl – 1)
        End If
Else
        ‘ Check if the url ends with ‘/’
        inturl = Len(urlStringEnd)
        If Right(urlStringEnd, 1) = “/” Then
            urlStringEnd = Left(urlStringEnd, inturl – 1)
        End If
       
        ‘Check for the right integer (numeric) data format
        If urlErrorCheck() = 1 Then
            Exit Sub
        End If

End If

 

‘ Initiate the FileNameAll String for the name of the file
If FileNameFlag = True Then
    FileNameAll = “”
Else
    FileNameAll = FilenameText.Text
End If

‘Check for the right integer (numeric) data format
If ErrorCheck() = 1 Then
    Exit Sub
End If
   
‘ Optain the starting and ending number
startnum = Val(startnumText.Text)   ‘ Converting a String to an Integer
endnum = Val(endNumText.Text)       ‘ Converting a String to an Integer
If startnum > endnum Then
    MsgBox “Warrning!!: Starting Number can not be larger than Ending Number”, vbCritical
    Exit Sub
End If

‘ Get parameters entered by user
iMin = CLng(Val(startnumText.Text))
iMax = CLng(Val(endNumText.Text))

‘ Check if the user has specified the tags
If strtag = “” Then
    MsgBox “Please, specify what type of tags do you want to use”, vbCritical
    Exit Sub
End If
 
‘ Check if the user has specified the extension
If strext = “” Then
    MsgBox “Please, specify what type of tags do you want to use”, vbCritical
    Exit Sub
End If

‘ Check if the save button has been pressed
If saveFlag = False Then
    Call Command2_Click
End If

‘Text1.Text = SaveDialog.CancelError

If SaveDialog.CancelError = True Then
    MsgBox “You pressed cancel rather than save. Your work was not saved”, vbCritical
    Exit Sub
End If

‘ Obtain the directory path
strdirectorypath = Left(SaveDialog.FileName, (Len(SaveDialog.FileName) – Len(SaveDialog.FileTitle)))
Text1.Text = strdirectorypath

‘ initialize progress bar
lblBack.Caption = “Processing …”
Call InitProgress(iMin, iMax)

‘Prevent recrusive Processing
    Butt1.Enabled = False
    butt2.Enabled = False

‘ Perform the required operation
If downloadCheck.Value = 1 Then

        If Left(startnumText.Text, 1) = “0” Then
            For i = startnum To 9
                Print #1, strtag & urlAddressString & “/” & FileNameAll & FileNameStart & “0” & i & FileNameEnd & “.” & strext & endtag
                Print #1, “[URL=” & urlAddressString & “/” & FileNameAll & FileNameStart & “0” & i & FileNameEnd & “.” & strext & “]” & FileNameAll & FileNameStart & i & FileNameEnd & “[/URL]”
                Call GetPICFile(urlAddressString & “/” & FileNameAll & FileNameStart & “0” & i & FileNameEnd & “.” & strext, strdirectorypath & FileNameAll & FileNameStart & “0” & i & FileNameEnd & “.” & strext)
                Call SetProgress(i)
            Next i
            For i = 10 To endnum
                Print #1, strtag & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & endtag
                Print #1, “[URL=” & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & “]” & FileNameAll & FileNameStart & i & FileNameEnd & “[/URL]”
                Call GetPICFile(urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext, strdirectorypath & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext)
                Call SetProgress(i)
            Next i
       
        Else
            For i = startnum To endnum
                Print #1, strtag & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & endtag
                Print #1, “[URL=” & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & “]” & FileNameAll & FileNameStart & i & FileNameEnd & “[/URL]”
                Call GetPICFile(urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext, strdirectorypath & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext)
                Call SetProgress(i)
            Next i
        End If
Else

        If Left(startnumText.Text, 1) = “0” Then
            For i = startnum To 9
                Print #1, strtag & urlAddressString & “/” & FileNameAll & FileNameStart & “0” & i & FileNameEnd & “.” & strext & endtag
                Print #1, “[URL=” & urlAddressString & “/” & FileNameAll & FileNameStart & “0” & i & FileNameEnd & “.” & strext & “]” & FileNameAll & FileNameEnd & i & FileNameEnd & “[/URL]”
                Call SetProgress(i)
            Next i
            For i = 10 To endnum
                Print #1, strtag & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & endtag
                Print #1, “[URL=” & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & “]” & FileNameAll & FileNameStart & i & FileNameEnd & “[/URL]”
                Call SetProgress(i)
            Next i
       
        Else
            For i = startnum To endnum
                Print #1, strtag & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & endtag
                Print #1, “[URL=” & urlAddressString & “/” & FileNameAll & FileNameStart & i & FileNameEnd & “.” & strext & “]” & FileNameAll & FileNameStart & i & FileNameEnd & “[/URL]”
                Call SetProgress(i)
            Next i
        End If
End If

‘ Create empty lines in the Output Files
For i = 0 To 10
    Print #1, “”
Next i

‘ Perform XML generation code
If Left(startnumText.Text, 1) = “0” Then
            For i = startnum To 9
                Print #1, “<p><img ” & FilenameText.Text & i & ” src=” & urlAddressString & “/” & FilenameText.Text & “0” & i & “.” & strext & ” /></p>”
                Print #1, “<p><a href=” & urlAddressString & “/” & FilenameText.Text & “0” & i & “.” & strext & “target=” & “_” & “blank” & “>” & FilenameText.Text & i & “</a>”
                Call SetProgress(i)
            Next i
            For i = 10 To endnum
                Print #1, “<p><img ” & FilenameText.Text & i & ” src=” & urlAddressString & “/” & FilenameText.Text & i & “.” & strext & ” /></p>”
                Print #1, “<p><a href=” & urlAddressString & “/” & FilenameText.Text & i & “.” & strext & “target=” & “_” & “blank” & “>” & FilenameText.Text & i & “</a>”
                Call SetProgress(i)
            Next i
        Else
            For i = startnum To endnum
                Print #1, “<p><img ” & FilenameText.Text & i & ” src=” & urlAddressString & “/” & FilenameText.Text & i & “.” & strext & ” /></p>”
                Print #1, “<p><a href=” & urlAddressString & “/” & FilenameText.Text & i & “.” & strext & “target=” & “_” & “blank” & “>” & FilenameText.Text & i & “</a>”
                Call SetProgress(i)
            Next i
End If

‘ Close the Output File
Close #1
   
‘ gather some information about the server
strHTML = Inet1.OpenURL(urlAddressString)
strServer = Inet1.GetHeader()
Text1.Text = strServer

Call ReadingFile(SaveDialog.FileName)
butt2.Enabled = True

End Sub

Private Sub butt3_Click()

Clipboard.Clear
OutputText.SelStart = 0
OutputText.SelLength = Len(OutputText.Text)
Clipboard.SetText OutputText.SelText

End Sub

Private Sub ButtAdvanced_Click()
FilenameText.Enabled = False
FileNamAdv.Show 1
End Sub

Private Sub Command1_Click()
OutputText.Text = “”
End Sub

Private Sub Command2_Click()

On Error GoTo SaveAsErr
   
    ‘ display the Save dialog
    SaveDialog.FileName = FilenameText.Text
    SaveDialog.ShowSave
   
    ‘ get the resulting filename
    FileName = SaveDialog.FileName
    Open FileName For Output As #1 ‘Opens The File
   
    ‘ and invoke the save procedure
    ‘SaveText
    saveFlag = True
    SaveDialog.CancelError = False
   
SaveAsErr:
    Exit Sub

End Sub

Private Sub butt2_Click()
TagList.ListIndex = -1
Extlist.ListIndex = -1
urlAddText.Text = “”
FilenameText.Text = “”
startnumText.Text = “”
endNumText.Text = “”
strtag = “”
endtag = “”
strext = “”
urlString = “”
OutputText.Text = “”
Text1.Text = “”
Call InitProgress(1, 1)
Call SetProgress(1)
FilenameText.Enabled = True
Butt1.Enabled = True
saveFlag = False
SaveDialog.CancelError = True
End Sub

Private Sub Form_load()
saveFlag = False
Call butt2_Click
End Sub

Private Sub mnuFileExit_Click(Index As Integer)

Unload frmAbout
Unload TagDialog
Unload MainPanel
Unload ProgressBar
Unload ExtDialog
End
End Sub

Private Sub mnuFileOpen_Click()

‘Dim fso As Scripting.FileSystemObject
‘Dim tso As Scripting.TextStream
   
On Error GoTo OpenAsErr
   
    ‘ display the Save dialog
      OpenDialog.ShowOpen
   
    ‘ get the resulting filename
    FileName = OpenDialog.FileName
    Call ReadingFile(FileName)
   
OpenAsErr:
    Exit Sub

End Sub

Private Sub mnuHelpAbout_Click(Index As Integer)
frmAbout.Show 1
End Sub

Private Sub TagList_Click()

If TagList.Text = “[IMG]/[/IMG]” Then
    strtag = “[IMG]”
    endtag = “[/IMG]”
ElseIf TagList.Text = “[URL]/[/URL]” Then
    strtag = “[URL]”
    endtag = “[/URL]”
ElseIf TagList.Text = “CUSTOM” Then     ‘listbox.text returns a string of the selected item
    TagDialog.Show 1
    End If
End Sub

Private Sub Extlist_Click()

If Extlist.Text = “JPG” Then
    strext = Extlist.Text
    Text1.Text = strext
ElseIf Extlist.Text = “GIF” Then
    strext = Extlist.Text
ElseIf Extlist.Text = “BMP” Then
    strext = Extlist.Text
ElseIf Extlist.Text = “PDF” Then
    strext = Extlist.Text
ElseIf Extlist.Text = “CUSTOM” Then  ‘listbox.text returns a string of the selected item
    ExtDialog.Show 1
    End If
End Sub

Public Sub GetPICFile(strSourceURL As String, strDestFilePath As String)
    Dim strPIC As String
    Dim b() As Byte
    Dim intFile As Integer
   
    intFile = FreeFile()    ‘ Find a free file
   
    b() = Inet1.OpenURL(strSourceURL, icByteArray)
    Do
        Loop Until Not Inet1.StillExecuting
        Open strDestFilePath For Binary Access _
        Write As #intFile
        Put #intFile, , b()
        Close #intFile

End Sub

Private Sub ReadingFile(sourceFile As String)
Dim variable1 As String
Dim intFile As Integer

intFile = FreeFile() ‘ Find a Free File
variable1 = “”
Open sourceFile For Input Lock Write As #intFile
Screen.MousePointer = vbHourglass
  DoEvents
OutputText.Text = StrConv(InputB$(LOF(intFile), intFile), vbUnicode)            ‘Input(LOF(intFile), intFile)
Close #intFile
Screen.MousePointer = vbDefault

End Sub

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

File #: 2 —> ExtDialog.frm

VERSION 5.00
Begin VB.Form ExtDialog
   Appearance      =   0  ‘Flat
   BackColor       =   &H80000001&
   BorderStyle     =   0  ‘None
   Caption         =   “Ext. Control Unit”
   ClientHeight    =   1065
   ClientLeft      =   4005
   ClientTop       =   4005
   ClientWidth     =   6030
   LinkTopic       =   “Form1”
   MaxButton       =   0   ‘False
   MinButton       =   0   ‘False
   ScaleHeight     =   1065
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   ‘False
   Begin VB.CommandButton Command2
      BackColor       =   &H80000005&
      Caption         =   “Cancel”
      Height          =   375
      Left            =   4680
      MaskColor       =   &H80000012&
      TabIndex        =   4
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton Command1
      Caption         =   “OK”
      Height          =   375
      Left            =   4680
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin VB.Frame Frame1
      Appearance      =   0  ‘Flat
      BackColor       =   &H80000005&
      Caption         =   “Ext. Control”
      ForeColor       =   &H80000008&
      Height          =   855
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4455
      Begin VB.TextBox ExtText
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         Height          =   285
         Left            =   1800
         TabIndex        =   3
         Text            =   “jpg”
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label1
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Ext. :”
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   1200
         TabIndex        =   2
         Top             =   360
         Width           =   495
      End
   End
End
Attribute VB_Name = “ExtDialog”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
MainPanel.strext = ExtText.Text
Unload ExtDialog
End Sub

Private Sub Command2_Click()
Unload ExtDialog
End Sub
=================================================================

File #: 3 —> FileNamAdv.frm

VERSION 5.00
Begin VB.Form FileNamAdv
   Appearance      =   0  ‘Flat
   BackColor       =   &H80000005&
   BorderStyle     =   0  ‘None
   Caption         =   “File Name Advanced Settings”
   ClientHeight    =   1725
   ClientLeft      =   4995
   ClientTop       =   4995
   ClientWidth     =   4800
   DrawStyle       =   5  ‘Transparent
   LinkTopic       =   “Form1”
   MaxButton       =   0   ‘False
   MinButton       =   0   ‘False
   ScaleHeight     =   1725
   ScaleWidth      =   4800
   ShowInTaskbar   =   0   ‘False
   Begin VB.CommandButton ButtCancel
      Appearance      =   0  ‘Flat
      BackColor       =   &H000000FF&
      Caption         =   “Cancel”
      Height          =   495
      Left            =   3360
      MaskColor       =   &H000080FF&
      Style           =   1  ‘Graphical
      TabIndex        =   1
      Top             =   960
      Width           =   1095
   End
   Begin VB.CommandButton Command1
      Appearance      =   0  ‘Flat
      BackColor       =   &H000080FF&
      Caption         =   “OK”
      Height          =   495
      Left            =   3360
      MaskColor       =   &H000000FF&
      Style           =   1  ‘Graphical
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
   Begin VB.Frame Frame1
      Appearance      =   0  ‘Flat
      BackColor       =   &H80000005&
      Caption         =   “File Name Advanced Settings”
      ForeColor       =   &H80000008&
      Height          =   1455
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   4455
      Begin VB.TextBox EndText
         Appearance      =   0  ‘Flat
         Height          =   285
         Left            =   720
         TabIndex        =   6
         Top             =   840
         Width           =   1575
      End
      Begin VB.TextBox FrontText
         Appearance      =   0  ‘Flat
         Height          =   285
         Left            =   720
         TabIndex        =   5
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label2
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “End: “
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label1
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Front: “
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   495
      End
   End
End
Attribute VB_Name = “FileNamAdv”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ButtCancel_Click()
MainPanel.FilenameText.Enabled = True
Unload FileNamAdv
End Sub

Private Sub Command1_Click()
MainPanel.FileNameStart = FrontText.Text
MainPanel.FileNameEnd = EndText.Text
MainPanel.FilenameText.Text = FrontText.Text + “xxx” + EndText.Text
MainPanel.FilenameText.Enabled = False
MainPanel.FileNameFlag = True
Unload FileNamAdv

End Sub
===============================================================

File #: 4 —> frmAbout.frm

VERSION 5.00
Begin VB.Form frmAbout
   BorderStyle     =   3  ‘Fixed Dialog
   Caption         =   “About MyApp”
   ClientHeight    =   3960
   ClientLeft      =   2340
   ClientTop       =   1935
   ClientWidth     =   5730
   ClipControls    =   0   ‘False
   LinkTopic       =   “Form2”
   MaxButton       =   0   ‘False
   MinButton       =   0   ‘False
   ScaleHeight     =   2733.262
   ScaleMode       =   0  ‘User
   ScaleWidth      =   5380.766
   ShowInTaskbar   =   0   ‘False
   Begin VB.PictureBox picIcon
      AutoSize        =   -1  ‘True
      ClipControls    =   0   ‘False
      Height          =   540
      Left            =   240
      Picture         =   “frmAbout.frx”:0000
      ScaleHeight     =   337.12
      ScaleMode       =   0  ‘User
      ScaleWidth      =   337.12
      TabIndex        =   1
      Top             =   240
      Width           =   540
   End
   Begin VB.CommandButton cmdOK
      Cancel          =   -1  ‘True
      Caption         =   “OK”
      Default         =   -1  ‘True
      Height          =   345
      Left            =   4245
      TabIndex        =   0
      Top             =   2625
      Width           =   1260
   End
   Begin VB.Line Line1
      BorderColor     =   &H00808080&
      BorderStyle     =   6  ‘Inside Solid
      Index           =   1
      X1              =   84.515
      X2              =   5309.398
      Y1              =   1687.582
      Y2              =   1687.582
   End
   Begin VB.Label lblDescription
      Caption         =   “This is a Test Version”
      ForeColor       =   &H00000000&
      Height          =   1170
      Left            =   1050
      TabIndex        =   2
      Top             =   1125
      Width           =   3885
   End
   Begin VB.Label lblTitle
      Caption         =   “Url Grabber”
      ForeColor       =   &H00000000&
      Height          =   480
      Left            =   1050
      TabIndex        =   4
      Top             =   240
      Width           =   3885
   End
   Begin VB.Line Line1
      BorderColor     =   &H00FFFFFF&
      BorderWidth     =   2
      Index           =   0
      X1              =   98.6
      X2              =   5309.398
      Y1              =   1697.935
      Y2              =   1697.935
   End
   Begin VB.Label lblVersion
      Caption         =   “Version 1.0”
      Height          =   225
      Left            =   1050
      TabIndex        =   5
      Top             =   780
      Width           =   3885
   End
   Begin VB.Label lblDisclaimer
      Caption         =   $”frmAbout.frx”:030A
      ForeColor       =   &H00000000&
      Height          =   1185
      Left            =   255
      TabIndex        =   3
      Top             =   2625
      Width           =   3870
   End
End
Attribute VB_Name = “frmAbout”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

‘ Reg Key Security Options…
Const READ_CONTROL = &H20000
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_CREATE_LINK = &H20
Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _
                       KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _
                       KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL
                    
‘ Reg Key ROOT Types…
Const HKEY_LOCAL_MACHINE = &H80000002
Const ERROR_SUCCESS = 0
Const REG_SZ = 1                         ‘ Unicode nul terminated string
Const REG_DWORD = 4                      ‘ 32-bit number

Const gREGKEYSYSINFOLOC = “SOFTWARE\Microsoft\Shared Tools Location”
Const gREGVALSYSINFOLOC = “MSINFO”
Const gREGKEYSYSINFO = “SOFTWARE\Microsoft\Shared Tools\MSINFO”
Const gREGVALSYSINFO = “PATH”

Private Declare Function RegOpenKeyEx Lib “advapi32” Alias “RegOpenKeyExA” (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib “advapi32” Alias “RegQueryValueExA” (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib “advapi32” (ByVal hKey As Long) As Long

Private Sub cmdSysInfo_Click()
  Call StartSysInfo
End Sub

Private Sub cmdOK_Click()
  Unload Me
End Sub

Private Sub Form_load()
    Me.Caption = “About ” & App.Title
    lblVersion.Caption = “Version ” & App.Major & “.” & App.Minor & “.” & App.Revision
    lblTitle.Caption = App.Title
End Sub

Public Sub StartSysInfo()
    On Error GoTo SysInfoErr
 
    Dim rc As Long
    Dim SysInfoPath As String
   
    ‘ Try To Get System Info Program Path\Name From Registry…
    If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then
    ‘ Try To Get System Info Program Path Only From Registry…
    ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
        ‘ Validate Existance Of Known 32 Bit File Version
        If (Dir(SysInfoPath & “\MSINFO32.EXE”) <> “”) Then
            SysInfoPath = SysInfoPath & “\MSINFO32.EXE”
           
        ‘ Error – File Can Not Be Found…
        Else
            GoTo SysInfoErr
        End If
    ‘ Error – Registry Entry Can Not Be Found…
    Else
        GoTo SysInfoErr
    End If
   
    Call Shell(SysInfoPath, vbNormalFocus)
   
    Exit Sub
SysInfoErr:
    MsgBox “System Information Is Unavailable At This Time”, vbOKOnly
End Sub

Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
    Dim i As Long                                           ‘ Loop Counter
    Dim rc As Long                                          ‘ Return Code
    Dim hKey As Long                                        ‘ Handle To An Open Registry Key
    Dim hDepth As Long                                      ‘
    Dim KeyValType As Long                                  ‘ Data Type Of A Registry Key
    Dim tmpVal As String                                    ‘ Tempory Storage For A Registry Key Value
    Dim KeyValSize As Long                                  ‘ Size Of Registry Key Variable
    ‘————————————————————
    ‘ Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE…}
    ‘————————————————————
    rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ‘ Open Registry Key
   
    If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ‘ Handle Error…
   
    tmpVal = String$(1024, 0)                             ‘ Allocate Variable Space
    KeyValSize = 1024                                       ‘ Mark Variable Size
   
    ‘————————————————————
    ‘ Retrieve Registry Key Value…
    ‘————————————————————
    rc = RegQueryValueEx(hKey, SubKeyRef, 0, _
                         KeyValType, tmpVal, KeyValSize)    ‘ Get/Create Key Value
                       
    If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ‘ Handle Errors
   
    If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then           ‘ Win95 Adds Null Terminated String…
        tmpVal = Left(tmpVal, KeyValSize – 1)               ‘ Null Found, Extract From String
    Else                                                    ‘ WinNT Does NOT Null Terminate String…
        tmpVal = Left(tmpVal, KeyValSize)                   ‘ Null Not Found, Extract String Only
    End If
    ‘————————————————————
    ‘ Determine Key Value Type For Conversion…
    ‘————————————————————
    Select Case KeyValType                                  ‘ Search Data Types…
    Case REG_SZ                                             ‘ String Registry Key Data Type
        KeyVal = tmpVal                                     ‘ Copy String Value
    Case REG_DWORD                                          ‘ Double Word Registry Key Data Type
        For i = Len(tmpVal) To 1 Step -1                    ‘ Convert Each Bit
            KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))   ‘ Build Value Char. By Char.
        Next
        KeyVal = Format$(“&h” + KeyVal)                     ‘ Convert Double Word To String
    End Select
   
    GetKeyValue = True                                      ‘ Return Success
    rc = RegCloseKey(hKey)                                  ‘ Close Registry Key
    Exit Function                                           ‘ Exit
   
GetKeyError:      ‘ Cleanup After An Error Has Occured…
    KeyVal = “”                                             ‘ Set Return Val To Empty String
    GetKeyValue = False                                     ‘ Return Failure
    rc = RegCloseKey(hKey)                                  ‘ Close Registry Key
End Function
======================================================================

File #: 5 —> ProgressBar.frm

VERSION 5.00
Begin VB.Form ProgressBar
   Appearance      =   0  ‘Flat
   AutoRedraw      =   -1  ‘True
   BackColor       =   &H80000001&
   BorderStyle     =   0  ‘None
   Caption         =   “Processing …..”
   ClientHeight    =   1215
   ClientLeft      =   4005
   ClientTop       =   4005
   ClientWidth     =   6480
   LinkTopic       =   “Form1”
   MaxButton       =   0   ‘False
   MinButton       =   0   ‘False
   ScaleHeight     =   1215
   ScaleWidth      =   6480
   ShowInTaskbar   =   0   ‘False
   Begin VB.Frame Frame1
      Appearance      =   0  ‘Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6255
      Begin VB.Label lblFace
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000001&
         BorderStyle     =   1  ‘Fixed Single
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   15
      End
      Begin VB.Label lblBack
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  ‘Transparent
         BorderStyle     =   1  ‘Fixed Single
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   6015
      End
   End
End
Attribute VB_Name = “ProgressBar”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

‘ Copyright (C) 2003 xllentSOFT.com, Sergey Popov. All Rights Reserved.
http://www.xllentsoft.com

‘ You may use, distribute or modify source code free of charge

‘ This code and information are provided “AS IS” without warranty of any kind, either expressed or implied

Private m_iMin As Long ‘ min value
Private m_iValue As Long ‘ current counter value
Private m_iMaxValue As Long ‘ max counter value
Private m_sWidth As Single ‘ progress bar width

‘ Initialize progress bar:
‘ – iMin: min value
‘ – iMax: max value
Private Sub InitProgress(ByVal iMin As Long, ByVal iMax As Long)
    ‘ get progress bar width
    m_sWidth = lblBack.Width
    ‘ save min value for further calculations
    m_iMin = iMin
    ‘ calculate max counter value
    If iMin = 1 Then
        m_iMaxValue = iMax
    Else
        m_iMaxValue = Abs(iMax – iMin)
        If iMin < 1 Then
            m_iMaxValue = m_iMaxValue + 1
        End If
    End If
    ‘ set initial counter value
    m_iValue = 1
End Sub

‘ Draw current progress bar state:
‘ – iValue – current value
Private Sub SetProgress(ByVal iValue As Long)
    ‘ normalize current value
    m_iValue = Abs(iValue – m_iMin) + 1
    With lblFace
        ‘ calculate progress bar width
        .Width = (m_iValue * m_sWidth) / m_iMaxValue
        ‘ calculate percentage
        .Caption = CStr(Int(m_iValue * 100 / m_iMaxValue)) & “%”
           
    End With
    ‘ let the operating system to process other events
    DoEvents
End Sub

Private Sub Form_load()
    Dim i As Long ‘ index variable
    Dim j As Long ‘ index variable
    Dim iMin As Long ‘ Max value
    Dim iMax As Long ‘ Min value
   
    ‘ get parameters entered by user
    iMin = CLng(Val(MainPanel.startnumText.Text))
    iMax = CLng(Val(MainPanel.endNumText.Text))
    ‘ initialize progress bar
    InitProgress iMin, iMax
    ‘ imitate useful calculations
    For i = iMin To iMax
        For j = 1 To 50000 ‘ some delay
        Next j
        ‘ change progress bar state
        SetProgress i
    Next i
       
End Sub
==========================================================

File #: 6 —> TagDialog.frm

VERSION 5.00
Begin VB.Form TagDialog
   Appearance      =   0  ‘Flat
   BackColor       =   &H80000001&
   BorderStyle     =   0  ‘None
   Caption         =   “Tag Control Unit”
   ClientHeight    =   1095
   ClientLeft      =   4005
   ClientTop       =   4005
   ClientWidth     =   6030
   LinkTopic       =   “Form1”
   MaxButton       =   0   ‘False
   MinButton       =   0   ‘False
   ScaleHeight     =   1095
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   ‘False
   Begin VB.Frame Frame1
      Appearance      =   0  ‘Flat
      BackColor       =   &H80000014&
      Caption         =   “Tag Control”
      ForeColor       =   &H80000008&
      Height          =   855
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   4455
      Begin VB.TextBox endTagText
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         Height          =   285
         Left            =   3240
         TabIndex        =   6
         Text            =   “[/IMG]”
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox StartTagText
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         Height          =   285
         Left            =   1080
         TabIndex        =   5
         Text            =   “[IMG]”
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label2
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “End Tag:”
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   2280
         TabIndex        =   4
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label1
         Alignment       =   2  ‘Center
         Appearance      =   0  ‘Flat
         BackColor       =   &H80000005&
         Caption         =   “Start Tag:”
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   855
      End
   End
   Begin VB.CommandButton CancelButton
      Caption         =   “Cancel”
      Height          =   375
      Left            =   4680
      TabIndex        =   1
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton OKButton
      Caption         =   “OK”
      Height          =   375
      Left            =   4680
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
End
Attribute VB_Name = “TagDialog”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private Sub CancelButton_Click()
Unload TagDialog
End Sub

Private Sub OKButton_Click()
MainPanel.strtag = StartTagText.Text
MainPanel.endtag = endTagText.Text
Unload TagDialog
End Sub
================================================================

File #: 7 —> ErrorCheck.bas

Attribute VB_Name = “Model1”

‘ Progress Bar Variables
Private m_iMin As Long ‘ min value
Private m_iValue As Long ‘ current counter value
Private m_iMaxValue As Long ‘ max counter value
Private m_sWidth As Single ‘ progress bar width

Public Function ErrorCheck() As Integer

If Not IsNumeric(MainPanel.startnumText.Text) Then
MsgBox “Enter the number of the First Picture”, vbCritical
MainPanel.startnumText.SetFocus
ErrorCheck = 1
Exit Function
End If

If Not IsNumeric(MainPanel.endNumText.Text) Then
MsgBox “Enter the Number of the Last Picture”, vbCritical
MainPanel.endNumText.SetFocus
ErrorCheck = 1
Exit Function
End If

End Function

Public Function urlErrorCheck() As Integer

Dim ibraket, idash, n As Integer

ibraket = InStr(urlAddText.Text, “[“)
idash = InStr(urlAddText.Text, “-“)
n = idash – ibraket – 1

If Not IsNumeric(Mid(MainPanel.urlAddText.Text, ibraket + 1, n)) Then
MsgBox “Invalid Number inserted in you URL Link”, vbCritical
MainPanel.urlAddText.SetFocus
urlErrorCheck = 1
Exit Function
End If

n = idash – InStr(urlAddText.Text, “]”) – 1

If Not IsNumeric(Mid(MainPanel.urlAddText.Text, idash + 1, n)) Then
MsgBox “Invalid Number inserted in you URL Link”, vbCritical
MainPanel.urlAddText.SetFocus
urlErrorCheck = 1
Exit Function
End If

End Function

‘ Initialize progress bar:
‘ – iMin: min value
‘ – iMax: max value
Public Function InitProgress(ByVal iMin As Long, ByVal iMax As Long)    ‘ private sub
    ‘ get progress bar width
    m_sWidth = MainPanel.lblBack.Width
    ‘ save min value for further calculations
    m_iMin = iMin
    ‘ calculate max counter value
    If iMin = 1 Then
        m_iMaxValue = iMax
    Else
        m_iMaxValue = Abs(iMax – iMin)
        If iMin < 1 Then
            m_iMaxValue = m_iMaxValue + 1
        End If
    End If
    ‘ set initial counter value
    m_iValue = 0
End Function

‘ Draw current progress bar state:
‘ – iValue – current value
Public Function SetProgress(ByVal iValue As Long)   ‘private sub
    ‘ normalize current value
    m_iValue = Abs(iValue – m_iMin)
    With MainPanel.lblFace
        ‘ calculate progress bar width
        .Width = (m_iValue * m_sWidth) / m_iMaxValue
        ‘ calculate percentage
        .Caption = CStr(Int(m_iValue * 100 / m_iMaxValue)) & “%”
    End With
    ‘ let the operating system to process other events
    DoEvents
End Function

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

File #: 8 —> LoadForm.bas

Attribute VB_Name = “Model2”
Private Sub Form_load()
‘Initializes globals and Loads the Spectral Analysis form
    Dim MainForm As MainPanel
    On Error GoTo Handle_Error
    Set MainForm = New MainPanel
    Call MainForm.Show
    Exit Sub
Handle_Error:
    MsgBox (Err.Description)
End Sub
=============================================================

File #: 9 —> urlgrabber.vbp

Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
Reference=*\G{6B263850-900B-11D0-9484-00A0C91110ED}#1.0#0#C:\WINDOWS\system32\MSSTDFMT.DLL#Microsoft Data Formatting Object Library 6.0 (SP4)
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX
Object={48E59290-9880-11CF-9754-00AA00C00908}#1.0#0; MSINET.OCX
Form=MainPanel.frm
Form=frmAbout.frm
Module=Model2; LoadForm.bas
Module=Model1; ErrorCheck.bas
Form=TagDialog.frm
Form=ProgressBar.frm
Form=ExtDialog.frm
Form=FileNamAdv.frm
IconForm=”MainPanel”
Startup=”MainPanel”
HelpFile=””
Title=”urlgrabber”
ExeName32=”urlgrabber.exe”
Command32=””
Name=”Project1″
HelpContextID=”0″
CompatibleMode=”0″
MajorVer=1
MinorVer=1
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName=” “
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1
=================================================================

File #: 10 —> urlgrabber.vbw

MainPanel = 154, 154, 701, 565, , 22, 22, 569, 433, C
frmAbout = 0, 0, 0, 0, C, 88, 88, 635, 499, C
Model2 = 154, 154, 701, 565, C
Model1 = 66, 66, 613, 477, C
TagDialog = 0, 0, 547, 411, C, 198, 198, 745, 609, C
ProgressBar = 66, 66, 621, 485, C, 154, 154, 709, 573, C
ExtDialog = 0, 0, 555, 419, C, 44, 44, 599, 463, C
FileNamAdv = 132, 132, 657, 572, C, 110, 110, 635, 550, C
===============================================================

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: