Hot Fixes

Online Help






CS-Script Samples Library

Important: This is a free style library of useful or interesting scripts. It is not an alternative (despite some overlaps) to the Samples Library installed with CS-Script. See CS-Script documentation for the latest code samples.

While the presented samples are still valid many of them has become obsolete and been replaced or dramatically improved in the Samples installed with CS-Script.

Hosting samples installed with CS-Script documentation demonstrate more advanced and flexible hosting approaches. Have a quick look at hosting scenarios summary here. More advances hosting examples can also be found in online documentation (Advanced Scripting tutorial). 

NKill.cs - Kills processes specified as command-line parameters.

GetUrl.cs - Gets URL content and saves it in a file. Capable to go through proxy authentication.

ImportData.cs - Imports data from specified file in SQL Server table.

ExportData.cs  - Exports data to specified file from SQL Server table.

RunScript.cs - Script that runs another script in background with redirection output to the 'parent script'. Run "cscscript runScript.cs tick.cs" and "cscscript tick.cs" to see it in work.

Tick.cs - Simple script that counts specified number of seconds (used as demo for runScript).

SynTime.cs - Gets time from http://tycho.usno.navy.mil/cgi-bin/timer.pl and synchronises PC systemtime.

SysFindConfig.cs - Displays configuration console to adjust system 'FindInFile' options on WindowsXP. This is the answer for WindowsXP BUG described in MSDN articles Q309173 and "Using the 'A Word or Phrase in the File' Search Criterion May Not Work".

MailTo.cs - Sends e-mail to the specified address.

Credentials.cs - Prompts and collect user login information.

GetOptusUsage.cs - Retreives monthly data usage (applicable only for "Optus Australia" customers).

Reflect.cs - Prints assembly reflection info.

setEV.cs - Permanently sets System environment variable and notifies all processes about the setting change.

PrintScreen.cs - Captures screen image and saves it to a file (default file: screen.gif)

Print.cs - Collection of simple reusable printing routines (the alternative to cmd: notepad.exe /p ).

Hosting samples - see section Script hosting scenarios in FAQ.

Progressbar.cs - Shows "continuous" progressbar. This is an example how to draw in GDI+ without flickering.

ScriptEE.cs - Script Execution Interactive Environment emulator. This is a simple WinForm application which allows you to execute C# code snippets. Note true interactive environment for CS-Script is not possible (see section "17. Interactive Environment for CS-Script" in FAQ).

ImportTickScript.cs - Imports (with 'import' directive) and execues 'tick.cs' script.

TeeChartForm.cs - This script demonstrates how to reference assemblies in the script code (with 'reference' directive).  This is a useful technique when namespace does not represent assembly name in any way (etc. teechart.lite.dll contains namespace "Steema.TeeChart"). To run this sample you will need to download  TeeChart dlls).

Interop.cs - This is an example how to create and access COM object and objects implemented in CLR assembly. To run this sample you will need to download required binaries). Note that the Using COM Tutorial from the online documentation has superseded this sample.

Chm2Html.zip is a collection of C# scripts that convert HTML help (.chm file) into HTML-Based help (WEB pages).

googleWebService.cs - This script performs Google search using Google API (WebService). It will need the GoogleSearchService.cs generated with WDSL (cmd: wsdl.exe http://api.google.com/GoogleSearch.wsdl)

SetReadOnly.cs  - This script makes all files in the current directory read-only. It is an example of classless C# script and it has to be executed only through classLess.cs script.

Sandbox.zip  - Example of executing the scripts from the .NET sandbox.

Copyright (C) 2004-2012 Oleg Shilo