Some of you out there may have experienced a stubborn vendor that uses a proprietary ticketing system without an RSS feed or proper email response system. Why not leverage AutoIt? It can check their web-based ticketing system for you, multiple times a day (via scheduled task) and email your users that they have an updated ticket waiting for a response.
Unless you’re also a customer of the same system, you can’t really use this directly (I’m not pointing any fingers)… but you might find this code useful as a starting point for doing something similar.
This is what part of the table looks like on their web based ticketing system:
| Number |
Contact |
Subject |
Status |
Created Date |
| 1623501 |
Billy Jason |
Issue 4731 |
ASSIGNED |
2/16/2012 |
| 4000699 |
John Doe |
Issue 5156 |
ASSIGNED |
2/15/2012 |
| 2431126 |
John Doe |
Issue 9898 |
IN PROGRESS |
2/1/2012 |
| 1868059 |
Bobby Bob |
Issue 3526 |
RESOLVED-WAITING ON CLIENT |
2/16/2012 |
| 6457699 |
Bobby Bob |
Issue 2045 |
IN PROGRESS |
2/16/2012 |
| 5116024 |
Mary Don |
Issue 8392 |
IN PROGRESS |
2/16/2012 |
| 1391800 |
Debbie Jean |
Issue 1288 |
IN PROGRESS |
2/2/2012 |
We have AutoIt login via POST and pull up the ticket list (only certain users have access to everyone’s tickets), then scrape the table into an array. The script looks for a line with a status of WAITING ON CLIENT and emails that ticket’s contact their ticket is awaiting a response:
#include <IE.au3> ; Required to interact with Internet Explorer
#include <Array.au3> ; Required for _ArrayDisplay() function if debugging needed
#include <INet.au3> ; Required for emailing
;Change to fit your environment
$s_SmtpServer = "Contoso-SMTPServer"
$s_FromName = "VendorTicketSys alert"
$s_FromAddress = "VendorTicketSys@contoso.com"
Dim $as_Body[1]
; Login via POST method
$loginIE = _IECreate('https://VendorSite.VendorWebsite.com/1234/login.asp?USERNAME=YYYYYY&PASSWORD=XXXXX')
; Open new window with info I need
$oIE = _IECreate("https://VendorSite.VendorWebsite.com/1234/5678/VendorTicketSys/VendorTicketSys.asp")
; 2nd table on page contains every ticket status... if not, then alert me something failed!
$oTable = _IETableGetCollection ($oIE, 2)
If @error Then
$s_Subject = "VendorTicketSys alert failed"
$s_ToAddress = "itguy@contoso.com"
$as_Body[0] = "VendorTicketSys alarm failed to login to VendorSite to check ticket status. Please check for password expiration."
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @computername, -1)
$err = @error
Exit
EndIf
; Dump table into 2D array
$aTableData = _IETableWriteToArray ($oTable, True)
; Debugging helper
;_ArrayDisplay($aTableData)
For $i = 1 to (UBound($aTableData) - 1)
;ConsoleWrite("STATUS: " & $aTableData[$i][5] & @CRLF)
If StringRight($aTableData[$i][5],17) = "WAITING ON CLIENT" Then
;ConsoleWrite("Detected response for " & $aTableData[$i][1] & @CRLF)
; Below could load from a text file if a lot of people want this alert...
Select
Case $aTableData[$i][1] = "John Doe"
_EmailTicketSys($aTableData[$i][0],$aTableData[$i][1],$aTableData[$i][4],$aTableData[$i][5],"jdoe@contoso.com")
Case $aTableData[$i][1] = "Bobby Bob"
_EmailTicketSys($aTableData[$i][0],$aTableData[$i][1],$aTableData[$i][4],$aTableData[$i][5],"bobbybob@contoso.com")
EndSelect
EndIf
Next
; Sometimes closing the login window worked, but it's safer to leave it open while scraping table
_IEQuit($loginIE)
_IEQuit($oIE)
; Send email for detected reponse
Func _EmailTicketSys($ticketID,$who,$subject,$status,$sendto)
$s_Subject = $ticketID & " - " & $subject & " - " & $status & " - VendorTicketSys alert"
$s_ToAddress = $sendto
$as_Body[0] = $who & " has received a response from VendorSite." & @CRLF & @CRLF & "ID: " & $ticketID & @CRLF & "Subject: " & _
$subject & @CRLF & "Status: " & $status & @CRLF & @CRLF & "Please login to VendorTicketSys Web Only Site to respond to the ticket. This email alert service is provided by the Contoso IT Department, not by VendorSite."
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @computername, -1)
$err = @error
EndFun
Our users have been quite happy with the alerts they’re finally getting, which enables the issue to be resolved much quicker than before. It’s hard to balance this between notifying the end users too much and not enough. The task only runs twice a day, morning and afternoon, so if the user ignores the alert, they will get alerts until they finally respond to the ticket. Sometimes the vendor will respond after the morning alert, so we won’t notice until the end of the day. It would be nice if I could detect whether or not the user has been alerted about that particular ticket or not, so I could check more often without bugging the users. But, an alert about the response within 24 hours should be better than no alert at all.
Recent Comments