Page 1 of 1 1
Topic Options
#14539 - 2001-11-22 11:24 PM 2 Functions required.
Greg Hains Offline
Fresh Scripter

Registered: 2001-11-22
Posts: 14
Loc: Alice Springs, Australia
Henri.

First of all I would like to congratulate the author of this product. Its brilliant.

The ability of this tool to be able to access the registry and other areas (@wksta) etc makes it a very powerful tool. I have been waiting for years to see such a tool on the market, and am happy to purchase it - just as soon as testing is complete.

Although GUI is nice, I prefer to run many of my jobs (some take hours) in Command Prompt mode. Call me old fashioned, but I love command line programming...

I do have 2 questions though.

One of the functions that I use frequently is the DOS "FOR - IN - DO" command.
eg.
for %%d in (aaa) do call c:\utils\e.bat process %%d
for %%d in (bbb\bbb1) do call c:\utils\e.bat process %%d
for %%d in (ccc) do call c:\utils\e.bat process %%d
for %%m in (jpg,jpeg,jpe,mpg,mpeg,mpe,avi,gif,wmv,ram,rm) do copy c:\*.%%m d:\ /v

I am unsure how to apply this same syntax using Kix. Please advise.

Also, is it possible to get a filecount from any given directory? Returning a number of files, and possibly even the combined size of those files in the directory to two variables that I can display?

Or has anybody written a script that can do this?

Cheers,
Greg Hains

Top
#14540 - 2001-11-26 03:44 PM Re: 2 Functions required.
Anonymous
Unregistered


Re: the first issue. I'm not familiar with the DOS for.. in ...do. What is the objective and I'll try to give some insight into similar kix functionality.

re: the file listing.
The Dir function enumerates files in a given directory.
The GetFileSize retruns the size of a given file.
Using the two together you could enumerate all the files in a folder and add the file sizes to a variable.

If you need additional assistance please let me know.

Top
#14541 - 2001-11-26 05:25 PM Re: 2 Functions required.
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
First, kixtart is free. You don't need to buy it. Membership & participation in this forum is also free. Many members including, MCA, byrce, cj, etc. provide websites with free script and utility libraries.

Second, kixtart has been around for years. I think it was intoduced with the first NT server resource kit. Over the years, it has grown. The last major upgrade from kixtart3.63 to kix2001 is probably one of the most comprehensive. (By the way, the creator of kixtart is Ruud who occassionly participates in these forums & is oftened refered by other members.)

Third, DOS doesn't really exist starting with WinNT and higher. WinNT contains a DOS simulator only. In some ways this simulator is a more primitive version of kixtart.

Fourth, I am not sure what you mean by "GUI" in the context of kixtart. In my opinion it doesn't really have a GUI interface. It is just a powerful non-GUI scripting language. Just think of it as DOS on steroids. It provides many extra functions that DOS does not have. It has many features builtin that usually can only be accessed through utilities in DOS.

Fifth, everything you do in DOS, kixtart can do, probably better. Your examples all have kixtart equivalents. All the examples you illustrate have been discussed in great detail in the past year. Try a search of the forums.

I think once you have had a chance to work with kixtart for a while you will love it. It makes scripting more powerful, easier and cleaner. I find maintenance of kixtart scripts much easier than DOS scripts. The new UDF funtions help even more in this area.

Good luck

[ 26 November 2001: Message edited by: JackLothian ]

_________________________
Jack

Top
#14542 - 2001-11-27 09:42 AM Re: 2 Functions required.
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I don't want to start an argument, Jack, but I have to say a few things

The command processor in NT is not "DOS", but it is still a command processor. The FOR command in NT4 is improved over NT3.5x and Win2k's one is even better. With the /F switch, for example, you can read each line of a text file and extract a word.

For example:

text file is

server1
server2
server3

Command line is

FOR /f %a in (filename.txt) do copy blah.txt \\%a\admin$

this will copy that file to those servers. Changing to

FOR /f %a in (filename.txt) do start /min cmd /c copy blah.txt \\%a\admin$

will start 3 CMD's and do the copy all at once. If you filename.txt had 2 dozen servers in it, you would suddenly have 24 CMD.exe's copying a file - very powerful.

KiX could do this to, but it would have to OPEN the file, READLINE it and COPY or SHELL then CLOSE the file.

FOR also supports Tokens. If your filename was

server1,share
server2,different share
server3,another share

then there are 2 columns of tokens, separated by comma. You can set the delimiter and the end of line character.

use FOR /? for more information.

cj

Top
#14543 - 2001-11-27 09:45 AM Re: 2 Functions required.
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
P.S. I still use and love KiX!

cj

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

Generated in 0.052 seconds in which 0.025 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