Karen
(Fresh Scripter)
2003-10-15 04:37 PM
Load and Execute a file

[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 ]


Mart
(KiX Supporter)
2003-10-15 04:49 PM
Re: Load and Execute a file

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



Les
(KiX Master)
2003-10-15 05:00 PM
Re: Load and Execute a file

This thread belongs in "Starters"

Karen
(Fresh Scripter)
2003-10-16 11:44 AM
Re: Load and Execute a file

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


LonkeroAdministrator
(KiX Master Guru)
2003-10-17 12:27 AM
Re: Load and Execute a file

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"


Mart
(KiX Supporter)
2003-10-16 01:53 PM
Re: Load and Execute a file

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.


LonkeroAdministrator
(KiX Master Guru)
2003-10-16 03:08 PM
Re: Load and Execute a file

heh.
no, bat is not script.
bat is BATCH-file.


Mart
(KiX Supporter)
2003-10-16 04:21 PM
Re: Load and Execute a file

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 ]