Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/23/2014 in all areas

  1. I tried your code, I have the same error. Strange, GetTemporaryFilePath fails. However, the $oAttachment.type is 1 (olByValue), so it should work... Everything seems to be ok ... More informations for the error : $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;create new email item and display $oOutlook = ObjCreate("Outlook.Application") $oMessage = $oOutlook.CreateItem(0) $oMessage.display() ;register events for the new email item $oevent = ObjEvent($oMessage,"oMessage_") ;add an attachment $oMessage.attachments.add("C:\windows\system32\calc.exe") ;keep script alive to receive events while 1 sleep(100) WEnd ;event for when attachment is added Func oMessage_AttachmentAdd($oAttachment) ConsoleWrite($oAttachment.filename & ' was added.' & @CR) ConsoleWrite('type=' & $oAttachment.type & @CR) ConsoleWrite('temp path=' & $oAttachment.GetTemporaryFilePath & @CR) EndFunc Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc @Danp2 :the OP's script seems to be good compared to remarks on MSDN
    1 point
  2. Try this: #include <Screencapture.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Message("Is this what you are looking for?") _GDIPlus_Shutdown() Func Message($sText, $sHeader = "Question", $iFlag = 4 + 32 + 262144, $iBlur = 5) ;coded by UEZ Local Const $iW = @DesktopWidth, $iH = @DesktopHeight Local $hGui = GUICreate("", $iW, $iH, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_APPWINDOW)) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Local $hHBitmap = _ScreenCapture_Capture("", 0, 0, $iW - 1, $iH - 1, 0) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) _WinAPI_DeleteObject($hHBitmap) Local $hEffect = _GDIPlus_EffectCreateBlur($iBlur) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) GUISetState(@SW_SHOWNA) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iW, $iH) Local $iRet = MsgBox($iFlag, $sHeader, $sText, 0, $hGui) _GDIPlus_EffectDispose($hEffect) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) GUIDelete($hGui) Return $iRet EndFunc Runs only with MS Vista or higher operating system and latest AutoIt version! Br, UEZ
    1 point
  3. masvil

    WebCam example

    Awesome, congratulation to rysiora!!! I need it just for screenshot (without GUI): which piece(s) of code have I to delete/change?
    1 point
  4. rysiora

    WebCam example

    ;COPY CONSTANTS FROM PREVIOUS SCRIPTS IN THIS TOPIC #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $avi = DllOpen("avicap32.dll") $user = DllOpen("user32.dll") $snapfile = @ScriptDir & "\scrshot.bmp" $moviefile = @ScriptDir & "\moviecam.avi" $Main = GUICreate("WebCam - Ready",350,300) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", $Main, "int", 1) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0) ;DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 30, "int", 0) $Combo = GUICtrlCreateCombo("Video Source",15,270,140,-1,$CBS_DROPDOWNLIST) GUICtrlSetData(-1,"Video Display|Video Format|Compression","Video Source") $Button = GUICtrlCreateButton("Show",170,270,100,21) GUICtrlSetOnEvent(-1,"Button") GUISetState(@SW_SHOW) HotKeySet("{INSERT}", "SnapShot"); Press 'Insert' to make a SnapShot ! HotKeySet("{HOME}", "StartRecording"); Press 'Home' to start recording ! Func Quit() ;DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_CALLBACK_FRAME, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_END, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) ;DllClose($avi); crashing, no one knows why... DllClose($user) Exit EndFunc Func Button() Switch GUICtrlRead($Combo) Case "Video Source" DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DLG_VIDEOSOURCE, "int", 0, "int", 0) Case "Video Display" DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DLG_VIDEODISPLAY, "int", 0, "int", 0) Case "Video Format" DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DLG_VIDEOFORMAT, "int", 0, "int", 0) Case "Compression" DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DLG_VIDEOCOMPRESSION, "int", 0, "int", 0) EndSwitch EndFunc While 1 Sleep(1) Wend Func SnapShot() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $snapfile) EndFunc Func StartRecording() WinSetTitle($Main, "", "WebCam - Capturing...") HotKeySet("{HOME}", "StopRecording") DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $moviefile) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0) EndFunc Func StopRecording() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_STOP, "int", 0, "int", 0) WinSetTitle($Main, "", "WebCam - Ready") HotKeySet("{HOME}", "StartRecording") EndFunc The 4 dialogs are available. As they are depending of drivers, for every camera/driver they will possibly look other. If someone wants to change the compression of recorded movie - have a look on the Compression Dialog. I also have problems with capturing (laggy, problems with stopping...) but I've already written about this. Don't know how to fix it yet. Any ideas and experiments are welcome.
    1 point
×
×
  • Create New...