Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: call UDFs
MAIN
CALL("C:\subroutines.WBC","UpperP = SomeFunc(param1)") . .subroutines.WBC
#DefineFunction SomeFunc(param1) param2 = StrUpper(param1) return param2 #EndFunctionI could not find examples of this sort of thing. Also, the documentation says that the function has to be defined before being used a first time. How do you do that in another file? Do you make a call to the subroutine.WBC where all the #DefinFunctions are? Any examples will help greatly.
Main script:
path = FilePath(IntControl (1004, 0, 0, 0, 0)) Call(strcat(path,"library.wbt"),"") ;Now setup the vars and use the UDF now=TimeYmdHms() doy=DayOfYear(now) dow=DayOfWeek(now) Message(strcat("Day of Year: ",doy),strcat("Day of week: ",dow)) ldm=LastDayOfMonth(now) Message("Last day of this month",ldm) exitCalled WBC:
;Library of UDFs #DefineFunction DayOfYear(ToDate) ThisYear=ItemExtract(1,ToDate,":") JanFirst="%thisyear%:01:01:00:00:00" JanFirstJulian=TimeJulianDay(JanFirst) ToJulian=TimeJulianDay(ToDate) doy=ToJulian-JanFirstJulian+1 return (doy) #EndFunction #DefineFunction DayOfWeek(ToDate) ToJulian=TimeJulianDay(ToDate) dayofweekcode=(ToJulian+5) mod 7 day=ItemExtract(dayofweekcode+1, "Sun Mon Tue Wed Thu Fri Sat", " ") return(day) #endfunction #DefineFunction LastDayOfMonth(today) nextmonth=TimeAdd(today,"0000:01:00:00:00:00") firstofnextmonth=strcat(strsub(nextmonth,1,8),"01:00:00:00") lastdayofthismonth=TimeSubtract(firstofnextmonth,"0000:00:01:00:00:00") return(lastdayofthismonth) #endfunction return ;required
Article ID: W14987
File Created: 2001:11:08:12:41:18
Last Updated: 2001:11:08:12:41:18