1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-11 11:55:02 -05:00

MML: SendKeys, added more shift characters.

This commit is contained in:
John P (Dgby714) 2011-07-23 17:14:04 -04:00
parent 34eb23ba24
commit 3fbeab9a0b
2 changed files with 59 additions and 46 deletions

View File

@ -413,34 +413,40 @@ implementation
result := xmask and ButtonP > 0; result := xmask and ButtonP > 0;
end; end;
procedure TWindow.SendString(str: string); procedure TWindow.SendString(str: string);
var var
i: integer; I, L: Integer;
key: byte; K: Byte;
HoldShift : boolean; HoldShift: Boolean;
begin
HoldShift := False;
L := Length(str);
for I := 1 to L do
begin begin
HoldShift := false; if (((str[I] >= 'A') and (str[I] <= 'Z')) or
for i := 1 to length(str) do ((str[I] >= '!') and (str[I] <= '&')) or
begin ((str[I] >= '(') and (str[I] <= '+')) or
if((str[i] >= 'A') and (str[i] <= 'Z')) then (str[I] = ':') or
((str[I] >= '<') and (str[I] <= '@')) or
((str[I] >= '^') and (str[I] <= '_')) or
((str[I] >= '{') and (str[I] <= '~'))) then
begin begin
HoldKey(VK_SHIFT); HoldKey(VK_SHIFT);
HoldShift:= True; HoldShift := True;
str[i] := lowerCase(str[i]); end;
end else
if HoldShift then K := GetKeyCode(str[I]);
HoldKey(K);
Sleep(20);
ReleaseKey(K);
if (HoldShift) then
begin begin
HoldShift:= false; HoldShift := False;
ReleaseKey(VK_SHIFT); ReleaseKey(VK_SHIFT);
end; end;
key:= GetKeyCode(str[i]);
HoldKey(key);
//BenLand100: You should probably wait here...
ReleaseKey(key);
end;
if HoldShift then
ReleaseKey(VK_SHIFT);
end; end;
end;
procedure TWindow.HoldKey(key: integer); procedure TWindow.HoldKey(key: integer);
begin begin

View File

@ -366,34 +366,41 @@ begin
end; end;
end; end;
procedure TWindow.SendString(str: string); procedure TWindow.SendString(str: string);
var var
i: integer; I, L: Integer;
key: byte; K: Byte;
HoldShift : boolean; HoldShift: Boolean;
begin
HoldShift := False;
L := Length(str);
for I := 1 to L do
begin begin
HoldShift := false; if (((str[I] >= 'A') and (str[I] <= 'Z')) or
for i := 1 to length(str) do ((str[I] >= '!') and (str[I] <= '&')) or
begin ((str[I] >= '(') and (str[I] <= '+')) or
if((str[i] >= 'A') and (str[i] <= 'Z')) then (str[I] = ':') or
((str[I] >= '<') and (str[I] <= '@')) or
((str[I] >= '^') and (str[I] <= '_')) or
((str[I] >= '{') and (str[I] <= '~'))) then
begin begin
HoldKey(VK_SHIFT); HoldKey(VK_SHIFT);
HoldShift:= True; HoldShift := True;
str[i] := lowerCase(str[i]); end;
end else
if HoldShift then K := GetKeyCode(str[I]);
HoldKey(K);
Sleep(20);
ReleaseKey(K);
if (HoldShift) then
begin begin
HoldShift:= false; HoldShift := False;
ReleaseKey(VK_SHIFT); ReleaseKey(VK_SHIFT);
end; end;
key:= GetKeyCode(str[i]);
HoldKey(key);
//BenLand100 note: probably should wait here
ReleaseKey(key);
end;
if HoldShift then
ReleaseKey(VK_SHIFT);
end; end;
end;
procedure TWindow.HoldKey(key: integer); procedure TWindow.HoldKey(key: integer);
begin begin
keyinput.Down(key); keyinput.Down(key);