Page 1 of 1 1
Topic Options
#24908 - 2002-07-11 10:50 PM Macro problem using INI file.. Please help!!!
KixStuck Offline
Fresh Scripter

Registered: 2002-07-11
Posts: 8
I am creating a script that will map drives for my users. Problem exists when I have to use a macro in the INI file and in the script trying pipe the result to a variable. It interprets the result has a string, which is understandable. I need to find out how to get Kixtart to recognize macro embedded in the string.

Sample Code:

$GrpName = readprofilestring ("@lserver\netlogon\kix\ini\groups.ini", 3, "group")
$DrvLtr = readprofilestring ("@lserver\netlogon\kix\ini\groups.ini", 3, "drive")
$Share = readprofilestring ("@lserver\netlogon\kix\ini\groups.ini", 3, "share")

at (13,5) "Executing:"
If ingroup("$GrpName")
at (13,20) "Mapping $DrvLtr to $Share"
Messagebox ($Share,"Show Share",)
use $DrvLtr /delete
use $DrvLtr $Share
sleep 2
endif

Sample of the INI file:

[3]
Group="network group"
Drive=W:
Share=\\is\netdata\users\@userid\lnotes

Thanks in advance for any assistance.

Top
#24909 - 2002-07-11 11:06 PM Re: Macro problem using INI file.. Please help!!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
dear, try your ini with:
Share=\\is\netdata\users\@@userid\lnotes

more on this in kixtart.doc

cheers,
_________________________
!

download KiXnet

Top
#24910 - 2002-07-11 11:23 PM Re: Macro problem using INI file.. Please help!!!
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Welcome to the board.

It is possible by using the Execute command.
Our version is
code:
 $grpname = ReadProfileString ("@lserver\netlogon\kix\ini\groups.ini", "3", "group")
$drvltr = ReadProfileString ("@lserver\netlogon\kix\ini\groups.ini", "3", "drive")
$share = ReadProfileString ("@lserver\netlogon\kix\ini\groups.ini", "3", "share")
$nul = Execute('$dummy="$share"')
$share = $dummy

At (13,5) "Executing:"
IF (InGroup("$GrpName") <> 0)
At (13,20) "Mapping $DrvLtr to $Share"
$nul=MessageBox ($share,"Show Share")
USE $drvltr /delete /persistent
USE $drvltr $share
ENDIF

FYI: IF/ENDIF win combination with Execute will not work. IF/ENDIF creates it
in his own environment block.
So don't use structures like this
code:
 $share = ReadProfileString ("@lserver\netlogon\kix\ini\groups.ini", "3", "share")
IF Execute('$dummy="$share"')
ENDIF
$share = $dummy

the result isn't the same.

greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#24911 - 2002-07-11 11:28 PM Re: Macro problem using INI file.. Please help!!!
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
As MCA stated:

Use the Execute() function to resolve the contents of @userid

You read the share from the ini-file, as you have done:
code:
$Share = readprofilestring ("@lserver\netlogon\kix\ini\groups.ini", 3, "share")

Add the following line just after this, to 'execute' the macro in the string:
code:
$RC = Execute('$$Share="$Share"')

If you are logged in as user: jaemi

Then $Share will contain:
\\is\netdata\users\@userid\lnotes
Before the Execute()

And
\\is\netdata\users\jaemi\lnotes
After the Execute()

-Erik

ps.

MCA, [Wink]
Your execute statement should look like this:
$nul = Execute('$$dummy="$share"')

[ 11 July 2002, 23:36: Message edited by: kholm ]

Top
#24912 - 2002-07-11 11:39 PM Re: Macro problem using INI file.. Please help!!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for something on execute there is:
http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=12;t=000238

something even jpols the executer could be broud of.
_________________________
!

download KiXnet

Top
#24913 - 2002-07-11 11:54 PM Re: Macro problem using INI file.. Please help!!!
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear kholm,

Indeed your version is also possible, but during testing with IF/ENDIF structure we introduce the
additional variable.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#24914 - 2002-07-11 11:59 PM Re: Macro problem using INI file.. Please help!!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
jaemi

Your question was answered here. Please do not cross post.
I have deleted the topic from SCRIPTS forum as all answers are here already.

http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003598

Top
#24915 - 2002-07-12 12:43 AM Re: Macro problem using INI file.. Please help!!!
KixStuck Offline
Fresh Scripter

Registered: 2002-07-11
Posts: 8
Thanks everyone!!! It works... You guys are a life saver (and not to mention time saver).

Thanks again.

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1172 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

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

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org