Page 1 of 1 1
Topic Options
#46828 - 2003-10-15 04:37 PM Load and Execute a file
Karen Offline
Fresh Scripter

Registered: 2003-10-15
Posts: 6
[Moderator (Sealeopard): Moved thread from 'Scripts' to 'Starters' forum due to lack of script in body]

I am very new to kixtart and as such need a bit of help!

I need to check if there is a copy of a file on each workstation that uses the script at logon, if there is then exit.

If however the file is missing it then needs to copy three files to the C:\ from a shared drive on the network, then execute one of the files and copy back the resulting *.gth file to the server.

Any help would be greatly appreciated.

Regards
Karen

[ 16. October 2003, 04:31: Message edited by: sealeopard ]

Top
#46829 - 2003-10-15 04:49 PM Re: Load and Execute a file
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Welcome.

This should work:

code:
$file = Exist ("path and filename goes here")

Select
Case $file <> 1
?"File does not exist, starting copy..."
Copy "\\server\share\file1" "c:\file1"
Copy "\\server\share\file2" "c:\file2"
Copy "\\server\share\file3" "c:\file3"
;depending on what to run use shell, call, etc..
Call otherscript.kix
Copy "c:\file.gth" "\\server\share\myfile.gth"
Case $file = 1
?"File exists skipping copy..."
;depending on what to run use shell, call, etc..
Call otherscript.kix
Copy "c:\file.gth" "\\server\share\myfile.gth"
EndSelect

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#46830 - 2003-10-15 05:00 PM Re: Load and Execute a file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
This thread belongs in "Starters"
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#46831 - 2003-10-16 11:44 AM Re: Load and Execute a file
Karen Offline
Fresh Scripter

Registered: 2003-10-15
Posts: 6
Thank you for the script, I chose Shell to execute a .bat file and this doesn't seem to run the application?

Also the file that is generated to be copied back to the server is individually named by the application that runs, therefore does kixtart utilise * wildcards eg:

copy "c:\*.gth" ....

Thanks

Top
#46832 - 2003-10-17 12:27 AM Re: Load and Execute a file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure it supports wildcarts.

what comes to bat-files...
as they are not applications, you can't "shell" them but you need to shell the application that does execute them. that is defined as %comspec%.
shell "%comspec% /c path_to_bat\my.bat"
_________________________
!

download KiXnet

Top
#46833 - 2003-10-16 01:53 PM Re: Load and Execute a file
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Then it would become something like this:

code:
$file = Exist ("path and filename goes here")

Select
Case $file <> 1
?"File does not exist, starting copy..."
Copy "\\server\share\file1" "c:\file1"
Copy "\\server\share\file2" "c:\file2"
Copy "\\server\share\file3" "c:\file3"
;depending on what to run use shell, call, etc..
Shell "%comspec% /c path_to_bat\my.bat"
Copy "c:\file.gth" "\\server\share\myfile.gth"
Case $file = 1
?"File exists skipping copy..."
;depending on what to run use shell, call, etc..
Shell "%comspec% /c path_to_bat\my.bat"
Copy "c:\file.gth" "\\server\share\myfile.gth"
EndSelect

There might be a possibility to convert the bat file into kix code [Confused] this way you don’t need to maintain two scripts.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#46834 - 2003-10-16 03:08 PM Re: Load and Execute a file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh.
no, bat is not script.
bat is BATCH-file.
_________________________
!

download KiXnet

Top
#46835 - 2003-10-16 04:21 PM Re: Load and Execute a file
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
quote:

bat is BATCH-file.

Duh! I know that.
What I mean is that maybe the stuff done in the batch file can be done with kix. Like copying files, mapping drives or something. Batch is usually just command line functions as far is I know.

[ 16. October 2003, 16:24: Message edited by: R2D2 ]
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

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
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.059 seconds in which 0.022 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