Path 我可以´;找不到Slider1的路径,我想为它设置一个值。

Path 我可以´;找不到Slider1的路径,我想为它设置一个值。,path,slider,applescript,Path,Slider,Applescript,我的问题是,我无法找到要设置值的滑块的正确路径 这是我目前拥有的代码,还有UIElemtInspector路径,非常感谢您的帮助。:) UIElemtInspector路径: <AXApplication: “OSCulator”> <AXWindow: “Preferences”> <AXTabGroup> <AXGroup> <AXSlider> Attributes: AXRole: “AXSlider” AXRoleDesc

我的问题是,我无法找到要设置值的滑块的正确路径

这是我目前拥有的代码,还有UIElemtInspector路径,非常感谢您的帮助。:)

UIElemtInspector路径:

<AXApplication: “OSCulator”>
<AXWindow: “Preferences”>
<AXTabGroup>
<AXGroup>
<AXSlider>

Attributes:
AXRole:  “AXSlider”
AXRoleDescription:  “slider”
AXHelp:  “(null)”
AXEnabled:  “1”
AXFocused (W):  “0”
AXParent:  “<AXGroup>”
AXWindow:  “<AXWindow: “Preferences”>”
AXTopLevelUIElement:  “<AXWindow: “Preferences”>”
AXPosition:  “x=263 y=513”
AXSize:  “w=214 h=21”
AXValue (W):  “20.35702720207254”
AXMinValue:  “0”
AXMaxValue:  “100”
AXChildren:  “<array of size 1>”
AXAllowedValues:  “(null)”
AXOrientation:  “AXHorizontalOrientation”
AXIdentifier:  “_NS:405”

Actions:
AXIncrement - increment
AXDecrement - decrement

正如UIElementInspector所说,滑块位于一个组中。您可以这样显示每个组:

tell application "System Events" to tell application process "OSCulator"
    tell window "Preferences" to tell tab group 1
        click radio button "Outputs"
        get every group
    end tell
end tell
结果:

group "Kyma" of tab group 1 of window "Preferences"...
group "HID" of tab group 1 of window "Preferences"...
group "Mouse" of tab group 1 of window "Preferences"...
现在,您可以查找滑块:

get every UI element of group "Mouse"
tell application "System Events" to tell application process "OSCulator"
    tell window "Preferences" to tell tab group 1
        click radio button "Outputs"
        set value of slider 1 of group "Mouse" to 50
    end tell
end tell
然后最后设置滑块:

get every UI element of group "Mouse"
tell application "System Events" to tell application process "OSCulator"
    tell window "Preferences" to tell tab group 1
        click radio button "Outputs"
        set value of slider 1 of group "Mouse" to 50
    end tell
end tell