2016-12-02 42 views
-1

以下代码在AppleScript中引发错误。我得到error "iTerm got an error: Can’t make class «class Ptrm»." number -2710 from «class Ptrm» to class。任何可能导致它的建议?我对AppleScript是全新的,但是我交付了这个可能过时的脚本,需要它运行,以便在iTerm中产生5个以下的操作。所有见解欢迎!谢谢AppleScript错误-2710

tell application "iTerm" 
set t to (make new «class Ptrm») 
tell t 
    activate «class Cssn» 
    «event ITRMLNCH» given «class Pssn»:"Default Session" 
    tell the last «class Pssn» 
     «event ITRMWrte» given «class iTxt»:"vagrant ssh" 
     «event ITRMWrte» given «class iTxt»:"cd /vagrant" 
     «event ITRMWrte» given «class iTxt»:"./devsettings.sh scripts/runserver.py" 
     delay 1 
    end tell 
    «event ITRMLNCH» given «class Pssn»:"Default Session" 
    tell the last «class Pssn» 
     «event ITRMWrte» given «class iTxt»:"vagrant ssh" 
     «event ITRMWrte» given «class iTxt»:"cd /vagrant" 
     «event ITRMWrte» given «class iTxt»:"./localsettings.sh ./scripts/runcelery.py worker -c 10 -A plug.tasks -Q celery,pushq" 
     delay 1 
    end tell 
    «event ITRMLNCH» given «class Pssn»:"Default Session" 
    tell the last «class Pssn» 
     «event ITRMWrte» given «class iTxt»:"vagrant ssh" 
     «event ITRMWrte» given «class iTxt»:"cd /vagrant/messaging" 
     «event ITRMWrte» given «class iTxt»:"python2.7 directoryServer.py" 
     delay 1 
    end tell 
    «event ITRMLNCH» given «class Pssn»:"Default Session" 
    tell the last «class Pssn» 
     «event ITRMWrte» given «class iTxt»:"vagrant ssh" 
     «event ITRMWrte» given «class iTxt»:"cd /vagrant/messaging" 
     «event ITRMWrte» given «class iTxt»:"python2.7 iHttp.py" 
     delay 1 
    end tell 
    «event ITRMLNCH» given «class Pssn»:"Default Session" 
    tell the last «class Pssn» 
     «event ITRMWrte» given «class iTxt»:"vagrant ssh" 
     «event ITRMWrte» given «class iTxt»:"cd /vagrant/messaging/src" 
     «event ITRMWrte» given «class iTxt»:"go run wsServer.go" 
    end tell 
end tell 
+0

显示的原始数据像'«class Ptrm»'而不是预期的可读术语表示编译后的脚本与当前应用程序字典不匹配。 – vadian

+0

好吧,那么你有什么想法如何去解决它? –

+0

尝试在当前字典的帮助下找出命令和类并重写脚本。 – vadian

回答

-1

您是否尝试重置计算机的库? 在iTerm中输入以下命令,然后重新编译脚本,看看是否仍然出现此错误。

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user