For Beginners

Lesson 8/18

C It In

G1ANT.Robot language has a unique feature: it allows you to insert C# code in the script and assign its result to a variable. The C# code must be embraced with special and macro characters, available by pressing Ctrl+9 or from the Insert menu.

Run this simple script:

dialog ⊂System.DateTime.Now⊃

The dialog box will display current date and time retrieved by a C# snippet.

You can also display year only:

dialog ⊂System.DateTime.Now.Year⊃

Or you can use custom date format — in this example, it will be passed to a snippet in a variable called ♥format:

♥format = yyy####MM####dd
dialog ⊂System.DateTime.Now.ToString(♥format)⊃

Check all available .NET framework classes, methods and properties on the .NET docs site.