AppleScript:在向上/向下发送按键之前,将焦点设置为滑块

AppleScript:在向上/向下发送按键之前,将焦点设置为滑块,applescript,Applescript,我有一个应用程序,它的界面由三个组和几个元素组成。组1包含一个滑块1,其值指示器1由UI浏览器获取 我已经设法使用按键操作滑块: tell application "GLM" to activate tell application "System Events" to tell application process "GLM Intel" tell group 1 of window 1 tell slider 1

我有一个应用程序,它的界面由三个组和几个元素组成。组1包含一个滑块1,其值指示器1由UI浏览器获取

我已经设法使用按键操作滑块:

  tell application "GLM" to activate
  tell application "System Events" to tell application process "GLM Intel"
      tell group 1 of window 1      
         tell slider 1
             repeat 2 times
                 key code 125
                 delay 0.1
             end repeat
         end tell
      end tell
  end tell
但是,这仅在滑块已具有焦点的情况下有效。如果我使用鼠标操作组2中的任何对象,脚本将停止工作


我试图通过AppleScript单击滑块1和/或值指示器1,但没有成功。任何提示都深表感谢

这不起作用吗?:设置滑块1的值,尝试在“告诉滑块1告诉”块的顶部将其设置为true,以确保始终获得焦点。未经测试,请尝试@user30963的设置值解决方案。谢谢,直接设置滑块效果很好。以集合为中心的方法不起作用。