|
WIL
(Windows Interface Language)
The Basics, or What you REALLY
have to know
Two reasons for using WinBatch to
automate Netware Windows clients:
|
|
1. Best functionality: Use the
NetWare Windows Client from Novell together
with with our NetWare WIL language extender.
The functions described
below.
2. For simple functionality
or to use both Novell and Microsoft
servers, you can use the Microsoft
Windows 32 bit (Win98/NT/2000) client.
It has limited Netware capabilities such
as attaching to a server. For most functionality,
you can use the Netware client for Netware
servers and the Windows network client
for NT networking. Both extenders can
live happily together in the same script.
|
Components of WIL (Wilson
WindowWare's Windows Interface Language)
|
|
Main Help File: WIL
core functions and sample code are in the
file, Windows Interface Language.hlp.
WinBatch Studio, an Integrated
Development Environment (IDE) for the WIL
language in WinBatch is included with WinBatch.
It offers ready access to help files and
function lists on the right mouse button
context menu.
WIL Extenders: Networking,
and many other, accessory functions are
used from language "Extenders". These extenders
are modular WIL script plug-ins. If you
downloaded the demo copy of WinBatch, these
networking extenders were included in that
downloaded zip file. You must download others
separately.
Syntax: You declare
Integer, floating point, string, Boolean,
date, and constant variables by assigning
then to a name. It must begin with a letter,
and have 30, or fewer, alphanumeric characters.
This structure will be very easy to learn
for those who have programming experience.
Process Control: WIL
scripts are lists of WIL functions run through
an interpreter. The position of a function
in the script is the primary method of process
control. Some functions, like RunWait(),
facilitate this by running an application,
and then waiting for the user to quit it
before continuing.
More control comes from structures
using If, While, Switch, Select, GoSub,
GoTo (for scripting purists).
Functions: The strength
of WinBatch and WIL is the power behind
its functions. They are designed to specifically
manipulate anything a Windows PC can do.
One specialized WIL function
can save a morning of coding from scratch
with other tools.
|
WIL Scripting Example:
;Lines are less than 256 plain text
characters. Comments start with a semi colon anywhere
on a line.
sString
= "" ; Creating a variable by assignment, in
this case it is an empty string.
iHowMany
= 5 ; Variables can be strings, integers, floats,
Boolean, or constants
sBirds
= "Ducks."
sTitle
= StrCat("How many " , sBirds) ; First method
for string concatenation (joining).
;
Note that there are no quotation marks around
the variable.
bSuccess
= Message( sTitle , "%iHowMany% %sBirds%"
) ; Second method, variable substitution.

onCancel
= "Exit" ; Defines a string variable that contains
a WIL function .
If
bSuccess == @TRUE Then Display(3, sTitle, "
Script Worked! ") ; more variable substitution.
This time a function is inserted.
; The line above is an example of
a single line If...Then construction.
; Most functions return a value.
The message box function returns @TRUE on success
and @FALSE on failure.
:Cancel
; This is a label. It is a default WIL label
needed to handle a click of a cancel button
in a WIL dialog.
%onCancel%
; The function, Exit, will be substituted here.
It will end the script gracefully when a user
cancels a dialog.
; More sample code? See the samples
below. Most are simple, but a few are almost release
candidates.
; Need better dialogs for user I/O?
Use the WIL Dialog Editor, BoxText functions,
or HTML Dialogs from the WIL HTML Dialog Extender.
Final Notes for NetWare Pros:
This page shows NetWare 4/5 functions.
The complete extender also supports NetWare 3.x.
To run scripts located on servers,
that script must be compiled into executable format
by Wilson WindowWare's WinBatch Compiler. This
is not available as a demo.
AddExtender(filename)
Installs a WIL extender Dll.
Syntax:
AddExtender(filename)
Parameters:
(str) filename WIL extender Dll filename.
Returns:
(int) @TRUE if function succeeded.
@FALSE if function failed.
WIL extender Dlls are special Dlls designed to
extend the built-in function set of the WIL processor.
Extender Dlls may add nearly any sort of function
to the WIL language, from the mundane network,
math or database extensions, to items that can
control fancy peripherals, including laboratory
or manufacturing equipment.
Use this function to install extender Dlls as
required. Up to 10 extender Dlls may be added.
The total number of added items may not exceed
200 functions and constants. The AddExtender function
must be executed before attempting to use any
functions in the extender library. The AddExtender
function should be only executed once in each
WIL script that requires it.
The documentation for the functions added are
supplied either in a separate manual or disk file
that accompanies the extender Dll.
Example: WIL
Language and Extender Syntax
;
Add vehicle radar processing dll controlling
billboard visible to
;
motorists, and link to enforcement computers.
;
The WIL Extender SPEED.DLL adds functions
to read a radar speed
;
detector(GetRadarSpeed) , put a message on
a billboard visible to
;
the motorist (BillBoard), take a video of
the vehicle (Camera), and
;
send a message to alert enforcement personnel
(Alert) that a
;
motorist in violation along with a picture
id number to help
;
identify the offending vehicle and the speed
which it was going.
;
AddExtender("SPEED.DLL")
BillBoard("Drive
Safely")
While
@TRUE
;
Wait for next vehicle
while
GetRadarSpeed()<5 ; if low, then just radar
noise
Yield
; wait a bit, then look again
endwhile
speed=GetRadarSpeed()
; Something is moving out there
if
speed < 58
BillBoard("Drive
Safely") ; Not too fast.
else
if
speed < 63
BillBoard("Watch
your Speed") ; Hmmm a hot one
else
if
speed < 66
BillBoard("Slow
Down") ; Tooooo fast
else
BillBoard("Violation
Pull Over")
pictnum
= Camera() ; Take Video Snapshot
Alert(pictnum,
speed); Pull this one over
endif
endif
endif
endwhile
LastError( )
Returns the most-recent error encountered during
the current WIL program.
Syntax:
LastError( )
Parameters:
None
Returns:
(int) most-recent WIL error code encountered.
In addition to the normal behavior of the LastError
function documented in the WIL Reference Guide,
if the most recent error occurred in a WIL Extender,
then a number assigned by the Extender will be
returned. The numbers are documented in the appendix
of this Extender document.
It may be possible to obtain error numbers not
documented. The "Notes" section of the WIL manual
has been provided to allow you to keep records
of undocumented error codes.
Example: Complete
Logon, Run Application, Logoff Script
;Access
script with some error checking
OnCancel="Exit"
; Setup default "cancel" processing
retcode
= AddExtender("wwn4x32i.dll") ;Load in Novell
4 extender
if
retcode == 0
;This
code should not even get the chance to execute.
;Fail-safe
error checking here
Message("Error","Failed
to load Novell 4 extender")
endif
MyServer="\\DEPT07"
UserID="FRED"
ErrorMode(@OFF)
;Tell WIL we want to handle errors in script
:TRYPSWD
OnCancel
= "goto DETACH"
Pswd=AskPassword("Login
to Server %MyServer%", "Enter Password for
%UserID%")
OnCancel
= "exit"
retcode
= n4Attach(MyServer,
UserID, Pswd)
if
retcode == 0
errcode=LastError()
if
errcode == 128
Message("Bad
Password Error","Bad password supplied
for Userid %UserID%")
goto
TRYPSWD
endif
Message("Login
Error %errcode%","Login Failure")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
exit
endif
;
Find drive to map. But don't use W, X, Y,
or Z just to
;
make it more interesting.
drives
= DiskScan(0)
for
I=1 to 4
nono
= strcat( num2char( char2num("V") + I) , ":")
a
= ItemLocate( nono, drives, " ")
if
a!=0 then drives = ItemDelete(a, drives,
" ")
next
if
ItemCount(drives, " ") == 0
Message("Error",
"No drives available for mapping")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
exit
endif
usedrive=ItemExtract(1,drives,"
")
n4Map("\\DEPT07\SYS\Excel",
usedrive)
errcode=LastError()
if
errcode != 0 ; Map Failue
Message("Map
Error %errcode%","Map to %usedrive% failed")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
exit
endif
OrigDir=DirGet()
DirChange(strcat(usedrive,"\"))
RunWait("EXCEL.EXE","/E")
errcode
= LastError()
if
errcode != 0
Message("RunWait
Failed ???","Errorcode=%errcode%")
;drop
thru to disconnect
endif
DirChange(OrigDir)
n4MapDelete(usedrive)
:DETACH
;
Just in case user has other mappings to server,
only
;
detach (logout) from server if no other mappings
exist
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
exit
:CANCEL
%OnCancel%
Message("Error","Oncancel
variable improperly set up")
exit
See Also:
Debug, ErrorMode (both found in main WIL
documentation)
NetInfo(requestcode)
Determines network(str) installed.
Syntax:
NetInfo(requestcode)
Parameters:
(int) requestcode 0 for primary network name.
1 for secondary subnet list.
Returns:
(str) Primary network name for request code 0,
or
Secondary network list for request code 1.
Use this function to determine the network type(str)
running on a workstation. When running in a mixed
network environment, it may be important to be
able to determine the types of networks running
on a workstation so as to be able to load the
appropriate network extender Dlls and issue the
corresponding commands.
NetInfo(0) will return the name of the primary
network, or will return "MULTINET" , which indicates
the Windows multinet driver is active and the
secondary subnet list should be queried. NetInfo(0)
will return one of the following strings:
NetInfo(0) return values:
|
|
NONE
No network installed
MULTINET
Multinet driver installed, see subnet codes.
MSNET
Microsoft Network
LANMAN
LAN Manager
NETWARE
Novell NetWare
VINES
Banyan Vines
10NET
10 Net
LOCUS
Locus
SUNPCNFS
SUN PC NFS
|
LANSTEP
LAN Step
9TILES
9 Tiles
LANTASTIC
Lantastic
AS400
IBM AS/400
FTPNFS
FTP NFS
PATHWORK
DEC PathWorks
OTHER1
Other (code 1)
OTHER2
Other( code 2)
UNKNOWN
Other (unknown)
|
If NetInfo(0) returned "MULTINET" then NetInfo(1)
will return one or more of the following in a
space delimited list:
NetInfo(1) return values:
| |
NONE
No networks active
MSNET
Microsoft Network
LANMAN
LAN Manager
WINNET
Windows Network (Windows for Workgroups,
etc)
NETWARE
Novell NetWare
VINES
Banyan Vines
OTHER2
Other (code 0x20)
OTHER4
Other (code 0x40)
OTHER8
Other (code 0x80)
32
Bit Windows
|
NetInfo(0) will always return the string "WINNT"
for 32 bit Windows platforms, regardless of whether
the platform is Windows95 or Windows NT.
Under Windows 95, NetInfo(1) will return a list
of installed network client ID's, delimited with
the standard file delimiter (by default, a tab).
Possible client ID's, with their corresponding
descriptions, are:
Client ID Description
| |
3OPEN
3Com 3+Open (all versions)
3SHARE
3Com 3+Share (all versions)
DLR
IBM OS/2 LAN Server (versions below 1.2)
DLR12
IBM OS/2 LAN Server (version 1.2)
DLR13
IBM OS/2 LAN Server (versions 1.2, 1.3,
and 1.2 without /API)
DLR13CSD
IBM OS/2 LAN Server (version 1.3 CSD 5015/5050)
DLR20
IBM OS/2 LAN Server (version 2.0)
FTPNFS
FTP Software NFS Client (InterDrive 95)
LANMAN
Microsoft Real Mode LAN Manager
LANT5
Artisoft LANtastic (version 5.X and above)
MSNET
Real mode MS-Net Compatible
NETWARE3
Novell NetWare (Workstation Shell 3.X [NETX])
NETWARE4
Novell NetWare (Workstation Shell 4.0 and
above [VLM])
NOVELL32
Novell NetWare Client 32
|
NWREDIR
Client for NetWare Networks
PATHWKS
DEC PATHWORKS (versions below 4.0)
PATHWKS40
DEC PATHWORKS (version 4.x)
PCLP
IBM PC LAN Program (all versions)
PCNFS50
SunSoft PC-NFS (version 5.0)
VINES552
Banyan DOS/Windows 3.1 client
VREDIR
Client for Microsoft Networks
Under
Windows NT, NetInfo(1) will return a list
of installed network provider ID's, delimited
with the standard file delimiter (by default,
a tab).
Possible
providers, with their corresponding descriptions,
are:
Provider
ID Description
LanmanWorkstation
Microsoft Windows Network
NetWareWorkstation
NetWare Services
NWCWorkstation
NetWare or Compatible Network
|
Example: Finding
Network Types
a=NetInfo(0)
if
a=="MULTINET"
b=NetInfo(1)
count=ItemCount(b,"
")
Message("Multinet
supporting %count% networks", b)
else
Message("Installed
Network", a)
endif
See Also:
Net101, AddExtender,
DllCall (found in main WIL documentation)
n4Attach(server-name)
Attaches to and authenticates a user with a Novell
4.x network file server.
Syntax:
n4Attach(server-name)
Parameters:
(str) server-name name of a network file server.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Attaches to and authenticates a user with a Novell
4.x network file server. User must already be
logged in to a Novell Directory Services connection.
Example: Server
Access
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
OrigDir=DirGet()
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
See Also:
n4Detach, n4Login
n4CaptureEnd(port-number)
Ends a printer capture.
Syntax:
n4CaptureEnd(port-number)
Parameters:
(int) port-number number from 1 to 9 (where 1
= "LPT1", etc.)
Returns:
(int) @TRUE if successful.
Example: Delete
a Printer Capture
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
;
a=n4CapturePrt("\\CHICAGO","PRINTERC",1,(Tabsize=8%@TAB%Numcopies=2")
RunWait("notepad.exe",
"/p readme.txt")
n4CaptureEnd(1)
See Also:
n4CapturePrt
n4CaptureGet(port-number)
Returns the name of the print queue associated
with a printer capture.
Syntax:
n4CaptureGet(port-number)
Parameters:
(int) port-number number from 1 to 9 (where 1
= "LPT1", etc.).
Returns:
(int) an abbreviated name of a print queue relative
to the current context, (eg, "Printer1.Print")
instead of a canonical name (eg, "Printer1.Print.Sales").
Example: Return
Queue Associated with a Capture
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
queue
= n4CaptureGet(1)
Message("LPT1
is captured to", queue)
See Also:
n4CaptureEnd,
n4CapturePrt
n4CapturePrt(server-name,
queue-name, port-number, flags)
Captures a local printer port to a NetWare printer
queue.
Syntax:
n4CapturePrt(server-name, queue-name, port-number,
flags)
Parameters:
(str) server-name name of a network file server.
(str) queue-name name of a network printer queue.
(str) port-number number from 1 to 9 (where 1
= "LPT1", etc.).
(str) flags a tab-delimited list of keyword=value
pairs,
Returns:
(int) @TRUE if successful.
Flags denotes a tab-delimited list of keyword=value
pairs. For example;
"key1=value1%@TAB%key2=value2%@TAB%key3=value3..."
Valid keywords are:
JobDescription =
Null-terminated ASCII description of the contents
or purpose of the job. The NetWare DOS Requester
uses only 13 bytes of this member. This member
is used only by the DOS Requester and OS/2.
JobControlFlags =
Set of queue job control flags affecting the
way a queue server processes a queue job. This
member is used only by the DOS Requester and OS/2.
Returns 0 under DOS/Windows. Under OS/2 JobControlFlags
is defined as 1024 (print interrupted capture),
and bits 0, 1, and 2 must be 0.
TabSize =
Returns a value between 1 and 18 inclusive, indicating
tab size. The default setting is 8.
NumCopies =
Number of copies of the captured file the printer
prints (The maximum number of copies is 255 for
netx.com, and 65536 for OS/2 and the DOS Requester).
The default setting is 1. If NumCopies is 0, nothing
prints.
PrintFlags =
Value Flag Name Description
4 Release Job If set, the print job is released
for printing if the capture is interrupted by
a loss of connection time to the server.
8 Suppress Form Feed If set, the print service
suppresses automatic form feed
64 Text File If set, tab size and other printer
control sequences are interpreted by the print
service. If not set, the job is interpreted as
a byte stream.
128 Print Banner If set, the print service precedes
the print job with a banner page.
NOTE: If you would like to set more than one
of the previous PrintFlag values you can add the
values together. For example, if you would like
to "Suppress Form Feed" (value=8) and "Print Banner"
(value=128) you would add those values together
(128+8=136).
Example: PrintFlags=136
MaxLines
Maximum lines per page.
MaxChars
Maximum characters per line.
FormName
Name of the form a user must mount in the printer
to print files captured to the LPT device. If
the form currently mounted in the printer differs
from the form name returned in this field, the
NetWare server console displays a message instructing
the console operator to mount the correct form.
FormType
Type of form (0 to 255) a user must mount in
the printer to print files captured to the LPT
device. If the form currently mounted in the printer
differs from the form type returned in this field,
the NetWare server console displays a message
instructing the console operator to mount the
correct form. The default form is 0.
BannerText
13-byte string containing the name appearing
on the bottom half of a banner page. All letters
are upper case.
FlushCaptureTimeout
(0 to 3,640) starts counting down every time
an application executes a print command (int 17h).
When the time-out expires, the server flushes
the capture file and queues it at a printer. If
an application executes a second print command
before the first time-out expires, the time-out
starts over from the original value. Each tick
of the capture time-out is approximately one second.
The range is 1 to 1000. The default time-out is
0---no time-out. (Not valid in OS/2.)
FlushCaptureOnClose
When FlushCaptureOnClose is enabled (0), the
server flushes the capture file when the application
ends the capture of the default LPT device. (Default
is 0.) Any other value means disabled. (Not valid
in OS/2.)
Example: Capture
a Printer
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
;
a=n4CapturePrt("\\CHICAGO","PRINTERC",1,"Tabsize=8%@TAB%Numcopies=2")
RunWait("notepad.exe",
"/p readme.txt")
n4CaptureEnd(1)
See Also:
n4CaptureEnd
n4ChgPassword(server-name,
user-name, old-password, new-password)
Changes a user's password.
Syntax:
n4ChgPassword(server-name, user-name, old password,
new password)
Parameters:
(str) server-name name of a network file server
or empty string.
(str) user-name name of the current user.
(str) old password the old password.
(str) new password a new password.
Returns:
(int) @TRUE if successful.
When changing passwords the "Old-password" must
be specified for Directory Services connections.
For bindery connections, if you have supervisor
or equivalent rights, a blank string ("") can
be specified for "old-password".
Passwords ARE case-sensitive for Directory Services
connections, but NOT for bindery connections.
Example: Changing
Passwords
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
n4ChgPassword("\\CHICAGO",
"joe", "spam", "spasm")
n4Detach(server-name)
Detaches from one or all NetWare file servers.
Syntax:
n4Detach(server-name)
Parameters:
(str) server-name name of a network file server.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
This function will detach a user from a Novell
3 or 4 file server. If a file server name is specified,
then the user will be detached from that particular
file server. If the server name is an empty string
("") then the user will be logged out of all NetWare
file servers.
The user will not be logged out of Directory
Services and may attach to other file servers.
Directory Services Monitored Connections will
not be detached. Detaches for Monitored Connections
are ignored. The function will return @TRUE
Example: Another
Server Access Script
;Normal
everyday server access script
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
OrigDir=DirGet()
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
See Also:
n4Attach, n4Logout
n4DirAttrGet(dirname)
Returns NetWare directory attributes
Syntax:
n4DirAttrGet(dirname)
Parameters:
(str) dirname directory pathname whose attributes
are to be determined.
Returns:
(int) the attributes of the specified directory
pathname.
Returns a number which is the sum of all attributes
set for the specified directory. Use the bitwise
AND
operator (&) to determine if a specific attribute
is set. See below for a list of attribute constants.
Attribute Constants :
@attr_Ro
Read-only
@attr_H
Hidden
@attr_Sy
System
@attr_X
eXecute-only
@attr_A
Archive-needed
@attr_Sh
Shareable
@attr_T
Transactional
@attr_P
Purge
@attr_Ri
Rename-inhibit
@attr_Di
Delete-inhibit
@attr_Ci
Copy-inhibit
@attr_Dm
Don't migrate
@attr_Ic
Immediate compress
@attr_Dc
Don't compress
Example: Get
NetWare Directory Attributes
AddExtender("wwn4x32i.dll")
dirname
= "n:\public"
attrs
= n4DirAttrGet(dirname)
If
attrs & @attr_H
Message(dirname,
"is hidden")
Else
Message(dirname,
"is not hidden")
Endif
See Also:
n4DirAttrSet,
n4FileAttrSet,
n4FileAttrGet
n4DirAttrSet(dirname,
attribs, mode)
Sets NetWare directory attributes
Syntax:
n4DirAttrSet(dirname, attribs, mode)
Parameters:
(str) dirname directory pathname.
(str) attribs one or more NetWare directory attribute
constants (see below for list).
(str) mode @ON, specified attributes are set.
@OFF, specified attributes are removed.
Note: The 'execute-only' attribute cannot be
removed.
If multiple attributes are specified, they should
be combined using the bitwise OR operator.
Attribute Constants :
@attr_Ro
Read-only
@attr_H
Hidden
@attr_Sy
System
@attr_X
eXecute-only
@attr_A
Archive-needed
@attr_Sh
Shareable
@attr_T
Transactional
@attr_P
Purge
@attr_Ri
Rename-inhibit
@attr_Di
Delete-inhibit
@attr_Ci
Copy-inhibit
@attr_Dm
Don't migrate
@attr_Ic
Immediate compress
@attr_Dc
Don't compress
Example: Set
NetWare Directory Attributes
AddExtender("wwn4x32i.dll")
dirname
= "n:\public"
;
set 'hidden' and 'system' attributes
n4DirAttrSet(dirname,
@attr_H | @attr_Sy, @ON)
;
remove 'shareable' attribute
n4DirAttrSet(dirname,
@attr_Sh, @OFF)
See Also:
n4DirAttrGet,
n4FileAttrSet,
n4FileAttrGet
n4DirTimeGet(dirname,
time-field)
Gets NetWare time information for a directory.
Syntax:
n4DirTimeGet( dirname, time-field)
Parameters:
(str) dirname must specify a single directory
name (no wildcards).
(int) time-field can be one of the following:
1 directory created
2 directory last modified
3 --- (not used)
4 directory last archived
Returns:
(str) the requested directory time in YmdHms
format (with a 4-digit year), or a blank string
("") if the requested time field is not set. (yyy:mm:dd:hh:mm:ss
)
See Also:
n4DirAttrGet, n4FileTimeGet
n4DrivePath(local-name)
Returns the network resource associated with
the local-name.
Syntax:
n4DrivePath(local-name)
Parameters:
(str) local-name local drive name.
Returns:
(int) network resource associated with the local
name.
This function will return a UNC-style network
path that a local drive is mapped to. If there
is no valid NetWare mapping, then an empty string
will be returned.
Example: Return
the Network Resource of a Local Drive
AddExtender("wwn4x32i.dll")
netpath
= n4DrivePath("Q:")
Message("Q:
is mapped to", netpath)
See
Also:
n4DriveStatus,
n4ServerList,
n4GetMapped
n4DriveStatus(local-name)
Returns a status code number indicating the type
of connection associated with a local-name.
Syntax:
n4DriveStatus(local-name)
Parameters:
(str) local-name local drive name.
Returns:
(int) a status code number.
This function returns information about a local
drive. It can determine if the drive is unmapped,
already mapped, or belongs to another network.
Bit Value Bit Definition
0 Unmapped, free drive
1 Local Free Drive
2 Local Drive
4 Network Drive
8 PNW Drive (Personal NetWare Drive)
16 NetWare Drive
Common status codes are:
0 Free Drive - Mapable
3 Free Drive - Mapable
20 Mapped drive belonging to Novell
Example: Get
Status of a Local Drive
AddExtender("wwn4x32i.dll")
for
d = 0 to 25
drive
= strcat( num2char( char2num("A") + d ), ":"
)
stat
= n4DriveStatus(drive)
if
stat == 0 || stat == 3
Message(drive,
"is a free, mapable drive")
endif
if
stat == 20
path
= n4DrivePath(drive)
Message(drive,
"is a mapped Novell drive, mapped to %@CRLF%%path%")
endif
next
See Also:
n4DrivePath, n4ServerList,
n4GetMapped
n4FileAttrGet(filename)
Returns NetWare file attributes
Syntax:
n4FileAttrGet(filename)
Parameters:
(str) filename a file name, which may include
a full path, and which
may *not* include wildcards.
Returns:
(int) sum of all attributes set.
Returns a number which is the sum of all attributes
set for the specified file. Use the bitwise AND
operator (&) to determine if a specific attribute
is set. See below for a list of attribute constants.
Attribute Constants:
@attr_Ro
Read-only
@attr_H
Hidden
@attr_Sy
System
@attr_X
eXecute-only
@attr_A
Archive-needed
@attr_Sh
Shareable
@attr_T
Transactional
@attr_P
Purge
@attr_Ri
Rename-inhibit
@attr_Di
Delete-inhibit
@attr_Ci
Copy-inhibit
@attr_Dm
Don't migrate
@attr_Ic
Immediate compress
@attr_Dc
Don't compress
Example: Get
File Attributes
AddExtender("wwn4x32i.dll")
filename
= "n:\public\nwadmin.exe"
attrs
= n4FileAttrGet(filename)
If
attrs & @attr_H
Message(filename,
"is hidden")
Else
Message(filename,
"is not hidden")
Endif
See Also:
n4FileAttrSet
n4FileAttrSet(filename,
attribs, mode)
Sets NetWare file attributes
Syntax:
n4FileAttrSet(filename, attribs, mode)
Parameters:
(str) filename a file name, which may include
a full path, and which may include wildcards.
(int) attribs one or more NetWare file attribute
constants (see below for list).
(int) mode @ON, specified attributes are set.
@OFF, specified attributes are removed.
If multiple attributes are specified, they should
be combined using the bitwise OR operator.
Note: The 'execute-only' attribute cannot be
removed.
Attribute Constants:
@attr_Ro
Read-only
@attr_H
Hidden
@attr_Sy
System
@attr_X
eXecute-only
@attr_A
Archive-needed
@attr_Sh
Shareable
@attr_T
Transactional
@attr_P
Purge
@attr_Ri
Rename-inhibit
@attr_Di
Delete-inhibit
@attr_Ci
Copy-inhibit
@attr_Dm
Don't migrate
@attr_Ic
Immediate compress
@attr_Dc
Don't compress
Example: Set
File Attributes
AddExtender("wwn4x32i.dll")
filename
= "n:\public\nwadmin.exe"
;
set 'hidden' and 'system' attributes
n4FileAttrSet(filename,
@attr_H | @attr_Sy, @ON)
;
remove 'shareable' attribute
n4FileAttrSet(filename,
@attr_Sh, @OFF)
See Also:
n4FileAttrGet
n4FileTimeGet(filename, time-field)
Gets NetWare time information for a file.
Syntax:
n4FileTimeGet(filename, time-field)
Parameters:
(str) filename must specify a single file name
(no wildcards).
(int) time-field can be one of the following:
1 file created
2 file last modified
3 file last accessed
4 file last archived
Returns:
(str) the requested file time in YmdHms format
(with a 4-digityear), or a blank string ("") if
the requested time field is not set.
See Also:
n4DirTimeGet
n4FileUsers(server,
filename)
Lists network users who have a file open.
Syntax:
n4FileUsers(server, filename)
Parameters:
(str) server the UNC name of the server on which
the file is located (eg, "\\MYSERVER").
(str) filename a full pathname to a file located
on the "server", in the form "volume:path" (eg,
"SYS:USER\JOHNDOE\MYFILE.TXT").
Returns:
(str) Returns a tab-delimited list of user names.
Note: This function requires console operator
rights.
Example: Get
a List of Users Accessing a File
addExtender("wwn4x32i.dll")
file="SYS:USER\JOHNDOE\MYFILE.TXT"
users=n4FileUsers("\\MYSERVER",
file)
AskItemList("Network
users who have %file% open",users,@TAB,@UNSORTED,@SINGLE)
exit
See Also:
n4GetUser
n4GetConnNum(server-name)
Gets the connection number for the current workstation.
Syntax:
n4GetConnNum(server)
Parameters:
(str) server-name name of a network file server
or empty string.
Returns:
(int) a connection number on success, or -1 on
failure.
This function returns the connection number for
the current workstation on the specified NetWare
server. The connection number is the index into
the connection table maintained by the server
for all connected objects.
See Also:
n4GetMapped, n4GetNetAddr
n4GetContext(request)
Returns the current user's default context or
tree.
Syntax:
n4GetContext(request)
Parameters:
(int) request see below.
Returns:
(str) 0-request returns context or 1-request
returns tree.
Request #
0 context
1 tree (32 bit version only)
Note: n4GetContext returns a blank string, if
the user had logged into and then logged out of
Directory Services before the function was called.
Example: Get
Current User's Context or Tree
AddExtender("wwn4x32i.dll")
context
= n4GetContext(0)
list=N4UserGroupEx("\\CHICAGO","JOE",context)
AskItemList("User
belongs to these groups",list,@tab,@sorted,@single)
See Also:
n4UserGroupEx
n4GetMapped(server-name)
Returns a tab delimited list of mapped Novell
drives.
Syntax:
n4GetMapped(server-name)
Parameters:
(str) server-name name of a network file server
or empty string.
Returns:
(str) tab delimited list of drives mapped to
the specified server
This function will interrogate drives A thru
Z, and will return a list of drives mapped to
Novell servers. If there is no valid NetWare mapping,
then an empty string will be returned. If an empty
string ("") is provided for the server name, then
all valid mapped Novell drives will be returned.
Example: Get
List of Mapped NetWare Drives
addExtender("wwn4x32i.dll")
MappedDrives
= n4GetMapped("\\SERV01")
Message("Mapped
drives on \\SERV01", Mapped Drives)
See Also:
n4DrivePath, n4DriveStatus
n4GetNetAddr(server-name,
flags)
Returns the Internet work address of the current
workstation.
Syntax:
n4GetNetAddr(server-name, flags)
Parameters:
(str) server-name name of a network file server
or empty string.
(int) flags 0 - reserved for future use.
Returns:
(int) string of hex bytes in the format:
x1x2x3x4:y1y2y3y4y5y6:z1z2
If a null string ("") is used for the server-name,
the default server will be used.
The Internet work address of the current workstation
is returned in the form of
x1x2x3x4:y1y2y3y4y5y6:z1z2
where:
x1x2x3x4 = 4-byte network address
y1y2y3y4y5y6 = 6-byte net node address (physical
address of workstation's LAN board)
z1z2 = socket
Example: List
Mapped Drives
AddExtender("wwn4x32i.dll")
;
;Assuming
user is attached to and logged into server
;
a=n4GetNetAddr("\\CHICAGO",0)
message("Net
Address is","%a%")
See Also:
n4GetUser, n4DrivePath,
n4DriveStatus,
n4ServerList,
Environment (found in main WIL documentation)
n4GetUser(server-name)
Determines the currently logged on user name
on the specified server.
Syntax:
n4GetUser(server-name)
Parameters:
(str) server-name name of a network file server.
Returns:
(int) a user name.
This function will return the currently logged
on user name on a specified Novell server. If
no user is logged on, a null string ("") will
be returned.
Example: Get
Logged on User
AddExtender("wwn4x32i.dll")
;
;Assuming
user is attached to and logged into server
;
Who
= n4GetUser("\\DEPT07")
Message("I
am logged into \\DEPT07 as", Who)
;
;
Also Note this may work, depending on your
setup
EnvWho
= Environment("USER")
Message("Environment
variable USER is",EnvWho)
See Also:
n4GetNetAddr,
n4DrivePath, n4DriveStatus,
n4ServerList,
Environment (found in main WIL documentation)
n4GetUserId(server-name,
user-name, format)
Returns the object ID corresponding to the specified
user name.
Syntax:
n4GetUserId(server-name, user-name, format)
Parameters:
(str) server-name name of a network file server
or empty string.
(str) user-name name of the current user.
(int) format the format for the return; see below.
Returns:
(int) object ID for specified user.
"Format" specifies the format in which the ID
is returned:
Request # Format
0 Decimal number, in internal NetWare format
1 Hexadecimal string, such as used for mail directories
Example: Get
Object ID of User
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
userid=N4GetUserId("\\CHICAGO","joe",0)
message("UserID
is","%userid%")
See Also:
n4GetUser, n4DrivePath,
n4DriveStatus,
n4ServerList,
Environment (found in main WIL documentation)
n4GetUserName( context)
Returns the name of the currently logged-in user.
Syntax:
n4GetUserName( context)
Parameters:
(str) context a Directory Services context, or
"" for the default context.
Returns:
(str) the name of the currently logged-in user,
relative to "context". Or "" on error.
This function uses Directory Services the get
the currently logged on user (unlike n4GetUser).
Note: Specify '[ROOT]' for the context,
if you want the full user name.
Example: Get
Currently Logged on User
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
userid=N4GetUserName("")
message("Currently
logged-in user, relative to the default context",userid)
See Also:
n4GetUser
n4Login( user-name, password,
context, tree)
Performs a login to Novell Directory Services.
Syntax:
n4Login( user-name, password, context, tree)
Parameters:
(str) user-name name of the current user.
(str) password password required to access Directory
Services.
(str) context desired login context.
(str) tree desired Directory Services Tree.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Performs a login to Novell Directory Services.
For Bindery based logins, use the Novell 3.x extender.
This function does NOT run any login scripts,
nor will it detach the user fron any existing
servers.
If the user has a valid settings in the NET.CFG
network configuration file, including the following:
PREFERRED SERVER dir-svc-server
PREFERRED TREE treename
CONTEXT NAME contextname
and the defaults are to be used, then the context
and tree parameters may be empty strings ("").
Otherwise the context and tree parameters must
be specified to login.
Example: Login
(NDS), Run App, Logout
;Normal
everyday server access script w/ login and logout
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
UserID="FRED"
Context="ACCOUNTING"
Tree="WORLDWIDEINC"
Pswd=AskPassword("Login
to Server %MyServer%", "Enter Password for
%UserID%")
n4Login(UserID,
Pswd, Context, Tree)
OrigDir=DirGet()
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
n4Logout()
See Also:
n4Logout, n4Attach,
n4Detach
n4Logout( )
Performs a network logout.
Syntax:
n4Logout( )
Parameters:
None
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
The Logout function will log the user out of
Directory Services and detach the user from all
unnecessary file servers - Both Directory Services
4.x servers and Bindery 3.x servers will be detached.
The Monitored Connection to the Directory Services
server will be retained.
Example: Log
Out of an NDS Server
;Normal
everyday server access script w/ login and logout
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
UserID="FRED"
Pswd=AskPassword("Login
to Server %MyServer%", "Enter Password for
%UserID%")
n4Login(UserID,
Pswd, "", "")
OrigDir=DirGet()
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
n4Logout()
See Also:
n4Login, n4Detach
n4LogoutTree( context,
tree)
Performs a network logout from the specified
tree.
Syntax:
n4LogoutTree ( context, tree )
Parameters:
(str) context desired login context.
(str) tree desired Directory Services Tree.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
The Logout function will log the user out of
Directory Services "context" is a Directory Services
context, or "" for the default context.
"tree" is a Directory Services tree, or "" for
the default tree.
Note: the "tree" parameter is only supported
in the 32 bit version.
This function terminates a client's connection
to the network. Unlike the n4Logout function,
it does not detach from any servers.
Returns @TRUE on success, or @FALSE if the user
was not authenticated through Directory Services.
Example: Logout
from a Tree
;Normal
everyday server access script w/ login and logout
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
UserID="FRED"
Pswd=AskPassword("Login
to Server %MyServer%", "Enter Password for
%UserID%")
n4Login(UserID,
Pswd, "", "")
OrigDir=DirGet()
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
n4Logout()
See Also:
n4Login, n4Detach,
n4Logout
n4Map(net-path, local-name)
Root maps a drive to a resource specified by
a UNC pathname.
Syntax:
n4Map(net-path, local-name)
Parameters:
(str) net-path UNC net resource.
(str) local-name local drive name.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Root maps a drive to a resource specified by
a fully qualified UNC filename. Must be either
logged into the server, or specified net resource
must not require a login.
Example: Map
a Drive
;Normal
everyday server access script
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
OrigDir=DirGet()
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
See Also:
n4DrivePath, n4DriveStatus,
n4MapDelete, n4MapDir
n4MapDelete(local-name)
Removes a drive mapping.
Syntax:
n4MapDelete(local-name)
Parameters:
(str) local-name local drive name.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
This function removes a drive mapping.
Example: Removes
a drive mapping
;Normal
everyday server access script
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
OrigDir=DirGet()
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
See Also:
n4Map, n4DrivePath,
n4DriveStatus
n4MapDir(net-path, local-name)
Maps a drive to a resource specified by a UNC
pathname.
Syntax:
n4MapDir(net-path, local-name)
Parameters:
(str) net-path UNC net resource.
(str) local-name local drive name.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Maps a drive to a resource specified by a fully
qualified UNC filename. Must be either logged
into the server, or specified net resource must
not require a login. If drive is already mapped
to a Novell server, the prior mapping will be
deleted and the new mapping will take effect.
Example: Maps
a Drive to a UNC Pathname
;Normal
everyday server access script
;See
example with "LastError()"
in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
UserID="FRED"
Pswd=AskPassword("Login
to Server %MyServer%", "Enter Password for
%UserID%")
OrigDir=DirGet()
n4Attach(MyServer,
UserID, Pswd)
n4MapDir("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
See Also:
n4MapDelete, n4MapRoot,
n4Map, n4DrivePath,
n4DriveStatus
n4MapRoot(net-path, local-name)
Root maps a drive to a resource specified by
a UNC pathname.
Syntax:
n4MapRoot(net-path, local-name)
Parameters:
(str) net-path UNC net resource.
(str) local-name local drive name.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Root maps a drive to a resource specified by
a fully qualified UNC filename. Must be either
logged into the server, or specified net resource
must not require a login. If drive is already
mapped to a Novell server, the prior mapping will
be deleted and the new mapping will take effect.
Example: Root
Map a Drive to a UNC Pathname
;Normal
everyday server access script
;See
example with "LastError()" in this help file
;
for a more bulletproof version
;
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
UserID="FRED"
Pswd=AskPassword("Login
to Server %MyServer%", "Enter Password for
%UserID%")
OrigDir=DirGet()
n4Attach(MyServer,
UserID, Pswd)
n4MapRoot("\\DEPT07\SYS\Excel",
"Q:")
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
See Also:
n4MapDelete, n4MapDir,
n4Map, n4DrivePath,
n4DriveStatus
n4MemberDel(group-name
,user-name)
Deletes the specified user from the specified
group on the specified server.
Syntax:
n4MemberDel(group-name ,user-name)
Parameters:
(str) group-name name of the group.
(str) user-name name of the current user.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Assuming that the person running this script
has sufficient authority to delete users from
the specified group, this function will delete
the specified user from the group.
Example: Deletes
a User from a Group on a Server
AddExtender("wwn4x32i.dll")
;
;Assuming
operator is attached to and logged into server
;
n4MemberDel("MAUI
SALES", "BSMITH")
See Also:
n4MemberGet, n4MemberSet
n4MemberGet(group-name
,user-name)
Determines if the specified user is a member
of the specified group on the specified server.
Syntax:
n4MemberGet(group-name ,user-name)
Parameters:
(str) group-name name of the group.
(str) user-name name of the current user.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Assuming that the person running this script
has sufficient authority to query members of the
specified group, this function will allow the
person to determine if the user is a member of
the specified group or not.
n4MemberGet can accept distinguished names.
Example: Check
a Group for a Member
AddExtender("wwn4x32i.dll")
;
;Assuming
operator is attached to and logged into server
;
resp
= n4MemberGet("NOME SALES", "BSMITH")
if
resp == 0 then resp2 = "is NOT"
else
resp2 = "is"
Message("NOME
SALES","BSMITH %resp2% a member.")
See Also:
n4NameConvert,
n4MemberSet, n4MemberDel
n4MemberSet(group-name
, user-name)
Sets the specified user as a member of the specified
group on the specified server.
Syntax:
n4MemberSet(group-name , user-name)
Parameters:
(str) group-name name of the group.
(str) user-name name of the current user.
Assuming that the person running this script
has sufficient authority to add users to the specified
group, this function will add the specified user
to the group.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Example: Assign
a User to a Group
AddExtender("wwn4x32i.dll")
;
;Assuming
operator is attached to and logged into server
;
n4MemberSet("NOME
SALES", "BSMITH")
See Also:
n4MemberDel, n4MemberGet
n4MsgSend(server-name,
message , user-name)
Sends a message (max 56 characters) to the specified
user.
Syntax:
n4MsgSend(server-name, message , user-name)
Parameters:
(str) server-name name of a network file server.
(str) message message to be sent.
(str) user-name name of the user to whom the
message is being sent.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Example: Send
Message to a User
AddExtender("wwn4x32i.dll")
Msg
= AskLine("My Mailing List","Enter Short Message","")
n4MsgSend("\\DEPT07",
Msg, "ERINP")
n4MsgSend("\\DEPT07",
Msg, "KARINW")
n4MsgSend("\\DEPT07",
Msg, "TINAB")
n4MsgSend("\\DEPT07",
Msg, "CAROLK")
n4MsgSend("\\DEPT07",
Msg, "LAURAW")
n4MsgSend("\\DEPT07",
Msg, "DONNAW")
n4MsgSend("\\DEPT07",
Msg, "CUPCAKE")
See Also:
n4MsgSendAll
n4MsgSendAll(server-name,
message)
Sends a message (max 56 characters) to all logged
on users.
Syntax:
n4MsgSendAll(server-name, message)
Parameters:
(str) server-name name of a network file server.
(str) message message to be sent.
Returns:
(int) @TRUE if successful;
@FALSE if unsuccessful.
Server-wide broadcasting to all logged in users.
Actually only gets the first 300 or so.
Example: Send
Message to All Users
AddExtender("wwn4x32i.dll")
n4MsgSendAll("\\DEPT07","Blue
Chevy, License 237-EKL, Lights on in back
lot")
See Also:
n4MsgSend
n4NameConvert(context,
object, format)
Converts an object name to a different format.
Syntax:
n4NameConvert(context, object, format)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of a NetWare object.
(int) format specifies what format "object" will
be converted to. (see below)
Returns:
(int) the name of the new format. "format" specifies
what format "object" will be converted to, and
is one of the following:
1 canonical typed (eg, "CN=Server.O=Office")
2 abbreviated typed (eg, "CN=Server")
3 canonical typeless (eg, "Server.Office")
4 abbreviated typeless (eg, "Server")
5 UNC (eg, "\\Server")
If "object" contains a period ("."), it is assumed
to be in canonical format; otherwise, it is assumed
to be in abbreviated format. If "object" begins
with two slashes "\\", it is assumed to be a UNC.
If "object" is in an invalid format, it will be
returned as-is, without being converted.
Example: Converts
Object Names Between Formats
objname
= n4NameConvert("", "\\Server", 3)
Message("Object
name", objname)
See Also:
n4ObjectList,
n4ObjectInfo,
n4ObjectProps
n4ObjDelete( context,
object)
Deletes an NDS object.
Syntax:
n4ObjDelete( context, object)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of a NetWare object.
Returns:
(int) always 1.
Example: Deletes
NDS Objects
objname
= n4NameConvert("", "\\Server", 3)
Message("Object
name", objname)
See Also:
n4ObjectList
n4ObjMove( context, object,
new-name, retain)
Moves an NDS object.
Syntax:
n4ObjMove( context, object, new-name, retain)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of an NDS object (eg, "janedoe",
or "janedoe.tech", or "cn=janedoe.o=tech").
(str) new-name the new name (relative to "context")
to be given to "object" (eg, "janedoe.sales",
or "cn=janesmith.o=tech").
This can be in a different location on the Directory
Tree than the object's current location (in which
case the object is moved). The least-significant
(left-most) part of the new name can be the same
as the existing object's name, or it can be different
(in which case the object is renamed as well as
moved).
(int) retain @TRUE = retain old name as additional
attribute value, @FALSE = discard old name.
This function moves and/or renames a leaf object.
It cannot be used to move an object which contains
subordinate objects.
Returns:
(int) always 1.
Example: Moves
NDS Objects
AddExtender("wwn4x32i.dll")
n4ObjMove("",
"janedoe", "janedoe.sales", @FALSE)
n4ObjMove("",
"janedoe.tech.newyork", "janesmith.sales.newyork",
@TRUE)
See Also:
n4ObjectList,
n4ObjRename
n4ObjSearch( context,
object, class, parent, flags)
Searches a region of the directory for an NDS
object.
Syntax:
n4ObjSearch( context, object, class, parent,
flags)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of an NDS object (eg, "janedoe",
or "janedoe.tech", or "cn=janedoe.o=tech").
(str) class identifies the type of objects to
search for. It can be "" to match objects of any
class, or it can be one of the
NetWare classes (see below).
(str) parent identifies the starting point for
the search (ie, the base object to which the search
is relative). It can be "[Root]" to specify
the DS root, or "" to specify the current context.
(int) flags specifies the scope of the search.
(see below).
Returns:
(str) object list Returns a tab-delimited list
of matching objects.
"class" identifies the type of objects to search
for. It can be "" to match objects of any class,
or it can be one of the following NetWare classes:
"AFP
Server"
"Alias"
"Bindery
Object"
"Bindery
Queue"
"Computer"
"Country"
"Device"
"Directory
Map"
"External
Entity"
"Group"
"List"
"Locality"
"Message
Routing Group"
"Messaging
Routing Group"
"Messaging
Server"
"NCP
Server"
"Organization"
"Organizational
Person"
"Organizational
Role"
"Organizational
Unit"
"Partition"
"Person"
"Print
Server"
"Printer"
"Profile"
"Queue"
"Resource"
"Server"
"Top"
"Unknown"
"User"
"Volume"
Note: Standard NetWare servers have a class of
"NCP Server".
"flags" specifies the scope of the search. It
can be one of the following:
Flag Name Meaning
0 SEARCH_ENTRY Search applies only to the base
object
1 SEARCH_SUBORDINATES Search applies only to
the immediate subordinates of the base object
2 SEARCH_SUBTREE Search applies to the base object
and all of its subordinates
In addition, you can add one of the following
option values:
Flag Meaning
100 De-reference aliases while searching
Warning: according to Novell's documentation,
"Currently, because of aliasing, searching a subtree
can result (1) in duplicate entries or (2) in
an infinite loop."
Example: Searches
for NDS Objects
AddExtender("wwn4x32i.dll")
n4ObjSearch("",
"janedoe", "User", "sales", 1)
n4ObjSearch("",
"janedoe", "User", "[Root]", 2)
n4ObjSearch("",
"", "User", "", 102)
See Also:
n4ObjectList,
n4ObjRename
n4ObjRename( context,
object, new-name, retain)
Renames an NDS object.
Syntax:
n4ObjRename( context, object, new-name, retain)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of an NDS object (eg, "janedoe",
or "janedoe.tech", or "cn=janedoe.o=tech").
(str) new-name the least-significant (left-most)
part of the new name to be given to "object" (eg,
"janesmith").
(int) retain @TRUE = retain old name as additional
attribute value, @FALSE = discard old name.
This function changes the least significant (left-most)
part of a leaf object's distinguished name. It
cannot be used to move an object to a different
location in the Directory Tree, and cannot be
used to rename an object which contains subordinate
objects.
Returns:
(int) always 1.
Example: Rename
NDS Objects
AddExtender("wwn4x32i.dll")
n4ObjRename("",
"janedoe.tech", "janesmith", @FALSE)
See Also:
n4ObjectList,
n4ObjMove
n4ObjectList(context,
parent, class, mask)
Lists objects in a Directory Services tree.
Syntax:
n4ObjectList(context, parent, class, mask)
Parameters:
(str) context A NetWare context, or "" for the
current context.
(str) parent The object whose immediate sub-ordinates
are to be listed, or "" for the top of the tree.
(str) class A NetWare class which identifies
the type of objects to be listed or "" for all
objects. (see below)
(str) mask A wildcard which identifies the objects
to be listed such as "Serv*" or "" for all names.
Returns:
(int) Returns a tab-delimited list of object
names.
"Class" can be one of the following NetWare classes
or a null string, "", for all objects.
"AFP Server" "Alias" "Bindery Object" "Bindery
Queue" "Computer" "Country" "Device" "Directory
Map"
"External Entity" "Group" "List" "Locality" "Message
Routing Group" "Messaging Routing Group"
"Messaging Server" "NCP Server" "Organization"
"Organizational Person" "Organizational Role"
"Organizational Unit" "Partition" "Person" "Print
Server" "Printer" "Profile"
"Queue" "Resource" "Server" "Top" "Unknown" "User"
"Volume"
Note: Standard NetWare servers have a class of
"NCP Server".
Example: List
NDS Objects
AddExtender("wwn4x32i.dll")
objects
= n4ObjectList("", "", "Queue", "")
askitemlist("Queues
in current context", objects, @TAB, @sorted,@single)
;Get
a list of groups on a Novell NetWare 4 server
grpobjects
= n4ObjectList("", "Group", "", "")
askitemlist(
"List of groups",grpobjects, @tab, @sorted,
@single)
See Also:
n4ObjectInfo, n4ObjectProps,
n4NameConvert
n4ObjectInfo(context,
object, request)
Returns information on the specified object.
Syntax:
n4ObjectInfo(context, object, request#)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of a NetWare object.
(int) request# 0 - Server where the object is
stored
(eg, "\\SERVER"). This is not necessarily the
server on which the object is physically located.
1 - Object class (see "n4ObjectList" for a list
of classes).
Returns:
(int) information on the specified object.
Example: Get
NDS Info on Objects
AddExtender("wwn4x32i.dll")
server
= n4ObjectInfo("Admin", "Print01", 0)
Message("Print01
is located on", server)
See Also:
n4ObjectList,
n4ObjectProps,
n4NameConvert
n4ObjectProps(context,
object, attribute)
Returns properties of the specified object.
Syntax:
n4ObjectProps (context, object, attribute)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of a NetWare object.
(str) attribute a valid attribute of "object"
or "" for a tab-delimited list of all attributes.
Returns:
(int) a tab-delimited list of values for an attribute.
If "attribute" is a blank string (""), this function
will return a tab-delimited list of all attributes
for "object".
If "attribute" specifies a valid attribute of
"object", this function will return a tab-delimited
list of values for that attribute.
Note: Only string values will be returned correctly.
Examples: Get
NDS Object Properties
AddExtender("wwn4x32i.dll")
host
= n4ObjectProps("", "Print01", "Host Device")
Message("Host
Device", host)
;
list all attributes and values for an object
attribs
= n4ObjectProps("", "Print01", "")
count
= ItemCount(attribs, @TAB)
For
i = 1 To count
attrib
= ItemExtract(i, attribs, @TAB)
values
= n4ObjectProps("", "Print01", attrib)
ItemSelect(attrib,
values, @TAB)
Next
See Also:
n4ObjectList,
n4ObjectInfo,
n4NameConvert
n4ObjGetVal(context,
object, attribute,address of buffer,size of buffer)
Returns values for an object attribute.
Syntax:
n4ObjGetVal(context, object, attribute, address
of buffer, size of buffer)
Parameters:
(str) context a NetWare context, or "" for the
current context.
(str) object the name of a NetWare object.
(str) attribute a valid attribute of "object".
(str) address of buffer specify " ". or for stream
values specify an address of a global memory buffer.
See IntControl 42.
(str) size of buffer specify " " or for stream
values specify the size of the buffer
Returns:
(s/i) a tab-delimited list of values for an attribute.
This function is similar to n4ObjectProps, but
returns more detail for value types which are
structures. For example, a FAX number type is
a structure which contains a phone number field
and an optional parameter field. n4ObjGetVal returns
both fields, whereas n4ObjectProps only returns
the phone number.
Distinguished names are returned in abbreviated,
typeless form.
By default, binary strings are returned as a
hex string (a sequence of hex bytes, with each
byte in the original string represented by two
hex characters in the returned string. This can
be changed with n4ObjOptions (below).
By default, multiple values for "attribute" are
delimited with tabs, and individual fields within
a structure-type value are delimited with vertical
bars ('|'). This can be changed with n4ObjOptions
(below).
Network addresses are returned in the form xxxxxxxx:xxxxxxxxxxxx:xxxx
n4ObjGetVal supports stream values, using the
following method:
You must specify the address of a global memory
buffer as param4, and the size of the buffer as
param5. The return value will be the number of
bytes copied to the buffer, or -1 on failure.
You can specify -1 for param4 (address of a global
memory buffer) and param5 (size of a global memory
buffer) to just return the buffer size needed.
You can obtain the address of a binary buffer
using IntControl(42), and you should call BinaryEodSet
after calling n4ObjGetVal.
This is an outline of the return format for various
value types:
Type Format of returned data
EMail_Address
type|address
Fax_Number
telephoneNumber|parameters
Path
nameSpaceType|volumeName|path
Po_Address
line1|line2|line3|line4|line5|line6
Typed_Name
objectName|level|interval
Back_Link
remoteID|objectName
CI_List
string|string|...
Object_ACL
protectedAttrName|subjectName|privileges
Octet_List
string|string|...
Hold
objectName|amount
Replica_Pointer
serverName|replicaType|replicaNumber|count|addressType|address
Net_Address
addressType|address
NWDS_TimeStamp
wholeSeconds|eventID
Unknown_Attr
attrName|syntaxID|value
See Also:
n4ObjectList,
n4ObjectProps
n4ObjOptions( value-delim,
field-delim, null-sub, flags, reserved)
Specifies options for n4ObjGetVal.
Syntax:
n4ObjOptions( value-delim, field-delim, null-sub,
flags, reserved)
Parameters:
(str) value-delim specifies a single character
used to delimit multiple values for an attribute.
The default is a tab. Specify a blank string ("")
to leave unchanged.
(str) field-delim specifies a single character
used to delimit fields within a structure-type
value. The default is a vertical bar ('|'). Specify
a blank string ("") to leave unchanged.
(str) null-sub specifies a single character used
to replace any NULL's found within a binary string,
when being returned as a regular string. The default
is a space (" "). Specify a blank string ("")
to leave unchanged.
(int) flags see below.
(str) reserved is currently unused, and should
be set to a blank string ("").
Returns:
(int) Returns 1.
"flags" can be one or more of the following,
combined with the bitwise OR ('|') operator:
Flag Meaning
1 Return binary strings as a regular string,
instead of a hex string. Any NULL's found within
the binary string will be replaced with the "null-sub"
character.
See Also:
n4ObjGetVal
n4ServerInfo(server-name,
request #)
Returns information on the specified NetWare
server.
Syntax:
n4ServerInfo(server-name, request #)
Parameters:
(str) server-name name of a network file server
or empty string.
(int) request # see below.
Returns:
(int) the requested server information.
Request Meaning
1 major NetWare version number
2 minor NetWare version number
3 revision number of the NetWare OS on NetWare
server
4 maximum number of connections the server will
support
5 highest number of connections simultaneously
in use
6 number of connections the server currently
has in use
7 maximum number of volumes the server will support
8 SFT level the server supports
9 TTS Level of NetWare server operating system
Example: Get
Server Info
AddExtender("wwn4x32i.dll")
;Assuming
user is attached to and logged into server
;
a=n4ServerInfo("\\CHICAGO",7)
Message("The
server will support at most:","%a% volumes")
See Also:
n4GetUser, n4DrivePath,
n4DriveStatus,
n4ServerList,
Environment (found in main WIL documentation)
n4ServerList(request#)
Returns name of connected server.
Syntax:
n4ServerList(request #)
Parameters:
(int) request # 0 - all connected servers (tab-delimited
list)
1 - default server
2 - primary server
3 - preferred server or tree
4 - all known servers (TAB-delimited list)
Returns:
(str) the name of the connected server.
Example: Get
Server Name
AddExtender("wwn4x32i.dll")
server
= n4ServerList(1)
Message("Default
server", server)
See Also:
n4GetUser, n4DrivePath,
n4DriveStatus,
Environment (found in main WIL documentation)
n4SetContext(context,
tree)
Changes the context and/or tree for the current
script.
Syntax:
n4SetContext(context, tree)
Parameters:
(str) context Directory Services context to be
set. If this parameter is a blank string (""),
the context will not be changed.
(str) tree Directory Services tree to be set.
If this parameter is a blank string (""), the
tree will not be changed.
Returns:
(int) always 1.
This function changes the NetWare context and/or
tree that is used by subsequent function calls
from this extender (for those functions which
do not take an explict "context" or "tree" parameter).
The new settings affect only the current script,
and the changes to the context and/or tree remain
in effect only for the duration of the current
script.
Example: Change
Context
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
UserID="FRED"
Context="ACCOUNTING"
Tree="WORLDWIDEINC"
n4SetContext(context,tree)
n4Login(UserID,
Pswd, Context, Tree)
n4Attach(MyServer)
n4Map("\\DEPT07\SYS\Excel",
"Q:")
OrigDir=DirGet()
DirChange("Q:\")
RunWait("EXCEL.EXE","/E")
DirChange(OrigDir)
n4MapDelete("Q:")
if
n4GetMapped(MyServer)==""
then n4Detach(MyServer)
n4Logout()
See Also:
n4SetContextG,
n4login
n4SetContextG(context,
tree)
Changes the current user's global default context
and/or tree.
Syntax:
n4SetContextG(context, tree)
Parameters:
(str) context Directory Services context to be
set. If this parameter
is a blank string (""), the context will not
be changed.
(str) tree Directory Services tree to be set.
If this parameter is
a blank string (""), the tree will not be changed.
Returns:
(int) always 1.
This function changes the current user's default
NetWare name context and/or preferred Directory
Server tree name. These changes affect future
Directory Services calls, but do not affect the
current script or other programs which are already
running.
Example: Set
Global Context
;
This script changes the global Novell Client
environment on a Win32 system
;
running a current version (v3.10 SP1 on Win9x,
v3.60 SP1 on WinNT) of the
;
Novell Client for Win9x/WinNT. When working
in a multiple NDS tree
;
environment it is some times necessary to
be able to change the
;
primary/preferred NDS tree on a global basis
because some NDS-aware
;
programs are not able to specify which tree
they are working with.
;
If a tree name is selected then the primary/preferred
tree name will be
;
changed.
;
;
All other context specifications work just
like the DOS-based CX.EXE
;
utility A context of '.' moves you up one
level towards the root of the
;
tree. A context of '[Root]' sets you
to the root. A context with a
;
leading '.' sets you to an absolute context.
A context with no
;
leading '.' sets you relative to you current
context.
AddExtender('wwn4x32i.dll')
NewContext
= ''
if
(IsDefined(param1))
NewContext
= param1
endif
NewTree
= ''
if
(IsDefined(param2))
NewTree
= param2
endif
ErrorMode(@OFF)
n4SetContextG(NewContext,NewTree)
ErrorMode(@CANCEL)
exit
See Also:
n4SetContext
n4SetOptions( option,
value)
Controls the format in which distinguished names
are returned.
Syntax:
n4SetOptions( option, value)
Parameters:
(int)option option flag. (see below)
(int)value @TRUE or @FALSE. (see below)
Returns:
(int) always 1.
Option Value Meaning
1 @TRUE/@FALSE Return typeless names
2 @TRUE/@FALSE Return abbreviated names
3 @TRUE/@FALSE Return canonical names
By default, all are @FALSE, and names are returned
as stored and/or based on default context flags.
Note: that abbreviating an already-abbreviated
name may causes a dot to be added to the end of
the name.
Example: Set
Format for Names
AddExtender("wwn4x32i.dll")
n4SetOptions(
1, @TRUE)
See Also:
n4ObjectList,
n4NameConvert
n4SetPrimServ( server)
Sets the primary server.
Syntax:
n4SetPrimServ(server)
Parameters:
(str)server specifies a server name in UNC format,
eg, "\\MYSERVER".
Returns:
(int) always 1.
Example: Set
Primary Server
AddExtender("wwn4x32i.dll")
MyServer="\\DEPT07"
n4SetPrimServ(MyServer)
See Also:
n4login
n4UserGroupEx(server-name,
user-name, context)
Returns a list of groups to which the specified
user belongs, in the specified context.
Syntax:
n4UserGroupEx(server-name, user-name, context)
Parameters:
(str) servername name of a network file server.
(str) user-name name of the current user.
(str) context a Directory Services context, or
"" for the default context.
Returns:
(str) a tab-delimited list of groups.
If the specified server is a Directory Services
connection, the group names will contain distinguishing
path information. (i.e. "Server1.Users")
Example: Find
Group Memberships for User
AddExtender("wwn4x32i.dll")
;
;Assuming
user is attached to and logged into server
;
list=N4UserGroupEx("\\CHICAGO","JOE","")
AskItemList("User
belongs to these groups",list,@tab,@sorted,@single)
See Also:
n4GetUser, n4DrivePath,
n4DriveStatus,
n4ServerList,
Environment (found in main WIL documentation)
n4UserGroups(server-name,
user-name)
Returns a list of groups to which the specified
user belongs.
Syntax:
n4UserGroups(server-name, user-name)
Parameters:
(str) servername name of a network file server.
(str) user-name name of the current user.
Returns:
(str) a tab-delimited list of groups.
If the specified server is a Directory Services
connection, the group names will contain distinguishing
path information. (i.e. "Server1.Users")
Example: Find
Group Memberships wo Context
AddExtender("wwn4x32i.dll")
;
;Assuming
user is attached to and logged into server
;
list=N4UserGroups("\\CHICAGO","JOE")
AskItemList("User
belongs to these groups",list,@tab,@sorted,@single)
See Also:
n4GetUser, n4DrivePath,
n4DriveStatus,
n4ServerList,
Environment (found in main WIL documentation)
n4Version( )
Returns the version of this Extender DLL.
Syntax:
n4Version( )
Parameters:
none
Returns:
(int) the version of number of this extender
Dll.
This function is used to check the version number
of this Dll in cases where older DLL's exist and
alternate processing is desirable. Version numbers
of newer versions will be larger than that of
older versions.
Example: Get
WIL Extender DLL Version
AddExtender("wwn4x32i.dll")
a=n4Version()
Message("Dll
Version",a)
|