Re: [Clip] Re: Joining corresponding lines of two files
- Hello Bruce,
Welcome to the club of confusion, frustration and (sometimes) elation of clips.
Notetab's Help file can be incomplete and confusing but hang in there. It is
sometimes useful or necessary to write short test clips just to understand how
a command or function actually works. A good use for your clipbar.
The confusion in this specific case comes from the ^$GetDocumentPath$ and
^$GetFileText$ functions. Notice that $GDP$ has no argument but $GFT$ does.
^$GetDocumentPath$ returns the fully qualified path of an OPEN DOCUMENT
(named File1.TXT & File2.TXT in the example), while ^$GetFileText$(...)
the text from the DISK FILE specified by the fully qualified file name in
So ^$GetFileText(^$GetDocumentPath$File1.TXT)$ first gets the fully
for the open doc File1.TXT, prepends it to File1.TXT, then passes the result to
^$GetFileText()$ to return the document text AS IT EXISTS ON THE DISK.
Note that this may be different than the text in Notetab if it has been
If you are dealing with open docs, a better and less convoluted approach
to use the ^$GetDocIndex$ & ^$GetDocIndex(Name)$ functions with ^!SetDocIndex
to navigate to and from open doc tabs, and then use ^!Select All and
to retrieve the subject text.
^!Set ^!SetListDelimiter ^%NL%
To place your text onto a disk there are a number of methods:
If you want to save the entire open doc in the current tab, use
^!Save or ^!Save AS as suggested by dideom.
Alternately, you can write text directly to a file as you generate it:
^!InsertText ^%Left^%i%% ^%Right^%i%%^%NL%
^!AppendToFile "FileName" ^%Left^%i%% ^%Right^%i%%^%NL%
where "FileName" is the fully qualified name of your target file.
Any job worth doing right the first time is worth doing over
At 09/05/2011 10:00, you wrote:
> > I have the need to join corresponding lines from two files, one after
> the other. I have
> > Have a look at the straightforward solutions offered in response to
> this recent similar inquiry:
>Thanks for the pointer. I have retrieved Flo's version of a clip by Art:
>; Strip empty records from end of array (by courtesy of Eb)
>^!If "^%Left^%Left0%%" <> "^%Empty%" Skip Else ^!Dec %Left0%
>^!If ^%i% > ^%Left0% End
>^!InsertText ^%Left^%i%% ^%Right^%i%%^%NL%
>I think I have deciphered all but
>^$GetDocumentPath$Â --Â Returns the path for NoteTab document files
>(always ends with backslash).
>Mustn't I have the corresponding files open in NoteTab? Surely NoteTab
>doesn't search all of my disks
>for File1.TXT . Suppose I had several such files.
>I haven't been able to find out how to save the file (with a new name)
>upon completion of the clip.
- Thanks both to Art Kocsis and to diodeom for the tips. I've had success now with
^!If "^%Left^%Left0%%" <> "^%Empty%" Skip Else ^!Dec %Left0%
^!If ^%i% > ^%Left0% Done
^!Save As D:\ownDevelopment\NTClips\rename.bat
^!Set %Left%=; %Right%=; %i%=
which I can follow (Yippee!). This does not require that before.txt and after.txt be open.
It saves the results in rename.bat but also inserts the lines into the currently open file.
Can the labels Loop and Done freely 'choosable'?
I will have to study the rest of your hints. As you can see, I generate a batch file to
be run under cmd.exe . All is well unless my files contain German Umlaute (ä ö ü). There
is a discrepancy between Windows and cmd.exe .
- bruce.somers@... wrote:
>Check out the modest restrictions listed in Help => Help on Clip Programming => Labels.
> Can the labels Loop and Done freely 'choosable'?
Thanks, got that.