Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email Address Books
Message
From
12/03/2013 15:24:31
 
 
To
07/03/2013 12:52:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01567774
Message ID:
01568111
Views:
67
I got no response as to an outlook express or thunderbird option, so I wrote some code to handle thunderbird.
This code will handle multiple address books, includes an outlook express one imported on the thunderbird install, and even checks for duplicates.
If you notice some inefficient code, feel free to let me know... I hope this helps someone who may want to do this at some point.
CREATE CURSOR contact;
 (email c(75))

#INCLUDE main.h
profilepath = SYSTEMPATHS(CSIDL_APPDATA)+"\thunderbird\profiles.ini"
*profilepath = "C:\Documents and Settings\kevin\Application Data\Thunderbird\profiles.ini"
xxx = FILETOSTR(profilepath)

zzz = ATC('Path=',xxx)

thunderbirdpath = ALLTRIM(STRTRAN(SUBSTR(xxx,zzz+5,100),CHR(13)+CHR(10)," "))

CD &thunderbirdpath

seedfile = SYS(2000,'*.mab')
filetest = ADDBS(thunderbirdpath)+seedfile

DO WHILE LEN(ALLTRIM(seedfile)) <> 0  &&& IF there is an address book file
		test = filetostr(filetest)

	x = 1

	DO WHILE AT("@",test,x) > 0 .and. AT("@",test,x)+5 < LEN(test)
		IF !EMPTY(SUBSTR(test,AT("@",test,x)-1,1))
			startat = 2
			DO WHILE SUBSTR(test,AT("@",test,x)-(startat+1),1) <> "="
				startat = startat + 1
			ENDDO

			endat = 2
			DO WHILE RIGHT(SUBSTR(test,AT("@",test,x)-startat+1,startat+endat),1) <> ")"
				endat = endat + 1
			ENDDO	
				
			address = SUBSTR(test,AT("@",test,x)-startat,startat+endat)

			dupe = 'N'
			SELECT contact
			GO top
			DO WHILE .not. EOF()
					IF ALLTRIM(UPPER(address)) == ALLTRIM(upper(contact.email))
						dupe = 'Y'	
					ENDIF	
				SELECT contact
				SKIP
			ENDDO
					IF dupe = 'N'
						IF ATC('$',address) = 0
							INSERT INTO contact VALUES (address)
						ENDIF
					ENDIF
		ENDIF
			x = x + 1
	ENDDO

seedfile = SYS(2000,'*.mab',1)
filetest = ADDBS(thunderbirdpath)+seedfile

ENDDO

BROWSE
Previous
Reply
Map
View

Click here to load this message in the networking platform