aenm
(Fresh Scripter)
2004-07-29 01:55 PM
Drive mapping ini file

Hi there,

I'm getting the hang of kixtart but maybe someone can help me out with this problem.

I use KiXGUI 1.0 also to get that nice interface.

Trough a function (a part is shown below) I read strings from a ini file:
Code:

Dim $tmpDrv
$Sec = ReadProfileString($inFile,$inSec,"")
$aMaps = Split($Sec,Chr(10),-1)
$ileft = 3
$itop = 6
For Each $a In $aMaps
$tmpDrv = ReadProfileString($inFile,$inSec,$a)
$aParms = Split($tmpDrv,",")
$act = Ubound($aParms)
If $act = 1
If Exist ($aParms[1])
Use $aParms[0] + ":" $aParms[1]
$path = $aParms[0] + ":" + $aParms[1]
$form.text = $form.text + $path + Chr(13) + Chr(10)
Else
$form.text = $form.text + "Error bij het aanmaken" + $aParms[1] + Chr(13) + Chr(10)
EndIf
EndIf
Next
$GroupMap = 1
EndFunction



Many of you will know this code. I ripped it from the internet.
With the use of the ini file it works fine, but when a macro is defined the string would not recognize the part of the string (\\servername\$USERID). Can someone help me out how to read or convert this so the username is given right?

Sorry for the worse english.

Martin


Sealeopard
(KiX Master)
2004-07-29 02:02 PM
Re: Drive mapping ini file

I don't see where in your string you define a macro. See the MapDrive() UDF as it demonstrates how to resolve macros inside a text string.

aenm
(Fresh Scripter)
2004-07-29 02:40 PM
Re: Drive mapping ini file

Sorry I misspelled my line.
I use \\servername\@USERID in my ini file as followed:

MapDrive1=u,\\ servername \@USERID

The @USERID isn't translated.


LonkeroAdministrator
(KiX Master Guru)
2004-07-29 03:34 PM
Re: Drive mapping ini file

yep.
replace:
Use $aParms[0] + ":" $aParms[1]

with:
$nul=execute(Use $aParms[0] + ":" $aParms[1])

and see if that does the trick.


aenm
(Fresh Scripter)
2004-07-29 05:24 PM
Re: Drive mapping ini file

I will try. But not now

JochenAdministrator
(KiX Supporter)
2004-07-30 12:23 AM
Re: Drive mapping ini file

Quote:


I use KiXGUI 1.0 also to get that nice interface.





see my sig to get an even nicer interface


aenm
(Fresh Scripter)
2004-07-30 02:12 PM
Re: Drive mapping ini file

Quote:

yep.
replace:
Use $aParms[0] + ":" $aParms[1]

with:
$nul=execute(Use $aParms[0] + ":" $aParms[1])

and see if that does the trick.




After that I get (while running the script) "Error in expression".


aenm
(Fresh Scripter)
2004-07-30 02:15 PM
Re: Drive mapping ini file

Quote:

Quote:


I use KiXGUI 1.0 also to get that nice interface.





see my sig to get an even nicer interface




Yep, you convinced me. I use the kixforms.dll in combination with the wkix32.exe and that ugly prompt box is gone


aenm
(Fresh Scripter)
2004-08-02 10:27 AM
Re: Drive mapping ini file

If InStr($aParms[1],'@@')
$rc=Execute('$aParms[1]="'+$aParms[1]+'"')
EndIf

This did the trick.

Many thanks


LonkeroAdministrator
(KiX Master Guru)
2004-08-02 01:28 PM
Re: Drive mapping ini file

the execute rules sometimes get us, specially if novarsinstrings is set to on.
glad to hear you worked it out yourself.