[comp.sys.amiga] Command sequence help needed...

koleman@pnet51.orb.mn.org (Kurt Koller) (05/25/90)

thomas@eleazar.dartmouth.edu (Thomas Summerall) writes:
>Hi, I'm trying to write a command sequence that will rename single frames saved
>from a deluxepaint animation so they can be loaded and compressed by SA4D.
>Dpaint saves each frame as framename001 framename002, etc...   SA4D needs
>framename.001.image framename.002.image, etc...
>
>So, I want to make a command "chanim" that will take as arguments the name
>of the anim and the number of frames, and convert the names.  The looping works
>fine using an environment variable and the skip function.  The problem is
>appending the current value of the environment variable to the name. The
>statement looks like this:
>
>.key animname,animnum
>setenv temp 1
>...
>(looping stuff deleted)
>...
>rename <animname>00<env:temp> to <animname>.00<env:temp>.image
>...
>(increment temp and loop)
>
>I get an error because the sequence looks for a file named "animname00"
>can I use my counter as part of the file name?  If not, how can this be done?
>Am I missing the obvious?

If you have the "move" command, it's really simple.  I think it's an ARP deal,
and if it isn't, it's very PD.  If you had all the .00x files in one
directory, with nothing else, it would require: 

move * *.image
 
If you had other stuff in the directory, something else would have to be
added, like:
 
move *.0?? *.image
 
The top example I use always, like to append .pic to a bunch of pictures, etc.
 The bottom statement I haven't tried, but it should work (maybe) .
 
>
>Thanks...
>Thomas Summerall
>thomas@eleazar.dartmouth.edu

==============================================================
|      | Kurt Koller - Graphic MicroSystems - (612) 228-0127 |
|   // |  UUCP: {amdahl!bungia, crash}!orbit!pnet51!koleman  |
| \X/  |  INET: koleman@pnet51.orb.mn.org                    |
|      |  ARPA: crash!orbit!pnet51!koleman@nosc.mil          |
==============================================================
"I do not feel pleasure.  I am only an android."

peterk@cbmger.UUCP (Peter Kittel GERMANY) (06/07/90)

In article <2500@orbit.cts.com> koleman@pnet51.orb.mn.org (Kurt Koller) writes:
>thomas@eleazar.dartmouth.edu (Thomas Summerall) writes:
>>Hi, I'm trying to write a command sequence that will rename single frames saved
>>from a deluxepaint animation so they can be loaded and compressed by SA4D.
>>Dpaint saves each frame as framename001 framename002, etc...   SA4D needs
>>framename.001.image framename.002.image, etc...
>>
>>So, I want to make a command "chanim" that will take as arguments the name
>>of the anim and the number of frames, and convert the names.  The looping works
>>fine using an environment variable and the skip function.  The problem is
>>appending the current value of the environment variable to the name. The
>>statement looks like this:
>>
>>.key animname,animnum
>>setenv temp 1
>>...
>>(looping stuff deleted)
>>...
>>rename <animname>00<env:temp> to <animname>.00<env:temp>.image
>>...
>>(increment temp and loop)
>>
>>I get an error because the sequence looks for a file named "animname00"
>>can I use my counter as part of the file name?  If not, how can this be done?
>>Am I missing the obvious?
>
There is no other way,  you must build an own batch file that will contain
all those rename statements. You may do this via excessive use of echo
commands redirected to a file, say, in RAM: disk. Use >> for redirection
for all the lines following the 1st one so to append to that file. This
all goes in your loop. Finally, when you exit the loop, you just execute
the newly generated batch file and delete it afterwards to close
gracefully. Done.

Hope that will help you,
Regards, Dr. Peter Kittel

waggoner@dtg.nsc.com (Mark Waggoner) (06/09/90)

Not sure about the quoting here, but it's non-controversial:

In article <191@cbmger.UUCP> peterk@cbmger.UUCP (Peter Kittel GERMANY) writes:
>In article <2500@orbit.cts.com> koleman@pnet51.orb.mn.org (Kurt Koller) writes:
>>Hi, I'm trying to write a command sequence that will rename single frames saved
>>from a deluxepaint animation so they can be loaded and compressed by SA4D.
>>Dpaint saves each frame as framename001 framename002, etc...   SA4D needs
>>framename.001.image framename.002.image, etc...
>>
>>So, I want to make a command "chanim" that will take as arguments the name
>>of the anim and the number of frames, and convert the names.  The looping works

conventional "execute" script deleted

>There is no other way,  you must build an own batch file that will contain
>all those rename statements. You may do this via excessive use of echo
...
>Hope that will help you,
>Regards, Dr. Peter Kittel

Since you are using a conventional execute script, I assume you don't
have ARexx.  If you did, however, this would be fairly easy....
The following code has not been tested in any way and is not the most
generic implementation, but you can get the idea.

/* Rename  DP files for SA */
parse arg basename count
do i = 1 to count
  'RENAME' basename || i || ' TO ' || basename || '.' || count || '.image'
end
exit



-- 
Mark Waggoner  Santa Clara, CA    (408) 721-6306         waggoner@dtg.nsc.com 
 Unofficially representing National Semiconductor Local Area Networks Group
                   Officially misrepresenting myself.

will@cunixf.cc.columbia.edu (William Chou) (06/10/90)

In article <417@icebox.nsc.com> waggoner@icebox.UUCP (Mark Waggoner) writes:
>Not sure about the quoting here, but it's non-controversial:
>
>In article <191@cbmger.UUCP> peterk@cbmger.UUCP (Peter Kittel GERMANY) writes:
>>In article <2500@orbit.cts.com> koleman@pnet51.orb.mn.org (Kurt Koller) writes:
>>>Hi, I'm trying to write a command sequence that will rename single frames saved
>>>from a deluxepaint animation so they can be loaded and compressed by SA4D.
>>>Dpaint saves each frame as framename001 framename002, etc...   SA4D needs
>>>framename.001.image framename.002.image, etc...
>>>
>>>So, I want to make a command "chanim" that will take as arguments the name
>>>of the anim and the number of frames, and convert the names.  The looping works
>
>conventional "execute" script deleted
>
>>There is no other way,  you must build an own batch file that will contain
>>all those rename statements. You may do this via excessive use of echo
>...
>>Hope that will help you,
>>Regards, Dr. Peter Kittel
>
>Since you are using a conventional execute script, I assume you don't
>have ARexx.  If you did, however, this would be fairly easy....
>The following code has not been tested in any way and is not the most
>generic implementation, but you can get the idea.
>
>/* Rename  DP files for SA */
>parse arg basename count
>do i = 1 to count
>  'RENAME' basename || i || ' TO ' || basename || '.' || count || '.image'
>end
>exit
>
>
>
>-- 
>Mark Waggoner  Santa Clara, CA    (408) 721-6306         waggoner@dtg.nsc.com 
> Unofficially representing National Semiconductor Local Area Networks Group
>                   Officially misrepresenting myself.

   An easier way to rename multiple files is to use ARP's move command.
		Just    Move  framename*  framename.*.image


   The wildcard can be used as a variable to hold a string, kindof.
	Something that I wish the UNIX version had!
		(Just say no to shell scripts! :-)

===============================================================================
    // "Only Amigas    Be Excellent to Yourself,        And most of all...
\\ //     Make It   And Be Excellent to Eachother.  Be Excellent to Your Amiga!
 \X/     Possible"          - Bill & Ted             will@cunixf.columbia.edu
===============================================================================
===============================================================================
    // "Only Amigas    Be Excellent to Yourself,        And most of all...
\\ //     Make It   And Be Excellent to Eachother.  Be Excellent to Your Amiga!
 \X/     Possible"          - Bill & Ted             will@cunixf.columbia.edu