Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find & Erase
#1
Hello QM Forum,

I am working on making a contact list transfer for yahoo messenger. Its a pretty simple concept, it just grabs the names of all the acc's in the buddy list once set to show yahooid's then saves them to a list then adds them to your new yahoo. What I am asking for help with is how to erase all characters after the "-" symbol is found. Using a.name; when outed the contact will look like this: "yahooid - " and have several spaces after. This isn't a big deal because I am able to use replacerx to get rid of the " - ", but if they have a status It will end up with an output of this: "yahooidhelloworlditsbeenawhile".

Is there a way like/using if(findrx( to find the "-" and delete everything to the right?

If this is possible I would appreciate the help to where I can go to find out how to do this, thanks for your time.
#2
I actually just figured out 1 way to solve my problem, if there is an easier way that this I welcome the idea, if not thanks my question is solved.

Macro Macro
Code:
Copy      Help
,int TRIMCOUNT=find(Hoo "-"); TRIMCOUNT-1
,Hoo.fix(TRIMCOUNT)
,out Hoo
#3
If I understand the structure it looks like this:

"name - stuff you don't care about"

I'd skip the whole process and just grab what you want in one step.

Macro Macro
Code:
Copy      Help
_s="name - stuff you don't care about"
_s.gett(_s 0 "-")
out _s
An old blog on QM coding and automation.

The Macro Hook
#4
Thank you ken,

Here is my code with your update, works well.

Macro Macro2
Code:
Copy      Help
Acc Contacts=acc("" "LISTITEM" win("Yahoo! Messenger" "YahooBuddyMain") "SysListView32" "" 0x1030)
_i=Contacts.a.ChildCount
for Contacts.elem 1 _i
,_s.gett(Contacts.Name 0 "-")
,out _s


Forum Jump:


Users browsing this thread: 1 Guest(s)