Sova-Kmv писал(а):
спасибо!На тебе более универсальный вариант
Add(MainForm,1351679,231,175)
{
Width=695
Height=561
}
Add(WebBrowser,15563951,378,168)
{
Left=5
Top=85
Width=665
Height=430
URL="http://www.igra3k.ru/"
Point(PHandle)
Point(doFromText)
Point(Handle)
}
Add(Edit,15375584,280,175)
{
Left=10
Top=5
Width=135
Text="signin[login]"
}
Add(Edit,12692327,322,175)
{
Left=155
Top=5
Width=135
Text="privet"
}
Add(Button,3488175,231,238)
{
Left=295
Top=5
TabOrder=-1
Caption="Set"
link(onClick,3134972:doAdd,[])
}
Add(Edit,3057939,280,280)
{
Left=10
Top=30
Width=135
Text="signin[password]"
}
Add(Edit,6191608,322,280)
{
Left=155
Top=30
Width=135
Text="privet"
}
Add(Button,16300376,231,343)
{
Left=295
Top=30
TabOrder=-1
Caption="Set"
link(onClick,1475487:doAdd,[])
}
Add(Edit,4667223,280,385)
{
Left=155
Top=60
Width=135
Text="Начать игру"
}
Add(Button,15211543,231,441)
{
Left=295
Top=60
TabOrder=-1
Caption="Set"
link(onClick,5921312:doData,[])
}
Add(KeyEvent,9754410,448,245)
{
Code=32
link(Handle,15563951:Handle,[(454,215)(405,215)])
}
Add(InlineCode,10977955,392,238)
{
WorkPoints=#16:doSetValueByName|20:doSetFocusByName |18:doSetFocusByValue |
EventPoints=#10:onSetValue|10:onSetFocus|
DataPoints=#2:ph|4:name|5:value|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|40:uses kol,Share,Debug,ActiveX,KOLSHDocVw;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|18: ph: THI_Event;|20: name: THI_Event;|21: value: THI_Event;|26: onSetValue: THI_Event;|26: onSetFocus: THI_Event;|0:|57: procedure doSetValueByName(var dt:TData; index:word);|61: procedure doSetFocusByName(var dt:TData; index:word); |62: procedure doSetFocusByValue(var dt:TData; index:word); |0:|5: end;|0:|14:implementation|0:|4:type|31: TKOLWebBrowser = PWebBrowser;|31: PKOLWebBrowser = PWebBrowser;|0:|74:function FindIdx(pc: PControl; val: string; FindByName: boolean): Integer;|3:var|13: i: integer;|5:begin|15: Result := -1;|85: for i := 0 to PKOLWebBrowser(pc).OleObject.Document.all.tags('input').length - 1 do|22: if FindByName then|13: begin |88: if PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(i).name = val then|11: begin|20: Result := i;|15: break; |10: end;|7: end|12: else |9: begin|89: if PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(i).value = val then|11: begin|20: Result := i;|15: break; |10: end;|8: end;|6:end; |0:|39:procedure THiAsmClass.doSetValueByName;|3:var|15: pc: PControl;|19: txt, val: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|30: txt := ReadString(dt, name);|33: val := ReadString(dt, value); |32: idx := FindIdx(pc, txt, true);|24: if idx < 0 then exit; |81: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).value := val;|26: _hi_onEvent(onSetValue);|4:end;|0:|39:procedure THiAsmClass.doSetFocusByName;|3:var|15: pc: PControl;|14: txt: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|30: txt := ReadString(dt, name);|32: idx := FindIdx(pc, txt, true);|24: if idx < 0 then exit; |74: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).focus;|26: _hi_onEvent(onSetFocus);|4:end;|0:|40:procedure THiAsmClass.doSetFocusByValue;|3:var|15: pc: PControl;|14: val: string;|15: idx: integer;|5:begin|37: pc := PControl(ToIntegerEvent(ph));|32: if not Assigned(pc) then exit;|33: val := ReadString(dt, value); |33: idx := FindIdx(pc, val, false);|24: if idx < 0 then exit; |74: PKOLWebBrowser(pc).OleObject.Document.all.tags('input').Item(idx).focus;|26: _hi_onEvent(onSetFocus);|4:end;|0:|4:end.|
link(onSetFocus,9754410:doPress,[])
link(ph,15563951:PHandle,[])
}
Add(MT_AddData,3134972,280,238)
{
link(onAdd,3095249:doWork2,[])
link(Data1,15375584:Text,[])
link(Data2,12692327:Text,[(293,215)(328,215)])
}
Add(MT_AddData,1475487,280,343)
{
link(onAdd,3095249:doWork3,[(368,349)])
link(Data1,3057939:Text,[])
link(Data2,6191608:Text,[(293,320)(328,320)])
}
Add(HubEx,3095249,364,238)
{
link(onEvent,10977955:doSetValueByName,[])
}
Add(DoData,5921312,280,441)
{
link(onEventData,10977955:doSetFocusByValue ,[(375,447)(375,258)])
link(Data,4667223:Text,[])
}