Archive for tag: Apple Mail

iTunes Titelliste als Email veschicken

28 October, 2008 (23:31) | AppleScript Schnipsel, applescript | By: hubi

Ein kleines Skript (quick&dirty) um die Ausgewählten iTunes Titel (Name, Interpret und Album) als Liste via Email zu verschicken:

set thelist to ""

tell application "iTunes"

set h to selection of browser window 1

set i to 1

repeat with s in h

set thelist to thelist & i & ". " & name of s & " -- " & artist of s & " -- " & album of s & return

set i to i + 1

end repeat

end tell

tell application "Mail"

--close every window

set newMessage to make new outgoing message with properties {content:thelist as text}

tell newMessage

set visible to true

end tell

end tell


Automatischer Zeilenumbruch nach x Zeichen in Apple Mail

13 August, 2008 (01:47) | applescript, entwicklung, tools | By: hubi

Sicherlich ein Grund, weshalb in Zeitungen und Magazinen immer der Text in Spalten unterteil ist, ist bestimmt die Lesbarkeit. Es strengt an, "zu lange" Text-Zeilen zu lesen und man verrutscht auch leicht.
Gerade bei längeren Emails verkleinere ich das Fenster, um die Lesbarkeit zu erhöhen, da viele einfach so ohne Zeilenumbrüche die Texte verfassen.

Wenn ich selber Emails schreibe formatiere ich oft den Text am Ende von Hand um, damit ca. alle 80 Buchstaben eine neue Zeile beginnt.

Um das jetzt aber nicht mehr von Hand zu machen, habe ich ein kleines Applescript geschrieben.
Jetzt muss ich nur noch nach dem Verfassen des Textes diesen in die Zwischenablage kopieren, das Skript starten und dies fügt nun automatisch die Zeilenumbrüche ein und kopiert diese Version des Textes wiederum in die Zwischenablage.

Beispiel:

Anwendung:

Download Zeilenumbrüche nach x Zeichen einfügen Version 0.1

Downloaded a total of 56 times

Code:


try
	display dialog "Umbruch nach ca. wieviel Zeichen?:" default answer "55"
	set line_char_count to (text returned of the result) as integer
	set finaltext to ""
	set thetext to the clipboard

	repeat with theline in every paragraph of thetext
		set charcount to count of every character of (theline as text)
		if charcount > line_char_count then
			set thepointer to 0
			set ret_line to ""
			repeat with i from 1 to charcount
				set thepointer to thepointer + 1
				if thepointer > line_char_count and (character i of theline) as text = " " then
					set thepointer to 0
					set ret_line to ret_line & return
				else if thepointer = 1 and (character i of theline) as text = " " then
				else
					set ret_line to ret_line & (character i of theline)

				end if
			end repeat
		else
			set ret_line to theline
		end if

		repeat with i from 1 to (count of every character of (ret_line as text))
			if (character i of ret_line) as text ≠ " " then
				set ret_line to characters i through -1 of ret_line
				exit repeat
			end if
		end repeat

		set finaltext to finaltext & ret_line & return
	end repeat
	set the clipboard to finaltext
on error msg
	error msg
end try