Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #575 > unrolled thread

getting system information from a PS program

Started byMichael Unger <spam.to.unger@spamgourmet.com>
First post2012-01-19 19:01 +0100
Last post2012-01-23 17:31 +0100
Articles 20 on this page of 23 — 8 participants

Back to article view | Back to comp.lang.postscript


Contents

  getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-19 19:01 +0100
    Re: getting system information from a PS program SaGS <sags5495@gmail.com> - 2012-01-19 11:05 -0800
      Re: getting system information from a PS program SaGS <sags5495@gmail.com> - 2012-01-21 07:03 -0800
        Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-23 17:16 +0100
          Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-24 17:33 +0100
            Re: getting system information from a PS program Odysseus <odysseus1479-at@yahoo-dot.ca> - 2012-01-24 18:10 -0700
              Re: getting system information from a PS program tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-01-25 04:57 -0500
              Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-25 17:39 +0100
                Re: getting system information from a PS program Helge Blischke <h.blischke@acm.org> - 2012-01-25 18:08 +0100
                  Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-26 17:52 +0100
                Re: getting system information from a PS program SaGS <sags5495@gmail.com> - 2012-01-25 11:27 -0800
                  Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-26 17:55 +0100
            Re: getting system information from a PS program Marc Olschok <nobody@nowhere.invalid> - 2012-01-25 20:07 +0000
              Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-26 17:57 +0100
                Re: getting system information from a PS program Marc Olschok <nobody@nowhere.invalid> - 2012-02-02 15:46 +0000
                  Re: getting system information from a PS program Helge Blischke <h.blischke@acm.org> - 2012-02-02 18:16 +0100
                  Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-02-02 21:52 +0100
                    Re: getting system information from a PS program luser- -droog <mijoryx@yahoo.com> - 2012-02-04 20:15 -0800
      Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-23 17:26 +0100
        Re: getting system information from a PS program SaGS <sags5495@gmail.com> - 2012-01-23 12:18 -0800
          Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-24 17:46 +0100
    Re: getting system information from a PS program bonomi@host122.r-bonomi.com (Robert Bonomi) - 2012-01-23 03:26 -0600
      Re: getting system information from a PS program Michael Unger <spam.to.unger@spamgourmet.com> - 2012-01-23 17:31 +0100

Page 1 of 2  [1] 2  Next page →


#575 — getting system information from a PS program

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-19 19:01 +0100
Subjectgetting system information from a PS program
Message-ID<9nr4ecF33kU1@mid.individual.net>
I'd like to get some system information from within a PostScript program.

(1) The name of the PostScript program currently being executed; "file"
and "currentfile" do return an _object_ instead of a simple file _name_.

(2) A reasonable system timestamp, i.e. a combination of system date and
time; "realtime" and "usertime" don't seem to be of any use here.

I want to print this information as a decent comment onto each page
generated by the program.

(3) An array filled with file names, the full path and a template for
the file names are known; "filenameforall" doesn't help much because
there are many parameters depending on parts of the file name and a
specific order has to be observed as well.

(4) Getting an array sorted (ASCII, ascending). I didn't find any
PostScript operator related to this issue at all.

Michael


PS: I'm running "Adobe Acrobat 6 Standard" on Windows XP (both a bit
"dated" now I'll have to admit); I'm right-clicking on the PS file and
then selecting "convert to a PDF document" (or rather similar, I'm using
a german language system) from the context menu and thereby invoking
Adobe's Distiller. Usual disclaimer: If I didn't mis-understand the
explanations given in the "PostScript Language Reference Manual" (3rd
edition) ...

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [next] | [standalone]


#576

FromSaGS <sags5495@gmail.com>
Date2012-01-19 11:05 -0800
Message-ID<e4492ec2-24b1-4b44-891d-50433e89bce8@u2g2000vbe.googlegroups.com>
In reply to#575
On Jan 19, 8:01 pm, Michael Unger <spam.to.un...@spamgourmet.com>
wrote:
> ...
> (1) The name of the PostScript program currently being executed; "file"
> and "currentfile" do return an _object_ instead of a simple file _name_.

I cannot think of a way to do this.

The PS interpreter input is actually a stream of bytes; not always a
physical file on disk, the bytes could come from communication port
(serial/ parallel/ network) or it could be a string, a fragment of
another stream (‘subfile’), etc.

> (2) A reasonable system timestamp, i.e. a combination of system date and
> time; "realtime" and "usertime" don't seem to be of any use here.

If you have a writable filesystem, try a combination of creating a
temporary file then using ‘(FILENAME) status’ on it. Not widely
portable; you’ll have to figure out, for the particular interpreter
you use, how are the dates/ times encoded.

> ...
> (3) An array filled with file names, the full path and a template for
> the file names are known; "filenameforall" doesn't help much because
> there are many parameters depending on parts of the file name and a
> specific order has to be observed as well.

Do a ‘filenameforall’ then post-process the file list you obtain. For
example you can use string operators on the filenames to examine them
and do supplemental filtering (if a filenameforall template does not
exactly suit what you want to select), or sort the list.

> ...
> (4) Getting an array sorted (ASCII, ascending). I didn't find any
> PostScript operator related to this issue at all.

There is no such operator, but you can write a procedure to do the
job :)
See, for example, http://en.wikibooks.org/wiki/PostScript_FAQ#How_to_sort_an_array.3F

> ...

[toc] | [prev] | [next] | [standalone]


#577

FromSaGS <sags5495@gmail.com>
Date2012-01-21 07:03 -0800
Message-ID<7c274e80-d66c-4b27-aa13-2637afe05e9f@cf6g2000vbb.googlegroups.com>
In reply to#576
> On Jan 19, 8:01 pm, Michael Unger <spam.to.un...@spamgourmet.com>
> wrote:
> ...
> > (2) A reasonable system timestamp, i.e. a combination of system date and
> > time; "realtime" and "usertime" don't seem to be of any use here.
>
> If you have a writable filesystem, try a combination of creating a
> temporary file then using ‘(FILENAME) status’ on it.
> ...

A much better way, if implemented in the interpreter you use:

    (%Calendar%) currentdevparams

This returns the current date/ time in a dictionary. See PDF page 68
in the ‘PostScript Language Reference Supplement for Version 3010 and
3011’, available from http://www.adobe.com/devnet/postscript.html .

[toc] | [prev] | [next] | [standalone]


#580

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-23 17:16 +0100
Message-ID<9o5gj6Fg78U1@mid.individual.net>
In reply to#577
On 2012-01-21 16:03, "SaGS" wrote:

>> On Jan 19, 8:01 pm, Michael Unger <spam.to.un...@spamgourmet.com>
>> wrote:
>> ...
>> > (2) A reasonable system timestamp, i.e. a combination of system date and
>> > time; "realtime" and "usertime" don't seem to be of any use here.
>>
>> If you have a writable filesystem, try a combination of creating a
>> temporary file then using ‘(FILENAME) status’ on it.
>> ...
> 
> A much better way, if implemented in the interpreter you use:

I'm using Adobe "Acrobat 6 Standard" -- admittedly rather "dated" but
still usable for what I need to get done.

>     (%Calendar%) currentdevparams
> 
> This returns the current date/ time in a dictionary. See PDF page 68
> in the ‘PostScript Language Reference Supplement for Version 3010 and
                                        ^^^^^^^^^^
> 3011’, available from http://www.adobe.com/devnet/postscript.html .

Obviously I missed the "Supplement" completely in the past.

The Distiller version is 3015.102, revision 0, according to the
"version" and "revision" operators; so this function should be
supported. That seems to be the most straight-forward approach because
the parameters Y, M, D, h, m and s are returned as separate values. Thanks.

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#584

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-24 17:33 +0100
Message-ID<9o87h2F8tgU1@mid.individual.net>
In reply to#580
On 2012-01-23 17:16, "Michael Unger" wrote:

> On 2012-01-21 16:03, "SaGS" wrote:
> 
>>> ...
>> 
>> A much better way, if implemented in the interpreter you use:
> 
> I'm using Adobe "Acrobat 6 Standard" -- admittedly rather "dated" but
> still usable for what I need to get done.
> 
>>     (%Calendar%) currentdevparams
>> 
>> This returns the current date/ time in a dictionary. [...]
> 
> Obviously I missed the "Supplement" completely in the past.
> 
> The Distiller version is 3015.102, revision 0, according to the
> "version" and "revision" operators; so this function should be
> supported. [...]

No luck so far, apparently Adobe's Distiller doesn't have a "calender
device":

|  %Calender% currentdevparams
|  copy /Year load 4 string cvs show

resulting in

|  %%[ Error: stackunderflow; OffendingCommand: copy ]%%

and

|  (%Calender%) currentdevparams
|  copy /Year load 4 string cvs show

resulting in

|  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
|
|  Stack:
|  (%Calender%)

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#586

FromOdysseus <odysseus1479-at@yahoo-dot.ca>
Date2012-01-24 18:10 -0700
Message-ID<odysseus1479-at-6CB08F.18105324012012@news.eternal-september.org>
In reply to#584
In article <9o87h2F8tgU1@mid.individual.net>,
 Michael Unger <spam.to.unger@spamgourmet.com> wrote:

<snip>

> |  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
> |
> |  Stack:
> |  (%Calender%)

Check your spelling of "calendar", maybe.

-- 
Odysseus

[toc] | [prev] | [next] | [standalone]


#587

Fromtlvp <mPiOsUcB.EtLlLvEp@att.net>
Date2012-01-25 04:57 -0500
Message-ID<h3ykhudlsns5.1ryzuob0r1otg.dlg@40tude.net>
In reply to#586
On Tue, 24 Jan 2012 18:10:53 -0700, Odysseus wrote:

> In article <9o87h2F8tgU1@mid.individual.net>,
>  Michael Unger <spam.to.unger@spamgourmet.com> wrote:
> 
> <snip>
> 
>>|  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
>>|
>>|  Stack:
>>|  (%Calender%)
> 
> Check your spelling of "calendar", maybe.

Good catch, there, Odysseus: sharp eyes :-) . Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.

[toc] | [prev] | [next] | [standalone]


#590

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-25 17:39 +0100
Message-ID<9oapr0Fr8sU1@mid.individual.net>
In reply to#586
On 2012-01-25 02:10, "Odysseus" wrote:

> In article <9o87h2F8tgU1@mid.individual.net>,
>  Michael Unger <spam.to.unger@spamgourmet.com> wrote:
> 
> <snip>
> 
>> |  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
>> |
>> |  Stack:
>> |  (%Calender%)
> 
> Check your spelling of "calendar", maybe.

Grrr. You are right of course -- but it doesn't make any difference at
all. Whether used with parantheses or without, whether used witn a
capital "C" or with a lower case "c", the error messages are the very same.

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#591

FromHelge Blischke <h.blischke@acm.org>
Date2012-01-25 18:08 +0100
Message-ID<9oar8hF5atU1@mid.individual.net>
In reply to#590
Michael Unger wrote:

> On 2012-01-25 02:10, "Odysseus" wrote:
> 
>> In article <9o87h2F8tgU1@mid.individual.net>,
>>  Michael Unger <spam.to.unger@spamgourmet.com> wrote:
>> 
>> <snip>
>> 
>>> |  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
>>> |
>>> |  Stack:
>>> |  (%Calender%)
>> 
>> Check your spelling of "calendar", maybe.
> 
> Grrr. You are right of course -- but it doesn't make any difference at
> all. Whether used with parantheses or without, whether used witn a
> capital "C" or with a lower case "c", the error messages are the very
> same.
> 
> Michael
> 

To check if the Calendar device is implemented in distiller, try

(*){==}32 string /IODevice resourceforall

and look at the output for the listed devices. FYI, Ghostscript (version 
9.02) lists the following:

(%statementedit%)
(%os%)
(%rom%)
(%Calendar%)
(%stdout%)
(%lineedit%)
(%pipe%)
(%null%)
(%stdin%)
(%stderr%)


Helge

[toc] | [prev] | [next] | [standalone]


#595

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-26 17:52 +0100
Message-ID<9odf8bFuk1U1@mid.individual.net>
In reply to#591
On 2012-01-25 18:08, "Helge Blischke" wrote:

> To check if the Calendar device is implemented in distiller, try
> 
> (*){==}32 string /IODevice resourceforall
> 
> and look at the output for the listed devices. [...]

The list of devices is rather short:

|  PS>(*){==}32 string /IODevice resourceforall
|  (%hostfont%)
|  (%Distillery%)
|  (%os%)
|  (%fontset%)
|  (%cid%)
|  (%ram%)
|  PS>

So definitely there is no "calendar" device implemented within the
version of Distiller I'm running (Distiller 6.0.1 ake version 3015.102,
revision 0, as reported by "version" and "revision" commands).

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#592

FromSaGS <sags5495@gmail.com>
Date2012-01-25 11:27 -0800
Message-ID<a55b6a92-918a-44e4-9816-42f6ef6283f8@y10g2000vbn.googlegroups.com>
In reply to#590
On Jan 25, 6:39 pm, Michael Unger <spam.to.un...@spamgourmet.com>
wrote:
> ...
>>> |  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
>>> |
>>> |  Stack:
>>> |  (%Calender%)
>
>> Check your spelling of "calendar", maybe.
>
> Grrr. You are right of course -- but it doesn't make any difference at
> all.

I only had at hand an install of Acrobat Distiller (*gulp*) 4.05 to
check, and this version indeed does not implement the %Calendar%
device. (In another reply, Helge Blischke already wrote how to find
out if %Calendar% is available or not.)

The other method I mentioned, using the timestamp of a temp file,
worked. From my experiments, the ‘status’ operator - for this version
of Distiller, running on Win98SE - returns the ‘last modified [not
creation] time’ as the number of seconds elapsed since 1970/01/01
00:00:00 UTC+00:00. So you will have to do some calendar + timezone +
DST calculations.

> Whether used with parantheses or without, whether used witn a
> capital "C" or with a lower case "c", the error messages are the very same.

... and with ‘a’ not ‘e’ : %Calend>>a<<r%.

[toc] | [prev] | [next] | [standalone]


#596

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-26 17:55 +0100
Message-ID<9odf8dFuk1U3@mid.individual.net>
In reply to#592
On 2012-01-25 20:27, "SaGS" wrote:

> I only had at hand an install of Acrobat Distiller (*gulp*) 4.05 to
> check, and this version indeed does not implement the %Calendar%
> device. (In another reply, Helge Blischke already wrote how to find
> out if %Calendar% is available or not.)

Definitely no luck at all, there is _no_ %Calendar% device available --
see my reply to Helge's posting for details.

> The other method I mentioned, using the timestamp of a temp file,
> worked. From my experiments, the ‘status’ operator - for this version
> of Distiller, running on Win98SE - returns the ‘last modified [not
> creation] time’ as the number of seconds elapsed since 1970/01/01
> 00:00:00 UTC+00:00. So you will have to do some calendar + timezone +
> DST calculations.

That's way too much work for the intended purpose. Distiller fills in
the "creation" and "modification" fields in the PDF metadata giving
start and end date/time of the creation process. That has to be
sufficient now.

> [...]

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#593

FromMarc Olschok <nobody@nowhere.invalid>
Date2012-01-25 20:07 +0000
Message-ID<jfpnei$8te$1@news.albasani.net>
In reply to#584
Michael Unger <spam.to.unger@spamgourmet.com> wrote:
> On 2012-01-23 17:16, "Michael Unger" wrote:
> 
> > On 2012-01-21 16:03, "SaGS" wrote:
> > 
> >>> ...
> >> 
> >> A much better way, if implemented in the interpreter you use:
> > 
> > I'm using Adobe "Acrobat 6 Standard" -- admittedly rather "dated" but
> > still usable for what I need to get done.
> > 
> >>     (%Calendar%) currentdevparams
> >> 
> >> This returns the current date/ time in a dictionary. [...]
> > 
> > Obviously I missed the "Supplement" completely in the past.
> > 
> > The Distiller version is 3015.102, revision 0, according to the
> > "version" and "revision" operators; so this function should be
> > supported. [...]
> 
> No luck so far, apparently Adobe's Distiller doesn't have a "calender
> device":
> 
> |  %Calender% currentdevparams
> |  copy /Year load 4 string cvs show
> 
> resulting in
> 
> |  %%[ Error: stackunderflow; OffendingCommand: copy ]%%

The % comments out the rest of the first line. Copy expects two arguments
on the stack, which are missing.
> 
> and
> 
-------------v--------------
> |  (%Calender%) currentdevparams
> |  copy /Year load 4 string cvs show
> 
> resulting in
> 
> |  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
> |
> |  Stack:
> |  (%Calender%)
_____________^________

Wenn man deutsche Schreibung gewöhnt ist, sind solche Tippfehler zuweilen
vorprogrammiert.

(%Calendar%) currentdevparams
/Year get 4 string cvs show

should do what you want

-- 
Marc

[toc] | [prev] | [next] | [standalone]


#597

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-26 17:57 +0100
Message-ID<9odf8eFuk1U4@mid.individual.net>
In reply to#593
On 2012-01-25 21:07, "Marc Olschok" wrote:

> Michael Unger <spam.to.unger@spamgourmet.com> wrote:
> 
> [...]
> 
> -------------v--------------
>> |  (%Calender%) currentdevparams
>> |  copy /Year load 4 string cvs show
>> 
>> resulting in
>> 
>> |  %%[ Error: undefined; OffendingCommand: currentdevparams ]%%
>> |
>> |  Stack:
>> |  (%Calender%)
> _____________^________
> 
> Wenn man deutsche Schreibung gewöhnt ist, sind solche Tippfehler zuweilen
> vorprogrammiert.

Richtig; und man sollte nicht nebenbei an ganz andere Dinge denken ...

> (%Calendar%) currentdevparams
> /Year get 4 string cvs show
> 
> should do what you want

It doesn't because there is no "calendar device" available. See my reply
to Helge's posting.

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#606

FromMarc Olschok <nobody@nowhere.invalid>
Date2012-02-02 15:46 +0000
Message-ID<jgeb4i$46s$1@news.albasani.net>
In reply to#597
Michael Unger <spam.to.unger@spamgourmet.com> wrote:
> On 2012-01-25 21:07, "Marc Olschok" wrote:
>[...] 
> > (%Calendar%) currentdevparams
> > /Year get 4 string cvs show
> > 
> > should do what you want
> 
> It doesn't because there is no "calendar device" available. See my reply
> to Helge's posting.

I see. Ghostscript under Linux actually uses the time/2 system call for this
and recently I had the chance to try it on Windows and it works also there.
Can you provide (String) parameters to the program you use, similar to
e.g.   gs -sDate="`date`"  from the commandline? This would provide some
workaround. 

-- 
Marc

[toc] | [prev] | [next] | [standalone]


#607

FromHelge Blischke <h.blischke@acm.org>
Date2012-02-02 18:16 +0100
Message-ID<9ovuoaF758U1@mid.individual.net>
In reply to#606
Marc Olschok wrote:

> Michael Unger <spam.to.unger@spamgourmet.com> wrote:
>> On 2012-01-25 21:07, "Marc Olschok" wrote:
>>[...]
>> > (%Calendar%) currentdevparams
>> > /Year get 4 string cvs show
>> > 
>> > should do what you want
>> 
>> It doesn't because there is no "calendar device" available. See my reply
>> to Helge's posting.
> 
> I see. Ghostscript under Linux actually uses the time/2 system call for
> this and recently I had the chance to try it on Windows and it works also
> there. Can you provide (String) parameters to the program you use, similar
> to
> e.g.   gs -sDate="`date`"  from the commandline? This would provide some
> workaround.
> 

Yes, that works, at least with Ghostscript:

gs -dNODISPLAY -sDate="`date`"
GPL Ghostscript 9.02 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>Date == flush
(Do  2 Feb 2012 18:16:21 CET)
GS>


Helge

[toc] | [prev] | [next] | [standalone]


#608

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-02-02 21:52 +0100
Message-ID<9p0gaeFjgjU1@mid.individual.net>
In reply to#606
On 2012-02-02 16:46, "Marc Olschok" wrote:

> [...]
> Can you provide (String) parameters to the program you use, similar to
> e.g.   gs -sDate="`date`"  from the commandline? This would provide some
> workaround. 

I'm using Adobe's Distiller (from the Acrobat package, Windows 2000/XP)
just by invocing it from the context menu selecting "convert to PDF
document" (or similar; I'm using the German version of Acrobat 6
Standard) so there isn't any command line option available -- at least
no documented option I'm aware of.

Michael

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#615

Fromluser- -droog <mijoryx@yahoo.com>
Date2012-02-04 20:15 -0800
Message-ID<438229c6-a0e0-4edf-acdd-eb5fbe56965c@n6g2000vbz.googlegroups.com>
In reply to#608
On Feb 2, 2:52 pm, Michael Unger <spam.to.un...@spamgourmet.com>
wrote:
> On 2012-02-02 16:46, "Marc Olschok" wrote:
>
> > [...]
> > Can you provide (String) parameters to the program you use, similar to
> > e.g.   gs -sDate="`date`"  from the commandline? This would provide some
> > workaround.
>
> I'm using Adobe's Distiller (from the Acrobat package, Windows 2000/XP)
> just by invocing it from the context menu selecting "convert to PDF
> document" (or similar; I'm using the German version of Acrobat 6
> Standard) so there isn't any command line option available -- at least
> no documented option I'm aware of.
>

There IS a command-line! I don't know where to look for it anymore;
but the context-menu options are part of the File Association
mechanism. Each context-menu action runs a specific command.
It's got to be somewhere in the Explorer Options (or
Properties, or whatever they call it now).

[toc] | [prev] | [next] | [standalone]


#581

FromMichael Unger <spam.to.unger@spamgourmet.com>
Date2012-01-23 17:26 +0100
Message-ID<9o5gj7Fg78U2@mid.individual.net>
In reply to#576
On 2012-01-19 20:05, "SaGS" wrote:

> On Jan 19, 8:01 pm, Michael Unger <spam.to.un...@spamgourmet.com>
> wrote:
> 
> [...]
> 
>> (3) An array filled with file names, the full path and a template for
>> the file names are known; "filenameforall" doesn't help much because
>> there are many parameters depending on parts of the file name and a
>> specific order has to be observed as well.
> 
> Do a ‘filenameforall’ then post-process the file list you obtain. For
> example you can use string operators on the filenames to examine them
> and do supplemental filtering (if a filenameforall template does not
> exactly suit what you want to select), or sort the list.

I'll have to read the PLRM carefully ...

Will it be sufficient to process the string object written to the
"scratch" object by "filenameforall", saving it to an array or a
dictionary for example? (PLRM, 3rd ed, page 588)

>> ...
>> (4) Getting an array sorted (ASCII, ascending). I didn't find any
>> PostScript operator related to this issue at all.
> 
> There is no such operator, but you can write a procedure to do the
> job :)
> See, for example, http://en.wikibooks.org/wiki/PostScript_FAQ#How_to_sort_an_array.3F
> 
>> ...

There obviously is an optimized bi-directional version of "bubble sort"
called "shaker sort" or "coctail sort" according to Wikipedia [1].

Michael


[1] <http://en.wikipedia.org/wiki/Shaker_sort>

-- 
Real names enhance the probability of getting real answers.
My e-mail account at DECUS Munich is no longer valid.

[toc] | [prev] | [next] | [standalone]


#583

FromSaGS <sags5495@gmail.com>
Date2012-01-23 12:18 -0800
Message-ID<30312552-d18c-4787-8d35-a4b00cec6a4d@dp8g2000vbb.googlegroups.com>
In reply to#581
On Jan 23, 6:26 pm, Michael Unger <spam.to.un...@spamgourmet.com>
wrote:
> ...
> Will it be sufficient to process the string object written to the
> "scratch" object by "filenameforall", saving it to an array or a
> dictionary for example? (PLRM, 3rd ed, page 588)

If you want to keep for later use the (sub)strings returned by
filenameforall, either as returned by the operator or modified ‘in
place’, then copy them to newly allocated string objects.

This is because at each iteration filenameforall overwrites the
initial bytes of the scratch string you pass to it, which are also the
initial (or all) bytes of the (sub)strings returned by previous
iterations, in order to return a new value.

To see what happens, run the following 2 code fragments and compare
the results:

    [ (*) {} 1024 string filenameforall ] ==
    [ (*) { dup length string copy } 1024 string filenameforall ] ==

> ...
> There obviously is an optimized bi-directional version of "bubble sort"
> called "shaker sort" or "coctail sort" according to Wikipedia [1].
> ...

And http://www.anastigmatix.net/postscript/Order.html offers, among
other things, ready-made quicksort and heapsort implementations.

A note, since you use Windows: NTFS filesystems enumerate files in
alphabetic order. While you cannot rely on this when you write your
program, it shows that the worst case for quicksort (which is O(n^2)
and happens when the input is already sorted) may appear more often
than expected... (Although with a small number of values to sort this
won’t matter.)

> ...

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.postscript


csiph-web