+ Post New Thread
Results 1 to 7 of 7
Scripts Thread, Spice Works Screen Capture Script in Coding and Web Development; This is an on-going script for me which I have rolled out for a few users alongside Spiceworks - some ...
  1. #1

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Spice Works Screen Capture Script

    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


    Code:
    ; 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 <Constants.au3>
    #include <ScreenCapture.au3>
    #include <IE.au3>
    #include <GUIConstants.au3>
    
    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.
    Last edited by mattx; 27th November 2009 at 10:58 AM.

  2. Thanks to mattx from:

    nadeem (27th November 2009)

  3. #2

    Edu-IT's Avatar
    Join Date
    Nov 2007
    Posts
    7,140
    Thank Post
    403
    Thanked 622 Times in 568 Posts
    Rep Power
    181
    Shame you can't somehow tie it in to Spiceworks and automatically attach the image to the ticket. Will test this.

  4. #3

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Quote Originally Posted by Edu-IT View Post
    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.

  5. #4

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Fixed - needs a Return - after the:

    Code:
    Case $nMsg = $GUI_EVENT_CLOSE
    				GUIDelete($Form1)
    Return

  6. #5

    Join Date
    Jun 2008
    Location
    Kensington, London
    Posts
    372
    Thank Post
    59
    Thanked 36 Times in 32 Posts
    Rep Power
    31
    looks interesting I may give this whirl

  7. #6

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    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.

  8. #7

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    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.

    Code:
    #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 <Constants.au3>
    #include <ScreenCapture.au3>
    #include <IE.au3>
    #include <GUIConstants.au3>
    #include <EventLog.au3>
    #include <file.au3>
    
    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
    Attached Files Attached Files
    Last edited by mattx; 9th December 2009 at 12:08 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. WMI Screen Capture
    By somabc in forum Scripts
    Replies: 6
    Last Post: 7th July 2008, 08:27 PM
  2. Real Time Screen Capture
    By enjay in forum Windows
    Replies: 7
    Last Post: 11th February 2008, 01:06 PM
  3. Screen Capture
    By angelikaalston in forum How do you do....it?
    Replies: 11
    Last Post: 29th November 2007, 08:56 AM
  4. JING - Screen capture software
    By mighty.grey.eagle in forum General Chat
    Replies: 12
    Last Post: 19th August 2007, 05:40 PM
  5. screen capture software
    By beeswax in forum Educational Software
    Replies: 12
    Last Post: 6th November 2006, 12:22 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •