Ich stieß auf ein Problem, wenn ich dieses AppleScript ausführen. Der Zweck dieses AppleScript ist, wenn Sie auf eine Datei einzeln klicken und dieses Skript ausführen, wird diese Datei automatisch auf ein Gerät auf dem Bluetooth namens "David" übertragen. Aber ich stieß auf ein Problem in der Linie der Underdashed. Das Ergebnis zeigt:Bluetooth AppleScript Auto Dateiübertragung
"Fehler" Systemereignisse erhalten einen Fehler: Scrollbereich \ "Bluetooth Devices \" des Fensters 1 des Prozesses \ "Bluetooth File Exchange \" kann nicht abgerufen werden. "Nummer -1728 vom Bildlaufbereich" Bluetooth-Geräte "von Fenster 1 des Prozesses" Bluetooth File Exchange ""
und ich weiß nicht warum. Ich bin komplett ein Noob zu AppleScript, das ist ein Skript von jemand anderem geschrieben, und ich habe nur geändert und fügen Sie ein wenig dazu. Kann mir bitte jemand helfen?
property device : "david"
tell application "Finder" to set fileAlias to selection as alias
set fileToSend to fileAlias
tell application "Finder" to open fileToSend using application file id "com.apple.BluetoothFileExchange"
activate application "Bluetooth File Exchange"
tell application "System Events"
tell process "Bluetooth File Exchange"
repeat until exists window 1
end repeat
select (1st row of table of scroll area "Bluetooth Devices" of window 1 whose value of text field 1 is device)
click button "Send" of window 1
end tell
end tell
Das Problem ist jetzt gelöst, dank "pbell" im Code den Tippfehler Hinweis.
Der folgende Code ist eine modifizierte Version, die für Bluetooth 4.4.4
property device : "vivo X5Pro D"
tell application "Finder" to set fileAlias to selection as alias
set fileToSend to fileAlias
tell application "Finder" to open fileToSend using application file id "com.apple.BluetoothFileExchange"
activate application "Bluetooth File Exchange"
tell application "System Events"
tell process "Bluetooth File Exchange"
repeat until exists window 1
end repeat
select ((row 1 of table 1 of scroll area 1 of window 1) whose value of UI element 2 of UI element 1 is device)
click button "Send" of window 1
end tell
end tell
Die Probleme dieses Codes
1) arbeitet zu langsam läuft es.
2) Der Code beinhaltet GUI, so dass ein Systemupdate mit geänderter Position mehrerer Bereiche diesen Code in Mist verwandelt. (Danke an pbell)
Gibt es also eine alternative Möglichkeit, die GUI und Befehle direkt zu umgehen? Ich denke, das wird die Laufzeit verringern. :)
können einen Blick von meinem Skript –