| 1. |
Solve : SCREEN CAPTURE? |
|
Answer» Is there any way with Batch Script or VBS to make a lil app that captures the desktops screen in a predefined time interval like every 3 seconds and then it saves each screen-shot somewhere in a timestamped .jpg file with the users name in the file name like: helpmeh, do you have the source code for that? I don't have the source...I saw it a while ago on youtube...but it automatically saves the captured image.yesterday i play around vbs, and finally have working code to capture screen. if anyone still interested on how to do it, let me know, and i will share the code here. I could really use that.Quote from: Helpmeh on March 29, 2009, 05:13:43 PM I could really use that. here you go, helpmeh. the solution is not pure vbs. Code: [Select]'captureie.vbs d=year(date)*10000+month(date)*100+day(date) with createobject("wscript.shell") if not .appactivate("Internet Explorer") then wsh.echo "Internet Explorer is in tray state or could not be found" wsh.quit 1 end if ' .sendkeys "%{prtsc}":wsh.sleep 200 'not working ' .run ".\printscreen.exe screen",1,false .run ".\printscreen.exe",1,false .run "c:\windows\system32\mspaint.exe",1,false:wsh.sleep 1000 if .appactivate("untitled - Paint") then 'resize to 1x1 pixel & paste from clipboard .sendkeys "^e1{TAB}1~^v" 'save as ".\ie yymmdd.jpg" .sendkeys "^sie " & d & "{TAB}{DOWN 2}~~%yy" else wsh.echo "Failed to activate Ms Paint" end if end with because there is something wrong with sending printscreen keystroke from vbs, i am using temporary solution by calling win32 api, "keybd_event". so create printscreen.exe with your favourite IDE. here is a sample with VB6. Code: [Select]Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Const VK_SNAPSHOT As Long = &H2C Sub Main() If INSTR(VBA.Command$, "?") <> 0 Then MsgBox "USAGE: " & App.EXEName & " [SCREEN]" & vbNewLine & vbNewLine & _ "Argument:" & vbNewLine & _ "Screen - capture entire screen " & vbNewLine & _ "If omitted - capture active window" ElseIf UCase(VBA.Command$) = "SCREEN" Then 'entire screen keybd_event VK_SNAPSHOT, 0, 0, 0 Else 'active window keybd_event VK_SNAPSHOT, 1, 0, 0 End If End Sub i am still looking for a way to call win32 api EASILY from vbs. |
|