Applescript delay issue

前端 未结 2 1300
花落未央
花落未央 2021-01-06 15:10

I am testing applescripts that I will use later in my OSX app. I\'m getting a 6 sec delay after the click button command below. After some research it seems that this is a

2条回答
  •  伪装坚强ぢ
    2021-01-06 15:37

    It seems click or axpress causes a big delay.

    Instead - get position and use a third party shell script to do the clicking. Much Much faster.

    using clicclik : https://www.bluem.net/en/mac/cliclick/

    put in user library/application support/Click

    set clickCommandPath to ((path to application support from user domain) as string) & "Click:cliclick"
    set clickCommandPosix to POSIX path of clickCommandPath
    
    tell application "System Events"
     tell process "Pro Tools"
         set frontmost to 1
         tell button "Track List pop-up" of window 1 
         set {xPosition, yPosition} to position
            set x to xPosition
            set y to yPosition
        end tell
        do shell script quoted form of clickCommandPosix & " c:" & xPosition & "," & yPosition
         key code 36   -- return key stroke
     end tell
    

    end tell

提交回复
热议问题