lansti Posted July 2, 2009 Share Posted July 2, 2009 Does anyone know how to use screencapture so you save 2 pics? 1 for screen 1, og 1 for screen 2. I have figured out how to capture on of 2 screens... ========= CODE ========= Case $msg = $FeilmeldingItem If FileExists(@TempDir & "PICTURE.jpg") Then FileDelete(@TempDir & "PICTURE.jpg") $hBmp = _ScreenCapture_Capture ("") $PicStamp = "PICTURE_" & $EnvVarPC & "_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC _ScreenCapture_SaveImage (@TempDir & $PicStamp & ".jpg", $hBmp) .... and how to send it by email. But i want to take prnt screen for both screens. Best Lansti Link to comment Share on other sites More sharing options...
MrChiliCheese Posted July 2, 2009 Share Posted July 2, 2009 Like this one? #NoTrayIcon #include <ScreenCapture.au3> $FW = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78) $FH = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79) $ExtendedWidth = $FW[0] $ExtendedHeight = $FH[0] _ScreenCapture_Capture(@ScriptDir & "\Mon 1.jpg", 0, 0, @DesktopWidth, @DesktopHeight) _ScreenCapture_Capture(@ScriptDir & "\Mon 2.jpg", @DesktopWidth, 0, $ExtendedWidth, $ExtendedHeight) Link to comment Share on other sites More sharing options...
lansti Posted July 2, 2009 Author Share Posted July 2, 2009 LOVELY!!!! Thank you very much. Best Lansti Link to comment Share on other sites More sharing options...
lansti Posted July 3, 2009 Author Share Posted July 3, 2009 Like this one? #NoTrayIcon #include <ScreenCapture.au3> $FW = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78) $FH = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79) $ExtendedWidth = $FW[0] $ExtendedHeight = $FH[0] _ScreenCapture_Capture(@ScriptDir & "\Mon 1.jpg", 0, 0, @DesktopWidth, @DesktopHeight) _ScreenCapture_Capture(@ScriptDir & "\Mon 2.jpg", @DesktopWidth, 0, $ExtendedWidth, $ExtendedHeight) Hello there... I have done some modifications to your script, and adding the screencapture to 2 variables: $s_AttachFiles2 & $s_AttachFiles3 (*jpg) In my script i have this: $s_AttachFiles = $s_AttachFiles1 & $s_AttachFiles2 & $s_AttachFiles3 so i can attach the files to an e-mail wich is sending to me by smtp server. And when i try to send them, i got ERROR: 1. But if i do this: $s_AttachFiles = $s_AttachFiles1 & $s_AttachFiles2 OR $s_AttachFiles = $s_AttachFiles1 & $s_AttachFiles3 it works.... why cant i send 2 *.jpgs??? $s_AttachFiles1 is for the eventlog file... Thanks. Best regards lansti Link to comment Share on other sites More sharing options...
lansti Posted July 3, 2009 Author Share Posted July 3, 2009 well ,here is my code: expandcollapse popupCase $msg = $FeilmeldingItem $FW = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78) $FH = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79) $ExtendedWidth = $FW[0] $ExtendedHeight = $FH[0] If FileExists(@TempDir & "SupportMail.jpg") Then FileDelete(@TempDir & "SupportMail.jpg") Do ;===================================================================== ;Print Screen 1(Left) ;===================================================================== if ($i = 0) Then $hBmp =_ScreenCapture_Capture("", 0, 0, @DesktopWidth, @DesktopHeight) $PicStamp = "Support_"& $i & "_" & $EnvVarPC & "_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC _ScreenCapture_SaveImage (@TempDir & $PicStamp & ".jpg", $hBmp) If FileExists(@TempDir & $PicStamp & ".jpg") Then $s_AttachFiles2 = (@TempDir & $PicStamp & ".jpg") Else $s_FileError = "Couldn't send print screen from " & $EnvVarPC & "!!" $s_AttachFiles2 = "" EndIf EndIf ;===================================================================== ;Print Screen 2(Right) ;===================================================================== if ($i = 1) Then $hBmp =_ScreenCapture_Capture("", @DesktopWidth, 0, $ExtendedWidth, $ExtendedHeight) $PicStamp = "Support_"& $i & "_" & $EnvVarPC & "_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC _ScreenCapture_SaveImage (@TempDir & $PicStamp & ".jpg", $hBmp) If FileExists(@TempDir & $PicStamp & ".jpg") Then $s_AttachFiles3 = (@TempDir & $PicStamp & ".jpg") Else $s_FileError = "Couldn't send print screen from " & $EnvVarPC & "!!" $s_AttachFiles3 = "" EndIf EndIf $i = $i + 1 until $i=2 $Feilmelding = InputBox($MsgTitle, "Describe your error message:"& @LF & "(eventlogg and printscreens will be added to the mail)"& @LF & @LF & "Sender: "& $EnvVarUser , "ERROR:", "",600,170) If @error Then Else $s_Subject = $Feilmelding $s_ToAddress = "mail@mail.com" Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") If FileExists("Documents and Settings\All Users\Dokumenter\" & $AvidType & "\EVENTLOG.LOG") Then $s_AttachFiles1 = ("Documents and Settings\All Users\Dokumenter\" & $AvidType & "\EVENTLOG.LOG") ElseIf FileExists($LogFile) Then $s_AttachFiles1 = ($LogFile & ";") Else $s_FileError = "NB: Didn't find the eventlog" & $EnvVarPC & "!!" $s_AttachFiles1 = "" EndIf $s_AttachFiles = $s_AttachFiles1 & $s_AttachFiles2 & $s_AttachFiles3 $s_Subject = "Error message from client (" & $EnvVarPC & ")" $as_Body = "Error on " & @LF & @LF & "Client: " & $EnvVarPC & @LF & "Room: " & $CompCom & @LF & @LF & "Errormessage: "& $Feilmelding & @LF & @LF & "Best regards" & @LF & $EnvVarUser &@LF &@LF & $s_FileError $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) If @error Then MsgBox(0,$MsgTitle, "Error sending mail."& @LF &"Error:" & @error & @LF &"Rc:" & $rc) EndIf EndIf WEnd Exit But i have problems sending 2 screenshots... 1 is fine... Link to comment Share on other sites More sharing options...
MrChiliCheese Posted July 6, 2009 Share Posted July 6, 2009 (edited) Not much time, but according to _INetSmtpMailCom, you should divide the attachments with ";" try this: $s_AttachFiles = $s_AttachFiles1 & ";" & $s_AttachFiles2 & ";" & $s_AttachFiles3 and please, next time use autoit-tags Edited July 6, 2009 by yetrael Link to comment Share on other sites More sharing options...
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