2016-04-07 6 views
0

Ich bin neu in AppleScript, und ich versuche, eine Tastenkombination zum Umschalten zwischen Fn-Tasten auf meiner Logitech K750. Ich benutze AutoCAD und brauche es wirklich.AppleScript K750 Toggle Fn Tasten

Ich fing an, einige Codes zu versuchen, aber bis jetzt kein Erfolg ... kann mir jemand helfen?

Hier ist der Code ...

Vielen Dank !!!

tell application "Device Manager" activate end tell tell application "Device Manager" get every attribute of checkbox "When this box is checked, press F1, F2, etc. keys to use the standard function keys, and press and hold the Fn key to use the enhanced functions printed on the keys." of window "Wireless Solar Keyboard K750 for Mac" click checkbox "When this box is checked, press F1, F2, etc. keys to use the standard function keys, and press and hold the Fn key to use the enhanced functions printed on the keys." of window "Wireless Solar Keyboard K750 for Mac" activate if value of checkbox "When this box is checked, press F1, F2, etc. keys to use the standard function keys, and press and hold the Fn key to use the enhanced functions printed on the keys." of window "Wireless Solar Keyboard K750 for Mac" = 0 then display dialog "Standard Function Keys off..." giving up after 1 else display dialog "Standard Function Keys on..." giving up after 1 end if end tell tell application "Device Manager" quit end tell

Antwort

0

Dieses Skript klickt auf die Funktionstaste Checkbox.

Es wird getestet und OK auf ElCapitain (10.11):

tell application "System Preferences" 
activate 
set current pane to pane "com.apple.preference.keyboard" 
reveal anchor "keyboardTab" of current pane 
end tell 
delay 0.5 -- to make sure system has time to open the window ! 
tell application "System Events" 
tell application process "System Preferences" to click checkbox 1 of tab group 1 of front window 
end tell 
tell application "System Preferences" to close front window 

Achtung: Das GUI-Scripting ist abhängig von der aktuellen Systemversion. Wenn Apple das Layout von Einstellungsfenstern in der nächsten Betriebssystemversion ändert, funktioniert dieses Skript möglicherweise nicht mehr.

-1

Vielen Dank, pbell! Aber das funktioniert nur mit einem Apple Keyboard. Mine ist eine Logitech K750, und die Option Fn Key befindet sich auf "Logitech Device Manager", einer App von Logitech. Ich habe es geschafft, es zu machen das Arbeiten bis, wenn die „Logitech Geräte-Manager“ öffnet ... so nach, ich habe manuell auf das Kontrollkästchen klicken ...

Logitech Device Manager

+0

Oups! Versuchen Sie dann, die Syntax im Gerätemanager ähnlich der Syntax meines Skripts zu verwenden. Um das Lesen des Skripts zu erleichtern, ersetzen Sie die Beschreibung im Kontrollkästchen durch eine Zahl (ich nehme an, dass 1 auf Ihrer Bildschirmkopie basiert). Auch Anweisung 'click checkbox ...' muss in einer 'Anwendung mitteilen "System Events"/Prozess "Device Manager" ... Block (siehe mein Skript). Auf diese Weise können Sie Klicks und andere GUI-Aktionen per Skript simulieren. Letzte Anmerkung: Ihr Anzeigedialog sollte sich nicht im Geräte-Manager-Block befinden, der ihn möglicherweise nicht unterstützt. Legen Sie einfach den Anzeigedialog nach dem Ende an. – pbell