Skip to main content
Skip table of contents

Executing Single Script Statements

In the Advanced section of theRun Scriptaction, you can add a single script statement.  This allows you to execute script commands without creating a file.  Statements are preceded with an ampersand (&) so HomeSeer knows to treat it as a statement.  For example, the followingif then else logiccould be typed into the "OR Script Statement" field of the Run Script action:

For VBScripts and VB.Net scripting:

VB
&if hs.ison(1234) then hs.SetDeviceValue 1234,0 Else hs.SetDeviceValue 1234, 100

or

VB
&hs.SetDeviceString 5678,"Garage Open",false


Multiple statements may be added to the "OR Script Statement" field.  Separate each statement with a colon (:).
Note: On Windows, you have the choice of using either the older VBScript engine for immediate scripts or the VB.NET script engine. To use VBScript format an immediate command as:

&

For example:

VB
&hs.WriteLog "script","this is from vbscript"

For the VB.NET script engine use:

&n

For example:

VB
&nhs.WriteLog("script","this is from vb.net")

On Linux, VBScript is not support so you can use either "&" or "&N", and either one will execute the script using the VB.NET script engine.

On Linux and Windows, you can also use C# immediate scripts. On slower Linux systems, C# is much faster than VB.NET for immediate scripts. The format is:

&s (for calling a sub)
&f (for calling a function that returns a value)

For example:

VB
&shs.Speak("hello",true,"");

See the CSharp scripting section for more information formatting C# scripts.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.