Page 1 of 1 1
Topic Options
#130273 - 2004-11-29 12:52 AM Passing Info From Kixtart to NT Shell
drum15 Offline
Fresh Scripter

Registered: 2003-11-26
Posts: 5
Loc: Glasgow, Scotland, UK
Does anyone know how to pass information from Kix to NT Shell?
Our login scripts are NT Shell, but we call some Kix scripts for some stuff. In particular I get Kix to do my AD queries, then I want to pass this info onto the NT Shell script that called my Kix Script for the Shell Script to deal.

Top
#130274 - 2004-11-29 01:03 AM Re: Passing Info From Kixtart to NT Shell
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You could write to a text file in KiX to pass stuff but why not just do everything in KiX instead?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#130275 - 2004-11-29 01:09 AM Re: Passing Info From Kixtart to NT Shell
drum15 Offline
Fresh Scripter

Registered: 2003-11-26
Posts: 5
Loc: Glasgow, Scotland, UK
Used the text file mechanism in the past. Just wondered if there was a "cleaner" way?
Yeah could use KIX for the lot, but just inherited the way it is just now. Maybe one day when I've got time..... :smirk:

Top
#130276 - 2004-11-29 01:12 AM Re: Passing Info From Kixtart to NT Shell
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
About the only thing you can pass back from KiX is %ERRORLEVEL% with the EXIT command.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#130277 - 2004-11-29 01:18 AM Re: Passing Info From Kixtart to NT Shell
drum15 Offline
Fresh Scripter

Registered: 2003-11-26
Posts: 5
Loc: Glasgow, Scotland, UK
ok, cheers!
Top
#130278 - 2004-11-29 01:37 AM Re: Passing Info From Kixtart to NT Shell
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I would really recommend that you revisit your script design and move the functionality in the Shell script into a Kixtart script. You would most likely be better served if your logon script was consolidated into KiX code. Oh, and this problem will no longer exist.

Edited by Howard Bullock (2004-11-29 01:38 AM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#130279 - 2004-11-29 01:42 AM Re: Passing Info From Kixtart to NT Shell
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
No guarantee, but if you post your current SHELL scripts here, someone "might" be bored enough to convert them to KiXtart for you.

Some of the guys here on the board are often bored looking for something to do.

Top
#130280 - 2004-12-01 02:46 AM Re: Passing Info From Kixtart to NT Shell
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I may be a bit late to this discussion and I agree with the others suggestions to change this to Kix only, but there is another way to pass info to the cmd shell from Kix...

First create your kix script. Below is my simple example.

csd.kix
Code:
  
$=setoption("ASCII","on")
@csd



Then add the following to your cmd script to set a variable to the output of the kix script.

Code:
 
@echo off
set csd=
for /f "tokens=*" %%i in ('kix32 csd.kix') do set csd=%%i
echo %csd%




To modify this to work with other kix scripts, you must prepend the line "$=setoption("ASCII","on")" to your kix script so that the script outputs ASCII characters to the console. And as another suggestion, only display one line of output per script.

Then its just a matter of modifying your cmd script to include the name of the kix script and the name of the variable you want to define.

Top
#130281 - 2004-12-01 03:28 AM Re: Passing Info From Kixtart to NT Shell
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
If you need to make this variable available to the system or other cmd shells, then you will have to use SETENV.

Code:
 
@echo off
for /f "tokens=*" %%i in ('kix32 csd.kix') do setenv -m csd "%%i"


Top
#130282 - 2004-12-01 05:45 PM Re: Passing Info From Kixtart to NT Shell
drum15 Offline
Fresh Scripter

Registered: 2003-11-26
Posts: 5
Loc: Glasgow, Scotland, UK
Al_po

Thanks for this. I will give it whirl and see what I get.

Top
#130283 - 2004-12-02 12:25 AM Re: Passing Info From Kixtart to NT Shell
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Al,

Did you actually try reading, setting vars from the called batch with this program?

Curious if it really worked.

Top
#130284 - 2004-12-02 02:14 AM Re: Passing Info From Kixtart to NT Shell
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
If you are talking about SETENV, using -M sets the variable as environment/system variable and is viewable in the system variables in the Windows GUI, and is available under different cmd shells too.

Let me know if this is not what you meant.


Top
#130285 - 2004-12-02 02:22 AM Re: Passing Info From Kixtart to NT Shell
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Curious if it really is able to allow a batch file to pull it in, once the batch has already been launched into it's own environment. Guess well let the original poster of the question let us know.
Top
#130286 - 2004-12-02 02:28 AM Re: Passing Info From Kixtart to NT Shell
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
okay... now I understand...

Well it would be a two step process if you want the var available at the time of the script, and left over for other shells...

Code:

for /f "tokens=*" %%i in ('kix32 csd.kix') do set csd=%%i
echo %csd%
setenv -m csd "%csd%"



give it a shot... it works

Top
#130287 - 2004-12-02 10:16 AM Re: Passing Info From Kixtart to NT Shell
drum15 Offline
Fresh Scripter

Registered: 2003-11-26
Posts: 5
Loc: Glasgow, Scotland, UK
Al_Po

Tried a small test script just like you suggested and played about with values and it seems to work a treat! So thanks for that.

Now just need to go and play with the real scripts....


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
0 registered and 558 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.065 seconds in which 0.023 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