I'd like this program for that same purpose (e.g. turning off the monitor when going to bed, starting the screensaver when walking away, shutting down at the end of the work day, etc.), but I can see usefulness for launching programs.
It could be customized at first by calling some text file, but it would ideally exhibit:
-rule customization in GUI, selecting parts of a current screenshot
-context sensitive (i.e. only work while looking at the desktop so as not to shut down while watching a movie)
I'm thinking it could use rectangular areas, based on pixel/percentage coordinates of the UL and LR corners, then check for the cursor's presence in that area for some amount of time.
No doubt there is someone who has a better way of doing this, but I was thinking something along the lines of: Check Cursor Good -> Wait for x seconds (while checking) -> Perform action. Along the lines of this sub-par pseudocode:
[copy or print]
const N;
int action[N] UL LR;
int main ()
{
  while(1)
    for ( n = 0; n <= N; ++n %= N)            //counts modulo N
      action[n] += ( check(n) ? 50ms : -action[N] );  //check position against 'rule n'
      if action[n] >= 5000 ms              //if it holds out long enough
        perform(n);                  //go for it!
      end
    end
  wait 50ms                         //don't eat the processor
  end
}
bool check (n)
{
  switch (n)
    case 0: UL = (900 700); LR = (950 700); break;    //define span
    case 1: ...
    ...
    case N: ...
  end
  return ( (mPos[0]>=UL[0]) && (mPos[1]<=LR[1]) && ... ) ) //is it in there?
}
void perform (n)
{
  switch (n)
    case 0: ScreensaverStart ()
    case 1: Hibernate ()
    ...
    case N: ShutDown ()
  end
}
const N;
int action[N] UL LR;
int main ()
{
  while(1)
    for ( n = 0; n <= N; ++n %= N)            //counts modulo N
      action[n] += ( check(n) ? 50ms : -action[N] );  //check position against 'rule n'
      if action[n] >= 5000 ms              //if it holds out long enough
        perform(n);                  //go for it!
      end
    end
  wait 50ms                         //don't eat the processor
  end
}
bool check (n)
{
  switch (n)
    case 0: UL = (900 700); LR = (950 700); break;    //define span
    case 1: ...
    ...
    case N: ...
  end
  return ( (mPos[0]>=UL[0]) && (mPos[1]<=LR[1]) && ... ) ) //is it in there?
}
void perform (n)
{
  switch (n)
    case 0: ScreensaverStart ()
    case 1: Hibernate ()
    ...
    case N: ShutDown ()
  end
}
I shudder to think what would happen with overlapping zones.Â

Thanks for your time and thoughts, Ben






Logged















