Janilabo

Untitled

Aug 8th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.12 KB | None | 0 0
  1. const
  2.   WindowTitle = 'muistio'; // NOTE: Open AT LEAST 2 window's which ALL contain this title (or part of the title..)!
  3.  
  4. var
  5.   cl: array of TSCARWindowClient;
  6.   h, i, tm: Integer;
  7.  
  8. function StartScript: Boolean;
  9. var
  10.   HWDC: THwndArray;
  11. begin
  12.   HWDC := FindWindowsEx(GetDesktopWindow, WindowTitle, '', False, False, True);
  13.   h := High(HWDC);
  14.   if (h < 1) then
  15.   begin            
  16.     SetLength(HWDC, 0);
  17.     Exit;
  18.   end;  
  19.   SetLength(cl, (h + 1));
  20.   for i := 0 to h do
  21.     cl[i] := TSCARWindowClient.Create(HWDC[i]);
  22.   SetLength(HWDC, 0);
  23.   Result := True;
  24. end;
  25.    
  26. begin    
  27.   if not StartScript then
  28.   begin
  29.     WriteLn('Failed to find 2(+) window''s with "' + WindowTitle + '".');
  30.     TerminateScript;                                                    
  31.   end;
  32.   repeat      
  33.     for i := 0 to h do
  34.     begin
  35.       cl[i].Activate;
  36.       tm := GetSystemTime;
  37.       repeat
  38.         Wait(1);
  39.       until (GetKeyState(VK_F12) or ((GetSystemTime - tm) >= 500));
  40.     end;                                                        
  41.     Wait(10);
  42.   until GetKeyState(VK_F12);
  43.   SetLength(cl, 0);
  44. end.
Advertisement
Add Comment
Please, Sign In to add comment