It even features a helpdesk notification box, so ongoing major issues or outages can be communicated to the entire front line staff with details and ticket numbers, completely automatically.
Code: Select all
#SingleInstance Force
MonitorFile = \\SomeCommon\NetworkLocation\File.txt
settimer,AlertWatcher,60000 ; 1 minute update on the timer for watching the file
WB:=[]
Global TabURLs:=[]
Global TabNames:=[]
OnMessage(11, "DisableSetRedraw") ;to disable the redraw problem
DisableSetRedraw() {
return 0
}
TabCount = 0
TabAdd("http://www.google.ca", "Google")
TabAdd("http://www.autohotkey.com", "AHK Website")
TabAdd("http://ahkscript.org/", "AHK_L Website")
Loop % TabNames.MaxIndex()
ListOfTabNames.=TabNames[a_index] "|"
Gui, Margin, 5, 0
Gui, Add, Tab2, x0 vTabRow gCurrentTab -wrap ,%ListOfTabNames%
Gui, Tab
Gui, Add, Edit, x0 y20 w150 vAlertBox h600, %Alerts%
Gui, Add, StatusBar,,
; Start tab listings
Loop % TabURLs.MaxIndex()
{
Gui, Tab, %A_Index%
TabCount++
Gui, Add, ActiveX, x+150 y+ w800 h600 vWB%A_Index%, shell.explorer
WB%A_Index%.Navigate(TabURLs[a_index])
WB.Insert(WB%A_Index%)
}
; end tab list
Gui, +resize +LastFound
Gui Show,autosize, Integrated Service Desk Tool
OnMessage(0x100, "gui_KeyDown", 2)
OnMessage(0x101, "gui_KeyDown", 2)
GoTo AlertWatcher
return
GuiClose:
ExitApp
GuiSize:
if A_EventInfo = 1
return
GuiControl, Move, TabRow, % "W" . (A_GuiWidth) ; Expand the available tab row to the full width of the tool since wrapping was turned off
GuiControl, Move, AlertBox, % "W150" . " H" . (A_GuiHeight - 43) ; To make sure the notification/alert box doesn't overlap the status bar
SB_SetParts((A_GuiWidth/6),(A_GuiWidth/6),(A_GuiWidth/6),(A_GuiWidth/6),(A_GuiWidth/6)) ; to split the status bar into 6 spaces
loop %TabCount%
{
GuiControl, Move, WB%a_index%, % "W" . (A_GuiWidth - 154) . " H" . (A_GuiHeight - 45) ; To loop through the tabs/IE windows and resize them to fit the window, with space for a vertical scroll bar
}
return
CurrentTab:
Gui,Submit,NoHide
; Creator, URL, ReadyState, Current Tab Name, UserName/IP, Timestamp - readystate doesn't seem to update nicely
SB_SetText("Integrated Service Desk thing by Jeramy",1)
SB_SetText(TabRow,4)
SB_SetText(A_UserName "`t`t" A_IPAddress1,5)
SB_SetText(A_DD "/" A_MMM "/" A_YYYY " - " A_Hour ":" A_Min,6)
Return
; Load contents of a monitoring file
AlertWatcher:
gui,submit,nohide
Alerts =
FileRead, Alerts, %MonitorFile%
GuiControl,,AlertBox,%Alerts%
return
; Required functions for the IE Tabs
TabAdd(URL, TabName) { ; Function to define the tab URL and name for each tab
TabURLs.Insert(URL)
TabNames.Insert(TabName)
return
}
GetSession(cur) { ; To enable scaling of the IE windows to as high a count as you need for as many internal resources as you need
try {
global WB
StringReplace,Session,Cur,Internet Explorer_Server
WB0 := WB[session]
Return WB0
}
}
gui_KeyDown(wParam, lParam, nMsg, webhndl) { ; The real magic, for making accelerators work in the tabs, so you can do things like newline/enter, backspace, or even tab without going to other places
ControlGetFocus, Cur
WB0 := GetSession(Cur)
Try { ; Without having this in a try, if you don't have the ActiveX explorer window focused when you start typing, the script will error out
sb_settext(WB0.LocationURL,2) ; This...
if WB0.ReadyState != 4 ; This...
SB_SetText("Loading...",3) ; This...
if WB0.ReadyState = 4 ; This...
SB_SetText("Ready",3) ; And this are all just to update the statusbar. Feel free to comment or delete if you don't want the status bar on your screen.
pipa := ComObjQuery(WB0, "{00000117-0000-0000-C000-000000000046}")
VarSetCapacity(kMsg, 48), NumPut(A_GuiY, NumPut(A_GuiX
, NumPut(A_EventInfo, NumPut(lParam, NumPut(wParam
, NumPut(nMsg, NumPut(webhndl, kMsg)))), "uint"), "int"), "int")
Loop 2
r := DllCall(NumGet(NumGet(1*pipa)+5*A_PtrSize), "ptr", pipa, "ptr", &kMsg)
; Loop to work around an odd tabbing issue (it's as if there
; is a non-existent element at the end of the tab order).
until wParam != 9 || WB0.Document.activeElement != ""
ObjRelease(pipa)
if r = 0 ; S_OK: the message was translated to an accelerator.
return 0
}
}