21887Re: [Clip] Manage Forwarding Lists
- Jul 5, 2011Alex, I think you are selling NoteTab clips short. "Clips does not have
subroutines as programming languages
do" you can call other clips or even create simple functions. I have
done what you said not to do, though I will admit it can be harder to
Ray, below is a start on automation of the first step. I kept the first
step and modified the lines. As I don't have the files it is untested.
You can add more on to your clip or repeat the loop with another sub clip.
; This is main control loop
; the following line calls the LoopA clip with Ray's clip as the clip to
^!clip "LoopA" csvgetfiles
;The LoopA clip will in turn call csvgetfiles with each file found in
"_csv" clip below
; I keep variables separate so the main clip is simpler to read.
^!set %oldpath%=D:\AAI\CompComtee\Forwarding Lists\HC\
; This is the source for the file names
; This is my loop that I use all the time. When I am not using regular
expressions ;-) Have to keep in with the majority RE folk.
; It is just a tailored version of the loop found in the "Quick List" F6.
^!If ^%Indexa% > ^%LoopCounta% EndLoopa
^!If "^%arrayA^%indexA%%"="" LoopStarta
^!clip "^&" ^%arraya^%indexa%%
; Ray's clip modified to be a subroutine of the "Start" clip
; the following line makes a variable of the parameter passed to it. I
did it for easier readability.
^!IfFalse ^$IsAltKeyDown$ RUN
^!Info [L]description of what this clip does, outputs, inputs, etc.
;optional Goto END is advisable with destructive clips
^!IfFileExist "^%oldpath%^%file%" DoesNewFileExist NoOldFile
^!IfFileExist "^%newpath%^%file%" BothFilesExist NoNewFile
^!Save AS "^%oldpath%^%file%OLD.csv"
^!Save AS "^%newpath%^%file%NEW.csv"
^!INFO Two files are ready for comparison.
^!INFO Can't find ^%oldpath%^%file%^pAborting
^!INFO Can't find ^%newpath%^%file%^pAborting
Hope it helps.
On 5/07/2011 10:04 AM, Axel Berger wrote:
> Ray Shapp wrote:
> > I think it might be best if the six file names were stored
> > in an array, and an integrated clip were to loop six times.
> Possibly, but I'd choose a different approach. As you have to write down
> those six paths anyway, I'd make do without a formal loop and write the
> main code linearly for all six. Arrays and indices only invite hard to
> find mistakes. Clips does not have subroutines as programming languages
> do, it lacks the RETURN command, but unless I'm mistaken you can use
> what FORTRAN calls "assigned gotos", i.e:
> ^!Goto ^%return%
> So your main part would mainly consist of ^!Set directives and after
> setting the proper return points you call "subroutines" with ^!Goto.
> > Also, how does one force "save as" if the file name
> > is already in use?
> Save or close the offending second document first. You can swap the
> active focus with ^!Document [FIRST|LAST|NEXT|PREV]
[Non-text portions of this message have been removed]
- << Previous post in topic Next post in topic >>