Placing your orderProducts and DownloadsPsychic Tech Support

 

Home  
Product Info  
  Quickstart
WinBatch
Compiler
WebBatch
Downloads  
Tech Support  
 

Online BBS
Database

Purchase  
  New
Renewals
Int'l. Resellers
More Info  
  Using WinBatch®
User Comments
WinBatch® Links
Whitepapers
Pressroom
What's New
Faq's
Housekeeping  
  About us
Contact Us
Funny pages
Privacy
Fine Print

Copyright ©1995-2008, Wilson WindowWare, Inc. All rights reserved.

 

 

WinBatch White Papers

Home | Tech Support | White Papers

WinBatch Home Page

Buy WinBatch

Product list

Download WinBatch

Library of useful examples

Solutions With NetWare Extenders

WinBatch can save time managinge client networking, rolling out software, and much more. The sample scripts below show how.

Functions Specific for NetWare

WinBatch functions include these for Netware 4 and 5. Netware and Windows 2000/NT/98 network functions can run from the same script.

Sample Scripts for Common Tasks

Functions for Netware Clients

 Scripting Basics

WIL Language Syntax

Logins

Quick Script: Login (NDS), Run App, Logout

Long Script: Complete Logon, Run Application, Logoff Script

Set Primary Server

Log Out of an NDS Server

Logout from a Tree

Servers

Get Server Name

Get Server Info

Server Access

Another Server Access Script

File Service, Drives, Mappings

Map a Drive

List Mapped Drives

Root Map a Drive to a UNC Pathname

Get List of Mapped NetWare Drives

Map a Drive to a UNC Pathname

Remove a drive mapping

Get a List of Users Accessing a File

Set File Attributes

Get File Attributes

Get Status of a Local Drive

Return the Network Resource of a Local Drive

Printer Service

Capture a Printer

Delete a Printer Capture

Return Queue Associated with a Capture

User Management

Changing Passwords

Find Group Memberships wo Context

Find Group Memberships for User

Send Message to All Users

Send Message to a User

Assign a User to a Group

Check a Group for a Member

Delete a User from a Group on a Server

Get Currently Logged on User

Get Object ID of User

Get Logged on User

Get Current User's Context or Tree

Get a List of Users Accessing a File

NDS

Change Context

Set Global Context

Logout from a Tree

Get NDS Object Properties

Get NDS Info on Objects

List NDS Objects

Rename NDS Objects

Search for NDS Objects

Move NDS Objects

Delete NDS Objects

Convert Object Names Between Formats

Log Out of an NDS Server

Set NetWare Directory Attributes

Get NetWare Directory Attributes

 

n4Attach(server-name)

n4CaptureEnd(port-number)

n4CaptureGet(port-number)

n4CapturePrt(server-name, queue-name, port-number, flags)

n4ChgPassword(server-name, user-name, old password, new-password)

n4Detach(server-name)

n4DirAttrGet(dirname)

n4DirAttrSet(dirname, attribs, mode)

n4DirTimeGet()

n4DrivePath(local-name)

n4DriveStatus(local-name)

n4FileAttrGet(filename)

n4FileAttrSet(filename, attribs, mode)

n4FileTimeGet()

n4FileUsers(server, filename)

n4GetContext()

n4GetMapped(server-name)

n4GetNetAddr(server-name, flags)

n4GetUser(server-name)

n4GetUserId(server-name, user-name, format)

n4GetUserName( context)

n4GetConnNum(server-name)

n4Login( user-name, password, context, tree)

n4Logout( )

n4LogoutTree()

n4Map(net-path, local-name)

n4MapDelete(local-name)

n4MapDir(net-path, local-name)

n4MapRoot(net-path, local-name)

n4MemberDel(group-name ,user-name)

n4MemberGet(group-name ,user-name)

n4MemberSet(group-name , user-name)

n4MsgSend(server-name, message , user-name)

n4MsgSendAll(server-name, message)

n4NameConvert(context, object, format)

n4ObjGetVal(context, object, attribute,addr of buffer,size of buffer)

n4ObjOptions( value-delim, field-delim, null-sub, flags, reserved)

n4ObjDelete( context, object)

n4ObjectList(context, parent, class, mask)

n4ObjectInfo(context, object, request)

n4ObjectProps(context, object, attribute)

n4ObjMove( context, object, new-name, retain)

n4ObjRename( context, object, new-name, retain)

n4ObjSearch( context, object, class, parent, flags)

n4ServerInfo(server-name, request #)

n4ServerList(request#)

n4SetContext(context, tree)

n4SetContextG(context, tree)

n4SetPrimServ( server)

n4SetOptions( option, value)

n4Version( )

n4UserGroupEx(server-name, user-name, context)

n4UserGroups(server-name, user-name)

General

Get WIL Extender DLL Version

Set Format for Names

Finding Network Types

 

 

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.


 

This page


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

 

This page


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)

 

 

This page


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)

This page


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

This page


 

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

This page


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

This page


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

 

This page


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")

 

This page


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

 

This page


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

This page


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

This page


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

This page


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

This page


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

This page


n4FileAttrGet(filename)

This page

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

This page

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

This page


n4FileAttrSet(filename, attribs, mode)

This page

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

This page

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

This page


n4FileTimeGet(filename, time-field)

This page

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

This page


n4FileUsers(server, filename)

This page

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

This page

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

 

This page


n4GetConnNum(server-name)

This page

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

 

This page


n4GetContext(request)

This page

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

This page

AddExtender("wwn4x32i.dll")

context = n4GetContext(0)

list=N4UserGroupEx("\\CHICAGO","JOE",context)

AskItemList("User belongs to these groups",list,@tab,@sorted,@single)

See Also:

n4UserGroupEx

 

 

This page


n4GetMapped(server-name)

This page

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

This page

addExtender("wwn4x32i.dll")

MappedDrives = n4GetMapped("\\SERV01")

Message("Mapped drives on \\SERV01", Mapped Drives)

See Also:

n4DrivePath, n4DriveStatus

 

 

This page


n4GetNetAddr(server-name, flags)

This page

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

This page

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)

 

 

This page


n4GetUser(server-name)

This page

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

This page

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)

 

 

This page


n4GetUserId(server-name, user-name, format)

This page

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

This page

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)

 

This page


n4GetUserName( context)

This page

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

This page

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

 

This page


n4Login( user-name, password, context, tree)

This page

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

This page

;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

 

This page


n4Logout( )

This page

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

This page

;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

 

 

This page


n4LogoutTree( context, tree)

This page

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

This page

;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

 

 

This page


n4Map(net-path, local-name)

This page

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

This page

;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

This page


n4MapDelete(local-name)

This page

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

This page

;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

This page


n4MapDir(net-path, local-name)

This page

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

This page

;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

 

This page