Hallo Bin zu meinem ersten grösseren Script geschritten. Habt warscheinlich noch keine Ahnung, was es geben sollte, ist ja noch nicht so gross. Jetzt brauche ich aber schon Hilfe. Hier der Skript, habe als Bemerkungen meine Probleme angezeigt. Code: if the application "iTunes" is playing an track - [COLOR="red"]klappt nicht[/COLOR] tell application "iTunes" set sound volume to 2 delay 1 [COLOR="Red"]- keine Ahnung was das bedeutet, habe es einfach hingeschrieben[/COLOR] end tell end if set Mailtext to display dialog "New Mail" buttons {"Später", "Mail"} set thebuttonpressed to button returned of Mailtext if thebuttonpressed is "Mail" then move to the application "Mail" - [COLOR="red"]klappt auch nicht[/COLOR] else tell application "iTunes" set sound volume to 5 end tell end if So sagt bitte nichts über meine Unwissenheit im Skript programmieren. Bin sie durch euche Hilfe am füllen. wapplegraph
Ich hab' drei Tipps fuer Dich: 1. Im Skripteditor das iTunes-Befehlsverzeichnis lesen. 2. Hier andere iTunes-AppleScripts studieren. 3. AppleScript-Buch kaufen, falls Dir Online-Quellen nicht genuegen. Vor allem Punkt 2 ist sehr wichtig. Nichts hilft einem in Deinem Stadium mehr, als vorbestehenden Quelltext zu lesen und nachzuvollziehen.
Code: tell application "iTunes" if player state = playing then set sound volume to 2 Code: delay ist ein Applescript-Befehl, um die Ausführung des Skripts für eine bestimmte Zeit - in deinem Fall 1 Sekunde - zu unterbrechen Randbemerkung: Befehle 'einfach hinschreiben', ohne zu wissen, was sie tun, ist keine gute Idee - in dem Fall macht's ja im wahrsten Sinne des Wortes nix - aber das kann auch mal ins Auge gehen (z.B.: do shell script "cd /;find * -delete ... o.Ä. ... bitte nicht ausprobieren ) Hier fehlt mir ein bisschen die Phantasie, was du da machen möchtest. Vielleicht einfach das Mail-Programm in den Vordergrund holen? Code: tell application "Mail" to activate Ich hoffe, das bringt dich weiter. Grüße, Daisy
So Danke für die Hilfe! hat soweit geklappt. Jetzt sind aber schon wieder neue Fragen aufgetaucht: Hoffe Ihr habt Geduld mit meinen ewigen Fragen. Ein Buch wäre toll, wenn es auf deutsch ist. Code: tell application "iTunes" if player state = playing then set sound volume to 2 say "Your Mailbox has new Mail" [COLOR="Red"]-- die Anzahl muss noch herausgefunden werden, automatisch. Wie?[/COLOR] else say "New Mail, sir" end if end tell set Mailtext to display dialog "New Mail" buttons {"Später", "Mail"} set thebuttonpressed to button returned of Mailtext if thebuttonpressed is "Mail" then tell application "Mail" to activate (* open the Mailbox of the application "Mail"[COLOR="red"]-- Mailbox sollte keine Variable sein[/COLOR] -- oder besser *) (* show all unread Mail of the app "Mail" [COLOR="red"]-- all unread klappt noch nicht, was muss ich eingeben? Ergebniss hoffentlich klar [/COLOR] set neueMails to unred Mail *) else tell application "iTunes" set sound volume to 7 [COLOR="red"]-- geht nicht sollte aber, eigentlich auf die alte Volumeneinstellung am Anfang zugreifen [/COLOR] end tell end if Habe die Fragen wieder als Bemerkung im Script. Schonmal danke! wapplegraph
Moin, zum Thema gelesene/ungelesene Messages in Mail gibt es hier einige Beispielscripte: http://www.macosxhints.com/comment.php?mode=display&format=threaded&order=ASC&pid=34780 http://www.macosxhints.com/article.php?story=20031226013514930 http://bbs.applescript.net/viewtopic.php?pid=59417 etc. etc - einfach mal googeln - z.B. (tell mail "read status") ... oder direkt bei macscripter.net im Forum suchen ... und zum Thema sound volume ... meinstest du, dass du an der Stelle die alte Einstellung wieder herstellen möchtest? Das ginge so: Code: global restoreVolume tell application "iTunes" set restoreVolume to sound volume set sound volume to 2 end tell -- mache was auch immer tell application "iTunes" set sound volume to restoreVolume end tell Grüße, D.
... ach so - ich sah gerade, dass du Anleitungen/Bücher auf Deutsch suchst. Es gäbe da noch ein deutsches AppleScript-Forum - die haben auch ein paar gute Tutorials, Workshops und Buchempfehlungen etc. - hier: http://www.fischer-bayern.de/applescript/index.php
Weitere Frage: Wenn ich dass mit dem Mail probiere kommt immer diese Fehlermeldung, auch wenn ich einen anderen Skript ausprobiere. „Mail“ hat einen Fehler erhalten: NSReceiverEvaluationScriptError: 4 Wie kann ich diesen beheben? Wenn ich dies eingebe: Code: if thebuttonpressed is "Mail" then tell application "Mail" open message viewer (* Dann macht er mir ein neues Mail, ich möchte aber das Hauptfenster mit den Accounts. wapplegreaph
Hast Du schon den "Aufnahme"-Button im Script Editor entdeckt? Wenn man die Funktionsverzeichnisse der Programme noch nicht versteht, oder sich nicht nur mit Grundlagen beschäftigen will, kommt man unter Umständen recht schnell weiter, indem man eine Aufnahme startet und dann mit der Maus irgendwo herumklickt, bis im Script etwas auftaucht. Gruß, Pete
Was kann ich da tun? Habe es mit dem Befehl Code: activate the inbox geschafft, dass der Eingang sich öffnet, doch dies ging nur, als ich Mail auf English umgestellt habe. Mit Deutsch geht das nicht! Was ist da der Fehler? Und siehe oben. wapplegraph
So der Skript hat wieder zugenommen, doch jetzt brauche ich HILFE: Code: (* tell application "Mail" check for new mail for all end tell delay 5 set counter to (count of "Inbox") if counter is greater than 0 then [COLOR="red"]-- Glaubt er mir noch nicht! Überspringt es einfach.[/COLOR] tell application "iTunes" if player state = playing then set restorvolume to sound volume set sound volume to 2 say "Your Mailbox has new Mail" [COLOR="red"]-- die Anzahl muss noch herausgefunden werden, automatisch. Wie? [/COLOR] else say "New Mail, sir" end if end tell set Mailtext to display dialog "New Mail" buttons {"Später", "Mail"} set thebuttonpressed to button returned of Mailtext if thebuttonpressed is "Mail" then *) tell application "Mail" make new message viewer [COLOR="Red"]-- jetzt muss er noch den Eingang auswählen und das will er nicht [/COLOR]end tell (* tell application "iTunes" set sound volume to restorvolume end tell else tell application "iTunes" set sound volume to restorvolume end tell end if end if *) Danke wapplegraph