Advertisement

01.24.2008 at 03:26AM PST, ID: 23107297
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Why is this working for some pages and not others?

Asked by touyets in Visual Basic Programming, VB Script

Tags:

RobSampson (or anyone else reading this),

the code you developped for me with tasky is  causing me a little bit of trouble and that is because it actually works for some URLs and not others.

For example, if you try the attached code for this URL it works (http://irishjobs.ie/showresults.aspx?IsProvince=1&MatchPerc=40&Location=&Ranking=&Roles=&Recruiter=Both&Category=9&cboLocation=-1&KEYWORDS=CAD+Technician)
but it doesn't work for this one (http://irishjobs.ie/showresults.aspx?IsProvince=1&MatchPerc=40&Location=&Ranking=&Roles=&Recruiter=Both&Category=9&cboLocation=-1&KEYWORDS=CAD)

this is bizarre because the only difference between each URL is the end where one has +Technician and other one doesn't.

I can't see why this is happening.
Do you think you could look into it and explain to me why it would allow one and not the other?Start Free Trial
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:
'=================
strOutputFile = "Results.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
Set objHTTP = CreateObject("Msxml2.XMLHTTP")
strURL = "http://irishjobs.ie/showresults.aspx?IsProvince=1&MatchPerc=40&Location=&Ranking=&Roles=&Recruiter=Both&Category=9&cboLocation=-1&KEYWORDS=CAD+Technician&I7.x=16&I7.y=8"
objHTTP.open "GET", strURL, False
objHTTP.send
strData = objHTTP.responseText
 
objHTTP.Open "GET", strURL, FALSE
objHTTP.Send
strPageText = objHTTP.responseText
arrText = Split(strPageText, "Big Fish Recruitment")
intDesignEngPg1Count = UBound(arrText)
 
 
 
' This code assumes strData holds the string returned from the listings page
Dim tmpBuffer
Dim strURL
Dim tmpURL
tmpBuffer = Replace(Replace(strData, VbCrLf, ""), vbTab, "") ' Copy data over to a temporary buffer that we can play With
Redim strURL(0) ' Initialize a blank array
' This loop will parse through the listing page's HTML and return all URLs to a job description page
' We will parse out company name and contact info from the job description page
Do While tmpBuffer <> ""
  If InStr(1, tmpBuffer, "/JobDesc.asp?") Then
    ' First find the beginning of the cell with the URL in it
    tmpURL = Mid(tmpBuffer, InStrRev(tmpBuffer, "<td", InStr(1, tmpBuffer, "/JobDesc.asp?")))
    ' Find the end of the cell with the URL in it
    tmpURL = Mid(tmpURL, 1, InStr(1, tmpURL, "</td>") - 1)
    ' Test if the company name is in that cell
    If InStr(1, tmpURL, "Big Fish Recruitment") > 0 Then
          ' First find the beginning of the link URL
          tmpURL = Mid(tmpBuffer, InStr(1, tmpBuffer, "/JobDesc.asp?"))
          ' Find the end of the URL
          tmpURL = Mid(tmpURL, 1, InStr(1, tmpURL, Chr(34)) - 1)
             ' Copy the URL into the upper bound of the array and resize the array
          strURL(UBound(strURL)) = "http://irishjobs.ie" & Replace(tmpURL, "&amp;", "&")
          Redim Preserve strURL(UBound(strURL) + 1)
      End If
    ' Next loop, search for the next URL (not the same one!)
    tmpBuffer = Mid(tmpBuffer, InStr(1, tmpBuffer, "/JobDesc.asp?") + 1)
  Else
    ' Erase the buffer to exit the loop
    tmpBuffer = ""
  End If
Loop
 
If UBound(strURL) = 0 Then
  MsgBox "Could not find ""/JobDesc.asp?"" in the page text. Exiting script."
  WScript.Quit
  ' No URLs parsed?!
Else
  ' Trim off the last (blank) array entry
  Redim Preserve strURL(UBound(strURL) - 1)
End If
 
' At this point strURL() is an array containing URLs To
'WScript.Echo Join(strURL, VbCrLf)
 
' SECOND PART TO GET EACH URL PAGE
Set objContacts = CreateObject("Scripting.Dictionary")
For Each strPage In strURL
      Set objHTTP = CreateObject("Msxml2.XMLHTTP")
      objHTTP.open "GET", strPage, False
      objHTTP.send
      strData = objHTTP.responseText
      'WScript.Echo strData
    Dim strContact
    
    If InStr(1, strData, "<div align=" & Chr(34) & "left" & Chr(34) & " class=" & Chr(34) & "heading" & Chr(34) & ">Contact:") Then
        strContact = Mid(strData, InStr(1, strData, "<div align=" & Chr(34) & "left" & Chr(34) & " class=" & Chr(34) & "heading" & Chr(34) & ">Contact:"))
        strContact = Mid(strContact, InStr(1, strContact, "<div align=" & Chr(34) & "left" & Chr(34) & " class=" & Chr(34) & "text" & Chr(34) & ">") + 31)
        strContact = Mid(strContact, 1, InStr(1, strContact, "</div>") - 1)
        'MsgBox "Contact " & strContact & " from Big Fish Recruitment"
          If objContacts.Exists(strContact) Then
                objContacts(strContact) = objContacts(strContact) + 1
          Else
                objContacts.Add strContact, 1
          End If
    Else
        'MsgBox "Could not find the contact's name!"
    End If
   
    'If strCompany <> "" And strContact <> "" Then MsgBox "Contact " & strContact & " from Big Fish Recruitment"
Next
 
strResults = """Contact Name"",""Count"""
For Each strContact In objContacts
      'WScript.Echo strExtension & " - " & objFileTypes(strExtension)
      strResults = strResults & VbCrLf & """" & strContact & """,""" & objContacts(strContact) & """"
Next
 
     
	If objcontacts("Niall Winter") =0 then
Msgbox "Niall has 0 and BigFish has "&intDesignEngPg1Count /2
Else
Msgbox "Niall has "&objcontacts("Niall Winter")&" and BigFish has "&intDesignEngPg1Count /2
End if
[+][-]01.24.2008 at 04:12AM PST, ID: 20732213

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.24.2008 at 12:41PM PST, ID: 20737169

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Basic Programming, VB Script
Tags: Visual Basic
Sign Up Now!
Solution Provided By: RobSampson
Participating Experts: 1
Solution Grade: B
 
 
[+][-]01.25.2008 at 02:20AM PST, ID: 20741386

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.25.2008 at 02:21AM PST, ID: 20741394

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.25.2008 at 02:35AM PST, ID: 20741425

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39 / EE_QW_2_20070628