2013-02-03 13 views
2

我试图自动化一些硬打印。打印文档的多个副本Applescripting a printer's app

我已经可以打印访问打印机的应用这样一个文件的一个副本:

tell application "hp LaserJet 2300 series (BDB806)" --my printer's app, could be any other model 
    print myFile 
end tell 

这段代码工作。

但是,当我尝试打印多个副本时,它变得棘手。根据打印机的应用词典,我应该可以通过这样做来实现它:

tell application "hp LaserJet 2300 series (BDB806)" 
    print myFile with properties {copies:n} -- n being an integer 
end tell 

但是这不起作用。

请让我知道我做错了什么。

回答

0

发生在相同的给我这个代码:

set d to ((path to home folder) as string) & "Desktop:" & "untitled.txt" 
set n to 3 
tell application "EPSON WP-4595 Series" 
    print d with properties {copies:n} 
end tell 

只打印一份。

据我知道没有什么是错的代码,或许真的是错误的使用AppleScript ..

不是很优雅,但你总是可以做

... 
    repeat n times 
     print d 
    end repeat 
+0

@保罗感谢,可能是一个错误然后在AppleScript中,我已经阅读了有关'{copies:n}'参数的类似问题。我曾使用过重复声明作为未完成的解决方案。问题在于打印大量副本的速度很慢,因为打印机将每个副本作为单独的作业。 – Guillaume

+0

您还可以使用它的应用程序打开文档,并执行一些GUI脚本来打开打印对话框,设置副本,打印。但这是一个非常糟糕的做法。 – Paolo