-- die var auftraggeber kommt aus einer Exceltabelle und enthält viele character 13 -- character 13 habe ich in eine var retChar definiert set myString to auftraggeber as string if myString contains retChar then display dialog "Ist enhalten" buttons ("OK") default button 1 -- trifft zu else display dialog "Ist nicht enthalten" buttons ("OK") default button 1 end if
set Datei to (path to desktop) & "test.txt" as string set referenzNummer to open for access Datei with write permission write blog2text to referenzNummer close access referenzNummer
set retChar to ASCII character 13 tell application "Microsoft Excel" tell workbook 1 tell sheet 1 set testString to value of cell 1 of row 1 end tell end tell end tell if testString contains retChar then display dialog "Ist enhalten" buttons "OK" default button 1 with icon 2 -- trifft zu else display dialog "Ist nicht enthalten" buttons "OK" default button 1 with icon 1 end if set AppleScript's text item delimiters to return set tempString to every text item of testString set AppleScript's text item delimiters to {""} set defString to tempString as string if defString contains retChar then display dialog "Ist enhalten" buttons "OK" default button 1 with icon 2 -- trifft zu else display dialog "Ist nicht enthalten" buttons "OK" default button 1 with icon 1 end if
-- öffne eine Excel Datei (vom Kunden geliefert) set theWorkbookFile to choose file with prompt "Bitte wählen Sie eine Excel-Datei aus: " set theWorkbookName to name of (info for theWorkbookFile) tell application "Microsoft Excel" open theWorkbookFile set theWorkbook to workbook theWorkbookName tell sheet 1 -- nur diese Felder auslesen set inhalt to value of (range "B3:B28") set spalteD to value of (range "D3:D4") end tell end tell -- Feldinhalte aus Liste in Variablen speichern copy 1st item of inhalt to auftraggeber copy 1st item of spalteD to kostenstelle copy 2nd item of inhalt to fAnsprechpartner set ansprechpartner to fAnsprechpartner as string copy 2nd item of spalteD to telefon copy 3rd item of inhalt to mailBefore set mailAfter to "@bistum-essen.de" set mailAdresse to mailBefore & mailAfter as string copy 6th item of inhalt to menge copy 7th item of inhalt to seiten copy 8th item of inhalt to format copy 9th item of inhalt to doppelseitig copy 10th item of inhalt to farbe copy 11th item of inhalt to deckblatt copy 13th item of inhalt to lochung copy 14th item of inhalt to bindung copy 15th item of inhalt to falzen copy 17th item of inhalt to lieferungAn copy 18th item of inhalt to probeexemplar copy 19th item of inhalt to lieferdatum copy 21st item of inhalt to briefumschlag copy 25th item of inhalt to nameVorlage set lieferdatumString to lieferdatum as string copy last item of inhalt to besonderheit set retChar to ASCII character 13 -- char13 (Return) aus Textdatei entfernen set tempAuftraggeber to auftraggeber as string if tempAuftraggeber contains retChar then set AppleScript's text item delimiters to return set tempString to every text item of tempAuftraggeber set AppleScript's text item delimiters to {" "} set nAuftraggeber to tempString as string --display dialog tempAuftraggeber end if -- Textvariable für neue .txt Datei erstellen set blog2text to nAuftraggeber & retChar & ansprechpartner & retChar & telefon & retChar & kostenstelle & retChar & mailAdresse & retChar & menge & retChar & seiten & retChar & format & retChar & doppelseitig & retChar & farbe & retChar & deckblatt & retChar & lochung & retChar & bindung & retChar & falzen & retChar & lieferungAn & retChar & probeexemplar & retChar & lieferdatumString & retChar & briefumschlag & retChar & nameVorlage & retChar & besonderheit -- neue .txt Datei schreiben set Datei to (path to desktop) & "test.txt" as string set referenzNummer to open for access Datei with write permission write blog2text to referenzNummer close access referenzNummer