2016-11-22 6 views
0

Ich benutze das folgende Apple-Skript, um herauszufinden, die tatsächliche Hintergrundbild auf meinem Monitor (Dual-Modus) und zeigen es in Finder. Unter El Capitan funktioniert das Skript gut. Nachdem ich Mac OS Sierra das Skript installiert zeigt die FehlermeldungNach der Installation von MacOS-Sierra Apfelscript zeigt tatsächliche Tapete in Finder funktioniert nicht mehr

"error "„Finder“ hat einen Fehler erhalten: Die Routine kann Objekte dieser Klasse nicht bearbeiten." number -10010"

Englisch-Übersetzung:

"error "„Finder“ received an error: The routine cannot work with objects of this class.“ number - 10010". The object which is highlighted in the script is "reveal rotationImage"

Ich bin kein Apple Script-Spezialist. Leider konnte ich im Web keine Hilfe finden. Was könnte das Problem sein?

tell application "System Events" 
    set posix_path to (pictures folder of desktop 1) 
    set picPath to (POSIX file posix_path) as string 
end tell 
set thePictures to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"SELECT data.value FROM preferences INNER JOIN data on preferences.key=16 and preferences.picture_id=5 and preferences.data_id=data.ROWID\"") 
set fullPath to picPath as string 
set rotationImage to fullPath & thePictures 
tell application "Finder" 
    reveal rotationImage 
    activate 
end tell 
tell application "Finder" 
    get selection 
    repeat with moose in result 
     if original item of moose exists then 
      reveal original item of moose 
     end if 
    end repeat 
end tell 

Antwort

0

Das Skript auf meinem Rechner funktioniert sogar auf Sierra, ein Grund Scheitern könnte sein, dass reveal eine Dateireferenz erwartet statt einer Zeichenkette.

Dies ist eine leicht optimierte Version des Skriptes:

tell application "System Events" 
    set posix_path to (pictures folder of desktop 1) 
    set picPath to (POSIX file posix_path) as string 
end tell 
set thePictures to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"SELECT data.value FROM preferences INNER JOIN data on preferences.key=16 and preferences.picture_id=5 and preferences.data_id=data.ROWID\"") 
set fullPath to picPath as string 
set rotationImage to fullPath & thePictures 
tell application "Finder" 
    try 
     set aliasItem to item rotationImage 
     if class of aliasItem is alias file then 
      reveal original item of aliasItem 
     end if 
    end try 
end tell 
+0

Hallo Vadian, funktioniert das Skript perfekt. Vielen Dank für Ihre Hilfe. Da ich kein guter Skriptprogrammierer bin, hätte ich diese Lösung wahrscheinlich nie gefunden. Mit freundlichen Grüßen, Afrikapit – afrikapit

Verwandte Themen