• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Viele hassen ihn, manche schwören auf ihn, wir aber möchten unbedingt sehen, welche Bilder Ihr vor Eurem geistigen Auge bzw. vor der Linse Eures iPhone oder iPad sehen könnt, wenn Ihr dieses Wort hört oder lest. Macht mit und beteiligt Euch an unserem Frühjahrsputz ---> Klick

isync per applescript automatisieren

jake99

Golden Delicious
Registriert
08.03.08
Beiträge
9
Hallo,

im Netz kursieren ja schon diverse Scripte zu besagtem Problem (Bluetooth einschalten, mit Handy synchronisieren, Bluetooth wieder ausschalten), ich habe mir daraus folgendes zusammengebastelt:

Code:
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
    try
        click bt_menu
        tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
            click
        else
            error
        end if
    on error
        repeat with x in menu bar items
            click x
            try
                if the title of the first menu item of the front menu of x starts with "Bluetooth" then exit repeat
            end try
        end repeat
        set bt_menu to x
        try
            tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
                click
            else
                error
            end if
        on error
            click bt_menu
            display alert "Bluetooth Menu Extra not found."
        end try
    end try
end tell
--
--
--
tell application "iSync"
    synchronize
    repeat while (syncing is true)
        delay 5
    end repeat
    set syncStatus to sync status
    
    if syncStatus = 2 then
        -- Success
        quit
    else
        if syncStatus = 3 then
            set syncStatus to "completed with warnings"
        else if syncStatus = 4 then
            set syncStatus to "completed with errors"
        else if syncStatus = 5 then
            set syncStatus to "last sync cancelled"
        else if syncStatus = 6 then
            set syncStatus to "last sync failed to complete"
        else if syncStatus = 7 then
            set syncStatus to "never synced"
        end if
        display dialog "syncStatus: " & syncStatus
        syncStatus
    end if
end tell
--
--
--
delay 5
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
    try
        click bt_menu
        tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
            click
        else
            error
        end if
    on error
        repeat with x in menu bar items
            click x
            try
                if the title of the first menu item of the front menu of x starts with "Bluetooth" then exit repeat
            end try
        end repeat
        set bt_menu to x
        try
            tell the second menu item of the front menu of bt_menu to if title contains "Bluetooth" then
                click
            else
                error
            end if
        on error
            click bt_menu
            display alert "Bluetooth Menu Extra not found."
        end try
    end try
end tell
Es funktioniert eigentlich auch, allerdings wird Bluetooth nach dem Synchronisieren nicht abgeschaltet.
Ich habe bereits die Suchfunktion benutzt, leider aber nichts hilfreiches gefunden; wäre nett, wenn mir jemand weiterhelfen könnte.

mfg
 

bezierkurve

Halberstädter Jungfernapfel
Registriert
12.06.05
Beiträge
3.860
Schau dir mal die Variante aus den Kommentaren dieses Artikels an, die verwende ich seit einer halben Ewigkeit ohne irgendwelche Probleme. Vorteil ggü. deiner Version: Du brauchst kein GUI-Skripting.
 

DergrosseApfel

Schöner von Nordhausen
Registriert
10.06.09
Beiträge
317
Hallo Threadersteller (u.a.),

ich suche aktuell (!) unter 10.6 nach einer Möglichkeit (deutsch) …
- Bluetooth nur ein-/auszuschalten OHNE iSync.
- Bluetooth ein-/auszuschalten MIT iSync.

Und diese beiden Aktionen hätte ich gerne so, dass sie per Tastenkürzel oder Button ausführbar sind. Mit dem Automator und dem Aufnehmen dieser Befehlsfolge hat das leider nicht geklappt, von Hand funktionierte es exzellent:


  1. ⌘Tab until you get to the Finder.
  2. ⇧⌘G to bring up the Go To dialog: type in "/Applications" without the quotes.
  3. Just type the letters "sys" and your highlight should be over "System Preferences". Press ⌘O to open it.
  4. In System Preferences, the cursor should be in the search field. Just type in "bluetooth" and press Return. Now you're in the Bluetooth preferences.
  5. Press Tab, and there should be a faint highlight on the "On" checkbox.
  6. Press spacebar, and that should turn it on.

(Quelle: http://is.gd/2mi07X)

Danke für Eure Anregungen/Tipps

Gruß
DgA
 

sedna

Galloway Pepping
Registriert
22.10.08
Beiträge
1.359
Hallo,

hier und hier gibt es fertige Lösungen für dein Anliegen.
Sind schon etwas älter ... sollten aber funktionieren
rolle15x18.gif



Gruß