LIMITER 0 Posted April 14, 2008 (edited) Thx rysiora for his awesome script (hope you don't get mad at me )Original post (rysiora's version): http://www.autoitscript.com/forum/index.php?showtopic=27925 Just modified the script a little and made it an UDF ...Example code :#include <GUIConstants.au3> #include <Webcam.au3> $gui = GUICreate("Webcam UDF Test",640,480) _WebcamInit() _Webcam($gui,640,480,0,0) GUISetState(@SW_SHOW) Sleep(2000) ConsoleWrite("Taking snapshot ..." & @CRLF) _WebcamSnapShot() ConsoleWrite("Snapshot taken !" & @CRLF) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then _WebcamStop() Exit EndIf Sleep(1) WEndWebcam UDFWebcam.au3 Edited May 10, 2008 by LIMITER Share this post Link to post Share on other sites
ludocus 8 Posted May 10, 2008 lol I made a webcam udf as well Share this post Link to post Share on other sites
BrettF 28 Posted May 10, 2008 Link to the original topic. but otherwise good job converting it... I guess. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites
Pain 1 Posted May 10, 2008 original post: http://www.autoitscript.com/forum/index.php?showtopic=27925 Share this post Link to post Share on other sites
goldenix 1 Posted June 12, 2008 Why is it taking only 1 snapshot if I write the code like this? IT should Take 3 right? For $sdf = 1 to 3 Sleep(2000) ConsoleWrite("Taking snapshot ..." & @CRLF) _WebcamSnapShot() Next My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Share this post Link to post Share on other sites
LIMITER 0 Posted June 13, 2008 It should take 3 .... I'll check the code later, cause now i don't have a webcam at this pc Share this post Link to post Share on other sites
boomingranny 18 Posted July 18, 2008 any ideas on how you change the resolution of the output bmp file? i can only ever get a 320x240 file, even though my web cam can do up to 1600x1200. Any help would be much appreciated! Share this post Link to post Share on other sites
BrettF 28 Posted July 18, 2008 (edited) Maybe.... #include <GUIConstants.au3> #include <Webcam.au3> $gui = GUICreate("Webcam UDF Test",1600,1200) _WebcamInit() _Webcam($gui,1600,120,0,0) GUISetState(@SW_SHOW) Sleep(2000) ConsoleWrite("Taking snapshot ..." & @CRLF) _WebcamSnapShot() ConsoleWrite("Snapshot taken !" & @CRLF) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then _WebcamStop() Exit EndIf Sleep(1) WEnd Edited July 18, 2008 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites
boomingranny 18 Posted July 18, 2008 (edited) thanks for your help Bert, i should of mentioned, i had tried that - the visible image becomes pixulated, as if it is stretching the 320x240, and the output file is still 320x240 muttley I am planning to use a webcam to do timelapse photos of a building being built, and then turn it into a video - but i need higher than 320x240... EDIT: Ok, worked it out adding the line: DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DLG_VIDEOFORMAT, "int", 1, "int", 0) triggers a dialog box which allows you to set resolution. once set, it will be remembered (i suspect thru the registry somewhere) Cheers Edited July 18, 2008 by boomingranny Share this post Link to post Share on other sites
VAG 0 Posted July 24, 2009 May I know is it possible to adjust the quality settings of webcam (eg. brightness, contrast, gamma, etc) and is there any way of reading back the different settings from the current webcam before I set it? Share this post Link to post Share on other sites
colafrysen 1 Posted August 5, 2009 (edited) Some thoughts on your UDFFirst, is there a way to capture some output without having to open a GUI control. Because if I don't call _Webcam() the array $cap is never declared.And as far as i understand, the _WebcamSnapShot() does read the output from the previously created controll.And why open this DLL if it is never used?$avi = DllOpen("avicap32.dll")Edit: Saw that it was used... Edited August 5, 2009 by colafrysen [font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size] Share this post Link to post Share on other sites
DJKMan 3 Posted August 6, 2009 Why is it taking only 1 snapshot if I write the code like this? IT should Take 3 right? For $sdf = 1 to 3 Sleep(2000) ConsoleWrite("Taking snapshot ..." & @CRLF) _WebcamSnapShot() Next The _WebcamSnapShot() function overwrites the default snapshot.bmp file. If you want three different shots then you must use a variable. Here's how you can achieve this. >_< #include <GUIConstants.au3> #include <Webcam.au3> #include <WindowsConstants.au3> $gui = GUICreate("Webcam UDF Test",640,480) _WebcamInit() _Webcam($gui,640,480,0,0) GUISetState(@SW_SHOW) Sleep(2000) For $sdf = 1 to 3 Sleep(2000) ConsoleWrite("Taking snapshot ..." &$sdf& @CRLF) _WebcamSnapShot(@DesktopDir & "\snapshot"&$sdf&".bmp") Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then _WebcamStop() Exit EndIf Sleep(1) WEnd My work in AutoIt (Not many yet): - Parse Large Text Files To 2D Array Quickly [With Chunk Size] My artificial intelligence project coded entirely in AutoIt. Meet Alice Assistant: http://facebook.com/ProjectAliceAI Share this post Link to post Share on other sites
IchBistTod 3 Posted August 10, 2009 I dont really understand how this works, but could anyone show a small example of how this could be streamed over a network and displayed on a remote PC instead of on the local one? I think that would be reall cool. Â I would try it but I am nto good in the area of DLL calls and such, as well as i dont understand how this works at all.... [center][/center][center]=][u][/u][/center][center][/center] Share this post Link to post Share on other sites
matwachich 36 Posted December 22, 2009 I've got a problem with te function _WebcamStop(): Every time i call it -> Autoit3.exe must close ..... error I think the problem is on the $avi dll (avicap32.dll) because when I comment the line "DllClose($avi)" there is no problem! but I want to close the webcam without exiting the script! Anyone could help?! Share this post Link to post Share on other sites
Zibit 0 Posted January 6, 2010 get error variable not declared Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Share this post Link to post Share on other sites
Splash 1 Posted January 21, 2010 (edited) With all webcam UDFs I get these errors:C:\Documents and Settings\Gisele\Desktop\Nova pasta\webcam.au3(122,91) : WARNING: $WS_CHILD: possibly used before declaration.$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Gisele\Desktop\Nova pasta\webcam.au3(122,103) : WARNING: $WS_VISIBLE: possibly used before declaration.$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Gisele\Desktop\Nova pasta\webcam.au3(122,91) : ERROR: $WS_CHILD: undeclared global variable.$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Gisele\Desktop\Nova pasta\webcam.au3 - 1 error(s), 2 warning(s)Why? I have tryed stable and beta.Thanks in advance. Edited January 21, 2010 by Splash Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link: Share this post Link to post Share on other sites
Michel Claveau 1 Posted February 7, 2010 Hi! I tested on four computers. For the first, it's OK, whenever. For other (three), if works only once. When I re-run the script, the webcam does not open, until I restart the computer. I tried also to close/re-open a session, but the problem remains. The first CPU is on W7 Other : W7 , W7 , XP Any idea? Share this post Link to post Share on other sites
stinson6016 0 Posted February 10, 2010 Nice, very nice Gnatwork Networks Share this post Link to post Share on other sites
galay 0 Posted April 5, 2010 I've got a problem with te function _WebcamStop():Every time i call it -> Autoit3.exe must close ..... errorI think the problem is on the $avi dll (avicap32.dll) because when I comment the line "DllClose($avi)" there is no problem! but I want to close the webcam without exiting the script!Anyone could help?!You need to destroy the gui used for webcam.Call GUIDelete() before WebcamStop(). Share this post Link to post Share on other sites
BrettF 28 Posted April 5, 2010 You need to destroy the gui used for webcam.Call GUIDelete() before WebcamStop().Its April now. Useless first post. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites