Previous Topic

Next Topic

Inhoudsopgave

Book Index

Using Code Frags

Code frags are pieces of script code that be inserted into a script. This mostly concerns code fragments you often use when creating scripts, for instance the statement that allows you to connect to a database or the statement to insert an SQL string. Use the Settings dialog to add to or update your set of code frags.

Example

The following snippet can be used to insert a select case statement.

Select Case nNumber

Case 0

Rem Code here

Case 1

Rem Code here

Case Else

Rem Code here

End Select

Parameterized Code Frags

You can set up parameters in your code fragments. The parameter values are inserted the moment you add the code fragment to your script. Parameters start and end with the percent character (%). You can add your own parameters. The following system parameters are available by default in your code frags:

  • %sysuser%

Contains the name of the user logged in to Windows

  • %sysdate%

Contains the current date

  • %systime%

Contains the current time

  • %sysdatetime%

Contains the current date and time

Adding Code Frags To Your Script

Use the Code Frags box at the top of the Code editor window to insert a code fragment. Select the snippet you want to insert and click the Insert code frag button.