Taskkilling the process if it's open more than 3 hours

I would suggest using PowerShell for such a task. For example, to start you off, how about:

foreach ($p in $(Get-Process -Name Notepad -ErrorAction SilentlyContinue))   
{
    write-host "Found PID:" $p.Id "Process:"$p.Name

    if ( $(NEW-TIMESPAN -start $p.starttime -End $(Get-Date)).TotalSeconds -ge 10800)
    {
        Stop-Process -Force -id $p.Id
    }
    else 
    {
        Write-host "$($p.Id) has not been running long enough to kill." 
    }
}

For each process found using Get-Process with the name Notepad, it prints the PID and Name. Then using the starttime attribute of the process found, it calls stop-process with force, using the PID. if the totalseconds the process is running for is greater or equal to 3 hours as specified in seconds.

You could run this script every 5 minutes from the Task Scheduler for example. I assume the 3 hours doesn't need to be exact.