|
|
Command Line Script
This allows you to run a script from the Command Line of your computer. This is very useful if, for example, you wish to run the script as part of your computer’s overnight batch process.
To see how this works you can try the following exercise in which we will determine the number of Sales Orders created today. We will then run this script from the Command Line on your PC
Go into Sales>Sales Orders and create a couple of Orders
Go into File>Custom Scripts and add a new Custom Script called (say) SalesToday.
In the ‘Script’ tab enter the following:
// Define the Variable
Var
OrdersToday: String;
// You can then get the number of Sales Orders created today
Begin
OrdersToday := GetSQLResult('Select Count(*) from SalesHeader where OrderDate = ''now''');
Showmessage('There are ' + OrdersToday + ' Orders Today');
End.
Open Notepad on your PC then copy and paste the following
"C:\Program Files\Ostendo\ostendo.exe" STARTUPID:DEMO SCRIPT=SalesToday
where "C:\Program Files\Ostendo\ostendo.exe" points to the Ostendo executable
STARTUPID:DEMO defines the Database to look at
SCRIPT=SalesToday defines the script name within the Database
‘Save’ this as a .bat file (for example SalesToday.bat) directly under 'C' drive
To run the .bat file from a Command Line click on ‘Start’ on your Windows screen and select ‘Run’. On the presented panel enter ‘CMD’ and click the ‘OK’ Button. Go back to the Root Directory (Hint: Enter cd .. to go back one level.). You should end up with C:\>
Type in the .bat file name (Example: SalesToday) to give C:\>SalesToday and hit the ‘Enter’ key on your keyboard to run your script