Windows“FILE:”端口的一个版本,它不提示输入文件名但会自动生成一个

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2691300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:19:38  来源:igfitidea点击:

A version of the Windows "FILE:" port which does not prompt for the file name but autogenerates one

windowsdriverprinting

提问by Thorbj?rn Ravn Andersen

I have a process where one of the things to do is to capture the output from a print into a file for further processing. For this I have configured a "FILE:" printer port which works very nicely but asks everytime for the file name to use.

我有一个过程,其中要做的一件事是将打印的输出捕获到文件中以供进一步处理。为此,我配置了一个“文件:”打印机端口,它工作得很好,但每次都要求使用文件名。

Unfortunately "FILE" is not a very descriptive word when trying to use a search engine :(

不幸的是,在尝试使用搜索引擎时,“文件”并不是一个非常具有描述性的词:(

Is there a small driver somewhere which does exactly the same as the FILE: driver, but can automatically generate a filename (perhaps based on a pattern) and just print to that?

是否有一个小驱动程序与 FILE: 驱动程序完全相同,但可以自动生成文件名(可能基于模式)并打印到该文件名?

回答by Brian THOMAS

Try Multi File Port Monitor. I have it connected to the Ghostscript PDF printer driver (which is just a PostScript driver). When the driver creates PostScript it gets piped into gswin32 which converts it into pdf. Each generated pdf is given a unique name. You could get the behaviour you require by not piping the data to an external program - that way you'll just get the unique file naming.

尝试多文件端口监视器。我将它连接到 Ghostscript PDF 打印机驱动程序(它只是一个 PostScript 驱动程序)。当驱动程序创建 PostScript 时,它会通过管道传输到 gswin32,然后将其转换为 pdf。每个生成的 pdf 都有一个唯一的名称。您可以通过不将数据通过管道传输到外部程序来获得所需的行为 - 这样您就可以获得唯一的文件命名。

Multi File Port Monitor configuration

Multi File Port Monitor configuration

The 1.5.1 release has more options than the earlier version. Here's the configuration dialog for 1.5.1:

1.5.1 版本比早期版本有更多的选项。这是 1.5.1 的配置对话框:

enter image description here

enter image description here

On my machine the User command text box contains this text:

在我的机器上,用户命令文本框包含以下文本:

"C:\Program Files\gs\gs9.21\bin\gswin64c.exe" -dBATCH -dSAFER -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dAutoRotatePages=/PageByPage -r600 -sOutputFile="%f" -

回答by James Newton

On the printer properties, port tab, click "Add Port...", "Local port", "New Port..." and then enter a drive path and filename. e.g. "C:\temp\printjob.prn" then click ok, and ok. If you get access denied, use the "Run as admin..." and then select Properties, etc..

在打印机属性的端口选项卡上,单击“添加端口...”、“本地端口”、“新端口...”,然后输入驱动器路径和文件名。例如“C:\temp\printjob.prn”然后单击确定,然后确定。如果访问被拒绝,请使用“以管理员身份运行...”,然后选择“属性”等。

That will print the job to that specific filename every time. You can rename the result.

每次都会将作业打印到该特定文件名。您可以重命名结果。

Sadly, you can't (apparently) use %TIME% or %RANDOM% to make a unique filename.

遗憾的是,您不能(显然)使用 %TIME% 或 %RANDOM% 来创建唯一的文件名。

回答by Nitin Unni

Use redmon. This is a file port redirector. It is open-source and has quite a lot of options for configuration. - http://pages.cs.wisc.edu/~ghost/redmon/

使用红魔。这是一个文件端口重定向器。它是开源的,有很多配置选项。- http://pages.cs.wisc.edu/~ghost/redmon/

The website says it is currently available only for Win XP so if that is your OS you are in luck.

该网站说它目前仅适用于 Win XP,因此如果这是您的操作系统,那么您很幸运。

Let me know if you need more help

如果您需要更多帮助,请告诉我

Hope this is useful. If so +1 :)

希望这是有用的。如果是这样+1 :)