Groups search result 22 for apmt os/2 |
"Bryan Wall" (bryanw@nowhere.com) writes:
> Is there a way to have OS/2 log onto the network (NT in this case) via a
> command line? I would like to be able to put a command in startup.cmd so
> that this OS/2 Warp 3 workstation logs in automatically on bootup. I can
> log in fine interactively, so the networking is setup OK.
>
> This is an unattended workstation, and I want it to automatically log back
> in if it is ever rebooted for whatever reason. Any other method to
> accomplish the same thing would be OK also.
>
> Thanks,
> Bryan
There is a way to do this, because I do it. However, my way is a crude
hack and maybe someone else has a better way (I hope so!)
I use a REXX program built into MYSTARTUP.CMD. IT calls two REXX
libraries, APMT (available free) and RxExtras (was licensed out of
Australia, maybe free by now).
Best of luck!
--
/* REXX programs must start with a comment */
CALL RxFuncAdd 'SysSleep', 'REXXUTIL', 'SysSleep'
CALL RxFuncAdd 'SysCreateObject', 'REXXUTIL', 'SysCreateObject'
CALL RxFuncAdd 'SysOpenObject', 'REXXUTIL', 'SysOpenObject'
/* these lines load some functions that come with REXX */
CALL RxFuncAdd 'APMTLoadFuncs', 'apmtext', 'APMTLoadFuncs'
CALL APMTLoadFuncs
rc = INIT_SESSION()
IF rc \= 0 THEN DO
SAY 'APMT says:' apmtmsg
EXIT
END
/* these lines load APMT -- you need this to simulate a mouse click */
CALL RxFuncAdd 'RxExtra', 'RxExtras', 'RxExtra'
CALL RxExtra 'Load'
/* these lines load RxExtras -- you need this to read the task list */
NTpath ='C:\Desktop\OS2 System\LAN Services File and Print'
/* This tells REXX where to find the desktop object that
you would click to connect to the NT server. Substitute
your own path and name (note that it's in the Desktop folder).
*/
/* OK, here we go: */
rc = SysCreateObject("WPProgram","LAN Server Logon", NTpath,
"ObjectID=<LAN Server Logon>", update)
/* this makes the desktop object accessible to REXX. Despite the command
name, it does not create the object, since in this case the object
already exists.
*/
rc = SysOpenObject('<LAN Server Logon>','DEFAULT',1)
/* this starts the object (as if someone had double-clicked it) */
rc = SysOpenObject('<LAN Server Logon>','DEFAULT',1)
proceed = 0
count = 0
DO WHILE proceed = 0 & count < 25
count = count + 1
junk = SysSleep(2)
RxQuerySwitchList('running.')
DO n = 1 to running.0
IF running.n = 'LAN Logon' THEN DO
proceed = 1
END
END
END
/* this DO WHILE loop waits for the Logon window to show up in the
task list (the same one you see when you click both mouse buttons
at the same time) */
IF proceed <> 1 THEN DO
SAY "NT Logon dialog box has still not appeared!"
END
ELSE DO
rc = Select_Window('LAN Logon')
rc = Set_Focus()
rc = FRAME_SET_POINTER("M",1,6,1,6)
rc = MOUSE("CLICK","1")
'NET USE G: \\yourserverdrive'
END
/* this ELSE clause clicks the 'OK' button in the Logon window,
and then maps the server drive.
You may have to send the logon name and password -- I don't
know how exactly, but there must be a way. . .
*/
--
James Owens ad354@Freenet.carleton.ca
Ottawa, Ontario, Canada
©2002 Google