AppleScript移动鼠标并单击Photoshop中的特定元素

问题描述

我的脚本需要一点帮助。实际上,我不确定问题是否出在脚本中还是我的概念是错误的。 因此,我要实现的是在Photoshop CS6 / Cloud中自动在两个特定位置(收缩然后展开特定选项卡)上单击鼠标,然后将鼠标返回到原始位置。

Contract

Extend

我正在使用Mousetools,并且该脚本在Photoshop中而不是在桌面上使用时,可以正常工作。 实际的问题是由于某种原因在Photoshop中没有执行鼠标单击。实际上,它们不时出现,但很少见。鼠标定位没有问题。只需单击即可。 这是我到目前为止所写的内容

set mousetoolsPath to (path to home folder as text) & "UnixBins:Mousetools"
set {x,y} to paragraphs of (do shell script quoted form of POSIX path of mousetoolsPath & " -location")
-- saves the original coordinates in two variables
set z to x
set zz to y

tell application "Adobe Photoshop CS6"
    activate
    delay 1
    
    set x to 1838
    set y to 463
    do shell script quoted form of POSIX path of mousetoolsPath & " -x " & (x as text) & " -y " & (y as text) & " -leftClick"
    
    set x to 1799
    set y to 463
    
    do shell script quoted form of POSIX path of mousetoolsPath & " -x " & (x as text) & " -y " & (y as text) & " -leftClick"
    
    set x to z
    set y to zz
    -- returns the mouse in original position
    do shell script quoted form of POSIX path of mousetoolsPath & " -x " & (x as text) & " -y " & (y as text)
end tell

我有一种感觉,我正在尝试欺骗台式机上的Mousetools,并且它正受到窃听或其他干扰。

我已经使用Keyboard Maestro试用版解决了这个问题,并且工作正常..但是由于我无力购买宏程序,特别是针对这个问题..我想编写一个脚本..andofc自己获得一些经验。 :)

编辑: 为了完成这篇文章,对我来说,此问题的临时解决方案是“ Mousetools”和“ Cliclick”的组合。它可以在10次中的9次中工作,并且由于某种原因,只有当我通过“脚本编辑器”制作的可执行文件运行代码时,才可以运行。仅当从Automator的GUI内部启动时,“ Automator”才能正确运行。由于某些原因,Automator可执行文件无法正确运行。确实是奇怪的和越野车的行为,可能会使我无法及时接受。.但目前还是可以的。

set mousetoolsPath to (path to home folder as text) & "UnixBins:Mousetools"
set {x,y} to paragraphs of (do shell script quoted form of POSIX path of mousetoolsPath & " -location")

tell application "Adobe Photoshop CS6"
    activate
    delay 1
    do shell script "/usr/local/bin/cliclick c:1838,463"
    
    delay 0.5
    do shell script "/usr/local/bin/cliclick c:1660,463"
end tell
delay 0.5
do shell script quoted form of POSIX path of mousetoolsPath & " -x " & (x as text) & " -y " & (y as text)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)