mattx Posted November 27, 2009 Posted November 27, 2009 (edited) This is an on-going script for me which I have rolled out for a few users alongside Spiceworks - some of you may find it handy. It's basically a script which sits in the system tray - [ click on the icon and it will give you some options ] or works via a hot key [ shift-alt-h ] that will take a snap shot of screen, save the jpg and then take the user to the Spice Works Portal page in which they can create their ticket and upload the .jpg. Very like what the panic button software does but I am getting rid of that come Jan 2010 and will run with Spiceworks accross the school. The main elements you will need to edit for your own use is as follows: The $helpdesk_screenshots variable - [ also remember I've not used this in all the code ] The $portalsite variable ; AutoIt Version: 3.3.0.0 ; Language: English ; Platform: WinXP ; Author: Matt ; Script Function: Screen Capture & Spice Works Page launcher ; Version: 1 Beta ; Date: Nov 2009 #Include #include #include #include Dim $portalsite = "http://stjohns02:9675/helpdesk" Dim $helpdesk_screenshots = "c:\helpdesk_screenshots" Opt("TrayMenuMode", 1) HotKeySet("+!h", "ShowMessage") ;Shift-Alt-h If FileExists("c:\helpdesk_screenshots") Then FileDelete("c:\helpdesk_screenshots\*.jpg") Else DirCreate("c:\helpdesk_screenshots") EndIf Func ShowMessage() $Form1 = GUICreate("Portal Launcher", 220, 110, 348, 309) $helpmenu = GUICtrlCreateMenu("Help") $infoitem = GUICtrlCreateMenuItem("About", $helpmenu) GUISetBkColor(0x0066FF) $Button1 = GUICtrlCreateButton("Screen Shot", 10, 20, 89, 49) $Button2 = GUICtrlCreateButton("To Portal", 120, 20, 89, 49) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $Button1 _ScreenCapture_Capture($helpdesk_screenshots & "\helpdesk_Image1.jpg") Sleep(2000) _IECreate($portalsite) Case $nMsg = $Button2 _IECreate($portalsite) Case $nMsg = $infoitem MsgBox(0, "Portal Launcher 1B", "Written By Matt." & @CRLF & "Comments & Suggestions to:" & @CRLF & "matt") Case $nMsg = $GUI_EVENT_CLOSE GUIDelete($Form1) Return EndSelect WEnd EndFunc ;==>ShowMessage $settingsitem = TrayCreateMenu("Settings") $displayitem = TrayCreateItem("Screen Shot", $settingsitem) $portal = TrayCreateItem("Portal", $settingsitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $displayitem _ScreenCapture_Capture($helpdesk_screenshots & "\helpdesk_Image1.jpg") Sleep(2000) _IECreate($portalsite) Case $msg = $portal _IECreate($portalsite) Case $msg = $aboutitem MsgBox(0, "Portal Launcher 1B", "Written By Matt." & @CRLF & "Comments & Suggestions to:" & @CRLF & "matt") ; Remember to comment out $exititem so prog can't be closed or keep it in if you want users to close !! Case $msg = $exititem Exit EndSelect WEnd I will add some extra stuff when I get time, like taking a snapshot of running processes too etc which can be held in a .txt file alongside the screen capture. I'll then try zipping them up into a single file in which users can include with their ticket. Edited November 27, 2009 by mattx 1
Edu-IT Posted November 27, 2009 Posted November 27, 2009 Shame you can't somehow tie it in to Spiceworks and automatically attach the image to the ticket. Will test this.
mattx Posted November 27, 2009 Author Posted November 27, 2009 Shame you can't somehow tie it in to Spiceworks and automatically attach the image to the ticket. Will test this. Would be nice wouldn't it ? My skills don't as far as that though !! This works our end, I have it compiled and running as .exe that starts when the user logs on. Only snag I have with it at the moment is if the hot key is used and then closed, it disables the system tray options - but using the hot key still works...... Currently investigating that one but not getting very far.
mattx Posted November 27, 2009 Author Posted November 27, 2009 Fixed - needs a Return - after the: Case $nMsg = $GUI_EVENT_CLOSE GUIDelete($Form1) Return
mattx Posted November 27, 2009 Author Posted November 27, 2009 I'll try and get procmon working along side it too - say a 5 second grab, save to a .pml file which can be held in the same location as the screen shot - just got to work on zipping them up to a single file..... Zip.exe is free so I could use that.
mattx Posted December 9, 2009 Author Posted December 9, 2009 (edited) I've managed to get procmon working alongside this now [ 5 second snapshot ] & have also got a capture of the eventlog, and basic machine info txt file. All I need to do now is get them all zipped up into one file as at the moment in my own example - my Vista Event log is around 15 meg, the screen shot around 1 meg, the 5 second procmon snapshot is around 65 meg and the basic PC info txt file is 1K - I can get the 80 meg down to around 15 meg when zipped........ The code so far [ AutoIT ] is below - edit to your own requirements and make sure you have a copy of procmon in the location where you run the script - I'll add the zipping of the files within the next few weeks. #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Peter-Griffen-Tux-zoomed-2.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; AutoIt Version: 3.3.0.0 ; Language: English ; Platform: WinXP ; Author: Matt ***** - matt@********.org.uk ; Script Function: Screen & Data Capture & Spice Works Page launcher ; Version: 1.4 Beta ; Date: Dec 2009 ; 1.2 Fixed GUI box not closing ; 1.3 Fixed System Tray not working after hotkey press ; 1.4 Added EventLog Grab, Basic PC Info & 5 Procmon snapshot #Include #include #include #include #include #include Dim $portalsite = "http://stjohns02:9675/helpdesk" Dim $helpdesk_screenshots = "c:\helpdesk_screenshots" Dim $hEventLog = _EventLog__Open ("", "Application") Dim $sDateNow Dim $sTimeNow Dim $sMsg Dim $hOpenFile Dim $hWriteFile Dim $user Dim $cname Dim $ip Dim $sLogMsg = "User: " $sDateNow = "On " & @YEAR & "-" & @MON & "-" & @MDAY $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC $user = @UserName $cname = @ComputerName $ip = @IPAddress1 $file = Fileopen("c:\helpdesk_screenshots\log.txt", 1) $sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg & $user & " Logged On To PC: " & $cname & "," & " IP Address: " & $ip Opt("TrayMenuMode", 1) HotKeySet("+!h", "ShowMessage") ;Shift-Alt-h If FileExists("c:\helpdesk_screenshots") Then FileDelete("c:\helpdesk_screenshots\*.jpg") FileDelete("c:\helpdesk_screenshots\*.txt") FileDelete("c:\helpdesk_screenshots\*.evt") FileDelete("c:\helpdesk_screenshots\*.PML") Else DirCreate("c:\helpdesk_screenshots") EndIf Func ShowMessage() $Form1 = GUICreate("Portal Launcher", 220, 110, 348, 309) $helpmenu = GUICtrlCreateMenu("Help") $infoitem = GUICtrlCreateMenuItem("About", $helpmenu) GUISetBkColor(0x0066FF) $Button1 = GUICtrlCreateButton("Screen Shot", 10, 20, 89, 49) $Button2 = GUICtrlCreateButton("To Portal", 120, 20, 89, 49) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $Button1 FileWriteLine($file, $sMsg) FileClose($file) _ScreenCapture_Capture($helpdesk_screenshots & "\helpdesk_Image1.jpg") _EventLog__Backup ($hEventLog, "C:\helpdesk_screenshots\EventLog.evt") _EventLog__Close ($hEventLog) Run(@ScriptDir & '\procmon.exe /Quiet /Minimized /BackingFile c:\helpdesk_screenshots\snapshot.PML') Sleep(5000) Run(@ScriptDir & '\procmon /terminate') Sleep(1000) _IECreate($portalsite) Case $nMsg = $Button2 _IECreate($portalsite) Case $nMsg = $infoitem MsgBox(0, "Portal Launcher 1.4B", "Written By Matt *****." & @CRLF & "Comments & Suggestions to:" & @CRLF & "matt@matt*****.co.uk") Case $nMsg = $GUI_EVENT_CLOSE GUIDelete($Form1) Return EndSelect WEnd EndFunc ;==>ShowMessage $settingsitem = TrayCreateMenu("Settings") $displayitem = TrayCreateItem("Screen Shot", $settingsitem) $portal = TrayCreateItem("Portal", $settingsitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $displayitem FileWriteLine($file, $sMsg) FileClose($file) _ScreenCapture_Capture($helpdesk_screenshots & "\helpdesk_Image1.jpg") _EventLog__Backup ($hEventLog, "C:\helpdesk_screenshots\EventLog.evt") _EventLog__Close ($hEventLog) Run(@ScriptDir & '\procmon.exe /Quiet /Minimized /BackingFile c:\helpdesk_screenshots\snapshot.PML') Sleep(5000) Run(@ScriptDir & '\procmon /terminate') Sleep(1000) _IECreate($portalsite) Case $msg = $aboutitem MsgBox(0, "Portal Launcher 1.4B", "Written By Matt *****." & @CRLF & "Comments & Suggestions to:" & @CRLF & "matt@matt****.co.uk") ; Remember to comment out $exititem so prog can't be closed or keep it in if you want users to close !! Case $msg = $exititem Exit EndSelect WEnd Procmon.zip Edited December 9, 2009 by mattx
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now