From LedHed's Wiki
Microsoft has implemented IPP since Windows 2000, and the webpage hasn't changed much over the years.
I find it annoying that the default page doesn't sort the printers. So I've put together a way to sort them based on "Location"
Editing ASP pages
To do this you will need to make changes to the IPP ASP files.
You can find them here:
%windir%\web\printers\
arraySort Function
Save the code below to:
%windir%\web\printers\my.inc
<% '------------------------------------------------------------ ' ' My IPP Functions ' '------------------------------------------------------------ ' ARRAYSORT FUNCTION ' sort a multi dem array ' Useage arraysort(array to be sorted, column to sort on, direction to sort (a|d) ' By: Eric Repec ' InetSolution Inc ' http://www.inetsolution.com Function arraySort(values(),intSortCol,strDirection) Dim i Dim j Dim value Dim value_j dim min dim max dim temp dim datatype dim intComp dim intA dim intCheckIndex min = lbound(values,2) max = ubound(values,2) ' check to see what direction you want to sort. if lcase(strDirection) = "d" then intComp = -1 else intComp = 1 end if if intSortCol < 0 or intSortCol > ubound(values,1) then arraysort = values exit function end if ' find the first item which has valid data in it to sort intCheckIndex = min while len(trim(values(intSortCol,intCheckIndex))) = 0 and intCheckIndex < ubound(values,2) intCheckIndex = intCheckIndex + 1 wend if isDate(trim(values(intSortCol,intCheckIndex))) then datatype = 1 else if isNumeric(trim(values(intSortCol,intCheckIndex))) then datatype = 2 else datatype = 0 end if end if For i = min To max - 1 value = values(intSortCol,i) value_j = i For j = i + 1 To max select case datatype case 0 ' See if values(j) is smaller. works with strings now. If strComp(values(intSortCol,j),value,vbTextCompare) = intComp Then ' Save the new smallest value. value = values(intSortCol,j) value_j = j End If case 1 if intComp = -1 then if DateDiff("s",values(intSortCol,j),value) > 0 then ' Save the new smallest value. value = values(intSortCol,j) value_j = j end if else if DateDiff("s",values(intSortCol,j),value) < 0 then ' Save the new smallest value. value = values(intSortCol,j) value_j = j end if end if case 2 if intComp = -1 then if cdbl(values(intSortCol,j)) < cdbl(value) then ' Save the new smallest value. value = values(intSortCol,j) value_j = j end if else if cdbl(values(intSortCol,j)) > cdbl(value) then ' Save the new smallest value. value = values(intSortCol,j) value_j = j end if end if end select Next 'j If value_j <> i Then ' Swap items i and value_j. for intA = 0 to ubound(values,1) temp = values(intA,value_j) values(intA,value_j) = values(intA,i) values(intA,i) = temp next 'intA End If Next 'i arraysort = values End function %>
ipp_0001.asp
Now that you have created the custom include file we need to reference it.
Edit the following file:
%windir%\web\printers\ipp_0001.asp
Find this line (typically line# 14): <!-- #include file = "ipp_util.inc" --> and insert this line below it <!-- #include file = "my.inc" -->
Now find this line (typically line# 123):
rgADSIGetPrinters = rgPrinters
Comment it out so it looks like this:
' rgADSIGetPrinters = rgPrinters
Insert this new line:
rgADSIGetPrinters = arraySort(rgPrinters,2,"a")
Save and exit