AppleScript für FileMaker zu Adressbuch export, brauche Hilfe!

hightime-fan

Aktives Mitglied
Thread Starter
Registriert
06.08.2007
Beiträge
716
Reaktionspunkte
29
Hallo,

ich brauche ein AppleScript mit dem ich bestimmte Felder aus einer FileMaker Pro 9 Datenbank in das Adressbuch kopieren kann. Was den Anfang für FileMaker Pro angeht, der ist glaube ich gemacht:

Code:
tell application "FileMaker Pro"
	
	activate
	
	set prenom to cell "Prénom" of current record
	set nom to cell "Nom" of current record
	set contact to cell "Contact" of current record
	set telephone1 to cell "N° de tél. 1" of current record
	set telephone2 to cell "N° de tél. 2" of current record
	set telephonefax to cell "N° de Fax" of current record
	set email to cell "Email" of current record
	set website to cell "Site Web" of current record
	
	set remarque to cell "Remarques" of current record
	
	set adressetype to cell "Adresse 1 Type" of current record
	set adresse to cell "Adresse 1" of current record
	set codepostal to cell "Code postal 1" of current record
	set ville to cell "Ville 1" of current record
	set pays to cell "Pays 1" of current record
	
end tell

Danach komme ich nicht mehr weiter…(ich kenne die Befehle nicht)! :(
Habe bis jetzt folgendes geschrieben:

Code:
tell application "Address Book"
	
	
end tell

Könnte wir jemande sagen was ich schreiben muss bzw. wie die Befehle lauten um ein neuen Kontakt im Adressbuch zu erstellen ?


Mit freundlichen Grüßen,

Hightime
 
Salut,
hier ein Beispiel:
PHP:
tell application "Address Book"
	activate
	set newPerson to (make new person with properties {last name:"Bellucci", first name:"Monica"})
	save addressbook
	make new email at end of emails of newPerson with properties {label:"Private", value:"monica@mac.com"}
	make new phone at end of phones of newPerson with properties {label:"Work", value:"+33-1-4711007"}
	make new phone at end of phones of newPerson with properties {label:"Mobile", value:"+33-679-808080"}
	make new phone at end of phones of newPerson with properties {label:"Fax", value:"+33-1-4711111"}
	make new address at end of addresses of newPerson with properties {label:"Home", city:"Paris", zip:"75001", country:"France", street:"65, rue de la Gare"}
end tell

Details findest Du im Scriptverzeichnis von "Address Book".

Ciao
Farid
 
Vielen Dank !

Jedoch bekomme ich jetzt immer folgende Fehlermeldung : "Objekt nicht vorhanden" / " Unbekannter Fehler -1728" :(
 
Hier das Skript:

Code:
tell application "FileMaker Pro"
	
	activate
	
	set prenom to cell "Prénom" of current record of layout 1
	set nom to cell "Nom" of current record of layout 1
	set contact to cell "Contact" of current record of layout 1
	set telephone1 to cell "N° de tél. 1" of current record of layout 1
	set telephone2 to cell "N° de tél. 2" of current record of layout 1
	set telephonefax to cell "N° de Fax" of current record of layout 1
	set telephonemobile to cell "N° de tél. mobile" of current record of layout 1
	set adressemail to cell "Email" of current record of layout 1
	set website to cell "Site Web" of current record of layout 1
	set remarque to cell "Remarques" of current record of layout 1
	set adressetype to cell "Adresse 1 Type" of current record of layout 1
	set adresse1 to cell "Adresse 1" of current record of layout 1
	set codepostal1 to cell "Code postal 1" of current record of layout 1
	set ville1 to cell "Ville 1" of current record of layout 1
	set pays1 to cell "Pays 1" of current record of layout 1
	
end tell


tell application "Address Book"
	
	activate
	set newPerson to (make new person with properties {last name:prenom, first name:nom})
	save addressbook
	make new email at end of emails of newPerson with properties {label:"Work", value:adressemail}
	make new phone at end of phones of newPerson with properties {label:"Work", value:telephone1}
	make new phone at end of phones of newPerson with properties {label:"Work", value:telephone2}
	make new phone at end of phones of newPerson with properties {label:"Mobile", value:telephonemobile}
	make new phone at end of phones of newPerson with properties {label:"Fax", value:telephonefax}
	make new address at end of addresses of newPerson with properties {label:"Home", city:ville1, zip:codepostal1, country:pays1, street:adresse1}
	
end tell

Und im Anhang ein Screenshot der FileMaker Datei.
 

Anhänge

  • Bild 1.jpg
    Bild 1.jpg
    60,5 KB · Aufrufe: 136
Ciao Hightime,

kann das jetzt nicht überprüfen, weil ich bis Mitternacht vor 'ner Dose sitze, aber ich glaube der Fehler liegt hier:
set prenom to cell "Prénom" of current record of layout 1
Ich denke richtig wäre:
set prenom to contents of cell "Prénom" of current record of layout 1

Im Original enthält die Variabile prenom eine Referenz zum FileMaker-Feld.
Im zweiten Fall enthält die Variabile den Inhalt des FileMaker-Feldes.

Ciao
Farid
 
Habe es geschafft ! :) :)

Habe mir mal eine FileMaker Datei für iCal heruntergeladen(benutzt auch ein AppleScript) und mir alles genau angeguckt und bei meiner Datei angewendet und nun funktioniert es ! :) :) :) :)

Vielen vielen Dank Chebfarid !!

MfG

hightime
 
Hallo ihr zwei,

Code:
tell application "FileMaker Pro"
	activate
	tell current record
		set prenom to cellValue of cell "Prénom"
		set nom to cellValue of cell "Nom"
		set contact to cellValue of cell "Contact"
		set telephone1 to cellValue of cell "N° de tél. 1"
		set telephone2 to cellValue of cell "N° de tél. 2"
		set telephonefax to cellValue of cell "N° de Fax"
		set telephonemobile to cellValue of cell "N° de tél. mobile"
		set adressemail to cellValue of cell "Email"
		set website to cellValue of cell "Site Web"
		set remarque to cellValue of cell "Remarques"
		set adressetype to cellValue of cell "Adresse 1 Type"
		set adresse1 to cellValue of cell "Adresse 1"
		set codepostal1 to cellValue of cell "Code postal 1"
		set ville1 to cellValue of cell "Ville 1"
		set pays1 to cellValue of cell "Pays 1"
	end tell
end tell

tell application "Address Book"
	activate
	set newPerson to (make new person with properties {last name:prenom, first name:nom})
	save addressbook
	make new email at end of emails of newPerson with properties {label:"Work", value:adressemail}
	make new phone at end of phones of newPerson with properties {label:"Work", value:telephone1}
	make new phone at end of phones of newPerson with properties {label:"Work", value:telephone2}
	make new phone at end of phones of newPerson with properties {label:"Mobile", value:telephonemobile}
	make new phone at end of phones of newPerson with properties {label:"Fax", value:telephonefax}
	make new address at end of addresses of newPerson with properties {label:"Home", city:ville1, zip:codepostal1, country:pays1, street:adresse1}
	
end tell

"cellValue of cell"

Viele Grüße
 
@ little_pixel

Ja, so funktioniert es auch ! :)

Mal eine andere Frage. In meiner FM Datei gibt es ein Feld für eine eventuelle zweite Telefonnummer. Wenn dieses Feld leer ist dann erstellt Address Book bzw. das Skript trotzdem ein neues Feld für die 2. Telefonnummer im Address Book.
Gibt es eine möglichkeit zu verhindern dass Felder erstellt werden auch wenn sie leer sind?

MfG
 
Klar,

Code:
if (telephone2 is not equal to "") then make new phone at end of phones of newPerson with properties {label:"Work", value:telephone2}

Viele Grüße
 
Angenommen man ändert in der FileMaker Datei zB. die Telefonnummer1 (telephone1) und möchte nun den Kontakt im Adressbuch aktualisieren was muss ich da tun?

Außerdem frage ich mich was ich schreiben kann damit company:true nur gesetzt wird wenn entreprise is not equal to "" .

Mit freundlichen Grüßen,

hightime
 
Zuletzt bearbeitet:
Zurück
Oben Unten