Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I set up my webcam to capture an image on the sly each time my account (or any account) logs on? Is there some specific software that will do this?

I have a Logitech QuickCam Fusion cam and running Windows 7.

share|improve this question
add comment

4 Answers

up vote 6 down vote accepted
+50

Using AutoIt, this code will take the snapshot, just run it on startup (just use a shortcut unless you change the save path and use the include folder for the include file) Note that this will flash any LED on the camera on for a half second while it takes the snapshot, there isn't a way around that:

#include <GUIConstants.au3>
#include <Webcam.au3>

$gui = GUICreate("Webcam UDF Test",640,480)
_WebcamInit()
_Webcam($gui,640,480,0,0)
GUISetState(@SW_HIDE)
Sleep(100)
ConsoleWrite("Taking snapshot ..." & @CRLF)
_WebcamSnapShot()
ConsoleWrite("Snapshot taken !" & @CRLF)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        _WebcamStop()
        Exit
    EndIf
    Sleep(10)
    _WebcamStop()
    Exit
WEnd

You will need to get the Webcam.au3 include file from here. Put it in the same directory as the script or into the autoit include folder. I borrowed the code from that site and modded it for your needs. The file will appear in the same folder as the script (you can change that via the Webcam.au3 file if needed).

EDIT: you will also need to add this line to the top of Webcam.au3:

#include <WindowsConstants.au3>

EDIT2: The line you will change for the path in Webcam.au3 if you want to specify it is:

$snapfile = @ScriptDir & "\snapshot.bmp"

to something like:

$snapfile = "C:\snapshot\snapshot.bmp"

or if you want date and time of pic:

$snapfile = "C:\snapshot\" & @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC & ".bmp"
share|improve this answer
    
You rock! I had been struggling with those files at AutoIt.com all afternoon yesterday with no luck making them take a pic! Thank you! BTW your code needs a small edit, you have $snapfile = "C:\snapshot\@YEAR and it needs to be $snapfile = "C:\snapshot\" & @YEAR & –  jerrygarciuh Aug 31 '11 at 14:24
    
SU says I have to wait 5 more hours to award bounty. Will add to my afternoon schedule. Thanks again!!! –  jerrygarciuh Aug 31 '11 at 14:25
    
One other note on timestamping the file- Windows won't accept the colons in the time segment and just discard everything after the first one. At first I thought it was an issue with the @MIN macro but monkeying with it revealed the colon problem. –  jerrygarciuh Aug 31 '11 at 14:41
    
@jerrygarciuh,I'll fix the time stamp portion, my brain was thinking log note, not file name when I wrote that. –  MaQleod Aug 31 '11 at 15:12
add comment

I have just built a small program called qpic.

The only requirements are .Net Framework 3.5.

Simply extract to a folder anywhere, and, when it is launched, a half second later it will close and save a JPG picture in the folder it was launched from with the next sequential number.

Simply place a shortcut to this program in your startup folder , or HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run - and it should work without problems!

In order to see when someone logged on, simply take a look at the date/time of the picture.

All this aside, if your webcam has a light or similar that shows when it is active, there is no way to get around this as it is a hardware feature of the webcam... Unless you open it up and disconnect the LED/light!

(It is built off of a modified version of this project)

You can download here.

share|improve this answer
    
Upvote for writing a custom tool. I was going to do similar and I also found that project. Unfortunately, the DLL throws an null reference exception for me. (Even the original project doesn't work.) N.B. The WebCam_Capture.dll is a .NET assembly and can be viewed with dot.Peek. (And really? You obfuscated your assembly? Trade secret, is it?) –  BillP3rd Aug 31 '11 at 4:07
    
@BillP3rd - No secret, I installed an addon and my VS does it automatically on release compiling... I am happy to give the source code to anyone who wants it.... As for the project, all I did was open it up, upgrade/convert the project to vs2010, run, it failed, dragged the .dll to the project directory - it worked... changed the form start to do in order - start webcam, capture picture, save picture and modified the save routine heavily so it goes to same directory and increases the count. –  William Hilsum Aug 31 '11 at 10:28
add comment

There are several ways to this.

Personally, I would make a script using AutoIt (there's an example how to take a snapshot here). AutoIt allows you to produce an executable from the script if desired.

After you have a working script, you'll need to create a shortcut for it (or the executable) in the StartMenu's Startup folder of the intended user (or "All Users" if the snapshot should be take from all users).

share|improve this answer
add comment

Visual Basic 6 apparently has libraries for controlling webcams.

This page has source code for a Visual Basic app that will start capture from a webcam, close the cam, and offers video formatting options.

I'd imaging VBScript offers this sort of thing as well, which would probably be easier to run on system startup.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.