Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[DELPHI REQUEST] Input to forms

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
live4eva5
Cheater
Reputation: 0

Joined: 01 Jul 2007
Posts: 38

PostPosted: Tue Oct 27, 2009 4:39 pm    Post subject: [DELPHI REQUEST] Input to forms Reply with quote

I am having proplems

In delphi i want to code so you put in a word in a text feild then next to it there will be the webbrowser component and i want it to input the word into the text feild then automatically submit it.
Back to top
View user's profile Send private message
Mabje
Newbie cheater
Reputation: 0

Joined: 25 Dec 2007
Posts: 16
Location: Norway

PostPosted: Sun Nov 01, 2009 6:13 am    Post subject: Reply with quote

You could use this piece of code. It should work.
Code:
function FillForm(WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
var
  i, j: Integer;
  FormItem: Variant;
begin
  Result := False;
  //no form on document
  if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then
  begin
    Exit;
  end;
  //count forms on document
  for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do
  begin
    FormItem := WebBrowser.OleObject.Document.forms.Item(I);
    for j := 0 to FormItem.Length - 1 do
    begin
      try
        //when the fieldname is found, try to fill out
        if FormItem.Item(j).Name = FieldName then
        begin
          FormItem.Item(j).Value := Value;
          Result := True;
        end;
      except
        Exit;
      end;
    end;
  end;
end;


Example:
Code:

begin
if FillForm(Webbrowser1, 'username', 'ExampleName') = False then
        ShowMessage('Error. Field not available or no Form found.');
end;


Hope this helped you out a bit.
Back to top
View user's profile Send private message MSN Messenger
live4eva5
Cheater
Reputation: 0

Joined: 01 Jul 2007
Posts: 38

PostPosted: Tue Nov 03, 2009 12:57 pm    Post subject: Reply with quote

Thanks mate its better then the code i was useing thanks alot mate =]

how do you make it press buttons tho ?
Back to top
View user's profile Send private message
Mabje
Newbie cheater
Reputation: 0

Joined: 25 Dec 2007
Posts: 16
Location: Norway

PostPosted: Wed Nov 04, 2009 5:37 pm    Post subject: Reply with quote

I am glad it helped you out a bit Smile If there is only one submit button, i just use this:

Browser.OleObject.document.forms.item(0).submit();

But if there is several submit buttons, then you have to do a bit more work.. Out of curiosity, what are you making? Razz
Back to top
View user's profile Send private message MSN Messenger
live4eva5
Cheater
Reputation: 0

Joined: 01 Jul 2007
Posts: 38

PostPosted: Thu Nov 05, 2009 5:24 am    Post subject: Reply with quote

Im just messing around im working out new ways to make like a quick status in twitter i seen that and im working on different ways to make it work so i can learn more in delphi because im supposed to be doing it in college >.<

thanks man it worked =]
Back to top
View user's profile Send private message
Mabje
Newbie cheater
Reputation: 0

Joined: 25 Dec 2007
Posts: 16
Location: Norway

PostPosted: Thu Nov 05, 2009 5:26 pm    Post subject: Reply with quote

Aah! I see Smile Its good to be well prepared for college, and messing around like this helps alot Wink

No problem, I hope you take the time to try to understand a bit of the code Wink
Back to top
View user's profile Send private message MSN Messenger
live4eva5
Cheater
Reputation: 0

Joined: 01 Jul 2007
Posts: 38

PostPosted: Fri Nov 06, 2009 11:18 am    Post subject: Reply with quote

Haha we start codeing in a couple of weeks so >.<

And yes ive taken time i need to know the code anyway so Smile

thanks alot Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites