yup, Function-Endfunction is a keyword pare that define user defined function.
they work just like inbuild functions of kixtart but they are custom build.

so, to correct your code:
Code:

function GetDefaultPrinter()
$GetDefaultPrinter = join(split(readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),',',1),'')
endfunction
? GetDefaultPrinter()
USE LPT1: GetDefaultPrinter()



in another words, it defines a function/keyword.
once you have added that code in your script, you can use it anywhere you like in your script and the same rules apply as for any other function that are in the manual.
_________________________
!

download KiXnet