发布于 2015-08-03 09:05:04
7楼
自动切换有数组, 全局脚本, 周期触发
#include "apdefap.h"
int gscAction( void )
{
#pragma option(mbcs)
const char* p[4] = {"pdl1", "pdl2", "pdl3", "pdl4"};
static int i = 0;
extern int flag;
if(flag) return 0;
OpenPictrue(p[i++ % 4]);
return 0;
}
int flag = 0;
附: 判断鼠标不动的脚本, 1分钟周期
#include "apdefap.h"
int gscAction( void )
{
#pragma option(mbcs)
#pragma code("user32.dll")
BOOL GetCursorPos( LPPOINT lpPoint);
#define cmp(a, b) (a.x == b.x && a.y == b.y)
static POINT lastPos;
POINT currPos;
static int count = 0;
extern int flag;
GetCursorPos(&currPos);
if(cmp(currPos, lastPos))
{
++count;
}
else
{
count = 0;
flag = 0; //恢复正常状态
}
if(5 == count)
{
//鼠标5分钟不动满足
printf("Trig\r\n");
flag = 1;
count = 0;
}
//printf("(%d, %d), (%d, %d)\r\n", lastPos.x, lastPos.y, currPos.x, currPos.y);
lastPos = currPos;
return 0;
}
不忘初心