A Windows 98 & ME forum. Win98banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Win98banter forum » Windows 98 » General
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

running many files through the same command



 
 
Thread Tools Display Modes
  #11  
Old June 24th 04, 07:45 AM
jt3
external usenet poster
 
Posts: n/a
Default running many files through the same command

Ivan,
I'm having some trouble with a response here, because there's more than
one issue here, as I see it. First, I didn't know that the environmental
variables would work as they have apparently worked for you in your first
example:
C:\ Set fname.wp=xxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602
I attempted to run something like that:
C:\ set fname.txt=config.txt (I had a file named config.txt in
folder)
C:\ copy config.txt %fname%.602
I don't understand the result. It copied the file, giving it the name .602
that is, blank fname, extension .602. I don't understand how it worked to
that extent, to be honest, since I was under the impression that the
environment simply had name-string equated to value-string, and the period
in the name-string would have terminated it. So I don't know what it
actually did, and even less do I understand the difference between your DOS
box and mine.
Secondly, since it worked for you, even if it won't for me, if you gave
it the file you indicated, presumeably you called it from a DOS box with
something like (say the batfile is PRE.BAT
PRE C:\windir\xxx.wp
It would act this way if you *could* use the neat little
drag-to-DOS-exe-program-input-buffer trick in Windows Explorer. Then, in
the way I'm used to using the batch processor, you'd have ended up with a
file:
C:\windir\xxx.wp.602
which, as AlmostBob points out, is an acceptable filename in Windows, and it
would be in the same directory as your original file.
The final extension rules once DOS has shortened the name, and so it
would seem like it would work. That's the way it works on my machine--the
original extension is just rolled into the long filename, and the one that
counts is the .602, so if you used FOR with a limited list (*.wp) it
wouldn't loop endlessly. Note that the following would:
FOR %f in (*.*) do copy %f %f.602 (infinite loop)
Note that if you use FOR in a batch file, you must use
FOR %%f in (*.wp) do pre602/d:5 %f %f.602
to make the batch processor happy!
From here, my difficulty lies in not understanding how you actually
want to use it; i.e., executing a batfile in WE should bring up a DOS box
and execute the file as written--no params unless you use SET first.
If you call up the box first, then command line execute, you have the
option of entering parameters (same from Run).
I don't know any way of providing a batch program with an input buffer
to allow you to run it from WE using the drag method, except by using some
program written for the purpose.
Don't know if any of this actually addresses your question, so I'll wait
for you to tell me!

Joe

"Ivan Bútora" wrote in message
...
Hi again,

thanks for the reply. First of all, I found out that the app will let me do
a simple
pre602.exe /d:5 xxx.wp .602
and it will automatically put in the xxx, so it is not a problem anymore.

But let's say the app didn't let me do that. I tried what you said, and I
was able to come up with the following procedure.
C:\ set fname.wp=xxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602

This works well from the command line. However, if I write a .bat file like
this (so that I can use it for the "convert" action in explorer)
set fname.wp=%1
pre602.exe /d:5 %1 %fname%.602

it doesn't work, since Windows puts in the full path (i.e. C:\xxx.wp) rather
than just the file name (i.e. xxx.wp) for %1. Is there any way to refer to
the file name without the full path?

Thanks much,

Ivan


"jt3" wrote in message
...
Off the top of my head, I would do that using environmental strings

with
the SET command--you can define some environmental variable, say FNAME

with
the SET command, and set it to the filename, sans extension, then, when

you
run the batfile you have %FNAME%.wp in the reference variable and the

batch
processor will replace %FNAME% with the string in the SET command, say SET
FNAME=xxx, to use your example. That way, you only need execute the SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in the

batch
file are simply replaced by the arguments, in numerical order, given on

the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space separated vars.)
would perform operations referring in the batch file to 'first.dat' as %1,
'second.exe' as %2, etc. But they're always used as parameters, not
strings.
Hope this is what you need,
Joe
"Ivan Bútora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards (I

don't
know why I thought it didn't.) So indeed, that solves my first question -

it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to the
part of a file before its extension? You mentioned %1, %2, etc. How are %2
or %3 different from %1?


"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and on

6.22,
as
well, and 7 is no doubt somewhat different, but the first order approach
(easiest) depends upon whether or not your program pre602.exe will

accept
wildcard characters, *, or ?, or not. If so, it is as easy as pre602

*.wp
*.602, conceivably. If you want a list, use the redirections symbol

to
have a function such as dir put it into an output file. Remember that

if
you execute a batch file within a batch file, the command processor

doesn't
return to the calling batch file unless you use the CALL command to load
another copy of the command processor. Reference any dummy parameters

as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR

loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost

anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1==string2 command (can also be EXIST, or NOT EXIST,
etc., as in a

file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program

gives
an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name

without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE, which
stops execution, displaying "Strike a key when ready.." until the key is
struck, allowing resumption of processing. I believe that there are

more,
some of which came in about 6.22 and later which I never used and don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you

with
the obvious.
Joe

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe what I

want
to do, but here it is. Basically I wish to convert several (many) files

from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I would

do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do

each
one individually. Is there any way to do this using a batch file? If I

put
all those files in one folder, is there any way how to generate a list

of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the

conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output

file
something fixed, which I subsequently have to rename. I know "%1" refers

to
the file that the action is taken on. If the file is, say, "xxx.wp", is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan






  #12  
Old June 24th 04, 02:01 PM
Ivan Bútora
external usenet poster
 
Posts: n/a
Default running many files through the same command

Hi Joe,

thanks for a detailed response. Let me address the issues step by step =
inline.

Ivan


"jt3" wrote in message =
...
Ivan,
I'm having some trouble with a response here, because there's more =

than
one issue here, as I see it. First, I didn't know that the =

environmental
variables would work as they have apparently worked for you in your =

first
example:
C:\ Set fname.wp=3Dxxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602
I attempted to run something like that:
C:\ set fname.txt=3Dconfig.txt (I had a file named =

config.txt in
folder)
C:\ copy config.txt %fname%.602
I don't understand the result. It copied the file, giving it the name =

..602
that is, blank fname, extension .602. I don't understand how it =

worked to
that extent, to be honest, since I was under the impression that the
environment simply had name-string equated to value-string, and the =

period
in the name-string would have terminated it. So I don't know what it
actually did, and even less do I understand the difference between =

your DOS
box and mine.


Actually, you are right, it doesn't work as I thought it did. (I tried =
it with the rename command, and it renamed merely to .602, as you =
described.) So what is really happening is that the application =
pre602.exe fills in the original part of the filename sans extension, as =
I mentioned before.

Secondly, since it worked for you, even if it won't for me, if you =

gave
it the file you indicated, presumeably you called it from a DOS box =

with
something like (say the batfile is PRE.BAT
PRE C:\windir\xxx.wp
It would act this way if you *could* use the neat little
drag-to-DOS-exe-program-input-buffer trick in Windows Explorer. Then, =

in
the way I'm used to using the batch processor, you'd have ended up =

with a
file:
C:\windir\xxx.wp.602
which, as AlmostBob points out, is an acceptable filename in Windows, =

and it
would be in the same directory as your original file.
The final extension rules once DOS has shortened the name, and so =

it
would seem like it would work. That's the way it works on my =

machine--the
original extension is just rolled into the long filename, and the one =

that
counts is the .602, so if you used FOR with a limited list (*.wp) it
wouldn't loop endlessly. Note that the following would:
FOR %f in (*.*) do copy %f %f.602 (infinite loop)
Note that if you use FOR in a batch file, you must use
FOR %%f in (*.wp) do pre602/d:5 %f %f.602
to make the batch processor happy!



Unfortunately, this doesn't work with pre602.exe. It does work with the =
'rename' command, for example. I tried:
C\: for %f in (*.wp) do rename %f %f.602

and indeed it renamed xxx.wp to xxx.wp.602.

However, pre602.exe is not able to put add the additional extension at =
the end of xxx.wp. Instead, it just tried to rename to "xxx.wp." and =
gives an error.


From here, my difficulty lies in not understanding how you =

actually
want to use it; i.e., executing a batfile in WE should bring up a DOS =

box
and execute the file as written--no params unless you use SET first.
If you call up the box first, then command line execute, you have =

the
option of entering parameters (same from Run).
I don't know any way of providing a batch program with an input =

buffer
to allow you to run it from WE using the drag method, except by using =

some
program written for the purpose.


What I am trying to do is this. I want to be able to, in explorer, right =
click on the file, select "convert" and have the file xxx.wp be =
converted to xxx.602. Thus what I am doing is defining a custom action =
called 'convert to .602' for all .wp files in View - Folder Options - =
File types. As I said, my problem is actually already solved, since the =
command that will do what I want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to =
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to =
automatically put in the part of the filename before the extension, how =
would I accomplish what I want, i.e. how would I refer to a filename =
sans extension. I could point to a batch file in "application used to =
perform action", but so far I don't see that there is any way to do what =
I want even with several steps in a batch file. My intention is that I =
would not have to type in anything manually.

Don't know if any of this actually addresses your question, so =

I'll wait
for you to tell me!
=20
Joe
=20
"Ivan B=FAtora" wrote in message
...
Hi again,
=20
thanks for the reply. First of all, I found out that the app will let =

me do
a simple
pre602.exe /d:5 xxx.wp .602
and it will automatically put in the xxx, so it is not a problem =

anymore.
=20
But let's say the app didn't let me do that. I tried what you said, =

and I
was able to come up with the following procedure.
C:\ set fname.wp=3Dxxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602
=20
This works well from the command line. However, if I write a .bat file =

like
this (so that I can use it for the "convert" action in explorer)
set fname.wp=3D%1
pre602.exe /d:5 %1 %fname%.602
=20
it doesn't work, since Windows puts in the full path (i.e. C:\xxx.wp) =

rather
than just the file name (i.e. xxx.wp) for %1. Is there any way to =

refer to
the file name without the full path?
=20
Thanks much,
=20
Ivan
=20
=20
"jt3" wrote in message
...
Off the top of my head, I would do that using environmental =

strings
with
the SET command--you can define some environmental variable, say =

FNAME
with
the SET command, and set it to the filename, sans extension, then, =

when
you
run the batfile you have %FNAME%.wp in the reference variable and =

the
batch
processor will replace %FNAME% with the string in the SET command, =

say SET
FNAME=3Dxxx, to use your example. That way, you only need execute =

the SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in =

the
batch
file are simply replaced by the arguments, in numerical order, given =

on
the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space separated =

vars.)
would perform operations referring in the batch file to 'first.dat' =

as %1,
'second.exe' as %2, etc. But they're always used as parameters, not
strings.
Hope this is what you need,
Joe
"Ivan B=FAtora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards =

(I
don't
know why I thought it didn't.) So indeed, that solves my first =

question -
it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to =

the
part of a file before its extension? You mentioned %1, %2, etc. How =

are %2
or %3 different from %1?


"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and =

on
6.22,
as
well, and 7 is no doubt somewhat different, but the first order =

approach
(easiest) depends upon whether or not your program pre602.exe will

accept
wildcard characters, *, or ?, or not. If so, it is as easy as =

pre602
*.wp
*.602, conceivably. If you want a list, use the redirections =

symbol
to
have a function such as dir put it into an output file. Remember =

that
if
you execute a batch file within a batch file, the command =

processor
doesn't
return to the calling batch file unless you use the CALL command =

to load
another copy of the command processor. Reference any dummy =

parameters
as
%1--%9, SHIFT can be used to access more than nine dummy args. =

FOR
loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is =

a
parameter in executing 'something' where 'something' can be =

almost
anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1=3D=3Dstring2 command (can also be EXIST, or NOT =

EXIST,
etc., as =

in a
file
referenced)
This can also test for an ERRORLEVEL (var) condition if the =

program
gives
an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name

without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE, =

which
stops execution, displaying "Strike a key when ready.." until the =

key is
struck, allowing resumption of processing. I believe that there =

are
more,
some of which came in about 6.22 and later which I never used and =

don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled =

you
with
the obvious.
Joe

"Ivan B=FAtora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe =

what I
want
to do, but here it is. Basically I wish to convert several (many) =

files
from
WordPerfect format to T602 format. For this, I have a small =

utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I =

would
do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to =

do
each
one individually. Is there any way to do this using a batch file? =

If I
put
all those files in one folder, is there any way how to generate a =

list
of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the

conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of =

the
filename before the file extension, and thus I had to make the =

output
file
something fixed, which I subsequently have to rename. I know "%1" =

refers
to
the file that the action is taken on. If the file is, say, =

"xxx.wp", is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan




=20

  #13  
Old June 24th 04, 06:19 PM
jt3
external usenet poster
 
Posts: n/a
Default running many files through the same command

Hello again,
So far as I know, the short answer is, 'You can't get there from here.'
The problem really centers around two issues, 1) no input buffer function in
the batch processor, and 2) no access to the DOS PSP via the batch
processor.
Both of these issues are readily accessible via assembly language or C
if you prefer, but you would need (an) executable program(s) to perform
these functions, called in the batch file. You need the first for
'stuffing' with the drag operation, and the second to direct your pre602
program's input and output, unless it has more options (switches) available
than those which you've detailed here. Since you're apparently looking at
this from a hypothetical viewpoint, it's worthwhile to note that *most* DOS
programs which accept wildcards are designed for input and output more along
the model of standard DOS functions such as COPY, etc., and there would be
less difficulty with this type of approach. But the real obstacle as I see
it is that the batch processor was not designed with drag or point and click
mouse operation in mind.
If you're inclined to pursue the matter further, I'd suggest either some
simple .ASM programs or, if that's not an option, try some of the DOS
newsgroups, of which I only know that there are some, and they may know of
some available programs to provide the facility you seek.
PC Magazine used to provide a selection of small DOS programs some of
which provided some extensive capabilities to DOS operations, keyboard
buffer stuffers, and so on, and some mouse functionality, if memory serves,
though I don't recall anything specifically addressing your needs, of
course, I wasn't looking for such then.
I rarely throw anything away (to my wife's chagrin) and so I undoubtedly
still have a couple of 5-1/4" floppies around with some of these on them if
you should want a look--but I warn you, some of them were even broken by DOS
6.22, so how they'd run on 7.0 is a matter of conjecture, to say nothing of
addressing your need. Mostly, the broken ones were file manipulation
routines, and this isn't in that class.
Joe
"Ivan Bútora" wrote in message
...
Hi Joe,

thanks for a detailed response. Let me address the issues step by step
inline.

Ivan


"jt3" wrote in message
...
Ivan,
I'm having some trouble with a response here, because there's more

than
one issue here, as I see it. First, I didn't know that the environmental
variables would work as they have apparently worked for you in your first
example:
C:\ Set fname.wp=xxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602
I attempted to run something like that:
C:\ set fname.txt=config.txt (I had a file named config.txt in
folder)
C:\ copy config.txt %fname%.602
I don't understand the result. It copied the file, giving it the name

..602
that is, blank fname, extension .602. I don't understand how it worked to
that extent, to be honest, since I was under the impression that the
environment simply had name-string equated to value-string, and the period
in the name-string would have terminated it. So I don't know what it
actually did, and even less do I understand the difference between your

DOS
box and mine.


Actually, you are right, it doesn't work as I thought it did. (I tried it
with the rename command, and it renamed merely to .602, as you described.)
So what is really happening is that the application pre602.exe fills in the
original part of the filename sans extension, as I mentioned before.

Secondly, since it worked for you, even if it won't for me, if you

gave
it the file you indicated, presumeably you called it from a DOS box with
something like (say the batfile is PRE.BAT
PRE C:\windir\xxx.wp
It would act this way if you *could* use the neat little
drag-to-DOS-exe-program-input-buffer trick in Windows Explorer. Then, in
the way I'm used to using the batch processor, you'd have ended up with a
file:
C:\windir\xxx.wp.602
which, as AlmostBob points out, is an acceptable filename in Windows, and

it
would be in the same directory as your original file.
The final extension rules once DOS has shortened the name, and so it
would seem like it would work. That's the way it works on my machine--the
original extension is just rolled into the long filename, and the one that
counts is the .602, so if you used FOR with a limited list (*.wp) it
wouldn't loop endlessly. Note that the following would:
FOR %f in (*.*) do copy %f %f.602 (infinite loop)
Note that if you use FOR in a batch file, you must use
FOR %%f in (*.wp) do pre602/d:5 %f %f.602
to make the batch processor happy!



Unfortunately, this doesn't work with pre602.exe. It does work with the
'rename' command, for example. I tried:
C\: for %f in (*.wp) do rename %f %f.602

and indeed it renamed xxx.wp to xxx.wp.602.

However, pre602.exe is not able to put add the additional extension at the
end of xxx.wp. Instead, it just tried to rename to "xxx.wp." and gives an
error.


From here, my difficulty lies in not understanding how you actually
want to use it; i.e., executing a batfile in WE should bring up a DOS box
and execute the file as written--no params unless you use SET first.
If you call up the box first, then command line execute, you have the
option of entering parameters (same from Run).
I don't know any way of providing a batch program with an input buffer
to allow you to run it from WE using the drag method, except by using some
program written for the purpose.


What I am trying to do is this. I want to be able to, in explorer, right
click on the file, select "convert" and have the file xxx.wp be converted to
xxx.602. Thus what I am doing is defining a custom action called 'convert to
..602' for all .wp files in View - Folder Options - File types. As I said,
my problem is actually already solved, since the command that will do what I
want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension, how
would I accomplish what I want, i.e. how would I refer to a filename sans
extension. I could point to a batch file in "application used to perform
action", but so far I don't see that there is any way to do what I want even
with several steps in a batch file. My intention is that I would not have to
type in anything manually.

Don't know if any of this actually addresses your question, so I'll

wait
for you to tell me!

Joe

"Ivan Bútora" wrote in message
...
Hi again,

thanks for the reply. First of all, I found out that the app will let me

do
a simple
pre602.exe /d:5 xxx.wp .602
and it will automatically put in the xxx, so it is not a problem anymore.

But let's say the app didn't let me do that. I tried what you said, and I
was able to come up with the following procedure.
C:\ set fname.wp=xxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602

This works well from the command line. However, if I write a .bat file

like
this (so that I can use it for the "convert" action in explorer)
set fname.wp=%1
pre602.exe /d:5 %1 %fname%.602

it doesn't work, since Windows puts in the full path (i.e. C:\xxx.wp)

rather
than just the file name (i.e. xxx.wp) for %1. Is there any way to refer to
the file name without the full path?

Thanks much,

Ivan


"jt3" wrote in message
...
Off the top of my head, I would do that using environmental strings

with
the SET command--you can define some environmental variable, say FNAME

with
the SET command, and set it to the filename, sans extension, then, when

you
run the batfile you have %FNAME%.wp in the reference variable and the

batch
processor will replace %FNAME% with the string in the SET command, say

SET
FNAME=xxx, to use your example. That way, you only need execute the SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in the

batch
file are simply replaced by the arguments, in numerical order, given on

the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space separated

vars.)
would perform operations referring in the batch file to 'first.dat' as

%1,
'second.exe' as %2, etc. But they're always used as parameters, not
strings.
Hope this is what you need,
Joe
"Ivan Bútora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards (I

don't
know why I thought it didn't.) So indeed, that solves my first

question -
it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to the
part of a file before its extension? You mentioned %1, %2, etc. How are

%2
or %3 different from %1?


"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and on

6.22,
as
well, and 7 is no doubt somewhat different, but the first order

approach
(easiest) depends upon whether or not your program pre602.exe will

accept
wildcard characters, *, or ?, or not. If so, it is as easy as pre602

*.wp
*.602, conceivably. If you want a list, use the redirections symbol

to
have a function such as dir put it into an output file. Remember that

if
you execute a batch file within a batch file, the command processor

doesn't
return to the calling batch file unless you use the CALL command to

load
another copy of the command processor. Reference any dummy parameters

as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR

loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost

anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1==string2 command (can also be EXIST, or NOT EXIST,
etc., as in a

file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program

gives
an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name

without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE,

which
stops execution, displaying "Strike a key when ready.." until the key

is
struck, allowing resumption of processing. I believe that there are

more,
some of which came in about 6.22 and later which I never used and

don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you

with
the obvious.
Joe

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe what

I
want
to do, but here it is. Basically I wish to convert several (many)

files
from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I

would
do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do

each
one individually. Is there any way to do this using a batch file? If I

put
all those files in one folder, is there any way how to generate a list

of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the

conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output

file
something fixed, which I subsequently have to rename. I know "%1"

refers
to
the file that the action is taken on. If the file is, say, "xxx.wp",

is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan








  #14  
Old June 24th 04, 09:46 PM
Ivan Bútora
external usenet poster
 
Posts: n/a
Default running many files through the same command

Hi,

I think I'll leave things as they are for now, since

pre602.exe /d:5 %1 .602

works fine. It works fine because pre602 allows the .602 substitution. =
If that was not the case, I would have a problem. I like to create =
custom explorer actions for files such as older wordperfect files, so =
that I don't have to open them through a DOS command, but instead can =
just double-click. I know some basic things about DOS commands and batch =
files, but not much, and I know nothing about any other programming =
languages.

I thought that there might have been some easy way to refer to the part =
of the filename without the extension in DOS or in a Windows command, =
but this doesn't seem to be the case. I could pursue this further, of =
course, in some directions that you have suggested, but I do not have =
the time and energy for that now.

Anyway, thanks for your responses. Obviously you have a much deeper =
understanding of all of this stuff, and I appreciate that you took the =
time to respond.


Ivan



"jt3" wrote in message =
...
Hello again,
So far as I know, the short answer is, 'You can't get there from =

here.'
The problem really centers around two issues, 1) no input buffer =

function in
the batch processor, and 2) no access to the DOS PSP via the batch
processor.
Both of these issues are readily accessible via assembly language =

or C
if you prefer, but you would need (an) executable program(s) to =

perform
these functions, called in the batch file. You need the first for
'stuffing' with the drag operation, and the second to direct your =

pre602
program's input and output, unless it has more options (switches) =

available
than those which you've detailed here. Since you're apparently =

looking at
this from a hypothetical viewpoint, it's worthwhile to note that =

*most* DOS
programs which accept wildcards are designed for input and output more =

along
the model of standard DOS functions such as COPY, etc., and there =

would be
less difficulty with this type of approach. But the real obstacle as =

I see
it is that the batch processor was not designed with drag or point and =

click
mouse operation in mind.
If you're inclined to pursue the matter further, I'd suggest =

either some
simple .ASM programs or, if that's not an option, try some of the DOS
newsgroups, of which I only know that there are some, and they may =

know of
some available programs to provide the facility you seek.
PC Magazine used to provide a selection of small DOS programs some =

of
which provided some extensive capabilities to DOS operations, keyboard
buffer stuffers, and so on, and some mouse functionality, if memory =

serves,
though I don't recall anything specifically addressing your needs, of
course, I wasn't looking for such then.
I rarely throw anything away (to my wife's chagrin) and so I =

undoubtedly
still have a couple of 5-1/4" floppies around with some of these on =

them if
you should want a look--but I warn you, some of them were even broken =

by DOS
6.22, so how they'd run on 7.0 is a matter of conjecture, to say =

nothing of
addressing your need. Mostly, the broken ones were file manipulation
routines, and this isn't in that class.
Joe
"Ivan B=FAtora" wrote in message
...
Hi Joe,
=20
thanks for a detailed response. Let me address the issues step by step
inline.
=20
Ivan
=20
=20
"jt3" wrote in message
...
Ivan,
I'm having some trouble with a response here, because there's =

more
than
one issue here, as I see it. First, I didn't know that the =

environmental
variables would work as they have apparently worked for you in your =

first
example:
C:\ Set fname.wp=3Dxxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602
I attempted to run something like that:
C:\ set fname.txt=3Dconfig.txt (I had a file named =

config.txt in
folder)
C:\ copy config.txt %fname%.602
I don't understand the result. It copied the file, giving it the =

name
.602
that is, blank fname, extension .602. I don't understand how it =

worked to
that extent, to be honest, since I was under the impression that the
environment simply had name-string equated to value-string, and the =

period
in the name-string would have terminated it. So I don't know what =

it
actually did, and even less do I understand the difference between =

your
DOS
box and mine.

=20
Actually, you are right, it doesn't work as I thought it did. (I tried =

it
with the rename command, and it renamed merely to .602, as you =

described.)
So what is really happening is that the application pre602.exe fills =

in the
original part of the filename sans extension, as I mentioned before.
=20
Secondly, since it worked for you, even if it won't for me, if =

you
gave
it the file you indicated, presumeably you called it from a DOS box =

with
something like (say the batfile is PRE.BAT
PRE C:\windir\xxx.wp
It would act this way if you *could* use the neat little
drag-to-DOS-exe-program-input-buffer trick in Windows Explorer. =

Then, in
the way I'm used to using the batch processor, you'd have ended up =

with a
file:
C:\windir\xxx.wp.602
which, as AlmostBob points out, is an acceptable filename in =

Windows, and
it
would be in the same directory as your original file.
The final extension rules once DOS has shortened the name, and =

so it
would seem like it would work. That's the way it works on my =

machine--the
original extension is just rolled into the long filename, and the =

one that
counts is the .602, so if you used FOR with a limited list (*.wp) it
wouldn't loop endlessly. Note that the following would:
FOR %f in (*.*) do copy %f %f.602 (infinite loop)
Note that if you use FOR in a batch file, you must use
FOR %%f in (*.wp) do pre602/d:5 %f %f.602
to make the batch processor happy!

=20
=20
Unfortunately, this doesn't work with pre602.exe. It does work with =

the
'rename' command, for example. I tried:
C\: for %f in (*.wp) do rename %f %f.602
=20
and indeed it renamed xxx.wp to xxx.wp.602.
=20
However, pre602.exe is not able to put add the additional extension at =

the
end of xxx.wp. Instead, it just tried to rename to "xxx.wp." and gives =

an
error.
=20
=20
From here, my difficulty lies in not understanding how you =

actually
want to use it; i.e., executing a batfile in WE should bring up a =

DOS box
and execute the file as written--no params unless you use SET first.
If you call up the box first, then command line execute, you =

have the
option of entering parameters (same from Run).
I don't know any way of providing a batch program with an input =

buffer
to allow you to run it from WE using the drag method, except by =

using some
program written for the purpose.

=20
What I am trying to do is this. I want to be able to, in explorer, =

right
click on the file, select "convert" and have the file xxx.wp be =

converted to
xxx.602. Thus what I am doing is defining a custom action called =

'convert to
.602' for all .wp files in View - Folder Options - File types. As I =

said,
my problem is actually already solved, since the command that will do =

what I
want is:
=20
pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to
perform action)
=20
What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension, =

how
would I accomplish what I want, i.e. how would I refer to a filename =

sans
extension. I could point to a batch file in "application used to =

perform
action", but so far I don't see that there is any way to do what I =

want even
with several steps in a batch file. My intention is that I would not =

have to
type in anything manually.
=20
Don't know if any of this actually addresses your question, so =

I'll
wait
for you to tell me!

Joe

"Ivan B=FAtora" wrote in message
...
Hi again,

thanks for the reply. First of all, I found out that the app will =

let me
do
a simple
pre602.exe /d:5 xxx.wp .602
and it will automatically put in the xxx, so it is not a problem =

anymore.

But let's say the app didn't let me do that. I tried what you said, =

and I
was able to come up with the following procedure.
C:\ set fname.wp=3Dxxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602

This works well from the command line. However, if I write a .bat =

file
like
this (so that I can use it for the "convert" action in explorer)
set fname.wp=3D%1
pre602.exe /d:5 %1 %fname%.602

it doesn't work, since Windows puts in the full path (i.e. =

C:\xxx.wp)
rather
than just the file name (i.e. xxx.wp) for %1. Is there any way to =

refer to
the file name without the full path?

Thanks much,

Ivan


"jt3" wrote in message
...
Off the top of my head, I would do that using environmental =

strings
with
the SET command--you can define some environmental variable, say =

FNAME
with
the SET command, and set it to the filename, sans extension, then, =

when
you
run the batfile you have %FNAME%.wp in the reference variable and =

the
batch
processor will replace %FNAME% with the string in the SET command, =

say
SET
FNAME=3Dxxx, to use your example. That way, you only need execute =

the SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in =

the
batch
file are simply replaced by the arguments, in numerical order, =

given on
the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space =

separated
vars.)
would perform operations referring in the batch file to =

'first.dat' as
%1,
'second.exe' as %2, etc. But they're always used as parameters, =

not
strings.
Hope this is what you need,
Joe
"Ivan B=FAtora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards =

(I
don't
know why I thought it didn't.) So indeed, that solves my first

question -
it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer =

to the
part of a file before its extension? You mentioned %1, %2, etc. =

How are
%2
or %3 different from %1?


"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and =

on
6.22,
as
well, and 7 is no doubt somewhat different, but the first order

approach
(easiest) depends upon whether or not your program pre602.exe =

will
accept
wildcard characters, *, or ?, or not. If so, it is as easy as =

pre602
*.wp
*.602, conceivably. If you want a list, use the redirections =

symbol
to
have a function such as dir put it into an output file. =

Remember that
if
you execute a batch file within a batch file, the command =

processor
doesn't
return to the calling batch file unless you use the CALL command =

to
load
another copy of the command processor. Reference any dummy =

parameters
as
%1--%9, SHIFT can be used to access more than nine dummy args. =

FOR
loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and =

is a
parameter in executing 'something' where 'something' can be =

almost
anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1=3D=3Dstring2 command (can also be EXIST, or =

NOT EXIST,
etc., as =

in a
file
referenced)
This can also test for an ERRORLEVEL (var) condition if the =

program
gives
an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the =

name
without
the colon. For output, there's REM, ECHO (ON or OFF), and =

PAUSE,
which
stops execution, displaying "Strike a key when ready.." until =

the key
is
struck, allowing resumption of processing. I believe that there =

are
more,
some of which came in about 6.22 and later which I never used =

and
don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled =

you
with
the obvious.
Joe

"Ivan B=FAtora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe =

what
I
want
to do, but here it is. Basically I wish to convert several =

(many)
files
from
WordPerfect format to T602 format. For this, I have a small =

utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", =

I
would
do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want =

to do
each
one individually. Is there any way to do this using a batch =

file? If I
put
all those files in one folder, is there any way how to generate =

a list
of
those files, and then run this list through the pre602.exe =

command
automatically?


Question 2
I want to define a custom action for .wp files which would do =

the
conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part =

of the
filename before the file extension, and thus I had to make the =

output
file
something fixed, which I subsequently have to rename. I know =

"%1"
refers
to
the file that the action is taken on. If the file is, say, =

"xxx.wp",
is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan






=20

  #15  
Old June 24th 04, 10:53 PM
jt3
external usenet poster
 
Posts: n/a
Default running many files through the same command

Happy to be of use.
Joe
"Ivan Bútora" wrote in message
...
Hi,

I think I'll leave things as they are for now, since

pre602.exe /d:5 %1 .602

works fine. It works fine because pre602 allows the .602 substitution. If
that was not the case, I would have a problem. I like to create custom
explorer actions for files such as older wordperfect files, so that I don't
have to open them through a DOS command, but instead can just double-click.
I know some basic things about DOS commands and batch files, but not much,
and I know nothing about any other programming languages.

I thought that there might have been some easy way to refer to the part of
the filename without the extension in DOS or in a Windows command, but this
doesn't seem to be the case. I could pursue this further, of course, in some
directions that you have suggested, but I do not have the time and energy
for that now.

Anyway, thanks for your responses. Obviously you have a much deeper
understanding of all of this stuff, and I appreciate that you took the time
to respond.


Ivan



"jt3" wrote in message
...
Hello again,
So far as I know, the short answer is, 'You can't get there from

here.'
The problem really centers around two issues, 1) no input buffer function

in
the batch processor, and 2) no access to the DOS PSP via the batch
processor.
Both of these issues are readily accessible via assembly language or C
if you prefer, but you would need (an) executable program(s) to perform
these functions, called in the batch file. You need the first for
'stuffing' with the drag operation, and the second to direct your pre602
program's input and output, unless it has more options (switches)

available
than those which you've detailed here. Since you're apparently looking at
this from a hypothetical viewpoint, it's worthwhile to note that *most*

DOS
programs which accept wildcards are designed for input and output more

along
the model of standard DOS functions such as COPY, etc., and there would be
less difficulty with this type of approach. But the real obstacle as I

see
it is that the batch processor was not designed with drag or point and

click
mouse operation in mind.
If you're inclined to pursue the matter further, I'd suggest either

some
simple .ASM programs or, if that's not an option, try some of the DOS
newsgroups, of which I only know that there are some, and they may know of
some available programs to provide the facility you seek.
PC Magazine used to provide a selection of small DOS programs some of
which provided some extensive capabilities to DOS operations, keyboard
buffer stuffers, and so on, and some mouse functionality, if memory

serves,
though I don't recall anything specifically addressing your needs, of
course, I wasn't looking for such then.
I rarely throw anything away (to my wife's chagrin) and so I

undoubtedly
still have a couple of 5-1/4" floppies around with some of these on them

if
you should want a look--but I warn you, some of them were even broken by

DOS
6.22, so how they'd run on 7.0 is a matter of conjecture, to say nothing

of
addressing your need. Mostly, the broken ones were file manipulation
routines, and this isn't in that class.
Joe
"Ivan Bútora" wrote in message
...
Hi Joe,

thanks for a detailed response. Let me address the issues step by step
inline.

Ivan


"jt3" wrote in message
...
Ivan,
I'm having some trouble with a response here, because there's more

than
one issue here, as I see it. First, I didn't know that the

environmental
variables would work as they have apparently worked for you in your

first
example:
C:\ Set fname.wp=xxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602
I attempted to run something like that:
C:\ set fname.txt=config.txt (I had a file named config.txt

in
folder)
C:\ copy config.txt %fname%.602
I don't understand the result. It copied the file, giving it the name

.602
that is, blank fname, extension .602. I don't understand how it worked

to
that extent, to be honest, since I was under the impression that the
environment simply had name-string equated to value-string, and the

period
in the name-string would have terminated it. So I don't know what it
actually did, and even less do I understand the difference between your

DOS
box and mine.


Actually, you are right, it doesn't work as I thought it did. (I tried it
with the rename command, and it renamed merely to .602, as you described.)
So what is really happening is that the application pre602.exe fills in

the
original part of the filename sans extension, as I mentioned before.

Secondly, since it worked for you, even if it won't for me, if you

gave
it the file you indicated, presumeably you called it from a DOS box with
something like (say the batfile is PRE.BAT
PRE C:\windir\xxx.wp
It would act this way if you *could* use the neat little
drag-to-DOS-exe-program-input-buffer trick in Windows Explorer. Then,

in
the way I'm used to using the batch processor, you'd have ended up with

a
file:
C:\windir\xxx.wp.602
which, as AlmostBob points out, is an acceptable filename in Windows,

and
it
would be in the same directory as your original file.
The final extension rules once DOS has shortened the name, and so it
would seem like it would work. That's the way it works on my

machine--the
original extension is just rolled into the long filename, and the one

that
counts is the .602, so if you used FOR with a limited list (*.wp) it
wouldn't loop endlessly. Note that the following would:
FOR %f in (*.*) do copy %f %f.602 (infinite loop)
Note that if you use FOR in a batch file, you must use
FOR %%f in (*.wp) do pre602/d:5 %f %f.602
to make the batch processor happy!



Unfortunately, this doesn't work with pre602.exe. It does work with the
'rename' command, for example. I tried:
C\: for %f in (*.wp) do rename %f %f.602

and indeed it renamed xxx.wp to xxx.wp.602.

However, pre602.exe is not able to put add the additional extension at the
end of xxx.wp. Instead, it just tried to rename to "xxx.wp." and gives an
error.


From here, my difficulty lies in not understanding how you actually
want to use it; i.e., executing a batfile in WE should bring up a DOS

box
and execute the file as written--no params unless you use SET first.
If you call up the box first, then command line execute, you have

the
option of entering parameters (same from Run).
I don't know any way of providing a batch program with an input

buffer
to allow you to run it from WE using the drag method, except by using

some
program written for the purpose.


What I am trying to do is this. I want to be able to, in explorer, right
click on the file, select "convert" and have the file xxx.wp be converted

to
xxx.602. Thus what I am doing is defining a custom action called 'convert

to
.602' for all .wp files in View - Folder Options - File types. As I

said,
my problem is actually already solved, since the command that will do what

I
want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension, how
would I accomplish what I want, i.e. how would I refer to a filename sans
extension. I could point to a batch file in "application used to perform
action", but so far I don't see that there is any way to do what I want

even
with several steps in a batch file. My intention is that I would not have

to
type in anything manually.

Don't know if any of this actually addresses your question, so I'll

wait
for you to tell me!

Joe

"Ivan Bútora" wrote in message
...
Hi again,

thanks for the reply. First of all, I found out that the app will let me

do
a simple
pre602.exe /d:5 xxx.wp .602
and it will automatically put in the xxx, so it is not a problem

anymore.

But let's say the app didn't let me do that. I tried what you said, and

I
was able to come up with the following procedure.
C:\ set fname.wp=xxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602

This works well from the command line. However, if I write a .bat file

like
this (so that I can use it for the "convert" action in explorer)
set fname.wp=%1
pre602.exe /d:5 %1 %fname%.602

it doesn't work, since Windows puts in the full path (i.e. C:\xxx.wp)

rather
than just the file name (i.e. xxx.wp) for %1. Is there any way to refer

to
the file name without the full path?

Thanks much,

Ivan


"jt3" wrote in message
...
Off the top of my head, I would do that using environmental

strings
with
the SET command--you can define some environmental variable, say FNAME

with
the SET command, and set it to the filename, sans extension, then,

when
you
run the batfile you have %FNAME%.wp in the reference variable and the

batch
processor will replace %FNAME% with the string in the SET command, say

SET
FNAME=xxx, to use your example. That way, you only need execute the

SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in the

batch
file are simply replaced by the arguments, in numerical order, given

on
the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space separated

vars.)
would perform operations referring in the batch file to 'first.dat' as

%1,
'second.exe' as %2, etc. But they're always used as parameters, not
strings.
Hope this is what you need,
Joe
"Ivan Bútora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards (I

don't
know why I thought it didn't.) So indeed, that solves my first

question -
it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to

the
part of a file before its extension? You mentioned %1, %2, etc. How

are
%2
or %3 different from %1?


"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and on

6.22,
as
well, and 7 is no doubt somewhat different, but the first order

approach
(easiest) depends upon whether or not your program pre602.exe will

accept
wildcard characters, *, or ?, or not. If so, it is as easy as

pre602
*.wp
*.602, conceivably. If you want a list, use the redirections symbol


to
have a function such as dir put it into an output file. Remember

that
if
you execute a batch file within a batch file, the command processor
doesn't
return to the calling batch file unless you use the CALL command to

load
another copy of the command processor. Reference any dummy

parameters
as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR

loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost
anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1==string2 command (can also be EXIST, or NOT EXIST,
etc., as in

a
file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program

gives
an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name

without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE,

which
stops execution, displaying "Strike a key when ready.." until the

key
is
struck, allowing resumption of processing. I believe that there are

more,
some of which came in about 6.22 and later which I never used and

don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you

with
the obvious.
Joe

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe

what
I
want
to do, but here it is. Basically I wish to convert several (many)

files
from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I

would
do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to

do
each
one individually. Is there any way to do this using a batch file? If

I
put
all those files in one folder, is there any way how to generate a

list
of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the
conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of

the
filename before the file extension, and thus I had to make the

output
file
something fixed, which I subsequently have to rename. I know "%1"

refers
to
the file that the action is taken on. If the file is, say, "xxx.wp",

is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan










  #16  
Old June 25th 04, 03:25 AM
Bill Blanton
external usenet poster
 
Posts: n/a
Default running many files through the same command

"Ivan Bútora" wrote in message ...

What I am trying to do is this. I want to be able to, in explorer,
right click on the file, select "convert" and have the file xxx.wp be
converted to xxx.602. Thus what I am doing is defining a custom action
called 'convert to .602' for all .wp files in View - Folder Options -
File types. As I said, my problem is actually already solved, since

the command that will do what I want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension,
how would I accomplish what I want, i.e. how would I refer to a
filename sans extension.


It's not very easy to parse strings with batch files, and there is no
command to return the base of a filename. You might want to
use windows scripting instead, which does have a method to
return a filename's base.

Copy/Paste/Save as convert.vbs (or whatever).

'''''''''''''''''''''''''''
Dim oFSO
Set oFSO=CreateObject("Scripting.FileSystemObject")
Dim oShell
Set oShell = wscript.CreateObject("WScript.Shell")

Dim aCmdArgs
Set aCmdArgs=wscript.arguments

If aCmdArgs.count 0 Then

For Each x In aCmdArgs
sBaseName = oFSO.GetBaseName(x)
sCmdline="pre602.exe /d:5 "+x+" "+sBaseName+".602"
MsgBox sCmdline
'oShell.Run sCmdline,1,TRUE
Next

End If

wscript.quit
'''''''''''''''''''''''''''

The reg entry would then be
wscript (pathto)\convert.vbs "%1"

The script as it is will just show a message box of the commandline
to be executed. If that tests okay, then delete the line containing
MsgBox sCmdline
and remove the starting quote character ( ' comment) from the line
oShell.Run sCmdline,1,TRUE

This should also work for multiple file selections.



  #17  
Old June 25th 04, 11:51 AM
Ivan Bútora
external usenet poster
 
Posts: n/a
Default running many files through the same command

Thanks, this worked fine as well. (Although I guess really I should =
learn something about windows scripting...)
One other thing I'm wondering while we're at this - when I select =
multiple files in explorer, and then perform the 'convert' action on =
those, multiple windows open, i.e. each one is done in its own DOS =
session. Would there be any way to do it so that when I select multiple =
files, they're all done in one DOS session?
Ivan


"Bill Blanton" wrote in message =
...
"Ivan B=FAtora" wrote in message =

...
=20
What I am trying to do is this. I want to be able to, in explorer,
right click on the file, select "convert" and have the file xxx.wp be
converted to xxx.602. Thus what I am doing is defining a custom =

action
called 'convert to .602' for all .wp files in View - Folder Options =

-
File types. As I said, my problem is actually already solved, since

the command that will do what I want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension,
how would I accomplish what I want, i.e. how would I refer to a
filename sans extension.

=20
It's not very easy to parse strings with batch files, and there is no
command to return the base of a filename. You might want to
use windows scripting instead, which does have a method to
return a filename's base.
=20
Copy/Paste/Save as convert.vbs (or whatever).
=20
'''''''''''''''''''''''''''
Dim oFSO
Set oFSO=3DCreateObject("Scripting.FileSystemObject")
Dim oShell
Set oShell =3D wscript.CreateObject("WScript.Shell")
=20
Dim aCmdArgs
Set aCmdArgs=3Dwscript.arguments
=20
If aCmdArgs.count 0 Then
=20
For Each x In aCmdArgs
sBaseName =3D oFSO.GetBaseName(x)
sCmdline=3D"pre602.exe /d:5 "+x+" "+sBaseName+".602"
MsgBox sCmdline
'oShell.Run sCmdline,1,TRUE
Next
=20
End If
=20
wscript.quit
'''''''''''''''''''''''''''
=20
The reg entry would then be
wscript (pathto)\convert.vbs "%1"
=20
The script as it is will just show a message box of the commandline
to be executed. If that tests okay, then delete the line containing
MsgBox sCmdline
and remove the starting quote character ( ' comment) from the line
oShell.Run sCmdline,1,TRUE
=20
This should also work for multiple file selections.
=20
=20

  #18  
Old June 26th 04, 03:40 AM
Bill Blanton
external usenet poster
 
Posts: n/a
Default running many files through the same command

Well, for that you'd probably need a batch file, unless your program
accepts multiple arguments. It's very difficult to call into a running DOS
VM command shell from outside the shell. (I don't know how, anyway)

Try this script. It creates a temporary bat file in %temp% with multiple
command lines, and then runs it.


Dim oFSO, oShell
Dim aCmdArgs
Dim sTempBatFile, sBaseName, sCmdline
Dim hDestFile, oDestTextStream

Set oFSO=CreateObject("Scripting.FileSystemObject")
Set oShell = wscript.CreateObject("WScript.Shell")

Const TEMP_DIR=2
Const WRITE_ONLY=2
Const ASCII=0

Set aCmdArgs=wscript.arguments

If aCmdArgs.count 0 Then

' ****this is one line****
sTempBatFile = oFSO.GetSpecialFolder(TEMP_DIR) & "\" & oFSO.GetBaseName(oFSO.GetTempName) & ".bat"

oFSO.CreateTextFile sTempBatFile

Set hDestFile=oFSO.GetFile(sTempBatFile)
Set oDestTextStream=hDestFile.OpenAsTextStream(WRITE_O NLY,ASCII)

oDestTextStream.WriteLine("@echo off")

For Each x In aCmdArgs
sBaseName = oFSO.GetBaseName(x)
sCmdline="pre602.exe /d:5 "+x+" "+sBaseName+".602"
oDestTextStream.WriteLine(sCmdline)
Next

oDestTextStream.WriteLine("pause")
oDestTextStream.WriteLine("cls")
oDestTextStream.Close

oShell.Run sTempBatFile,,TRUE

oFSO.DeleteFile(sTempBatFile)

End If

wscript.quit



"Ivan Bútora" wrote in message ...
Thanks, this worked fine as well. (Although I guess really I should learn something about windows scripting...)
One other thing I'm wondering while we're at this - when I select multiple files in explorer, and then perform the 'convert' action
on those, multiple windows open, i.e. each one is done in its own DOS session. Would there be any way to do it so that when I select
multiple files, they're all done in one DOS session?
Ivan


"Bill Blanton" wrote in message ...
"Ivan Bútora" wrote in message ...

What I am trying to do is this. I want to be able to, in explorer,
right click on the file, select "convert" and have the file xxx.wp be
converted to xxx.602. Thus what I am doing is defining a custom action
called 'convert to .602' for all .wp files in View - Folder Options -
File types. As I said, my problem is actually already solved, since

the command that will do what I want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used to
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension,
how would I accomplish what I want, i.e. how would I refer to a
filename sans extension.


It's not very easy to parse strings with batch files, and there is no
command to return the base of a filename. You might want to
use windows scripting instead, which does have a method to
return a filename's base.

Copy/Paste/Save as convert.vbs (or whatever).

'''''''''''''''''''''''''''
Dim oFSO
Set oFSO=CreateObject("Scripting.FileSystemObject")
Dim oShell
Set oShell = wscript.CreateObject("WScript.Shell")

Dim aCmdArgs
Set aCmdArgs=wscript.arguments

If aCmdArgs.count 0 Then

For Each x In aCmdArgs
sBaseName = oFSO.GetBaseName(x)
sCmdline="pre602.exe /d:5 "+x+" "+sBaseName+".602"
MsgBox sCmdline
'oShell.Run sCmdline,1,TRUE
Next

End If

wscript.quit
'''''''''''''''''''''''''''

The reg entry would then be
wscript (pathto)\convert.vbs "%1"

The script as it is will just show a message box of the commandline
to be executed. If that tests okay, then delete the line containing
MsgBox sCmdline
and remove the starting quote character ( ' comment) from the line
oShell.Run sCmdline,1,TRUE

This should also work for multiple file selections.





  #19  
Old June 26th 04, 04:14 AM
Bill Blanton
external usenet poster
 
Posts: n/a
Default running many files through the same command


"Bill Blanton" wrote in message ...
Well, for that you'd probably need a batch file, unless your program
accepts multiple arguments. It's very difficult to call into a running DOS
VM command shell from outside the shell. (I don't know how, anyway)


should read .."outside the VM"

...anyway here's docs for scripting, if you're interested.
http://msdn.microsoft.com/library/de...entid=28001169



  #20  
Old June 28th 04, 11:39 AM
Ivan Bútora
external usenet poster
 
Posts: n/a
Default running many files through the same command

Thanks for the response. I tried the script, but it still launched a =
separate window for each file. I should probably do some studying on =
scripting, but I don't have the time for that now.
I had one more question about batch files: Is there any way to refer to =
a file or folder without the full path. I find that "%1" puts in the =
full path of the file, but I need just the name. (this is not related to =
the conversion thing)

Ivan

P.S. I am having laser eye surgery now, so I won't be able to do =
anything with the computer for at least a week - thus, my response might =
be delayed.


"Bill Blanton" wrote in message =
...
Well, for that you'd probably need a batch file, unless your program
accepts multiple arguments. It's very difficult to call into a running =

DOS
VM command shell from outside the shell. (I don't know how, anyway)
=20
Try this script. It creates a temporary bat file in %temp% with =

multiple
command lines, and then runs it.
=20
=20
Dim oFSO, oShell
Dim aCmdArgs
Dim sTempBatFile, sBaseName, sCmdline
Dim hDestFile, oDestTextStream
=20
Set oFSO=3DCreateObject("Scripting.FileSystemObject")
Set oShell =3D wscript.CreateObject("WScript.Shell")
=20
Const TEMP_DIR=3D2
Const WRITE_ONLY=3D2
Const ASCII=3D0
=20
Set aCmdArgs=3Dwscript.arguments
=20
If aCmdArgs.count 0 Then
=20
' ****this is one line****
sTempBatFile =3D oFSO.GetSpecialFolder(TEMP_DIR) & "\" & =

oFSO.GetBaseName(oFSO.GetTempName) & ".bat"
=20
oFSO.CreateTextFile sTempBatFile
=20
Set hDestFile=3DoFSO.GetFile(sTempBatFile)
Set oDestTextStream=3DhDestFile.OpenAsTextStream(WRITE _ONLY,ASCII)
=20
oDestTextStream.WriteLine("@echo off")
=20
For Each x In aCmdArgs
sBaseName =3D oFSO.GetBaseName(x)
sCmdline=3D"pre602.exe /d:5 "+x+" "+sBaseName+".602"
oDestTextStream.WriteLine(sCmdline)
Next
=20
oDestTextStream.WriteLine("pause")
oDestTextStream.WriteLine("cls")
oDestTextStream.Close
=20
oShell.Run sTempBatFile,,TRUE
=20
oFSO.DeleteFile(sTempBatFile)
=20
End If
=20
wscript.quit
=20
=20
=20
"Ivan B=FAtora" wrote in message =

...
Thanks, this worked fine as well. (Although I guess really I should =

learn something about windows scripting...)
One other thing I'm wondering while we're at this - when I select =

multiple files in explorer, and then perform the 'convert' action
on those, multiple windows open, i.e. each one is done in its own DOS =

session. Would there be any way to do it so that when I select
multiple files, they're all done in one DOS session?
Ivan
=20
=20
"Bill Blanton" wrote in message =

...
"Ivan B=FAtora" wrote in message =

...

What I am trying to do is this. I want to be able to, in explorer,
right click on the file, select "convert" and have the file xxx.wp =

be
converted to xxx.602. Thus what I am doing is defining a custom =

action
called 'convert to .602' for all .wp files in View - Folder =

Options -
File types. As I said, my problem is actually already solved, =

since
the command that will do what I want is:

pre602.exe /d:5 %1 .602 (Edit action 'convert' - Application used =

to
perform action)

What I am asking now is, *if* pre602.exe was not smart enough to
automatically put in the part of the filename before the extension,
how would I accomplish what I want, i.e. how would I refer to a
filename sans extension.


It's not very easy to parse strings with batch files, and there is =

no
command to return the base of a filename. You might want to
use windows scripting instead, which does have a method to
return a filename's base.

Copy/Paste/Save as convert.vbs (or whatever).

'''''''''''''''''''''''''''
Dim oFSO
Set oFSO=3DCreateObject("Scripting.FileSystemObject")
Dim oShell
Set oShell =3D wscript.CreateObject("WScript.Shell")

Dim aCmdArgs
Set aCmdArgs=3Dwscript.arguments

If aCmdArgs.count 0 Then

For Each x In aCmdArgs
sBaseName =3D oFSO.GetBaseName(x)
sCmdline=3D"pre602.exe /d:5 "+x+" "+sBaseName+".602"
MsgBox sCmdline
'oShell.Run sCmdline,1,TRUE
Next

End If

wscript.quit
'''''''''''''''''''''''''''

The reg entry would then be
wscript (pathto)\convert.vbs "%1"

The script as it is will just show a message box of the commandline
to be executed. If that tests okay, then delete the line containing
MsgBox sCmdline
and remove the starting quote character ( ' comment) from the line
oShell.Run sCmdline,1,TRUE

This should also work for multiple file selections.



=20

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recovering files DAJ General 3 June 21st 04 05:39 AM
C Windows profiles user application data LuckyStrike General 24 June 18th 04 12:13 AM
Lost access to Windows Help Files overzealous General 2 June 14th 04 10:08 PM
Safely delete .exe files in "TEMP" folder?? CNJ General 2 June 14th 04 06:16 AM
Question about C:\Windows\Temp files JR Berry General 6 June 7th 04 09:32 PM


All times are GMT +1. The time now is 11:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Win98banter.
The comments are property of their posters.