Page 1 of 1 1
Topic Options
#137621 - 2005-04-08 10:32 PM 2010 Beta 2a - Couple of issues
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
(1) Trying to understand or get the include working:

In our script today, we have:
Code:

IF RIGHT(@SCRIPTNAME,2)='kx'
CALL @ldrive+'kldtest\function.kx'
ELSE
CALL @ldrive+'kldtest\function.kix'
ENDIF


CALL works fine.

Why can't I do the following?
Code:

IF RIGHT(@SCRIPTNAME,2)='kx'
INCLUDE @ldrive+'kldtest\function.kx'
ELSE
INCLUDE @ldrive+'kldtest\function.kix'
ENDIF



(2) Not sure of the search path of W/KIX32, but when I run:
C:\Scripts>kix32 %logonserver%\netlogon\kldtest\kixtart

The script works fine.

But, when I run:
C:\Scripts>kix32 %logonserver%\netlogon\kldtest\kixtart.KIX

The script comes back with the following message:
Quote:


ERROR : expected string!
Script: \\CHIRON\netlogon\kldtest\kixtart.KIX





So, I am assuming that W/KIX32 automatically picks up on the .KX or compiled script before the .KIX or text version?

How this came about is that I am playing with the script, but have one that is tokenized there. So, I get bad results unless I specify the .kix extension. Call me lazy.

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#137622 - 2005-04-08 10:46 PM Re: 2010 Beta 2a - Couple of issues
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
include is an include option.
it includes the told script(s) to the including one, before any processing.
if you wanna call - or in other words, include at run time - a script, use call.

what comes to the .kix... well, worked for me on local drive...
_________________________
!

download KiXnet

Top
#137623 - 2005-04-08 10:49 PM Re: 2010 Beta 2a - Couple of issues
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Right.. But what I want to do is to INCLUDE the function script that used by several different companies in our main login script and the problem is that I have to CALL function.kix file again from one of the branch-outs from KiXtart.kix.

So, what you are saying is that you have to have a hard-mapped drive to run this correctly?

Kent


Edited by kdyer (2005-04-08 10:51 PM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#137624 - 2005-04-08 10:57 PM Re: 2010 Beta 2a - Couple of issues
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Did some more playing with this..

Commented out:
Code:

$rc=SETOPTION('Explicit','On')
$rc=SETOPTION('NoVarsInStrings','On')



And did some changes to my code - Yes I know Vars in Strings are evil.

Code:

; -- LOAD FUNCTIONS
IF RIGHT(@SCRIPTNAME,2)='kx'
INCLUDE '@ldrive\kldtest\function.kx'
ELSE
INCLUDE '@ldrive\kldtest\function.kix'
ENDIF



And.. Get an intersting error:
Quote:


ERROR : failed to find/open script [@ldrive\kldtest\function.kx]!
Script: kixtart.kix



The function.kx is there and is updated with the new version of KiX.

I map my DC\Netlogon as a drive, it works fine:
Code:

IF RIGHT(@SCRIPTNAME,2)='kx'
INCLUDE 'z:\kldtest\function.kx'
ELSE
INCLUDE 'z:\kldtest\function.kix'
ENDIF



Thanks,

Kent

Edited by kdyer (2005-04-08 11:00 PM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#137625 - 2005-04-09 01:08 AM Re: 2010 Beta 2a - Couple of issues
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
IIRC, Ruud has stated multiple times that macros and variables cannot be used in the INCLUDE function, otherwise the pre-tokenization would not work if the final INCLUDE path is only being decided upon at run-time. Then again, doing an INCLUDE at run-time is kind-of pointless, anyway.
_________________________
There are two types of vessels, submarines and targets.

Top
#137626 - 2005-04-09 09:14 AM Re: 2010 Beta 2a - Couple of issues
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
and, if one wants it, there is call that does exactly that.
_________________________
!

download KiXnet

Top
#137627 - 2005-04-11 03:43 AM Re: 2010 Beta 2a - Couple of issues
Ruud van Velsen Offline
Developer
*****

Registered: 1999-05-06
Posts: 359
Loc: Amsterdam, The Netherlands
The issue here is that the current implementation of INCLUDE only accepts clear-text scripts (ie: .KIX scripts, not .KX scripts). Sorry this wasn't clear yet, I'll make sure it is clarified in the documentation.

Kind regards,

Ruud

Top
#137628 - 2005-04-11 03:50 AM Re: 2010 Beta 2a - Couple of issues
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ruud,
What about the macro and UNC in the path? Any comment?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#137629 - 2005-04-11 12:32 PM Re: 2010 Beta 2a - Couple of issues
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
and the path...
not relative to curdir but exe-dir.
_________________________
!

download KiXnet

Top
#137630 - 2005-04-12 07:52 PM Re: 2010 Beta 2a - Couple of issues
Ruud van Velsen Offline
Developer
*****

Registered: 1999-05-06
Posts: 359
Loc: Amsterdam, The Netherlands
In short: INCLUDE takes either an absolute path (including a drive or UNC reference) or a path relative to the current directory.

Using macros, vars or functions with an INCLUDE statement is not supported and does not make a lot of sense (at least not considering the way it was designed). All INCLUDE does is 'tack' the INCLUDed script into the INCLUDing script. The result is just as if you had typed the INCLUDed script in the INCLUDing script. After the INCLUDE is processed and the resulting script as been tokenized, the INCLUDE statement itself is effectively gone.

What this does is provide a way to write small, modular, re-usable 'script-lets' and at the same time produce a single KX-script for use in production.

If you need to be able to dynamically call different scripts based on runtime information, you really need the CALL statement.

Let me know if there any additional questions or suggestions.

Regards,

Ruud

Top
#137631 - 2005-04-13 10:08 AM Re: 2010 Beta 2a - Couple of issues
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22334
Loc: OK
yes.
this is the info from start to finish.
and even looks clean and mean enough for manual

thanks ruud.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
0 registered and 170 anonymous users online.
Newest Members
gkustra, emnipetro, Hirze, thequeen, ameliaryan
17642 Registered Users

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