Page 1 of 1 1
Topic Options
#52374 - 2000-11-27 04:37 PM What is the name of the script?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Hey guys!

I have been kixing around an idea of having a kix script reference it self for information (Well, Shawn put the bug in my ear!). What I am looking for is a way to ID the current running script's file name.

I am trying to get away from having to do this.

code:

$script = @curdir + "test.kix"

because, some one could come along and rename the script!

Bryce

Top
#52375 - 2000-11-27 10:24 PM Re: What is the name of the script?
BoxKite Offline
Da Box
*****

Registered: 2000-05-17
Posts: 282
Loc: Vacaville,CA,USA
Are you wanting to reference the file, or whats in the file, or am I missing the point.

I do that alot, missing the point I mean.

_________________________
Box
FACTA NON VERBA

Top
#52376 - 2000-11-27 11:50 PM Re: What is the name of the script?
Anonymous
Unregistered


at windows me (sorry but I am there right now) if you type "doskey /history" you have a list of the more recent commands. The command that run your script is the last one. So you have start substr(1,$i,len($var)-$i) blah blah
Top
#52377 - 2000-11-27 11:58 PM Re: What is the name of the script?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Box:
I want the name of the currently running script, I think, i might be able to use Nova's idea!

Nova:
Thanks!

Bryce


Top
#52378 - 2000-11-28 03:33 PM Re: What is the name of the script?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Nova:

Thanks, for the input but I am back to square one I think.

I can't get

shell '%comspec% /c doskey /history'

to work (on win2k) .... but a

shell '%comspec% /c doskey /?'

will work??....

Bryce

Top
#52379 - 2000-11-28 04:34 PM Re: What is the name of the script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Guys

I don't think doskey has any history during the initial logon process - might want to check it out before you invest alot of time !

Shawn.

p.s. I think KIX could use the following new macros ...

@SCRIPT - name of script
@LINE - current line number of script

Just think how neat @LINE would be - we could display error messages with line numbers !


[This message has been edited by Shawn (edited 28 November 2000).]

Top
#52380 - 2000-11-28 06:40 PM Re: What is the name of the script?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Yea i don't think it will work....

so i am stuck with.

$script = @curdir + "test.kix"

I can live with this

Bryce

Top
#52381 - 2000-11-28 08:54 PM Re: What is the name of the script?
Anonymous
Unregistered


Ok the doskey /history it is not the best solution ... ( at my win me , win 2k box works )

Here is the briliant idea of the day #2 :

why not to use the variable $scriptname ? It will return the name of your script. All you have to is to start your script with the command :
kixtart whatever.kix

The kixtart is a bat file that you ll have to copy to the known place ....

here are the contents of the kixtart.bat


code:

@echo off
goto code

-------------------------------------------------

If you run your kixtart script within that bat
file, then inside your script you can have the
script name available as variable $scriptname

The only thing you have to is simply to start
your script with the command :

kixtart script.kix

If for some reason you want to start your script
with the classical way and do not have the option
of $scriptname variable, then you have to give
the command :

kixtart script.kix -normal


George Bouras
root@novastar.dtdns.net

-------------------------------------------------

:code
cls

if "%1%"=="" goto error
if "%2%"=="-normal" goto normal
if "%2%"=="" goto iloveperl
if not "%2%"=="" goto ohnoo
if not "%3%"=="" goto error

goto iloveperl
:error
echo.
echo.
echo You are missing the kix script name !
echo You have to do something like this :
echo.
echo kixtart myscript.kix
echo.
echo Please try again : )
echo.
echo.
goto end

:ohnoo
echo.
echo.
echo It looks that you tried to run your
echo script with the default way; close
echo enough but not exactly. Try the
echo command :
echo.
echo kixtart myscript.kix -normal
echo.
echo.
goto end


:normal
%comspec% /c kix32.exe %1
goto end

:iloveperl
%comspec% /c kix32.exe %1 $scriptname=%1%
goto end

:end


by the way, why I downgraded from member to junior ? :)

Top
#52382 - 2000-11-28 09:32 PM Re: What is the name of the script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Nova:

I noticed that yesterday (you being a junior member that is). At first I thought you were a different (new) guy that stole the name.

But then I searched on your posts and realized that you've always been an un-registered member.

Did you just properly register a day or so ago ? - I guess that's why there's no record of any of your old posts !

Oh well - everyone knows you're a big contributor around these parts !

Shawn.

Top
#52383 - 2000-11-28 11:17 PM Re: What is the name of the script?
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Shawn/Bryce

I Agre we could use the macro:
@SCRIPT - name of script

We already have:
@ScriptDir - Directory of current script

Of course it would be nice to have the @Line macro. But what would the cost be in terms of the size of kix32.exe !!

As long as KiXtart dosn't support @Script you can make any trick to obtain the name of the script called from the commandline, but scripts called from whitin other KiX-scripts will be "invissible".
I see that even Bryce have given up! (No chalenge Bryce, keep on brainstorming for new ideas for KiXtart!!)

Erik

[This message has been edited by kholm (edited 29 November 2000).]

Top
Page 1 of 1 1


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

Who's Online
0 registered and 857 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.068 seconds in which 0.046 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