Automatically taking screenshots with IrfanView: shortcut not working at startup

0

I am trying to make my Windows 8.1 system automatically take a screenshot every minute. This helps me with time tracking.

My current solution uses IrfanView. I wrote the following cmd batch file:

set IrfanView="C:\Program Files (x86)\IrfanView\i_view32.exe"
set DestDir=%~dp0.
set Cygwin=C:\cygwin64
REM see http://stackoverflow.com/questions/905226/mkdir-p-linux-windows
setlocal enableextensions

:loop

REM these for loops are really weird, but see SO
for /f "tokens=*" %%i in ('%Cygwin%\bin\date.exe +"%%y\%%m\%%d\%%H-%%M-%%S"') do set timestamp=%%i

set filename="%DestDir%\%timestamp%.png"
for %%F in (%filename%) do set dirname="%%~dpF"

if not exist %dirname% md %dirname%
%IrfanView% /ini="%~dp0" /capture=0 /convert=%filename%

%Cygwin%\bin\sleep.exe 60
goto :loop

and I put a copy of i_view32.ini in the target directory. Then I made a shortcut to the batch file and put it into the Windows 8.1 startup folder: shell:startup.

When I doubleclick the shortcut, the script starts and works fine. But it doesn't start automatically when I log in.

Why not?

The Event Log shows a BlueScreen event with image atikmpag.sys when I log in, but I do not know if that is related.

How do I work around this issue?

reinierpost

Posted 2015-05-27T09:59:55.000

Reputation: 1 904

You say you put the batch file in the start-up directory: it is more usual to put a link there, with the script in a standard place. With the link you can control the command name and path (used in your script) and the initial directory, and you may find that it then behaves more uniformly. You can also turn echo on and log the output to a file (using cmd /c "..."), so that you can see what went on during start-up. – AFH – 2015-05-27T11:02:10.380

I put a shortcut to the batch file in the startup directory. In the actual script, echo is on, but I haven't tried logging the output, thanks! – reinierpost – 2015-05-27T12:00:14.557

Sorry, I was interrupted and misread your question. I usually check back that I have covered everything before posting, but didn't on this occasion. Mea culpa. – AFH – 2015-05-27T13:38:50.913

@reinierpost: Try a simple batch file that only echoes some text and then pauses. Does that run? Also, what's the need for Cygwin utilities here when Windows can do it all? – Karan – 2015-05-28T01:01:31.523

@Karan: I am just trying to get this to work. If you can tell me how to do it with Windows utilities I'll be happy. – reinierpost – 2015-05-28T08:29:52.947

@reinierpost: Did you try with a simple batch file as I suggested first? Cygwin dependency can be removed later if required. – Karan – 2015-05-28T18:17:20.027

@Karan: I just tried. Nothing shows up in the logfile at all. Not even when I place the batchfile itself in the startup folder. Other shortcuts are working fine. – reinierpost – 2015-05-29T09:15:22.733

Try a login script or a scheduled task.

– Karan – 2015-05-29T09:42:42.850

@Karan: I tried both; neither work. For the scheduled task, the problem seems to be that it has to run as SYSTEM and cannot access my screen. A login script doesn't work at all (not even one that just echoes a line to a logfile). – reinierpost – 2015-05-29T11:05:03.890

That's strange. At least one of these should have worked, especially with a simple batch file. – Karan – 2015-05-30T00:17:25.467

I'm still looking for a solution. – reinierpost – 2015-10-09T13:17:16.050

I never found a solution. I use TimeSnapper now. – reinierpost – 2019-05-21T09:36:59.197

No answers