Ja ich hab gestern ein schönes Appelskript hier im Forum gesehen und meinen Bedingungen angepasst.
Aber ich bin mit 1-2 Sachen nicht ganz zufrieden. Ich poste mal herrein was ich bisher so geschrieben hab.
set theDate to current date
set theTime to time of the theDate
set theDay to weekday of theDate
set d to current date
set derTag to text -2 thru -1 of ("0" & d's day)
set Monat to word 3 of ((current date) as text)
set MonatsListe to {January, February, March, April, May, June, July, August, September, October, November, December}
repeat with i from 1 to 12
if d's month = item i of MonatsListe then
set MM to text -2 thru -1 of ("0" & i)
exit repeat
end if
end repeat
set Jahr to ((year of d) as text)
set dasDatum to theDay & derTag & "." & Monat
-- Datumskonvertierung für say
(* tell application "Finder"
set sound to 0
end tell *)
set probeItunes to false
set probeItunesrun to false
tell application "System Events"
if process "iTunes" exists then set probeItunesrun to true
end tell
if probeItunesrun = true then
set probeItunes to true
tell application "iTunes"
set probeItunesplay to player state as text
if player state = paused then
set probeItunes to false
end if
if player state = stopped then
set probeItunes to false
end if
end tell
end if
(* Es soll mir mal jemand erklären warum ich einen Händler setzen muß obwohl ich ihn nicht garnicht benutze *)
(* Um die Begrüßung abzuschalten bitte in der nächsten Zeile die "--" entfernen. Achtung !! Dies muß nochmaleinmal an einer anderen Stelle des Skriptes getan werden *)
-- (*
if probeItunes = true then
tell application "iTunes"
set sound volume to 15
end tell
end if
-- Überprüfung ob Itunes läuft, ggf. Lautstärke anpassen
delay 2
if theTime < 21600 then
say "UP late, o Master i will serve you! Master it's " & dasDatum & "."
else if theTime < 43200 then
say "Good morning, o Master i will serve you! Master it's " & dasDatum & "."
else if theTime < 64800 then
say "Good Afternoon, o Master i will serve you! Master it's " & dasDatum & "."
else
say "Good evening, o Master i will serve you! Master it's " & dasDatum & "."
end if
-- Zur Abschalten der Begrüßung bitte die "--" entfernen
-- *(
if probeItunes = true then
tell application "iTunes"
set sound volume to 100
delay 15
set theTrack to current track
set theTrackName to name of theTrack
set theTrackArtist to artist of theTrack
end tell
tell application "iTunes"
set sound volume to 15
say "This is " & theTrackName & ", by " & ¬
theTrackArtist & ". "
set sound volume to 100
end tell
end if
-- sollte Itunes schon laufen wird nun der Titel angesagt
if probeItunes = false then
delay 15
say "I will put some music on"
tell application "iTunes"
activate
set sound volume to 100
set theTrack to some file track of user playlist "Meine Top 25"
-- Anstelle von "Meine Top 25" einfach eure Lieblingplalist eintragen
set theTrackName to name of theTrack
set theTrackArtist to artist of theTrack
play theTrack
set collapsed of window 1 to true
end tell
tell application "iTunes"
activate
set sound volume to 15
say "This is " & theTrackName & ", by " & ¬
theTrackArtist & ". "
set sound volume to 100
end tell
end if
-- Itunes starten, zufällig wird ein Track aus "Meine Top 25" abgespielt
delay 10
property theURL : "http://www.icewars.de/index.php?action=login&name=XXXXXXXXXX&pswd=XXXXXXXXXXX&submit=1"
-- Anstelle der XXX eure Zugangsdaten eintragen
open location theURL
delay 30
-- Ja hier könnte auch http://www.spiegel.de stehen.
tell application "Mail"
activate
check for new mail
delay 60
set unreadCount to unread count of inbox
tell application "iTunes"
set sound volume to 15
delay 1
if unreadCount is equal to 0 then say ¬
"You have no new messages!"
if unreadCount is equal to 1 then say ¬
"You have a new message!"
if unreadCount is greater than 1 then say ¬
"You have " & unreadCount & " new messages!"
delay 1
set sound volume to 100
end tell
end tell
-- Mail unread count mit Ansage.
erstmal danke an Bqit.
So meine "Problem" sind:
Kann ich z.B.:
- Eine Syntax einfügen das überprüft ob eine Website schon geöffnet ist ?
-/edit leider doch nicht /edit Wie kann ich überprüfen ob eine Anwendung schon gestartet worden ist ?
- /edit Dieser Punkt hat sich erledigt dank an http://www.fischer-bayern.de /edit
- Wie kann ich z.B. wenn in der Systemeinstellungen der Hacken auf Ton Aus dies ändern per Appleskript ?
Aber ich bin mit 1-2 Sachen nicht ganz zufrieden. Ich poste mal herrein was ich bisher so geschrieben hab.
set theDate to current date
set theTime to time of the theDate
set theDay to weekday of theDate
set d to current date
set derTag to text -2 thru -1 of ("0" & d's day)
set Monat to word 3 of ((current date) as text)
set MonatsListe to {January, February, March, April, May, June, July, August, September, October, November, December}
repeat with i from 1 to 12
if d's month = item i of MonatsListe then
set MM to text -2 thru -1 of ("0" & i)
exit repeat
end if
end repeat
set Jahr to ((year of d) as text)
set dasDatum to theDay & derTag & "." & Monat
-- Datumskonvertierung für say
(* tell application "Finder"
set sound to 0
end tell *)
set probeItunes to false
set probeItunesrun to false
tell application "System Events"
if process "iTunes" exists then set probeItunesrun to true
end tell
if probeItunesrun = true then
set probeItunes to true
tell application "iTunes"
set probeItunesplay to player state as text
if player state = paused then
set probeItunes to false
end if
if player state = stopped then
set probeItunes to false
end if
end tell
end if
(* Es soll mir mal jemand erklären warum ich einen Händler setzen muß obwohl ich ihn nicht garnicht benutze *)
(* Um die Begrüßung abzuschalten bitte in der nächsten Zeile die "--" entfernen. Achtung !! Dies muß nochmaleinmal an einer anderen Stelle des Skriptes getan werden *)
-- (*
if probeItunes = true then
tell application "iTunes"
set sound volume to 15
end tell
end if
-- Überprüfung ob Itunes läuft, ggf. Lautstärke anpassen
delay 2
if theTime < 21600 then
say "UP late, o Master i will serve you! Master it's " & dasDatum & "."
else if theTime < 43200 then
say "Good morning, o Master i will serve you! Master it's " & dasDatum & "."
else if theTime < 64800 then
say "Good Afternoon, o Master i will serve you! Master it's " & dasDatum & "."
else
say "Good evening, o Master i will serve you! Master it's " & dasDatum & "."
end if
-- Zur Abschalten der Begrüßung bitte die "--" entfernen
-- *(
if probeItunes = true then
tell application "iTunes"
set sound volume to 100
delay 15
set theTrack to current track
set theTrackName to name of theTrack
set theTrackArtist to artist of theTrack
end tell
tell application "iTunes"
set sound volume to 15
say "This is " & theTrackName & ", by " & ¬
theTrackArtist & ". "
set sound volume to 100
end tell
end if
-- sollte Itunes schon laufen wird nun der Titel angesagt
if probeItunes = false then
delay 15
say "I will put some music on"
tell application "iTunes"
activate
set sound volume to 100
set theTrack to some file track of user playlist "Meine Top 25"
-- Anstelle von "Meine Top 25" einfach eure Lieblingplalist eintragen
set theTrackName to name of theTrack
set theTrackArtist to artist of theTrack
play theTrack
set collapsed of window 1 to true
end tell
tell application "iTunes"
activate
set sound volume to 15
say "This is " & theTrackName & ", by " & ¬
theTrackArtist & ". "
set sound volume to 100
end tell
end if
-- Itunes starten, zufällig wird ein Track aus "Meine Top 25" abgespielt
delay 10
property theURL : "http://www.icewars.de/index.php?action=login&name=XXXXXXXXXX&pswd=XXXXXXXXXXX&submit=1"
-- Anstelle der XXX eure Zugangsdaten eintragen
open location theURL
delay 30
-- Ja hier könnte auch http://www.spiegel.de stehen.
tell application "Mail"
activate
check for new mail
delay 60
set unreadCount to unread count of inbox
tell application "iTunes"
set sound volume to 15
delay 1
if unreadCount is equal to 0 then say ¬
"You have no new messages!"
if unreadCount is equal to 1 then say ¬
"You have a new message!"
if unreadCount is greater than 1 then say ¬
"You have " & unreadCount & " new messages!"
delay 1
set sound volume to 100
end tell
end tell
-- Mail unread count mit Ansage.
erstmal danke an Bqit.
So meine "Problem" sind:
Kann ich z.B.:
- Eine Syntax einfügen das überprüft ob eine Website schon geöffnet ist ?
-/edit leider doch nicht /edit Wie kann ich überprüfen ob eine Anwendung schon gestartet worden ist ?
- /edit Dieser Punkt hat sich erledigt dank an http://www.fischer-bayern.de /edit
- Wie kann ich z.B. wenn in der Systemeinstellungen der Hacken auf Ton Aus dies ändern per Appleskript ?
Zuletzt bearbeitet: