dgz Posted June 5, 2006 Share Posted June 5, 2006 I try to make a Vcard editor. My script create a *.vcf file and an other script make a *.txt file with a "base64" encoded picture. I want to include the text code from the txt file to my vcf file but I don't know how to do... Can anybody help me? Thanks Link to comment Share on other sites More sharing options...
Simucal Posted June 5, 2006 Share Posted June 5, 2006 I try to make a Vcard editor. My script create a *.vcf file and an other script make a *.txt file with a "base64" encoded picture. I want to include the text code from the txt file to my vcf file but I don't know how to do...Can anybody help me? ThanksHow about supplying your script. Then give us a .vcf file and the txt file with the base64 picture in it. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
dgz Posted June 5, 2006 Author Share Posted June 5, 2006 Here is my script:expandcollapse popup#include <GUIConstants.au3> dim $image $img = "photo.jpg" $largeur=530 $hauteur=430 $input_pos = 110 GUICreate("Nouvelle vCard", $largeur, $hauteur) $ok=GUICtrlCreateButton ("Ok", ($largeur/2)-75, $hauteur-35, 70) $annuler=GUICtrlCreateButton ("Annuler", ($largeur/2)+5, $hauteur-35, 70) GUICtrlCreateTab (5, 5, $largeur-10, $hauteur-50) GuiCtrlCreateTabItem ("Identité") GUICtrlCreateGroup ("Général:", 10, 35, ($largeur/2)-15, 185) GUICtrlCreateGroup ("Photo:", ($largeur/2), 35, ($largeur/2)-15, 185) GUICtrlCreateGroup ("Notes Personnelles:", 10, 220, $largeur-25, 150) ;Titre GUICtrlCreateLabel ("Titre:", 20, 55) $titre_i=GUICtrlCreateCombo ("",$input_pos,52,120) GUICtrlSetData ($titre_i, " |Monsieur|Madame|Mademoiselle") ;Nom GUICtrlCreateLabel ("Nom:", 20, 80) $nom_i=GUICtrlCreateInput ("",$input_pos, 77, 120) ;Prénom GUICtrlCreateLabel ("Prénom:", 20, 105) $prenom_i=GUICtrlCreateInput ("",$input_pos, 102, 120) ;Deuxième Prénom GUICtrlCreateLabel ("2ème Prénom:", 20, 130) $deuxieme_prenom_i=GUICtrlCreateInput ("",$input_pos, 127, 120) ;Surnom GUICtrlCreateLabel ("Surnom:", 20, 155) $surnom_i=GUICtrlCreateInput ("",$input_pos, 152, 120) ;Date De Naissance GUICtrlCreateLabel ("Date de", 20, 174) GUICtrlCreateLabel ("Naissance:", 20, 186) $date_naissance_i=GUICtrlCreateDate ("", $input_pos, 177, 120, 20, $DTS_SHORTDATEFORMAT) ;photo $affich_img = GUICtrlCreatePic ($img, 275, 52, 130, 156) $modifier_image=GUICtrlCreateButton ("Modifier", 410, 55, 100) $supprimer_image=GUICtrlCreateButton ("Supprimer", 410, 85, 100) ;Notes Personnelles GUICtrlCreateInput ("", 20, 235, $largeur-45, 125) ;____________________________________________________________________________________________ Domicile GuiCtrlCreateTabItem("Domicile") GUICtrlCreateGroup("Adresse postale", 10, 35, 270, 200) ;Boîte Postale GUICtrlCreateLabel ("Boîte postale:", 20, 55) $boite_postale_i=GUICtrlCreateInput ("",$input_pos,52,160) ;Extension GUICtrlCreateLabel ("Extension:", 20, 80) $extension_i=GUICtrlCreateInput ("",$input_pos,77,160) ;Rue GUICtrlCreateLabel ("Rue:", 20, 105) $rue_i=GUICtrlCreateInput ("",$input_pos,102,160) ;Code Postal GUICtrlCreateLabel ("Code postal:", 20, 130) $code_postal_i=GUICtrlCreateInput ("",$input_pos, 127, 160) ;Ville GUICtrlCreateLabel ("Ville:", 20, 155) $ville_i=GUICtrlCreateInput ("",$input_pos, 152, 160) ;Région GUICtrlCreateLabel ("Région:", 20, 180) $region_i=GUICtrlCreateInput ("",$input_pos, 177, 160) ;Pays GUICtrlCreateLabel ("Pays:", 20, 205) $pays_i=GUICtrlCreateInput ("",$input_pos, 203, 160) ;____________________________________________________________________________________________ GUICtrlCreateGroup("Téléphone / Fax", 285, 35, 230, 100) ;Téléphone Fixe GUICtrlCreateLabel ("Téléphone fixe:", 295, 55) $tel_fixe_i=GUICtrlCreateInput ("",$input_pos+295, 52, 100) ;Téléphone Mobile GUICtrlCreateLabel ("Téléphone mobile:", 295, 80) $tel_mobile_i=GUICtrlCreateInput ("",$input_pos+295, 77, 100) ;Fax GUICtrlCreateLabel ("Fax:", 295, 105) $fax_i=GUICtrlCreateInput ("",$input_pos+295, 102, 100) ;____________________________________________________________________________________________ ;eMail GUICtrlCreateLabel ("Courriel:", 250, 240) $email_i=GUICtrlCreateInput ("",$input_pos+250, 237, 160) ;____________________________________________________________________________________________ Profession GuiCtrlCreateTabItem("Profession") GUICtrlCreateGroup("Adresse postale", 10, 35, 270, 225) ;Société GUICtrlCreateLabel ("Société:", 20, 55) $extension_pi=GUICtrlCreateInput ("",$input_pos,52,160) ;Boîte Postale GUICtrlCreateLabel ("Boîte postale:", 20, 80) $boite_postale_pi=GUICtrlCreateInput ("",$input_pos,77,160) ;Extension GUICtrlCreateLabel ("Extension:", 20, 105) $extension_pi=GUICtrlCreateInput ("",$input_pos,102,160) ;Rue GUICtrlCreateLabel ("Rue:", 20, 130) $rue_pi=GUICtrlCreateInput ("",$input_pos,127,160) ;Code Postal GUICtrlCreateLabel ("Code postal:", 20, 155) $code_postal_pi=GUICtrlCreateInput ("",$input_pos, 152, 160) ;Ville GUICtrlCreateLabel ("Ville:", 20, 180) $ville_pi=GUICtrlCreateInput ("",$input_pos, 177, 160) ;Région GUICtrlCreateLabel ("Région:", 20, 205) $region_pi=GUICtrlCreateInput ("",$input_pos, 202, 160) ;Pays GUICtrlCreateLabel ("Pays:", 20, 230) $pays_pi=GUICtrlCreateInput ("",$input_pos, 227, 160) ;____________________________________________________________________________________________ GUICtrlCreateGroup("Téléphone / Fax", 285, 35, 230, 100) ;Téléphone Fixe GUICtrlCreateLabel ("Téléphone fixe:", 295, 55) $tel_fixe_pi=GUICtrlCreateInput ("",$input_pos+295, 52, 100) ;Téléphone Mobile GUICtrlCreateLabel ("Téléphone mobile:", 295, 80) $tel_mobile_pi=GUICtrlCreateInput ("",$input_pos+295, 77, 100) ;Fax GUICtrlCreateLabel ("Fax:", 295, 105) $fax_pi=GUICtrlCreateInput ("",$input_pos+295, 102, 100) ;____________________________________________________________________________________________ ;eMail GUICtrlCreateLabel ("Courriel:", 250, 240) $email_pi=GUICtrlCreateInput ("",$input_pos+250, 237, 160) GUISetState (@SW_SHOW) Sleep(2000) Func Encodage () $tmp = @ScriptDir & "\temp.txt" $type = StringSplit($image, ".") $name = StringSplit($type[$type[0] - 1], "\") $name = $name[$name[0]] $type = $type[$type[0]] RunWait(@ComSpec & ' /c base64 -e "' & $image & '" "' & $tmp & '"', @ScriptDir, @SW_HIDE) Do Sleep(100) Until FileExists($tmp) EndFunc Func Ecriture () $titre = GUICtrlRead ($titre_i) $nom = GUICtrlRead ($nom_i) $prenom = GUICtrlRead ($prenom_i) $deuxieme_prenom = GUICtrlRead ($deuxieme_prenom_i) $surnom = GUICtrlRead ($surnom_i) $date_naissance = GUICtrlRead ($date_naissance_i) $split = StringSplit ($date_naissance,"/") $date_naissance = $split [3] & $split [2] & $split [1] $boite_postale = GUICtrlRead ($boite_postale_i) $extension = GUICtrlRead ($extension_i) $rue = GUICtrlRead ($rue_i) $code_postal = GUICtrlRead ($code_postal_i) $ville = GUICtrlRead ($ville_i) $region = GUICtrlRead ($region_i) $pays = GUICtrlRead ($pays_i) $tel_fixe = GUICtrlRead ($tel_fixe_i) $tel_mobile = GUICtrlRead ($tel_mobile_i) $fax = GUICtrlRead ($fax_i) $email = GUICtrlRead ($email_i) $vcard=FileOpen ("temp.vcf", 2) FileWriteLine ($vcard, "BEGIN:VCARD") FileWriteLine ($vcard, "VERSION:2.1") FileWriteLine ($vcard, "N;LANGUAGE=fr:" & $nom & ";" & $prenom & ";" & $deuxieme_prenom & ";" & $titre) FileWriteLine ($vcard, "FN;LANGUAGE=fr:" & $nom & " " & $prenom) FileWriteLine ($vcard, "NICKNAME;LANGUAGE=fr:" & $surnom) FileWriteLine ($vcard, "BDAY:" & $date_naissance) FileWriteLine ($vcard, "TEL;HOME;VOICE;LANGUAGE=fr:" & $tel_fixe) FileWriteLine ($vcard, "TEL;HOME;FAX;LANGUAGE=fr:" & $fax) FileWriteLine ($vcard, "TEL;CELL;VOICE;LANGUAGE=fr:" & $tel_mobile) FileWriteLine ($vcard, "ADR;DOM;HOME;LANGUAGE=fr:" & $boite_postale & ";" & $extension & ";" & $rue & ";" & $ville & ";" & $region & ";" & $code_postal & ";" & $pays) FileWriteLine ($vcard, "EMAIL;INTERNET;LANGUAGE=fr:" & $email) FileWriteLine ($vcard, "PHOTO;ENCODING=BASE64:" & @CRLF) ;???????? FileWriteLine ($vcard, "END:VCARD") FileClose ($vcard) EndFunc While 1 $msg = GUIGetMsg () Select case $msg = $GUI_EVENT_CLOSE Or $msg = $annuler Exit Case $msg = $modifier_image $image=FileOpenDialog ("Parcourir...","C:\","Images (*.gif;*.jpg;*.png;*.png)",1) Encodage () GUICtrlSetImage ($affich_img, $image) GUICtrlSetState ($affich_img, $GUI_SHOW) Case $msg = $ok Ecriture () Run ("save.exe") Exit EndSelect WEndThen a VCF file looks like this:BEGIN:VCARDVERSION:2.1N:Homer;Simpson;;M.FN:Simpson HomerTEL;HOME;VOICE:1111111111TEL;CELL;VOICE:2222222222ADR;HOME:;;32 Evergreen Terrace;Sringfield;;;USLABEL;HOME;ENCODING=QUOTED-PRINTABLE:32 Evergreen Terrace=0D=0ASringfield=0D=0AUSEMAIL;PREF;INTERNET:anything@anywhere.comPHOTO;ENCODING=BASE64:/9j/4AAQSk271vaPaXFjp629zJG7qzYaMYGCcjirkUSQxLFEoVEGFUdAKfV7KxyTm5u7CjrVaJ7vUp3g0qJHEbbZbqXPlIe6jHLt7DgdzWrD4UhcbtQvbu7Y9V8wxR/gqY/UmtoYec1fY5p4iEHbcz5pYEUrPJEqkYIkYAEenNeYazdvc2sEqgNc3ZMRukumDQhTl0RF4AX7oz3bPNe2w+HNFtx+60uzB9TCpP5nmvLPiGump43ihs0t0uI7IGdYgAQS/G4DvgD8K0lgeZxvLRO7Xc55YrmVkjy7xX4mOixrpmm7UuNgLyAf6odgPevOpppbiQyTSPI56s5yTV7X5Hl8QX7yE7vPcc+xwKzq7zkLmn6pe6VcLPZXLwuD/CeD9R0NexeFdfOv2Kapbxquq6ectGP4uOVH+ywB+h+leI133wkmkTxTPEpPlvbEsPowx/Ok0mrMaZ9HWUkV3aw3MJ3RyoHQ+oIyKW52qtc5ousWum+HLUXE6pgSBEGWdlV2Awo5PA7CrlyNe1DSJdRsLFYLZYvOSS6OXlTGfkjXvjpuI+leN7GUm4wRvzJasz9bFrJaMLi2FwG+SOLZuaRzwFUf3j7Vc8I6rawzWqX18iXCWCRSeedhEgPKndjkVBfT6RoF5Yalplw2s6jasZrqV5PlSAxtuAx8iMcqVXqe/HNenNHFd243xhkdQdsi+vqDXRTwS5HBy1/ImVR2END:VCARDThe bold text is what I need tu put from the txt file. Link to comment Share on other sites More sharing options...
Uten Posted June 5, 2006 Share Posted June 5, 2006 Something like this? You might have to adjust the merge point $dat1 = FileRead($vcffile) $dat2 = FileRead($base64File) FileWrite($fileout, $dat1 & $dat2) Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
dgz Posted June 5, 2006 Author Share Posted June 5, 2006 Thanks Uten. It works fine like this. I don't know why i tried to make something more difficult!!! Thanks again Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now