Page 1 of 1 1
Topic Options
#176820 - 2007-06-08 07:44 AM Get Batch Info
ClientMaster Offline
Fresh Scripter

Registered: 2005-01-19
Posts: 46
Loc: Tokyo, Japan
I am running a kix batch as logon on all of my client pcs.
this kix batch is started by using a DOS batch.
I am trying to get the kix batch to retrieve the DOS batch name and log it.
Any ideas how I can get the logonscript DOS batch name?
_________________________
How can you know good, unless you experience bad.

Top
#176822 - 2007-06-08 09:47 AM Re: Get Batch Info [Re: ClientMaster]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Unless I'm forgetting some macro or just zoned out (as it is 3:45am my time and I can't sleep), I think you just need to add a variable to the line in your batch file that starts your kix script. For example:

kix32 yourscript.kix $batch=%0

then in your kix script just write or display the $batch variable like normal. For example:

? "[" +$batch + "]"
_________________________
(... better days ahead)

Top
#176823 - 2007-06-08 09:51 AM Re: Get Batch Info [Re: ClientMaster]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
It depends on why you need to do it, but the easiest way is to pass the value on the command line.

For example, in your batch file:
 Code:
REM *********************************
REM * THIS IS THE XYZLOGON.BAT FILE *
REM *********************************
 
\\server\path\kix32.exe \\server\path\logon.kix $sBatchFile="XYZLOGON.BAT"


Then you can pick up and display the value in KiXtart:
 Code:
"This script was called by batch file '"+$sBatchFile+'"'+@CRLF


[edit]Allen was faster, and the %0 is simpler. Tch, must be getting old.[/edit]

Top
#176824 - 2007-06-08 10:03 AM Re: Get Batch Info [Re: Richard H.]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
 Quote:
[edit]Allen was faster, and the %0 is simpler. Tch, must be getting old.[/edit]


Even if you are getting old, it is a rare day when I pull one out over you bud.
_________________________
(... better days ahead)

Top
#176853 - 2007-06-09 03:30 AM Re: Get Batch Info [Re: Allen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why even run it from within a batch file unless you're still supporting Windows 9x. Also, why do you need to log the batch file name to begin with?

Edited by Sealeopard (2007-06-09 03:30 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#176892 - 2007-06-11 03:45 PM Re: Get Batch Info [Re: Sealeopard]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
%0 for the batch, @ScriptName for your script \:\)
Top
#176905 - 2007-06-12 04:43 AM Re: Get Batch Info [Re: Arend_]
ClientMaster Offline
Fresh Scripter

Registered: 2005-01-19
Posts: 46
Loc: Tokyo, Japan
apronk,
Sorry, I am not sure what you mean?
Could you explain?
_________________________
How can you know good, unless you experience bad.

Top
#176906 - 2007-06-12 09:07 AM Re: Get Batch Info [Re: ClientMaster]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Like this:

 Code:
@ScriptName+" was called by batch file '"+$sBatchFile+'"'+@CRLF

Top
#177054 - 2007-06-19 04:51 AM Re: Get Batch Info [Re: Allen]
FromTheBeanBag Offline
Lurker

Registered: 2007-06-19
Posts: 3
 Originally Posted By: Allen
For example:

kix32 yourscript.kix $batch=%0

then in your kix script just write or display the $batch variable like normal. For example:

? "[" +$batch + "]"



Is their a way to do this without the kix32?? As my command line is currently

yourscript.kix $batch=%0

And the $batch variable is empty.

Cheers,
Dave.


Edited by FromTheBeanBag (2007-06-19 04:56 AM)

Top
#177055 - 2007-06-19 05:13 AM Re: Get Batch Info [Re: FromTheBeanBag]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
I'm a little confused by your question. Are you doing this in a batch file or directly from the command line? If it is from the command line, I'm guessing you've set up an association with .kix and kix32.exe, so is there no batch... can you give us more details?

Edited by Allen (2007-06-19 05:24 AM)
_________________________
(... better days ahead)

Top
#177056 - 2007-06-19 06:40 AM Re: Get Batch Info [Re: Allen]
FromTheBeanBag Offline
Lurker

Registered: 2007-06-19
Posts: 3
Sorry for the confuzzlement..

As you've guessed, I've setup an association for .kix to launch kix32 and i don't need to prepend the command line with the kix32..

When the command line is

kix32 script.kix $args=hello123

$args is parsed into the script.kix and all is good.

But when the command line is just

script.kix $args=hello123

The variable $args does not appear within the script.


Cheers,
Dave

Top
#177057 - 2007-06-19 07:01 AM Re: Get Batch Info [Re: FromTheBeanBag]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
I believe the problem is in your association.

Try changing it to something like:

kix32.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
or
kix32.exe %*

[edit: just thinking... I dont believe %* will work... it will include %0 which is not what you want]



Edited by Allen (2007-06-19 07:08 AM)
_________________________
(... better days ahead)

Top
#177058 - 2007-06-19 07:47 AM Re: Get Batch Info [Re: FromTheBeanBag]
FromTheBeanBag Offline
Lurker

Registered: 2007-06-19
Posts: 3
WOOHOO! FIXED!!

As the script name was being passed to kix32.exe, i just assumed all variables were being passed.. But infact the mapping only had %1 passed.

Thanks for ya help!! Much appreciated.

Cheers,
Dave

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 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.072 seconds in which 0.028 seconds were spent on a total of 13 queries. Zlib compression enabled.

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