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] Need Help With TMemo1

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

Joined: 02 Apr 2007
Posts: 159
Location: Cheat Engine

PostPosted: Fri May 30, 2008 1:38 pm    Post subject: [Delphi] Need Help With TMemo1 Reply with quote

How do I do this
Let say text in my memo1 is
Code:
Hi
lol
Myname = *random text*  //*random text* can be asd,qwer,az,phrzacefq,mftb blabla...


I want to get the text next to the Myname = '' or *random text*
then show it on showmessage

_________________
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Fri May 30, 2008 2:17 pm    Post subject: Reply with quote

Try this:
Code:
var
   I,SlashPos:Integer;
   MyText:String;
begin
   for I:=0 to memo1.Lines.Count-1 do
   begin
      SlashPos:=Pos('//',memo1.Lines[I]);//get the pos of '//' in the line
      if SlashPos > 0 then //check if '//' found
      begin //if true get the wanted text and break
         MyText:=copy(memo1.Lines[I],SlashPos,length(memo1.Lines[I])-SlashPos);
         break;
      end;
   end;
end;
Back to top
View user's profile Send private message
cicak
Expert Cheater
Reputation: 0

Joined: 02 Apr 2007
Posts: 159
Location: Cheat Engine

PostPosted: Fri May 30, 2008 2:38 pm    Post subject: Reply with quote

Thanks HolyBlah. +rep Wink
But I want to get the text after Myname =
not after //

I edited the code to
Code:
var
   I,SlashPos:Integer;
   MyText:String;
begin
   for I:=0 to memo1.Lines.Count-1 do
   begin
      SlashPos:=Pos('Myname =',memo1.Lines[I]);//get the pos of '//' in the line
      if SlashPos > 0 then //check if '//' found
      begin //if true get the wanted text and break
         MyText:=copy(memo1.Lines[I],SlashPos,length(memo1.Lines[I])-SlashPos);
         //break;
         showmessage (mytext)
      end;
   end;
end;

it works. btw is it possible not to show 'Myname =' on showmessage? Only show the text after 'Myname ='

_________________
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sat May 31, 2008 12:26 am    Post subject: Reply with quote

just find out which line it's in and then use string - 'Myname ='
_________________
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sat May 31, 2008 1:38 am    Post subject: Reply with quote

You can use the Value property for this:
Code:
showmessage(memo1.Lines.Values['Myname ']);
Back to top
View user's profile Send private message
cicak
Expert Cheater
Reputation: 0

Joined: 02 Apr 2007
Posts: 159
Location: Cheat Engine

PostPosted: Sat May 31, 2008 6:19 am    Post subject: Reply with quote

Thanks again HolyBlah. That one more simple Razz
_________________
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