Kix script – functions.kix

By | March 9, 2011
Selec All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Function map_drive($drive_letter, $unc)
   COLOR W+/n
   ? "Mapping $drive_letter to $unc"
   USE $drive_letter /del /persistent
   USE $drive_letter "$unc"
 
   If @ERROR == 0
      COLOR G+/n
      ? "   Connection succesful"
   Else
      print_error(@Error, @SError)
   EndIf
EndFunction
 
Function print_error($errorno, $errorstr)
   COLOR R+/n
   ? "   Error $errorno - $errorstr"
EndFunction
 
Function connect_printer($unc)
   COLOR W+/n
   ? "Connecting to $unc"
   If ADDPRINTERCONNECTION ($unc) = 0
      COLOR G+/n
      ? "   Connection to $unc succesful."
   Else
      COLOR R+/n
      ? "   Error connecting to printer $unc"
      print_error(@Error, @SError)
   Endif
EndFunction
 
Function defatult_printer($unc)
   COLOR W+/n
   ? "Setting Windows default printer to $unc"
   If SetDefaultPrinter ($unc) = 0
      COLOR G+/n
      ? "   Defaulting successful."
   Else
      COLOR R+/n
      ? "   Error defaulting to $unc"
      print_error(@Error, @SError)
   Endif
EndFunction