#137650 - 2005-04-11 12:15 AM
Using vars and macros in Include statements
|
kholm
Korg Regular
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
You cannot use variables, macros and env-strings in Include statemenent,
You can beat this limitation, by using Execute()
Try placing this small script in @LanRoot (Normally: %WinDir%\System32) Name it: Test.inc Code:
Function IncOk() Dim $x 'I am here !!' Get $x EndFunction
Then try executing this script Code:
$RC = Execute("Include '@LanRoot\Test.inc'") IncOk()
Seems to work
I just tried: Code:
Execute("Include '@LServer\Netlogon\KiX\InstProg.udf'")
And then called a function in InstProg.udf
Also worked OK
-Erik
Edited by kholm (2005-04-11 12:38 AM)
|
Top
|
|
|
|
#137654 - 2005-04-11 01:16 AM
Re: Using vars and macros in Include statements
|
kholm
Korg Regular
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
Right Les,
I forgot to delete/rename the test.inc file.
So no beating the vars/macros in Include
-Erik
|
Top
|
|
|
|
#137657 - 2005-04-11 09:53 AM
Re: Using vars and macros in Include statements
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
Well, I have had the same thoughts (KiX generating code), but it wouldn't work for ie. @LServer, @UserID ...
-Erik
But those sort of variables don't make any sense in this context.
INCLUDE is a "tokenisation time" directive, not a run-time directive.
The files are included at the point in time that you tokenise the script, not when it is run, so @LSERVER and @USERID will be set to the value of the environment doing the tokenisation, not the value of the environment that it is going to run in.
This means that a wrapper which expand include lines is entirely feasible. However it would be better to use a mechanism designed for managing software project files.
|
Top
|
|
|
|
#137658 - 2005-04-12 08:09 PM
Re: Using vars and macros in Include statements
|
Ruud van Velsen
Developer
Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
|
Bingo! Richard is through to the next round of KiXtart Trivia: this is exactly why INCLUDE works the way it does.
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 382 anonymous users online.
|
|
|