PC Review


Reply
Thread Tools Rate Thread

How do I get the directory to produce names in alphabetical order?

 
 
Robert Macy
Guest
Posts: n/a
 
      27th Apr 2009
This may be OT for WinXP, but here is the problem:

Running Word 2003 on WinXP I use a macro to print some 120 documents.
The order come out random and each print run has to be collated to put
them into alphabetical order!

Of course the documents all come up in Windows Explorer in any order
selectable, yet the macro prints in the order the documents appear on
the drive in DOS memory and ignore any other order. As a result I
have to collate these documents back into order!

There must be at least two ways to do this. The first, and this is
what I tried to do, was copy into a pristine location the files so
that they would already be 'laid down' in order. That almost worked,
but I have to add documents from time to time and that shifts it all
around again. If this were Win98, I could include a statement in the
autoexec.bat file to order the directories, then when Word under macro
control goes to get its list, it would get the list in alphabetical
order. The second, must relate to the macro command in Word, but I
couldn't find anything about that.

So, the question is

How do I get DOS to order the directory so that when Word, under macro
control, prints the douments in the necessary alphabetical order?

Robert
 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      27th Apr 2009

"Robert Macy" <(E-Mail Removed)> wrote in message
news:d8ee3820-944e-4ae7-a8e2-(E-Mail Removed)...
> This may be OT for WinXP, but here is the problem:
>
> Running Word 2003 on WinXP I use a macro to print some 120 documents.
> The order come out random and each print run has to be collated to put
> them into alphabetical order!
>
> Of course the documents all come up in Windows Explorer in any order
> selectable, yet the macro prints in the order the documents appear on
> the drive in DOS memory and ignore any other order. As a result I
> have to collate these documents back into order!
>
> There must be at least two ways to do this. The first, and this is
> what I tried to do, was copy into a pristine location the files so
> that they would already be 'laid down' in order. That almost worked,
> but I have to add documents from time to time and that shifts it all
> around again. If this were Win98, I could include a statement in the
> autoexec.bat file to order the directories, then when Word under macro
> control goes to get its list, it would get the list in alphabetical
> order. The second, must relate to the macro command in Word, but I
> couldn't find anything about that.
>
> So, the question is
>
> How do I get DOS to order the directory so that when Word, under macro
> control, prints the douments in the necessary alphabetical order?
>
> Robert


This is not a DOS or a Windows issue but a Word issue. I recommend you
repost it in a Word newsgroup - that's where the Word experts dwell.


 
Reply With Quote
 
Tim Slattery
Guest
Posts: n/a
 
      27th Apr 2009
Robert Macy <(E-Mail Removed)> wrote:

>This may be OT for WinXP, but here is the problem:
>
>Running Word 2003 on WinXP I use a macro to print some 120 documents.
>The order come out random and each print run has to be collated to put
>them into alphabetical order!
>
>Of course the documents all come up in Windows Explorer in any order
>selectable, yet the macro prints in the order the documents appear on
>the drive in DOS memory and ignore any other order. As a result I
>have to collate these documents back into order!


What file system is your disk using? In the FAT systems, files can be
stored in any order, and simply traversing the directory will bring
them back in whatever order they are stored in. In NTFS, files are
stored in a BTree, therefore traversing the directory brings them back
in alphabetical order.

I don't know whether the fact that you're using a Word macro would
impact this, but I doubt it.

Another possibility: is it possible to have your macro retrieve a list
of file names, sort that list, then iterate over the list and print
each file?

--
Tim Slattery
MS MVP(Shell/User)
(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
Robert Macy
Guest
Posts: n/a
 
      28th Apr 2009
On Apr 27, 1:08*pm, Tim Slattery <Slatter...@bls.gov> wrote:
> Robert Macy <m...@california.com> wrote:
> >This may be OT for WinXP, but here is the problem:

>
> >Running Word 2003 on WinXP I use a macro to print some 120 documents.
> >The order come out random and each print run has to be collated to put
> >them into alphabetical order!

>
> >Of course the documents all come up in Windows Explorer in any order
> >selectable, yet the macro prints in the order the documents appear on
> >the drive in DOS memory and ignore any other order. *As a result I
> >have to collate these documents back into order!

>
> What file system is your disk using? In the FAT systems, files can be
> stored in any order, and simply traversing the directory will bring
> them back in whatever order they are stored in. In NTFS, files are
> stored in a BTree, therefore traversing the directory brings them back
> in alphabetical order.
>
> I don't know whether the fact that you're using a Word macro would
> impact this, but I doubt it.
>
> Another possibility: is it possible to have your macro retrieve a list
> of file names, sort that list, then iterate over the list and print
> each file?
>
> --
> Tim Slattery
> MS MVP(Shell/User)
> Slatter...@bls.govhttp://members.cox.net/slatteryt


Thank you for your reply.
The memory stick is a FAT directory. The main computer is NTFS
Interesting concept to include sorting in the macro. I originally
posted here because DOS in the Win98 controls the order, and I thought
that the DOS of WinXP did something similar here.

Robert
 
Reply With Quote
 
Tim Slattery
Guest
Posts: n/a
 
      28th Apr 2009
Robert Macy <(E-Mail Removed)> wrote:


>Thank you for your reply.
>The memory stick is a FAT directory. The main computer is NTFS
>Interesting concept to include sorting in the macro. I originally
>posted here because DOS in the Win98 controls the order, and I thought
>that the DOS of WinXP did something similar here.


DOS's "dir" app can sort the names it retrieves, that's the only
control DOS has over this.

There is no DOS in WinXP or Vista. There is a 32-bit command console
that has many of the same commands (like dir), but it's much more
capable. If you do a "dir" without specifying a sort in XP or Vista,
you'll get filenames in alphabetical order if the file system is NTFS,
in a FAT file system they'll be in whatever order. It's a function of
the file system, not the OS.

--
Tim Slattery
MS MVP(Shell/User)
(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      28th Apr 2009

"Tim Slattery" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Robert Macy <(E-Mail Removed)> wrote:
>
>
>>Thank you for your reply.
>>The memory stick is a FAT directory. The main computer is NTFS
>>Interesting concept to include sorting in the macro. I originally
>>posted here because DOS in the Win98 controls the order, and I thought
>>that the DOS of WinXP did something similar here.

>
> DOS's "dir" app can sort the names it retrieves, that's the only
> control DOS has over this.
>
> There is no DOS in WinXP or Vista. There is a 32-bit command console
> that has many of the same commands (like dir), but it's much more
> capable. If you do a "dir" without specifying a sort in XP or Vista,
> you'll get filenames in alphabetical order if the file system is NTFS,
> in a FAT file system they'll be in whatever order. It's a function of
> the file system, not the OS.
>
> --
> Tim Slattery
> MS MVP(Shell/User)
> (E-Mail Removed)
> http://members.cox.net/slatteryt


Under all OSs based on WinNT the order of files under the "dir" command
depends on the setting of the environmental variable %dircmd%, e.g. set
dircmd=/on, regardless of the file system. If this variable is not specified
then you get the files in the order you mentioned in your reply.


 
Reply With Quote
 
Tim Slattery
Guest
Posts: n/a
 
      29th Apr 2009
"Pegasus [MVP]" <(E-Mail Removed)> wrote:

>Under all OSs based on WinNT the order of files under the "dir" command
>depends on the setting of the environmental variable %dircmd%, e.g. set
>dircmd=/on, regardless of the file system. If this variable is not specified
>then you get the files in the order you mentioned in your reply.


Thanks, I didn't know that. It seems the dircmd environment variable
can be used to set switches that you want the "dir" command to use
each time you invoke it. "/on" tells "dir" to order its output by file
name. There's a brief discussion here:
http://windowsitpro.com/article/arti...-variable.html

--
Tim Slattery
MS MVP(Shell/User)
(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
Robert Macy
Guest
Posts: n/a
 
      29th Apr 2009
On Apr 29, 6:08*am, Tim Slattery <Slatter...@bls.gov> wrote:
> "Pegasus [MVP]" <n...@microsoft.com> wrote:
> >Under all OSs based on WinNT the order of files under the "dir" command
> >depends on the setting of the environmental variable %dircmd%, e.g. set
> >dircmd=/on, regardless of the file system. If this variable is not specified
> >then you get the files in the order you mentioned in your reply.

>
> Thanks, I didn't know that. It seems the dircmd environment variable
> can be used to set switches that you want the "dir" command to use
> each time you invoke it. "/on" tells "dir" to order its output by file
> name. There's a brief discussion here:http://windowsitpro.com/article/arti...-0651---using-...
>
> --
> Tim Slattery
> MS MVP(Shell/User)
> Slatter...@bls.govhttp://members.cox.net/slatteryt


Thank you for that URL.

The article had a 'brief' way to set the variable DIRCMD, and only
took 20 minutes to pick around until I found what I 'think' it was
talking about.

I'll try and see what happens.

Robert
 
Reply With Quote
 
Robert Macy
Guest
Posts: n/a
 
      29th Apr 2009
On Apr 29, 6:08*am, Tim Slattery <Slatter...@bls.gov> wrote:
> "Pegasus [MVP]" <n...@microsoft.com> wrote:
> >Under all OSs based on WinNT the order of files under the "dir" command
> >depends on the setting of the environmental variable %dircmd%, e.g. set
> >dircmd=/on, regardless of the file system. If this variable is not specified
> >then you get the files in the order you mentioned in your reply.

>
> Thanks, I didn't know that. It seems the dircmd environment variable
> can be used to set switches that you want the "dir" command to use
> each time you invoke it. "/on" tells "dir" to order its output by file
> name. There's a brief discussion here:http://windowsitpro.com/article/arti...-0651---using-...
>
> --
> Tim Slattery
> MS MVP(Shell/User)
> Slatter...@bls.govhttp://members.cox.net/slatteryt


Tim,

Thank you for your URL

The description in that URL on how to add/set the variable was a bit
vague but after 20 minutes of poking around I added the variable,
DIRCMD to the environment list and set its value to /ON. The example
in the URL was slightly different value, but the example also had an =
sign which can't be done.

Will try out and let everyone know.

Robert
 
Reply With Quote
 
Bill in Co.
Guest
Posts: n/a
 
      29th Apr 2009
Actually I think just dir /o defaults to sorting by name, so you don't need
to explicitly use dir /on (IIRC)

Tim Slattery wrote:
> "Pegasus [MVP]" <(E-Mail Removed)> wrote:
>
>> Under all OSs based on WinNT the order of files under the "dir" command
>> depends on the setting of the environmental variable %dircmd%, e.g. set
>> dircmd=/on, regardless of the file system. If this variable is not
>> specified
>> then you get the files in the order you mentioned in your reply.

>
> Thanks, I didn't know that. It seems the dircmd environment variable
> can be used to set switches that you want the "dir" command to use
> each time you invoke it. "/on" tells "dir" to order its output by file
> name. There's a brief discussion here:
> http://windowsitpro.com/article/arti...-variable.html
>
> --
> Tim Slattery
> MS MVP(Shell/User)
> (E-Mail Removed)
> http://members.cox.net/slatteryt



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how i get defferent names in alphabetical order abdurehmankk Microsoft Excel Misc 2 29th Nov 2009 11:07 AM
Highest then alphabetical order By Names? =?Utf-8?B?S2lsbGVy?= Microsoft Excel Misc 0 24th Sep 2007 03:20 AM
organizing names in alphabetical order =?Utf-8?B?aHVudA==?= Windows XP New Users 9 19th Feb 2007 03:13 PM
sort last names by in alphabetical order =?Utf-8?B?SmFja2ll?= Microsoft Excel Misc 1 24th May 2006 08:45 PM
Alphabetical order of file names Ernst Windows XP Customization 2 29th Sep 2003 05:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:14 PM.