This is probably a very silly question!

I am busy tidying up my kixtart scripts and I can't see how to make a UDF run if it meets a specific condition.

For example my coding to compare file times and copy from source if both files do not have the same time is as follows:

main script

 Code:
filetime ("d:\startup\source\", "D:\startup\destination\", "test.ini", SValue, "Source filetime test Ini file"

UDF function is as follows
 Code:
;================================================================================================
;   This function checks the file time and date and updates files if both files are not the same time
;================================================================================================

Function filetime($Installs, $DestDir, $File, $Value, $ProgorProfile)

	  $Value = COMPAREFILETIMES ($Installs + $File, $Destdir + $File)
	  if $Value <> 0
 ? "Attempting to install $ProgorProfile"
      ? "Copying Files to Install $ProgorProfile"
    copy $Installs + $File $DestDir + $File
  Else
    ? "$ProgorProfile Already installed"
	  Endif
EndFunction

Now lets say that I have another file in the main script that I want to comparefiletimes, but I want to copy the file if the source file is newer than the destination file and I want to delete the destination subdirectory and files and recreate the subdirectory.

I can easily copy the function and replace if $Value <> 0 with if $Value = 1 or $Value = -3 and add a RD $Destdir /S and MD $DestDir code, but I am trying to get rid of functions that are practically identical apart from one/two lines.

I have the same problem with another function where the function is reading a file and then either installing a printer based on names from that file or editing the registry based on the names or setting the default printer based on the names in the file being read. So I have four or five different functions reading a file and doing something slightly different with the results of the read. I don't think I can create two different functions as the readline part of the function has a loop so I need to stay within the function.

Or would you recommend that I have one line of code in the main script and a dozen different UDF's that are practically identical apart from one or two lines?