]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.tutorial/scl/Tutorial/1.01 Console.md
Import org.simantics.scl.tutorial from incubator SVN repo
[simantics/platform.git] / bundles / org.simantics.scl.tutorial / scl / Tutorial / 1.01 Console.md
1 # Console\r
2 \r
3 The easiest way of getting started with SCL is to use SCL console that is normally included in\r
4 Simantics-based products. You can open the console by pressing ALT-SHIFT-q and s or\r
5 from menu **Window/Show View/SCL Console**.\r
6 \r
7 ## Executing commands \r
8 \r
9 SCL console works by executing commands you write into the input box in the bottom of the view.\r
10 After the command has been written, it can be executed by pressing ENTER. If the command\r
11 contains syntax errors they are written to the console in red text and indication for the\r
12 error position.\r
13 \r
14 Multi-line commands can be written by creating a new line with CTRL-ENTER. \r
15 The command history can be browsed with CTRL-UP and CTRL-DOWN.\r
16 Also the standard keybindings CTRL-c (Copy), CTRL-v (Paste), CTRL-x (Cut), CTRL-a (Select all) work as expected\r
17 both in the input and output area of the console depending on which of them has a focus.\r
18 You can also write (or paste) multiple commands at the same time.\r
19 \r
20 If the command you write into console results as an ordinary value, it is printed\r
21 to the console. Here are couple of examples you can try:\r
22 \r
23 ~~~\r
24 > 13\r
25 13\r
26 > 1+2\r
27 3\r
28 > sin 1\r
29 0.8414709848078965\r
30 > "Hello " + "world!"\r
31 Hello world!\r
32 > [1,3,5]\r
33 [1, 3, 5]\r
34 ~~~\r
35 \r
36 The console remembers the variables you declare, but they are forgotten when the\r
37 console (or the whole application) is closed.\r
38 \r
39 ~~~\r
40 > x = 35\r
41 > y = 40\r
42 > x + y\r
43 75\r
44 > x * y\r
45 1400\r
46 ~~~\r
47 \r
48 If you write a command that prints something as a side-effect, the prints are shown in the console:\r
49 \r
50 ~~~\r
51 > print "Hello" ; print "world!"\r
52 Hello\r
53 world!\r
54 ~~~\r
55 \r
56 The currently running command can be interrupted with **Interrupt current command** button\r
57 in the top right corner of the console.\r
58 All commands don't support interruption.\r
59 The output area of the console can be cleared with **Clear console** button.\r
60 \r
61 ## Importing modules\r
62 \r
63 The rightmost button in the console opens a dialog for managing modules that are available\r
64 for the console. It shows currently imported modules and contains buttons for importing\r
65 modules from different sources. The imported modules are remembered even when the console\r
66 is closed if the import is marked persistent. \r
67 \r
68 The another way to import modules is run import command from the console, for example\r
69 \r
70     import "Simantics/DB"\r
71 \r
72 The button with two arrows reloads the modules that are imported to the console. It\r
73 is useful if you develop your own module and want to test modified definitions.