Operating system scripts

"Can I do that with KSX?" We get that question quite often. And while the answer we give is almost always a resounding YES, sometimes there are just things we haven't thought of, or are outside of our scope.

Enter the shell function.

The shell function takes any number of arguments separated by commas, concatenates the lot, and sends it to your operating system. The script is run from the location of the KSX server application. In Windows this is usually "C:\Programs Files\KnowledgScape\bin". The shell function looks like this:

shell ( 'text' , attribute , 'more text' ) ;

The shell function allows you to call out to your computer's operating system and execute code as if you were at a command prompt. Here is an example of the the shell function at work. The following code creates a text file with a time stamp in it and then opens that file in Notepad. Here is a working example on a Windows operating system:

shellExample.jpg

The term 'echo' is Windows for print. That is followed by the KSX function 'timestamp', that spits out the current date and time. Those are followed by the '>' and the file name 'theTimeNow.txt' which sends the "echoed" timestamp to the file 'theTimeNow.txt'. Look for this file in "C:\Programs Files\KnowledgScape\bin". The next line opens the file we just created in Windows Notepad.

While this is a trivial example, I hope it demonstrates how you can use shell to open up your operating system and all the other applications you have installed. If you still can't do what you want, give us a call! We do write software after all, and we want KSX to be the best that it can be.