Let see if i can explain this right....

first the ini file i am using

test.ini

code:

[test]
Drive = y:
unc = \\server\@userid$$

Running this code, the execute command works just fine.

code:

$Drive = readprofilestring("@curdir"+"test.ini","test","drive")
$unc = readprofilestring("@curdir"+"test.ini","test","UNC")

nul = execute('use $Drive "$UNC" exit(@@error)')

? @serror


Now, i place the same execute command in to a function

code:

Function MapDrive($a,$b)
$MapDrive = ""
use $a /d
$nul = execute('use $a "$b" exit(@@error)') ;this is the error point for Beta 2
if @error = 0
$nul = execute('? "$tab$a mapped to $b"')
$mapdrive=0
exit(0)
ELSE
$nul = execute('? "$tabThere was Error#@error mapping $drive to $b$cr$tab@Serror"')
$mapdrive=@error
exit(@error)
endif
endfunction


$Drive = readprofilestring("@curdir"+"test.ini","test","drive")
$unc = readprofilestring("@curdir"+"test.ini","test","UNC")

$nul = mapdrive($drive, $unc)
? @serror


and i get the following error, and kix exits

quote:

Script error : error in USE statement !
if @error = 0

This is code that works fine under kix4.00 Beta 1, but not Beta 2

Bryce

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

[This message has been edited by Bryce (edited 25 April 2001).]