|
|||||||
| Registrieren | Hilfe | Benutzerliste | Interessengemeinschaften | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
![]() |
|
|
Optionen | Thema durchsuchen | Ansicht |
|
|
#1 |
|
Erdapfel
Registriert seit: 06.2007
Beiträge: 5
![]() |
[AppleScript] Prüfen, ob iTunes auf entfernter Maschine läuft
Hi,
Man kann ja iTunes auf entfernten Mac OS X Rechnern steuern: Code:
tell application "iTunes" of machine "eppc://192.168.1.200" to next track Code:
ob das entfernte iTunes läuft
dann das entfernte iTunes steuern
wenn nein
dann das lokale iTunes steuern.
Code:
on getHost()
tell application "System Events" of machine "eppc://192.168.1.200" to set isRunning to (name of processes) contains "iTunes"
if isRunning then
return "eppc://192.168.1.200"
else
return "eppc://192.168.1.201"
end if
end getHost
try
set theHost to getHost()
tell application "iTunes" of machine theHost to playpause
end try
![]() Komme mit Applescript nicht wirklich klar. Es ist einfach nicht logisch. Code:
#funktioniert: tell application "iTunes" of machine "eppc://192.168.1.200" to playpause #funktioniert nicht! set theHost to "eppc://192.168.1.200" tell application "iTunes" of machine theHost to playpause ![]() Und dann ist auch noch die Undo-Funktion vom Scripteditor verbuggt... alter schwede Danke
|
|
|
|
|
|
#2 |
|
Elstar
Registriert seit: 10.2008
Beiträge: 96
![]() ![]() ![]() ![]() ![]() |
Hallo Kampfgnom!
![]() Hihi! Manchmal kann man wirklich verzweifeln. Kopf hoch! Code:
set theHost to "eppc://192.168.1.200"
using terms from application "iTunes"
tell application "iTunes" of machine theHost to playpause
end using terms from
Was stimmt denn da nicht? Sedna
__________________
ᓴᓐᓇ |
|
|
|
|
|
#3 | |
|
Erdapfel
Registriert seit: 06.2007
Beiträge: 5
![]() |
EDIT: Siehe unten...
################################################ Ich verstehe zwar nicht was dieses Konstrukt soll, will es aber auch lieber nicht wissen. Hinterher mag ich noch Apple-Script *schauder* Auf jeden Fall danke, es funktioniert nun: Code:
on checkProcess()
tell application "System Events" of machine "eppc://192.168.1.200"
set isRunning to ((application processes whose (name is equal to "iTunes")) count)
end tell
if isRunning is greater than 0 then
return true
else
return false
end if
end checkProcess
on getHost()
if checkProcess() then
return "eppc://192.168.1.200"
else
return "eppc://192.168.1.201"
end if
end getHost
set theHost to getHost()
using terms from application "iTunes"
tell application "iTunes" of machine theHost to playpause
end using terms from
Was verbuggt ist an der Undo-Funktion: Nachdem ich ein paar mal Apfel-Z gedrückt habe kommt das hier dabei raus: Code:
on checkProcess()
tell application "System Evenachine "eppc://192.168.1.200"
set isRunning to ((application processes whose (name is equal to "iTunes")) count)
end tell
if isRunning is greater than 0 then
return tru//192.168.1.200"e
else
return f//192.168.1.201"alse
end if
end checkProcess
on getHost()
if ceppc://192.168.1.201"
end if
end g from application "iTunes"
tell application "iTuneachine theHost to playpause
end using terms from
Danke nochmal ################################################ EDIT: Hm Applescript scheint nicht deterministisch zu sein. Das Script funktioniert eine zeitlang (5 Minuten). Jetzt sagt er mir: Zitat:
|
|
|
|
|
|
|
#4 |
|
Erdapfel
Registriert seit: 06.2007
Beiträge: 5
![]() |
Ich Doppelposte mal um die Übersicht zu erhalten. Es funktioniert nun endgültig (meine Änderungen in Rot):
Code:
set myHost to "eppc://192.168.1.200"
on checkProcess()
try
tell application "System Events" of machine myHost
set isRunning to ((application processes whose (name is equal to "iTunes")) count)
end tell
if isRunning is greater than 0 then
return true
else
return false
end if
on error
return false
end try
end checkProcess
on getHost()
if checkProcess() then
return "eppc://192.168.1.200"
else
return "eppc://192.168.1.201"
end if
end getHost
set theHost to getHost()
using terms from application "iTunes"
tell application "iTunes" of machine theHost to playpause
end using terms from
|
|
|
|
![]() |
| Optionen | Thema durchsuchen |
| Ansicht | |
|
|
Ähnliche Themen
|
||||
| Thema | Erstellt von | Forum | Antworten | Letzter Beitrag |
| Kein entfernter Zugriff über Front Row möglich | luettmatten | OS X | 19 | 24.08.2007 11:42 |
| itunes und last.fm mit applescript koppeln? | trust_us_24 | OS X-Developer & AppleScript | 19 | 23.01.2007 14:28 |
| svn Repository+entfernter Server commiten | cellardoor | Web-Programmierung | 11 | 07.01.2007 18:11 |
| Problem mit Applescript und iTunes | Medico | OS X | 0 | 15.12.2006 10:54 |
| Brauche AppleScript für iTunes | Stalefish | OS X-Developer & AppleScript | 12 | 08.12.2006 13:13 |