Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #2319 > unrolled thread
| Started by | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| First post | 2015-08-15 02:55 -0700 |
| Last post | 2015-12-14 07:05 -0800 |
| Articles | 12 — 3 participants |
Back to article view | Back to comp.lang.postscript
Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-15 02:55 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? ken <ken@spamcop.net> - 2015-08-15 12:11 +0100
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-15 04:36 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-15 06:22 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-15 11:24 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-15 11:26 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2015-08-15 11:23 -0600
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-15 14:38 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-08-16 04:58 -0700
Re: Can PostScript access the machine clock, expressed as a date and time? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2015-08-16 10:29 -0600
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-12-08 06:13 -0800
Re: Can PostScript access the machine clock, expressed as a date and time? jdaw1 <jdawiseman@gmail.com> - 2015-12-14 07:05 -0800
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-15 02:55 -0700 |
| Subject | Can PostScript access the machine clock, expressed as a date and time? |
| Message-ID | <13dc49a5-e8f7-4609-a2ab-7e3a186abc3d@googlegroups.com> |
A PostScript file is written, and later distilled. I'd like the output to include the date and time of distillation. Can PostScript access the machine clock, expressed as a date and time? I'm not stressed whether local or GMT, but want at least one of them? Please, is it possible, and if so, how? The question applies to both Adobe Distiller and Ghostscript: a solution that works in one is better than no solution.
[toc] | [next] | [standalone]
| From | ken <ken@spamcop.net> |
|---|---|
| Date | 2015-08-15 12:11 +0100 |
| Message-ID | <MPG.30392ed7af4b66f3989900@usenet.plus.net> |
| In reply to | #2319 |
In article <13dc49a5-e8f7-4609-a2ab-7e3a186abc3d@googlegroups.com>, jdawiseman@gmail.com says... > > A PostScript file is written, and later distilled. I'd like the output to include the date and time of distillation. Can PostScript access the machine clock, expressed as a date and time? I'm not stressed whether local or GMT, but want at least one of them? > > Please, is it possible, and if so, how? > > The question applies to both Adobe Distiller and Ghostscript: a solution that works in one is better than no solution. The %calendar% device, if implemented, might work, I don't recall what exactly it returns. However Since PostScript was originally intended for use on laser priners, the basic asnwer is no. NB when creating a PDF file, both Ghostscript and Distiller already put the creation date and time in the PDF file, so the information is already present in the PDF file. Did you want it actually stamped on the pages of the PDF ? Ken
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-15 04:36 -0700 |
| Message-ID | <45e5cf66-0a9f-4399-9e9b-244baffa8f28@googlegroups.com> |
| In reply to | #2320 |
Thank you. I'll investigate the %calendar% device. > Did you want it actually stamped on the pages of the PDF ? Yes. My output, e.g., that at http://www.jdawiseman.com/2015/20150509_1945.pdf already has a line saying > Version of placemat program code = D:201505062230 = 22:30 Wed 06 May 2015 derived from a constant in the code > /CreationDateAdobeFormat (D:201505062230) def I'd like to add a similar line of the form "Distilled ...", where the ellipsis is the time and date.
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-15 06:22 -0700 |
| Message-ID | <b042a9d3-5855-4397-a993-4c18a87e32e9@googlegroups.com> |
| In reply to | #2321 |
Thank you for suggesting %Calendar%, but I'm not quite winning with it. It is absent from Adobe Distiller XI (tut tut), so let's ignore that. So to GPL Ghostscript 9.15 (2014-09-22). PostScript code follows:
%!PS
(--- ... /IODevice resourceforall) () = =
/Resources [
(*) {cvn 255 string cvs dup =} 255 string /IODevice resourceforall
] def
Resources ==
/ResourceNumber 6 def
Resources ResourceNumber get ==
count 0 ne {(+pstack 10) = pstack (-pstack 10) =} if
(--- ... /IODevice findresource) () = =
Resources ResourceNumber get /IODevice findresource
dup type ==
dup ==
{count {==} repeat} forall
count 0 ne {(+pstack 20) = pstack (-pstack 20) =} if
which outputs
--- ... /IODevice resourceforall
%rom%
%stdin%
%stderr%
%statementedit%
%os%
%ram%
%Calendar%
%stdout%
%lineedit%
%pipe%
%null%
[(%rom%) (%stdin%) (%stderr%) (%statementedit%) (%os%) (%ram%) (%Calendar%) (%stdout%) (%lineedit%) (%pipe%) (%null%)]
(%Calendar%)
--- ... /IODevice findresource
stringtype
(%Calendar%)
37
67
97
108
101
110
100
97
114
37
Progress: resource (%Calendar%) exists. But how do I access it? It seems that findresource returns just that string. Please sir?
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-15 11:24 -0700 |
| Message-ID | <b5109e1b-634e-4764-9f4c-61f18960b32d@googlegroups.com> |
| In reply to | #2322 |
Actually, you have given me enough clues to find https://en.wikibooks.org/wiki/PostScript_FAQ#How_to_get_date_and_time Job done. Thank you.
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-15 11:26 -0700 |
| Message-ID | <e6b8998c-b1a5-4b73-ba73-2bf29ff25bbb@googlegroups.com> |
| In reply to | #2323 |
On Saturday, 15 August 2015 19:24:29 UTC+1, jdaw1 wrote: > Actually, you have given me enough clues to find > https://en.wikibooks.org/wiki/PostScript_FAQ#How_to_get_date_and_time > > Job done. Thank you. Link fix: https://en.wikibooks.org/wiki/PostScript_FAQ#How_to_get_date_and_time.3F
[toc] | [prev] | [next] | [standalone]
| From | Martin Leese <please@see.Web.for.e-mail.INVALID> |
|---|---|
| Date | 2015-08-15 11:23 -0600 |
| Message-ID | <mqnser$1e8$1@dont-email.me> |
| In reply to | #2319 |
jdaw1 wrote: > A PostScript file is written, and later distilled. I'd like the output to include the date and time of distillation. Can PostScript access the machine clock, expressed as a date and time? I'm not stressed whether local or GMT, but want at least one of them? > > Please, is it possible, and if so, how? > > The question applies to both Adobe Distiller and Ghostscript: a solution that works in one is better than no solution. Visit: https://en.wikibooks.org/wiki/PostScript_FAQ#How_to_get_date_and_time.3F This illustrates how to use the %Calendar% resource (as suggested by ken). This link also points to PostScript Language Reference Manual version 2012 supplement (1992), in which %Calendar% is defined. Note that %Calendar% is not mentioned in PostScript LANGUAGE REFERENCE third edition (1999). It is therefore pot luck whether it is supported on a particular printer/interpreter. It seems to be associated with a Fax device. -- Regards, Martin Leese E-mail: please@see.Web.for.e-mail.INVALID Web: http://members.tripod.com/martin_leese/
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-15 14:38 -0700 |
| Message-ID | <9024b035-1c79-48b7-9348-41a11f1a174b@googlegroups.com> |
| In reply to | #2325 |
On Saturday, 15 August 2015 20:21:47 UTC+1, Martin Leese wrote:
> pot luck whether it
> is supported on a particular
> printer/interpreter.
Adobe Distiller XI, no; GPL Ghostscript 9.15 (2014-09-22), yes.
My code is now:
/MonthNames [(Jan) (Feb) (March) (April) (May) (June) (July) (Aug) (Sep) (Oct) (Nov) (Dec)] def
(%Calendar%) /IODevice resourcestatus
{
pop pop (%Calendar%) currentdevparams
begin
Running
{
mark (Distilled ) Hour (:) Minute ( )
[(Sun) (Mon) (Tue) (Wed) (Thu) (Fri) (Sat)] Weekday get ( )
Day 2 string cvs dup length 1 le {(0) exch} if
( ) MonthNames Month 1 sub get ( ) Year
(, according to the clock of the computer running the distillation application.)
ConcatenateToMark OutputToLog
} if % Running
end
} if % ... resourcestatus
In which 'ConcatenateToMark' and 'OutputToLog' do what they say, the former automatically cvs'ing non-strings.
Comment and correction would be welcomed.
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-08-16 04:58 -0700 |
| Message-ID | <f0d8abee-1ba2-4104-a553-0995566aa0d2@googlegroups.com> |
| In reply to | #2326 |
Code improved to make hour and minutes two-digit:
/MonthNames [(Jan) (Feb) (March) (April) (May) (June) (July) (Aug) (Sep) (Oct) (Nov) (Dec)] def
(\%Calendar\%) /IODevice resourcestatus
{
pop pop (\%Calendar\%) currentdevparams
begin
Running
{
mark (Distilled ) Hour 2 string cvs dup length 1 le {(0) exch} if
(:) Minute 2 string cvs dup length 1 le {(0) exch} if ( )
[(Sun) (Mon) (Tue) (Wed) (Thu) (Fri) (Sat)] Weekday get ( )
Day 2 string cvs dup length 1 le {(0) exch} if ( )
MonthNames Month 1 sub get ( ) Year
(, according to the clock of the computer running the distillation application.)
ConcatenateToMark OutputToLog
} if % Running
end
} if % ... resourcestatus
Is there any way to use 'run' on Mac Distiller as an alternative?
[toc] | [prev] | [next] | [standalone]
| From | Martin Leese <please@see.Web.for.e-mail.INVALID> |
|---|---|
| Date | 2015-08-16 10:29 -0600 |
| Message-ID | <mqqdln$ouu$1@dont-email.me> |
| In reply to | #2327 |
jdaw1 wrote: ... > Is there any way to use 'run' on Mac Distiller as an alternative? As run is similar to exec, and as exec just executes a PostScript object, I don't see how. Adobe Distiller XI does not have %Calendar%, so you cannot do this using only PostScript. However, you might be able to access an operating system command from within PostScript, as described later (using a named pipe) in the PostScript FAQ section referenced. (I do not run a Mac, so cannot help further.) -- Regards, Martin Leese E-mail: please@see.Web.for.e-mail.INVALID Web: http://members.tripod.com/martin_leese/
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-12-08 06:13 -0800 |
| Message-ID | <94564422-79bb-4e5f-aef5-a837b32076e4@googlegroups.com> |
| In reply to | #2327 |
I'm going to make an Adobe feature request for this. Are there any particulars that folks think should be in the request?
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2015-12-14 07:05 -0800 |
| Message-ID | <22bb950a-788b-4d7a-be3c-8f9614c53816@googlegroups.com> |
| In reply to | #2402 |
The following has been submitted: Brief title for your desired feature: IODevice resource %Calendar%: implemented in Ghostscript, not in Adobe Distiller The Adobe PostScript 3 Version 3010 and 3011 Product Supplement https://partners.adobe.com/public/developer/en/ps/PS3010and3011.Supplement.pdf mentions on page 74 the IODevice resource %Calendar%. %Calendar% is implemented in Ghostscript, but not in Adobe Distiller. Please could %Calendar% be implemented in Adobe Distiller. Also see https://groups.google.com/forum/#!topic/comp.lang.postscript/UAkMrNLakKs
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web