Loading ...
Sorry, an error occurred while loading the content.

revised file comparison and issues

Expand Messages
  • Tom
    hello all, i made some changes to the compare two files clip that comes with notetab in order to tailor it to my needs (revised clip below). here are the
    Message 1 of 2 , Jul 1, 2001
    • 0 Attachment
      hello all,

      i made some changes to the "compare two files" clip that comes with
      notetab in order to tailor it to my needs (revised clip below). here
      are the main changes as i recall them:

      1. by default the current file and the file in the next tab are
      compared (this way i just open the files i want to compare in
      notetab, double-click on the compare clip and hit enter)

      2. if either file 1 or file 2 is invalid, the clip brings up the
      wizard again instead of exiting

      3. since i only compare text files, the "compare file as ascii text"
      option was removed and the switch (/l) was hardcoded into the command
      line; i added a new option, "compress white space" (/w)

      4. instead of saving the differences into a third file, the
      differences are written to a temporary file to make it behave more
      like a cvs or perforce merge conflict resolution

      while revising the clip i came upon two issues...

      first, is there a better way to get the next/previous tab's file
      name? i'll be the first to admit that ^$GetDocName(^$Calc
      (^$GetDocIndex$+1)$)$ is not the most elegant solution in the world.

      second of all, i notice that the temporary files are not being
      deleted, even when i exit out of windows. is anyone else experiencing
      this? (i'm using win98se.) better yet, does anyone know how to copy
      DOS output to the windows clipboard? this way, you can just paste the
      clipboard data into a new document and avoid doing any i/o operations
      at all.

      thanks in advance,
      tom


      ~~ begin clip ~~

      H="Compare two files"
      ;The Clip uses the DOS command "fc" to compare the differences
      between two disk files. If necessary, NoteTab saves a temporary copy
      of the current document before doing the comparison

      ;Define the delimiter for the checkbox field
      ^!SetListDelimiter " "

      :Begin
      ;Prompt for file names and option settings used to control the
      comparisor
      ^!Set %File1%=^?{(T=O)Compare file=^**}; %File2%=^?{(T=O)With
      file=^$GetDocName(^$Calc(^$GetDocIndex$+1)$)$}; %Options%=^?{(T=A;H=5)
      Switches=Display only first and last lines for each set of
      differences^=/a|Ignore character case^=/c|Display line
      numbers^=/n|_Do not expand tabs to spaces^=/t|Compress white space
      (tabs and spaces)^=/w}
      ;Bring up the Wizard again if invalid file is specified
      ^!IfFileExist ^%File1% Skip_2
      ^!Info File 1 is invalid.
      ^!Goto Begin
      ^!IfFileExist ^%File2% Skip_2
      ^!Info File 2 is invalid.
      ^!Goto Begin

      ;Set output file name in a variable
      ^!Set %OutputFile%=^$GetTempFile$
      ;Convert long file names to DOS short names
      ^!Set %File1%=^$GetShort(^%File1%)$
      ^!Set %File2%=^$GetShort(^%File2%)$
      ;Copy the file path in a variable
      ^!Set %Path%=^$GetPath(^%File1%)$
      ;If both files being compared are in the same directory, remove the
      path from the second file name
      ^!IfSame ^%Path% ^$GetPath(^%File2%)$ Next ELSE Skip
      ^!Set %File2%=^$GetFileName(^%File2%)$

      ;Create and save the command line in a variable
      ^!Set %Command%=fc /l ^%Options% ^$GetFileName(^%File1%)$ ^%File2% >
      ^%OutputFile%
      ;Show warning if command line exceeds the normal DOS length limit
      ^!If ^$StrSize(^%Command%)$ > 127 Warning ELSE Execute

      :Warning
      ^!Info [L]WARNING: The DOS command about to be executed is very long,
      so it might not work. In case of failure, try to shorten the
      path/file names of the documents you want to compare.

      :Execute
      ;Set the default path
      ^!ChDir ^%Path%
      ;Execute the fc command with all parameters
      ^!CmdShow Minimize
      ^!Dos ^%Command%
      ;Wait until the command has finished executing
      ^!Wait
      ;Open the output file if it exists or show error message
      ^!IfFileExist ^%OutputFile% Next ELSE Error
      ^!Open ^%OutputFile%
      ^!Goto End

      :Error
      ^!Info File comparison failed.
    • Jim Hall
      Tom, ... FWIW I don t know if it is the same scenario or not but I recently had a similar situation with a Clip (in Win98SE) wherein it Appeared that my temp
      Message 2 of 2 , Jul 2, 2001
      • 0 Attachment
        Tom,

        At 06:56 AM 7/2/01 +0000, you wrote:
        >second of all, i notice that the temporary files are not being
        >deleted, even when i exit out of windows. is anyone else experiencing
        >this? (i'm using win98se.)

        FWIW

        I don't know if it is the same scenario or not but I recently had a similar
        situation with a Clip (in Win98SE) wherein it "Appeared" that my temp files
        were not getting deleted until I refreshed my Explorer window and then they
        were in fact gone.

        NoteTab also thought that they were still there until after the refresh so
        in the clip I changed to another directory and then back to the working
        directory which seemed to accomplish the same thing but within the clip itself.

        In any case NoteTab didn't think they were there anymore.


        Regards,

        Jim
      Your message has been successfully submitted and would be delivered to recipients shortly.