ひとりゴト

ウィンドウ変化監視.uws

AX
// ウィンドウ変化監視 (id, 監視時間)
//  id = 監視するウィンドウID
//  監視時間 = 秒で指定。
//  指定時間内に変化が無ければFALSEを返す。
//  変化があればTRUE。エラーは-1。

//多重起動防止ここから
id = getid(get_thisuwsc_win)
st = status(id,st_title);sc = status(id,st_class)
acw(id,0,0)//不要。強制終了したいときのため。
id = getid(st,sc)
ifb id > 0 then
  ctrlwin(id,close);slctbox(slct_btn,5,st,"exit");exit
endif
//多重起動防止ここまで

//使用例ここから
id = getid(get_active_win)//試しにアクティブウィンドウを監視
select ウィンドウ変化監視 (id, 30)//監視時間は30秒指定
  case true;msgbox("変化あり")
  case false;msgbox("時間内に変化なし")
  case -1;msgbox("error")
selend
//使用例はここまで

function ウィンドウ変化監視(id,監視時間)
  ifb id < 0 or !chknum(監視時間) or 監視時間 < 1
    result = -1;exit
  endif

  ctrlwin(id,normal); ctrlwin(id,topmost)
  sleep(1)
  filename = status(getid(get_thisuwsc_win),st_title)
  saveimg(filename,id,0,0,status(id,st_width),status(id,st_height))
  ifb !fopen(filename,f_exists)
    result = -1;exit
  endif

  開始時間 = GETTIME() + 監視時間
  while true;sleep(1)
    ifb gettime() > 開始時間
      ctrlwin(id,notopmost);doscmd("del " + filename)
      result = false;exit
    endif
    if !status(id,st_active) then continue//アクティブじゃない間は確認しない
    if !chkimg(filename) then break
  wend
  ctrlwin(id,notopmost);doscmd("del " + filename)
  result = true
fend

//2006/06/02版


© Rakuten Group, Inc.
X
Design a Mobile Site
スマートフォン版を閲覧 | PC版を閲覧
Share by: