JSFiddle - React, Tailwind, and code Playground

by huppen

HTML

//mail to asana externlist

JavaScript

//mail to asana externlist
set nameList to {}
set mailList to {}
try
	--server directory
	set Kunden to paragraphs of (read POSIX file "/Volumes/Hosting/kunden_asana.txt" as «class utf8»)
	set Server to "iServer"
on error
	display dialog "/Volumes/Hosting/kunden_asana.txt ist nicht verfügbar" with title "Server Pfad nicht verfügbar!" buttons {"Abbrechen", "Lokal versuchen"}
	try
		set theHome to POSIX path of (path to home folder from user domain)
		set localpath to the text returned of (display dialog "Wo liegt die Datei lokal?" default answer "" & theHome & "Library/Services/kunden_asana.txt")
		set Kunden to paragraphs of (read POSIX file localpath as «class utf8»)
		set Server to "Lokal"
	on error
		display dialog "Fehler bei lokaler Datei, bitte den Pfad prüfen." with title "Datei ist Lokal nicht verfügbar oder der Pfad ist falsch!" buttons "OK"
		return false
		error number -1700
	end try
	--return false
	--error number -1700
end try
repeat with nextLine in Kunden
	if length of nextLine is greater than 0 then
		--split by pipe |
		set AppleScript's text item delimiters to "|"
		--create two lists name and mail
		set {tmpName, tmpMail} to {text item 1 of nextLine, text item 2 of nextLine}
		copy tmpName to the end of nameList
		copy tmpMail to the end of mailList
		set AppleScript's text item delimiters to ""
	end if
end repeat

set project to (choose from list nameList with prompt "asana Projekte @ " & Server & ":" with title "Bitte ein Projekt auswählen!" OK button name "OK" cancel button name "Abbrechen")

if project is {false} or project is false then
	error number -128
end if

--sub-routine for getting the offset of an item in a list:
on list_position(this_item, this_list)
	repeat with i from 1 to the count of this_list
		if item i of this_list is this_item then return i
	end repeat
	return 0
end list_position

set the emailadress to ¬
	item (list_position((project as string), nameList)) of the mailList


set recipientName to "asana Aufgabe für " &...