Jump to content
Macro Express Forums

Getting A Macro To Find + Var Phone Numbers -


Recommended Posts

Okay, okay.. Something else I need help with again :D


Here is an *example* of the 'Clipboard' I want to pull numbers from:


dasd-as9cikl2k3mltm2l vlk,,fa
h:  (515) 555-1551 asr123
asjdia98i312 fasfc23 (251) 414-1516
12ddasc t4rh45yhwerfweaccasccaccasc
314r3r13 (251) 123-4567


Basically, I just want to get the three phone numbers out of there while setting each one to a Variable as fast as possible. Any help is appreciated and I hope this is possible?


End result would be like...


%t1%=(515) 555-1551

%t2%=(251) 414-1516

%t3%=(251) 123-4567




Link to comment
Share on other sites

Write the clipboard copy to a text variable T4 then parse out your phone numbers. Now if the number of characters is the same you can just grab the text from character number X to Y for all three. However it's more likely to be different each time. In this case I would get the position of the ( and stuff it in N1. Then decrement N1 by 1 and delete characters 1 thru N1. Now copy characters 1 – 14 to T1. Now delete the first character of T4. Now do the routine again for T2 and T3.

Link to comment
Share on other sites

I had made one that used ASCII or something like that but I couldn't completely get it to work and just deleted it after frustrations, perhaps you could shed some light with an example as I really am not too good with this? :) Perhaps Direct Editor format?


If not, that's okay. I can read more about this kind of stuff heh.

Link to comment
Share on other sites

Here ya go:


<CLIPC><TVAR2:01:03:><REM2:Find the position of the first (><IVAR2:01:13:1:(><REM2:Reduce the number 1 so we don't delete teh first (><NMVAR:09:01:0:0000001:0:0000000><REM2:Delete everythign up to the first (><TMVAR2:11:01:00:001:N01:><REM2:Grab the first phone number><TMVAR2:10:02:01:001:014:><REM2:Delete teh first character "(" so we don't get a 1 next time.><TMVAR2:11:01:00:001:001:><REM2:Do it again for the second number><IVAR2:01:13:1:(><NMVAR:09:01:0:0000001:0:0000000><TMVAR2:11:01:00:001:N01:><TMVAR2:10:03:01:001:014:><TMVAR2:11:01:00:001:001:><REM2:Do it again for the third number><IVAR2:01:13:1:(><NMVAR:09:01:0:0000001:0:0000000><TMVAR2:11:01:00:001:N01:><TMVAR2:10:04:01:001:014:><TBOX4:T:1:CenterCenter000278000200:000:T2= %T2%
T3= %T3%
T4= %T4%


If you find it mystifying how I got around the carriage returns you might want to check out my web page about using a hex editor as it covers the topic of how data appears as opposed to how the computer stores it.


Link to comment
Share on other sites

Thanks! It looks like I got it to work, but when there is less than 3 phone numbers it like relaps and takes the same number as before and chops it up so to say.


I think I can fix this though :)


EDIT: Yep, fixed it up nicely so it figures out how many there are first. ;)

Link to comment
Share on other sites

Add a condition If N1<>0 (not equal to zero) for each of the extractions. If the ( is not found it N1 will eqaul zero and you know to skip it.


You can also do some smarter logic as well to look for your phone numbers so you can get the Home in the right spot and such. For instacne you can look at the "h:" for the home number but in the example it is't clea what is consistent that can be used as a positional clue.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...