Page 1 of 1 1
Topic Options
#77665 - 2001-04-25 06:53 PM USE command syntax.
Anonymous
Unregistered


Confused here, I've never seen any reference to this in documents before...

IMHO Kix v3.63 and before had a severe bug in the USE command surrounding parameters passed to it. I struggled to programmaticaly store username, password, share, server etc. in INI files and pull them out. E.g.

$INIFile is somewhere looking like this:

[SETTINGS]
Driveletter=V
Server=INSTALLSERV
Share=PACKAGES$
Username=JOEBLOGGS
Domain=NTDOMAIN
Password=letmein

Therefore a piece of code looking like this fails:

$DriveLetter=getprofilestring($INIFile, "Settings", "DriveLetter")
$Share=getprofilestring($INIFile, "Settings", "Share")
$Share=getprofilestring($INIFile, "Settings", "Server")
$Username=getprofilestring($INIFile, "Settings", "Username")
$Domain=getprofilestring($INIFile, "Settings", "Domain")
$Password=getprofilestring($INIFile, "Settings", "Password")
$UseParams = $driveletter + ": " + chr(34) + "\\" + $Server + "\" + $Share + chr(34) + " /user:" + $Domain + "\" + $Username + " /password:" + $Password
use $UseParams
$Error = @error

My way around it was to write all this to a file and call it. E.g.

$DriveLetter=getprofilestring($INIFile, "Settings", "DriveLetter")
$Share=getprofilestring($INIFile, "Settings", "Share")
$Share=getprofilestring($INIFile, "Settings", "Server")
$Username=getprofilestring($INIFile, "Settings", "Username")
$Domain=getprofilestring($INIFile, "Settings", "Domain")
$Password=getprofilestring($INIFile, "Settings", "Password")
$UseParams = $driveletter + ": " + chr(34) + "\\" + $Server + "\" + $Share + chr(34) + " /user:" + $Domain + "\" + $Username + " /password:" + $Password
$MapTempFile = "%TEMP%\maptemp.kix"
if exist($MapTempFile)
$RC = setfileattr($MapTempFile, 128)
del $MapTempFile
endif
$RC = open(2, $MapTempFile, 5)
$RC = writeline(2, "use " + $UseParams + chr(13) + chr(10))
$RC = writeline(2, "$$Error=@@error" + chr(13) + chr(10))
$RC = close(2)
call $MapTempFile

This worked successfully and allowed me to programmically map drives using kix. Now I've started to convert some scripts to Kix2001 Beta 2 and I see that the functionality of the command has changed. I can no longer simply hardcode a use command and call it!

e.g a file named USE.KIX simply containing the following:

use v: "\\INSTALLSERV\PACKAGES$" /user:NTDOMAIN\JOEBLOGGS /password:letmein

returns a 'Script Error: error in USE statement!' problem when called from KIX2001 Beta 2. However, It works under Kix v3.63. I know I could simply spawn a %COMSPEC% session and 'net use' the map but I loose the @error returned.

Can anyone confirm or deny that (a) there was a USE problem in Kix v3.63 and before, and (b) there is a new bug in Kix2001 which is a lot more serious!

I'm using Kix2001 on Windows 2000 Professional SP1 mapping drives to NT4 SP4 servers. However I've seen similar problems on 9x (although without /username: and /password:) and NT4.

PoD

Top
#77666 - 2001-04-25 07:12 PM Re: USE command syntax.
gregglsc Offline
Fresh Scripter

Registered: 2000-11-16
Posts: 21
Loc: USA
Looks like USE is busted entirely. A simple USE G: /DEL will not work. I have sent Ruud an email.

Gregg

Top
#77667 - 2001-04-25 07:34 PM Re: USE command syntax.
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I have run across the same problem...Execute exit(@@error) in a Function

I am doing similar operation, reading drive mapping info from an INI, but instead of writing to a kix file, i create the kix code in a variable and run it using the EXECUTE command.

Bryce

------------------
kix.isorg.net

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 509 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.05 seconds in which 0.021 seconds were spent on a total of 12 queries. Zlib compression enabled.