Applescript更改?
我在工作时升级的iMac上的applescript有问题,如下所示,它停在:Applescript更改?,applescript,Applescript,我在工作时升级的iMac上的applescript有问题,如下所示,它停在: error number -1719 from text field 1 of window 1 of process "QuarkXPress" 我正在尝试运行的完整脚本: try tell application "FileMaker Pro Advanced" --tell database "artdb_Client" set theRecord to current
error number -1719 from text field 1 of window 1 of process "QuarkXPress"
我正在尝试运行的完整脚本:
try
tell application "FileMaker Pro Advanced"
--tell database "artdb_Client"
set theRecord to current record of database "artdb_Client"
tell theRecord
set theCustomer to item 4
set theCustomerName to item 5
set theFileName to item 2
end tell
--end tell
end tell
tell application "QuarkXPress"
activate
display dialog ¬
theCustomer & " - " & theCustomerName default answer theCustomer buttons {"Cancel", "OK"} default button 2 ¬
with title "Enter the Customer Code for Job"
(*
display dialog ¬
theCustomer & " - " & theCustomerName & ¬
"?" with title "Export PDF for Customer"
*)
end tell
set theFolder to "Data HD:Proofs:" & theCustomer
set theFolderOfPosix to "/volumes/Data HD/Proofs/" & theCustomer
set this_item to theFolder & ":" & theFileName & ".pdf"
set theProofsDir to "Data HD:Proofs:" as alias
tell application "System Events"
tell process "QuarkXPress"
tell menu bar 1
tell menu bar item "File"
tell menu "File"
tell menu item "Export"
tell menu "Export"
click menu item "Layout as PDF..."
delay 1
end tell
end tell
end tell
end tell
end tell
end tell
repeat 5 times
tell process "QuarkXPress"
if window "Export as PDF" exists then
keystroke "G" using command down
set value of text field 1 of window 1 to theFolderOfPosix & "/"
keystroke return
click button "Go" of window 1
exit repeat
else
delay 1
end if
end tell
delay 1
end repeat
end tell
end try
您需要在“系统首选项”的“安全”窗格中为.app设置UI脚本(辅助功能支持)。这里有一篇关于它如何工作的好文章:。也就是说,它描述了使ui脚本工作所需的步骤。
HTH我终于让它工作了,脚本停止了(没有将调用的数据放入): 将窗口1的文本字段1的值设置为FOLDEROFPOSIX&“/” 我把它改成: 将窗口2第1页的文本字段1的值设置为FOLDEROFPOSIX&“/”
感谢用户界面浏览器向我显示了我丢失的“sheet”字段,它看起来不正确,但它能完成任务,所以我想这就是最重要的。我可能会补充说,这个脚本在旧的PowerPC G5上运行良好,但在新的iMac上不起作用。是的,我已经更改了,这是旧mac上的原始脚本。不好,虽然我只理解了你写的前半部分。看来我的可访问性中没有“系统事件”。希望你知道如何找到它:我相信它位于/System/Library/CoreServices中。然后在解锁窗格后将其拖动到该窗格中。:)您还希望将Quark Express拖动到同一窗格中,因为如果没有Quark Express,脚本将无法工作@Zero:非常感谢,我已经稍微编辑了我的答案。脚本实际上是从Filemaker运行的,我在applescript中解决脚本问题,因为它为我提供了更多关于正在发生的事情的反馈,我已经将Quark添加到可访问性中,不确定是否有人问我添加系统事件,我在工作的空闲时间已经做了几个月了,谢谢你的帮助,我会尝试在CoreServices中查找,以便添加它。你可能还应该添加Filemaker Pro.Hello。我没有夸克,所以我帮不了你。我认为您有开发人员工具,所以您可以使用UI元素检查器来双重检查您是否处理了正确的元素?这是GUI脚本的主要缺点。当目标应用程序的GUI发生更改时,您必须随时重写。即使在小的更新之后,甚至当GUI看起来没有更改时,也可能发生这种情况。