#!/usr/bin/perl use DBI; #----------------------------------- DBI #Bitte hier ausfüllen: $database = (deine database); $tabelle = (deine tabelle); $hostname = "localhost"; $user = (dein mysql username); $pass = (..und das Passwort); $address_book = (hier der name des Adressbuchs bitte!) #in meinem Fall: abook-5.mab $dsn = "DBI:mysql:database=$database;host=$hostname"; $dbh = DBI::->connect( $dsn, $user, $pass, { 'RaiseError' => 1, 'AutoCommit' => 1 } ) or die DBI::errstr; $sql = "SELECT * FROM $tabelle"; my $sth = $dbh->prepare($sql) or die $dbh->errstr; $sth->execute or die $sth->errstr; while ($reihenref = $sth->fetchrow_hashref) { %reihe = %{$reihenref}; if ($reihe{'email'}) { push @email, $reihe{'email'}; #alle adressen gehen in @email } } #----------------------------------- Mork - header open (textfile, ">$address_book"); print textfile '// < <(a=c)> // (f=iso-8859-1) (B8=Custom4)(B9=Notes)(BA=LastModifiedDate)(BB=RecordKey) (BC=AddrCharSet)(BD=LastRecordKey)(BE=ns:addrbk:db:table:kind:pab) (BF=ListName)(C0=ListNickName)(C1=ListDescription) (C2=ListTotalAddresses)(C3=LowercaseListName) (C4=ns:addrbk:db:table:kind:deleted) (80=ns:addrbk:db:row:scope:card:all) (81=ns:addrbk:db:row:scope:list:all) (82=ns:addrbk:db:row:scope:data:all)(83=FirstName)(84=LastName) (85=PhoneticFirstName)(86=PhoneticLastName)(87=DisplayName) (88=NickName)(89=PrimaryEmail)(8A=LowercasePrimaryEmail) (8B=SecondEmail)(8C=DefaultEmail)(8D=CardType)(8E=PreferMailFormat) (8F=WorkPhone)(90=HomePhone)(91=FaxNumber)(92=PagerNumber) (93=CellularNumber)(94=WorkPhoneType)(95=HomePhoneType) (96=FaxNumberType)(97=PagerNumberType)(98=CellularNumberType) (99=HomeAddress)(9A=HomeAddress2)(9B=HomeCity)(9C=HomeState) (9D=HomeZipCode)(9E=HomeCountry)(9F=WorkAddress)(A0=WorkAddress2) (A1=WorkCity)(A2=WorkState)(A3=WorkZipCode)(A4=WorkCountry) (A5=JobTitle)(A6=Department)(A7=Company)(A8=_AimScreenName) (A9=AnniversaryYear)(AA=AnniversaryMonth)(AB=AnniversaryDay) (AC=SpouseName)(AD=FamilyName)(AE=DefaultAddress)(AF=Category) (B0=WebPage1)(B1=WebPage2)(B2=BirthYear)(B3=BirthMonth)(B4=BirthDay) (B5=Custom1)(B6=Custom2)(B7=Custom3)>'; print textfile "\n\n<(80=0)(81=)"; $e =0; $i =1; #------------------------------------- mork Mittelteil foreach $mail (@email) { $mail_nummer = $e + 82; $id_nummer = $e + 83; print textfile "\n($mail_nummer=$mail)($id_nummer=$i)"; $e=$e+2; $i++; } print textfile '>'; print textfile "\n\n{\n1:^80\n{\n(k^BE:c)(s=9)\n}\n[1:^82(^BD=3)] "; $e=0; $i =1; #----------------------------------------- mork - Bauch foreach $mail(@email) { $mail_nummer = $e + 82; print textfile " [$i(^83=)(^84=)(^85=)(^86=)(^87=)(^88=)(^89^$mail_nummer)(^8A^$mail_nummer)(^8B=)(^8C=) (^8D=)(^8E=0)(^8F=)(^90=)(^91=)(^92=)(^93=)(^94=)(^95=)(^96=)(^97=) (^98=)(^99=)(^9A=)(^9B=)(^9C=)(^9D=)(^9E=)(^9F=)(^A0=)(^A1=)(^A2=) (^A3=)(^A4=)(^A5=)(^A6=)(^A7=)(^A8=)(^A9=)(^AA=)(^AB=)(^AC=)(^AD=) (^AE=)(^AF=)(^B0=)(^B1=)(^B2=)(^B3=)(^B4=)(^B5=)(^B6=)(^B7=)(^B8=) (^B9=)(^BA=0)(^BB=$i)]"; $e =$e+2; $i++; } print textfile "\n}"; close textfile;