WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

List Administrative Shares Freespace in HTML



AddExtender("WWWNT34i.DLL")
AddExtender("WWHUG34I.DLL")
AddExtender("wwint34i.dll")



; ********************************************************************************
; *** Establish if script is running in debug (script) mode or is a compiled EXE
; ********************************************************************************
state=rtStatus()
  If state==1 then  home=dirhome()                             ; compiled EXE
  If state==10 then home=FilePath(IntControl(1004,0,0,0,0))    ; debug mode

 

; ************************************************************************************
; *** In their order: Enable close command from icon.
; ***                 Allow quiet termination of this app at Windows shutdown.
;***                  Add system menus to dialog box.
;***                  Hide the Winbatch icon from the taskbar. 
; ************************************************************************************
IntControl (1008, 1, 0, 0, 0)
IntControl(12, 5, 0, 0, 0)
IntControl(49,1,99,0,0)
; IntControl (1002, 0, 0, 0, 0)




; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
;;; UDF to convert decimal to Hex for color definitions  ( 255|255|255  ===> RRGGBB )
#DefineFunction UDF_Dec2Hex(Decimal)
   If Decimal==0 then Decimal="128|128|128"
   If Decimal=="DEFAULT" then Decimal ="192|192|192"
   
   Hex=""
   A=1

While A <= 3
   decValue=ItemExtract(A,Decimal, "|")
   decCount=StrCharCount(decValue)
   If decCount==1 
    decValue=StrFixLeft(decValue,"0", 2)
    Hex=StrCat(Hex,decValue)
    A=A+1
    continue
   EndIf

   IsZero=@TRUE
   str="0123456789ABCDEF"
   hexValue=""
   
   for x=7 to 0 by -1
       nibble= (decValue >> (x*4)) & 15
       if nibble==0 && IsZero==@TRUE then continue
       IsZero=@FALSE
       hexValue=strcat(hexValue,Strsub(str,nibble+1,1))
   next
     
   Hex=StrCat(Hex,hexValue)
   A=A+1
EndWhile

   return(hex)
#EndFunction  ; UDF_Dec2Hex
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################




; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
;;; UDF to set color depending on the drive with the least amount of free space.
#DefineFunction UDF_SetColor(least_MB, inifile)

   critical_bkgd_color=UDF_Dec2Hex(IniReadPvt("PREFERENCES", "critical_bkgd_color", "", inifile) )
   attention_bkgd_color=UDF_Dec2Hex(IniReadPvt("PREFERENCES", "attention_bkgd_color", "", inifile) )
   acceptable_bkgd_color=UDF_Dec2Hex(IniReadPvt("PREFERENCES", "acceptable_bkgd_color", "", inifile) )
   crit_thresh=IniReadPvt ("THRESHOLDS", "critical_space_free", "", inifile)
   att_thresh=IniReadPvt ("THRESHOLDS", "attention_space_free", "", inifile)

   If least_MB > att_thresh then hex_color=acceptable_bkgd_color
   If least_MB <= att_thresh then hex_color=attention_bkgd_color
   If least_MB <= crit_thresh then hex_color=critical_bkgd_color
   ; If 'least_MB' is actually a returned error, set the hex color to red.
   If IsNumber(least_MB)==@FALSE then hex_color=critical_bkgd_color

   Return(hex_color)
#EndFunction ; UDF_SetColor
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################




; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
;;; UDF for discovering free space on drive partitions.
#DefineFunction UDF_Sizer(share_list, server_id)

   least_free_space=100000000   ;start out very large and  work it down as we go.
   drive_stats=""
   Legal_drive_names="C$,D$,E$,F$,G$,H$,I$,J$,K$,L$,M$,N$,O$,P$,Q$,R$,S$,T$,U$,V$,W$,X$,Y$,Z$"
   share_list_count=ItemCount(share_list, @TAB)

   ;*** Extract and work on each share name for this server.
   For XX = 1 to share_list_count
      share_name=ITemExtract(XX, share_list, @TAB)

      ;*** Make sure it's a legitimate system root share.
      If StrIndexNc(Legal_drive_names, share_name, 1, @FWDSCAN) != 0
          free_space=DiskFree(StrCat("\\", server_id, "\", share_name), 1)

         ;*** Use hugemath function in case of numbers over 2 GB.
         huge_Decimal (0)
         free_space=huge_Divide(free_space, (1024*1024))
            If free_space < least_free_space then least_free_space=free_space
    
         ;*** String elements together
         drive_stats=StrCat(drive_stats, "|", share_name, "=",  free_space)
      EndIf

   Next XX  

   ;*** Replace '$' with ':' in the list
   drive_stats=StrReplace(drive_stats, "$", ":")

   ;*** Insert the least amount of free space found into 2nd position in the list.
   drive_stats=ItemInsert(least_free_space, 1, drive_stats, "|")

   Return(drive_stats)

#EndFunction ; UDF_Sizer
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################




; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
;*** UDF for changing background color and  MB threshold preferences.
#DefineFunction UDF_Prefs(inifile, red, yellow, green)

 ;** Get current colors & thresholds
 While @TRUE
   drop(color_var)
   critical_bkgd_color=IniReadPvt("PREFERENCES", "critical_bkgd_color", "", inifile)
   attention_bkgd_color=IniReadPvt("PREFERENCES", "attention_bkgd_color", "", inifile)
   acceptable_bkgd_color=IniReadPvt("PREFERENCES", "acceptable_bkgd_color", "", inifile)
   crit_thresh=IniReadPvt ("THRESHOLDS", "critical_space_free", "", inifile)
   att_thresh=IniReadPvt ("THRESHOLDS", "attention_space_free", "", inifile)
   crit_reset="1|10000|10"
   att_reset="1|10000|10"


   ;*** Trun off system menus
   IntControl (49, 0, 0, 0, 0)

   PrefsDialogFormat=`WWWDLGED,6.1`

   PrefsDialogCaption=`Set Preferences`
   PrefsDialogX=-02
   PrefsDialogY=-01
   PrefsDialogWidth=164
   PrefsDialogHeight=208
   PrefsDialogNumControls=013
   PrefsDialogProcedure=`DEFAULT`
   PrefsDialogFont=`DEFAULT`
   PrefsDialogTextColor=`DEFAULT`
   PrefsDialogBackground=`DEFAULT,DEFAULT`
   PrefsDialogConfig=0

   PrefsDialog001=`023,183,036,012,PUSHBUTTON,DEFAULT,"Reset",1,1,32,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog002=`097,183,036,012,PUSHBUTTON,DEFAULT,"Cancel",2,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog003=`145,191,012,012,RADIOBUTTON,color_var,DEFAULT,1,1,3,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog004=`021,015,118,012,RADIOBUTTON,color_var,"Change 'Critical Warning' background color",2,2,DEFAULT,DEFAULT,DEFAULT,%critical_bkgd_color%`
   PrefsDialog005=`021,037,118,012,RADIOBUTTON,color_var,"Change 'Attention' background color",3,3,DEFAULT,DEFAULT,DEFAULT,%attention_bkgd_color%`
   PrefsDialog006=`021,059,118,012,RADIOBUTTON,color_var,"Change 'Acceptable' background color",4,4,DEFAULT,DEFAULT,DEFAULT,%acceptable_bkgd_color%`
   PrefsDialog007=`021,081,118,012,RADIOBUTTON,color_var,"Set default background colors",5,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog008=`013,005,132,098,GROUPBOX,DEFAULT,"Select a radio button, click 'Reset'",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog009=`029,141,024,018,SPINNER,crit_reset,%crit_thresh%,DEFAULT,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog010=`021,117,050,020,STATICTEXT,DEFAULT,"Set the 'critical' threshold warning limit",DEFAULT,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog011=`091,141,024,018,SPINNER,att_reset,%att_thresh%,DEFAULT,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog012=`083,117,050,020,STATICTEXT,DEFAULT,"Set the 'attention' threshold warning limit",DEFAULT,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
   PrefsDialog013=`013,105,132,064,GROUPBOX,DEFAULT,"Change MB threshold, click 'Reset'",DEFAULT,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

   ButtonPushed=Dialog("PrefsDialog")

   If buttonpushed==2 then Return(-1)   ; 'Cancel' button

   ;*** Discover if a radio putton was selected.
   ;*** Radio 1 is hidden & disabled, but defaults to it so none
   ;*** of the selectable radios are highlighted.
   Switch color_var

   Case 5
      iniWritePvt("PREFERENCES", "critical_bkgd_color", red, inifile)
      iniWritePvt("PREFERENCES", "attention_bkgd_color", yellow, inifile)
      iniWritePvt("PREFERENCES", "acceptable_bkgd_color", green, inifile)
      ;Force ini write to disk
      IniWritePvt("","","",inifile)
      Break

   Case 4
   Case 3
   Case 2
      If color_var==4 then choice="acceptable_bkgd_color"
      If color_var==3 then choice="attention_bkgd_color"
      If color_var==2 then choice="critical_bkgd_color" 
         decimal=IniReadPvt("PREFERENCES", choice, "", inifile)
         hex=UDF_Dec2Hex(decimal)  ;obtain the hex value from the UDF_Dec2Hex Function
         color=AskColor("#%hex%", "", 1)
         iniWritePvt("PREFERENCES", choice, color, inifile)
         ;Force ini write to disk
         IniWritePvt("","","",inifile)
      Break

   Case 1   ;Assume a spinner was changed to reset thresholds ('cause none of the viewable radios were selected)
     ; make sure 'critical' is not set to more than 'attention'
     If crit_reset >= att_reset
        message("No no", "Critical threshold cannot be more than Attention threshold.")
        break
     EndIf
     IniWritePvt ("THRESHOLDS", "critical_space_free", crit_reset, inifile)
     IniWritePvt ("THRESHOLDS", "attention_space_free", att_reset, inifile)
     ;Force ini write to disk
     IniWritePvt("","","",inifile)
     Break

   EndSwitch

 EndWhile ; Return to top of dialog  

#EndFunction ; UDF_Prefs
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################



; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
#DefineSubRoutine startMSIE(url)
   Browser = ObjectOpen("InternetExplorer.Application")
   Browser.addressbar = @FALSE
   Browser.statusbar = @FALSE
   Browser.menubar = @FALSE
   Browser.toolbar = @FALSE
   browser.visible = @TRUE
   browser.navigate(url)
   ; wait until page loads...
   While Browser.busy || Browser.readystate <> 4
      TimeDelay(0.5)
   EndWhile
   ; setup the document object...
   browserDoc = Browser.Document
   all = browserdoc.all
   Return(browser)
#EndSubRoutine
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################




; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
; *** UDF to generate server 'buttons' table.
#DefineFunction UDF_BuildHTMLInputTable(inputList)
;*** Colors have been passed here in Hex format.
;*** build an INPUT for each server...
   InputTable = StrCat(`<TABLE border="0" width="200">`, @CRLF)
   For xx = 1 To ItemCount(inputList, @TAB)
      ThisLine = ItemExtract(xx, inputList, @TAB)
      server_name=ItemExtract(1, ThisLine, "|")
      bkgd_color=ItemExtract(2, ThisLine, "|")
      input = StrCat(`<INPUT type="button" style="background-color: #%bkgd_color%" onclick="ServerSpan.innerText='`, Server_Name, `'" value="`, Server_Name, `" >`)
      InputTable = StrCat(InputTable, `<tr><td>`, input, `</td></tr>`, @CRLF)
   Next
   ;add an EXIT button...
   InputTable = StrCat(InputTable, `<tr><td><INPUT type="button" onclick="ServerSpan.innerText='EXIT'" value="  EXIT  "></td></tr>`, @CRLF)
   InputTable = StrCat(InputTable, `</TABLE>`)

   Return(InputTable)
#EndFunction ;UDF_BuildHTMLInputTable 
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################




; ####################################################################################
; ////////////////////////////////////////////////////////////////////////////////////
;*** UDF to create master table with all server data.
#DefineFunction UDF_BuildHTMLDataTable(list, id, inifile)
;   build a table for each server and place the ID as the CAPTION...
   DataTable = StrCat(`<TABLE class="frame" id="`, id, `" style="border-collapse: collapse" border="1" width="200">`, @CRLF)
   DataTable = StrCat(DataTable, `<caption>`, id, `</caption>`, @CRLF)
   DataTable = StrCat(DataTable, `<th>Share</th><th>Free Space</th>`, @CRLF)
   
   For xx = 3 To ItemCount(list, "|")
      ThisData = ItemExtract(xx, list, "|")
      ThisShare = ItemExtract(1, ThisData, "=")
      ThisSpace = ItemExtract(2, ThisData, "=")
      hex_color = UDF_SetColor(ThisSpace, inifile)
      share_path=StrCat("\\", id, "\", StrReplace(ThisShare, ":", "$"))

      DataTable = StrCat(DataTable, `<tr><td align="center" style="background-color: #%hex_color%"><a href="`,share_path,`" target="_blank">   `, ThisShare , `</a> </td>`)
      DataTable = StrCat(DataTable, `<td align="right" style="background-color: #%hex_color%">`, ThisSpace, ` MB Free </td></tr>`, @CRLF)
   Next

   DataTable = StrCat(DataTable, `</TABLE>`)

   Return(DataTable)
#EndFunction ; UDF_BuildHTMLDataTable
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; ####################################################################################









; ***************************************************************************************
;### beginning of main script
; ***************************************************************************************

;*** Set variables
inifile=StrCat(home, "prefs.ini")
serverfile=StrCat(home, "servers.txt")
resultsfile=StrCat(home, "Results.html")
WB_errors=StrCat(home, "WB_Errors.txt")
red="255|0|0"
yellow="255|255|0"
green="0|255|64"
strOutput=""
cells=""
error_Log=""


;*** Make sure 2 crucial files exist.
If ! FileExist(inifile)
   IniWritePvt ("PREFERENCES", "critical_bkgd_color", red, inifile)
   IniWritePvt ("PREFERENCES", "attention_bkgd_color", yellow, inifile)
   IniWritePvt ("PREFERENCES", "acceptable_bkgd_color", green, inifile)
   IniWritePvt ("THRESHOLDS", "critical_space_free", "20", inifile)
   IniWritePvt ("THRESHOLDS", "attention_space_free", "100", inifile)
   ; Force ini write to disk
   IniWritePvt("","","",inifile)
EndIf

If ! FileExist(serverfile)
   str=StrCat("Put your Node IDs into", @CRLF, serverfile, @CRLF, "like this:%@CRLF%ServerID1%@CRLF%ServerID2")
   FilePut(serverfile, str)
   Message("","Enter Node IDs in the next Notepad session, then Close Notepad to continue")
   RunWait("Notepad.exe", serverfile)
EndIf




:MAIN
;*** Turn on system menus
IntControl(49,1,99,0,0)

Scan_DialogFormat=`WWWDLGED,6.1`

Scan_DialogCaption=`Drive Space Utility`
Scan_DialogX=-01
Scan_DialogY=-02
Scan_DialogWidth=112
Scan_DialogHeight=076
Scan_DialogNumControls=002
Scan_DialogProcedure=`DEFAULT`
Scan_DialogFont=`DEFAULT`
Scan_DialogTextColor=`DEFAULT`
Scan_DialogBackground=`DEFAULT,DEFAULT`
Scan_DialogConfig=0

Scan_Dialog001=`019,015,070,014,PUSHBUTTON,DEFAULT,"Run A Scan",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Scan_Dialog002=`019,043,070,014,PUSHBUTTON,DEFAULT,"Set Preferences",2,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("Scan_Dialog")

Switch buttonpushed

   Case 99
      Exit
      Break

   Case 2
      UDF_Prefs(inifile, red, yellow, green)
      break

   Case 1
      critical_bkgd_color=UDF_Dec2Hex(IniReadPvt("PREFERENCES", "critical_bkgd_color", "", inifile))
      attention_bkgd_color=UDF_Dec2Hex(IniReadPvt("PREFERENCES", "attention_bkgd_color", "", inifile))
      acceptable_bkgd_color=UDF_Dec2Hex(IniReadPvt("PREFERENCES", "acceptable_bkgd_color", "", inifile))      
      crit_thresh=IniReadPvt ("THRESHOLDS", "critical_space_free", "", inifile)
      att_thresh=IniReadPvt ("THRESHOLDS", "attention_space_free", "", inifile) 
      share_list=""
      all_servers=FileGet(serverfile, "")
      all_servers=StrTrim(StrReplace(all_servers, @CRLF, @TAB))
      
      Server_list=AskItemList("Select servers to scan (Shift + Ctrl keys enabled)", all_servers, @TAB, @SORTED, @EXTENDED)
     
      server_count=ItemCount(server_list, @TAB)

      BoxOpen("Working, please wait...", "")
      For XX = 1 to  server_count
       Fatal="FALSE"
         server_id=StrUpper(ItemExtract(XX, server_list, @TAB))      
         BoxText(server_id)
         ;*** Make sure the node is online
         ping=iPing(server_id, 3) ; <----- Adjust timeout of ping to suit your needs.
         if ping == 0
            error_log=StrCat(error_log, server_id,":", @CRLF, "Node Offline", @CRLF, @CRLF)
            Continue
         EndIf

         
         ;*** Set up error handling for potential fatal error
         IntControl(73, 2, 0, 0, 0)

         ;*** Enumerate all the disk shares on the server & sort.
         share_list=ItemSort(wntShareList(server_id, 16, 0), @TAB)

         ;*** Set error handling back to normal
         IntControl(73, 0, 0, 0, 0)

         ;*** If there was an error from WntShareList, then just return to process next server.
         If Fatal=="TRUE" then Continue

         strOutput=StrCat(strOutput, server_id)
         
         ;*** Go get drive info from UDF
         drive_results=UDF_Sizer(share_list, server_id)

         ;*** Back from the UDF. See how many drives on this server and adjust for HTML table cells.
         If ItemCount(drive_results, "|") > cells then cells=ItemCount(drive_results, "|") 
         ;*** Now append info to the list.
         strOutput=StrCat(strOutput, drive_results, @TAB)
       
      Next XX
      BoxShut()
      ;*** All done with gathering server info.
      strOutput=StrTrim(strOutput)
      Goto Make_It
      Break

EndSwitch


:CANCEL
Goto MAIN




:Make_It
;*** Build list of server IDs and the hex color for button background.
Input_List = ""
For xx = 1 To ItemCount(strOutput, @TAB)
   ThisLine = ItemExtract(xx, strOutput, @TAB)
   servername = ItemExtract(1, ThisLine, "|")
   least_MB = ItemExtract(2, ThisLine, "|")

   ;*** Set colors
   hex_color=UDF_SetColor(least_MB, inifile)
 
   If StrTrim(servername) <> "" Then Input_List = StrCat(Input_List, servername, "|", hex_color, @TAB)
Next

Input_List=StrTrim(Input_List)
;*** Submit the list and get back a table of INPUTs with each server's name on it.
InputTable = UDF_BuildHTMLInputTable(Input_List)

;*** Set up the list to hold each server's table data.
MasterData = ""

For xx = 1 To ItemCount(strOutput, @TAB)
   ThisLine = ItemExtract(xx, strOutput, @TAB)
   tableid  = ItemExtract(1, ThisLine, "|")
   If StrTrim(tableid) <> "" Then MasterData = ItemInsert(UDF_BuildHTMLDataTable(ThisLine, tableid, inifile), -1, MasterData, @TAB)
Next


;*** Popup message if any errors encountered.
If error_log != "" then Message("Errors encountered", error_log)

;*** Start the browser...
br = startMSIE("about:blank")
;   build a STYLE section...
style = `<style> .yellow {background-color: yellow;} .red {background-color: red;} .hidden {display: none;} .frame {border: .25mm solid black}`
style = StrCat(style, ` th {background-color: black; font-weight: bold; color: gold} caption {background-color: black; font-weight: bold; color: gold} </style>`)

;*** ...build a display table to hold the report...
displayTable = `<TABLE border="0"><tr><td id="ButtonCell"></td><td id="DataCell"></td></tr></TABLE>`
displayTable = StrCat(displayTable, @CRLF, `<span id="ServerSpan" class="hidden"></span>`)

;*** ...write the style, table and set the title...
browserdoc.writeln(style)
browserdoc.writeln(displayTable)
browserdoc.title = "Server Space Report"

;*** ...ref the left/right table cells...
BC = browserdoc.all("ButtonCell")
;*** ...place the buttons onscreen...
BC.innerHTML = InputTable
;*** ...ref the data cell to display the server's table info...
DC = browserdoc.all("DataCell")

;*** ...ref the hidden span, so we know which button the user clicked on...
SS =browserdoc.all("ServerSpan")

;*** ...loop until the EXIT button is clicked.
While @TRUE
   Yields(2000)
   If SS.innerText <> ""
      If SS.innerText == "EXIT" Then Break

      ; Find out where in the masterdata the server ID is located.
      spot=StrIndexNC(masterdata, ss.InnerText, 1, @FWDSCAN)
      ; Back up to find the start of the individual table data.
      start=StrIndexNC(masterdata, "<TABLE", spot, @BACKSCAN)
      stop=StrIndexNC(masterdata, "/TABLE>", spot, @FWDSCAN)
      
      ; Display the table.
      DC.innerHTML=StrSub(masterdata, start, ((stop-start)+7))
     
      SS.innerText = ""
   EndIf

EndWhile

;*** Close up, go home.
ObjectClose(DC)
ObjectClose(SS)

br.quit

Exit



:WBERRORHANDLER
;### Use this section if you want simple error info.
;### You only need to remark out this section if wanting to use
;### detailed error info.
;### Begin error reporting, Part 1 #########################################
   Fatal="TRUE"
   error_log=StrCat(error_log, server_id,":", @CRLF, "Error", @CRLF, @CRLF)  
   Return                                                      
;### End error reporting, Part 1  ##########################################                         



;### This section is for detailed error info.
;### WB_Errors file must exist in the same dir as the script.
;### Begin error reporting, Part 2 #########################################
   Fatal="TRUE" 
   error=LastError()
   ref=FileGet(WB_errors)
   start=StrIndexNc(ref, error, 1, @FWDSCAN)
   If start==0
      error_log=StrCat(error_log, server_id,":", @CRLF, "Unknown Error", @CRLF, @CRLF)
     Return
   EndIf

   stop=StrScan(ref, @CRLF, start, @FWDSCAN)
   line=StrSub(ref,  start, (stop-start) )
   line=StrTrim(ItemExtract(2, line, ":"))
   error_log=StrCat(error_log, server_id,":", @CRLF, line, @CRLF, @CRLF)
   return
;### End error reporting, Part 2 ###########################################

Article ID:   W16696
File Created: 2005:04:28:08:27:48
Last Updated: 2005:04:28:08:27:48