SyntaxColoring.CheckVariableDeclaration.Enable
----------------------------------------------

Enables checking variable declarations in FileMaker Scripts.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SyntaxColoring](component_SyntaxColoring.md) | [3.5](newinversion35.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

MBS( "SyntaxColoring.CheckVariableDeclaration.Enable" ) ### Parameters

none

### Result

Returns OK on success.

### Description

Enables checking variable declarations in FileMaker Scripts.  
Settings are saved in preferences files and you can use different settings in different FileMaker versions.  
Works with FileMaker 11 or newer.  
  
Checking variable declarations can only be enabled in FileMaker Pro, not in server or runtime versions.  
By default this is off. It takes some additional CPU time for drawing the script and not everyone may want to have it on. Of course the extra work for the CPU should not be noticeable to the developer. Variable names declared inside Let commands are not recognized.  
May only work in Advanced version of FileMaker.  
  
You can declare variables in comment when writing @parameter, @variable or @constant in the comment followed by variable name. Shorter @param, @var and @const also work and you can declare multiple variables in one line.  
  
On macOS Ventura, when you scroll with errors shown, you may see redraw issues.  
### Examples

Enable or disable checking variable declarations:

 If (Enable)  
 Set Variable \[$r ; MBS ( "SyntaxColoring.CheckVariableDeclaration.Enable" )\]  
else  
 Set Variable \[$r ; MBS ( "[SyntaxColoring.CheckVariableDeclaration.Disable](SyntaxColoringCheckVariableDeclarationDisable.md)" )\]  
end if  
Use @variable to declare variable:

 # Declare variable via comment as plugin has no way to know easily that $test is defined here   
\# @variable $test   
Insert Current Time \[ Select ; Target: $test \]  
Declare variable via comment:

 # Declare variables via comment as plugin has no way to know easily that $param1 is defined here   
\# @parameter $param1   
\# @parameter $param2   
Set Variable \[ $r ; Value: Let ( \[ parameters = Get(ScriptParameter); $param1 = GetValue(parameters; 1); $param2 = GetValue(parameters; 2) \] ; 1 ) \]  
Declare multiple variables:

 # @var $FirstName , $LastName , $City   
### See also

- [SyntaxColoring.CheckVariableDeclaration.Disable](SyntaxColoringCheckVariableDeclarationDisable.md)
- [SyntaxColoring.CheckVariableDeclaration.Enabled](SyntaxColoringCheckVariableDeclarationEnabled.md)
- [SyntaxColoring.CheckVariableDeclaration.GetLimits](SyntaxColoringCheckVariableDeclarationGetLimits.md)
- [SyntaxColoring.CheckVariableDeclaration.Notification.Enable](SyntaxColoringCheckVariableDeclarationNotificationEnable.md)
- [SyntaxColoring.CheckVariableDeclaration.SetLimits](SyntaxColoringCheckVariableDeclarationSetLimits.md)
- [SyntaxColoring.CopyButton.SetEnabled](SyntaxColoringCopyButtonSetEnabled.md)
- [SyntaxColoring.LineNumbers.Enable](SyntaxColoringLineNumbersEnable.md)
- [SyntaxColoring.ScriptGoToBox.SetEnabled](SyntaxColoringScriptGoToBoxSetEnabled.md)
- [SyntaxColoring.ScriptSearchBox.SetEnabled](SyntaxColoringScriptSearchBoxSetEnabled.md)
- [SyntaxColoring.SetScriptHighlightColor](SyntaxColoringSetScriptHighlightColor.md)

### Blog Entries

- [Goodies video from FMValencia conference](https://www.mbsplugins.de/archive/2016-12-15/Goodies_video_from_FMValencia_/monkeybreadsoftware_blog_filemaker)
- [Checking Variable Declarations in FileMaker with MBS Plugin](https://www.mbsplugins.de/archive/2015-07-23/Checking_Variable_Declarations/monkeybreadsoftware_blog_filemaker)
- [New Text for unknown variables in scripts](https://www.mbsplugins.de/archive/2014-05-12/New_Text_for_unknown_variables/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.5pr7](https://www.mbsplugins.de/archive/2013-11-18/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 10th April 2024

  
[SyntaxColoring.CheckVariableDeclaration.Disable](SyntaxColoringCheckVariableDeclarationDisable.md) - [SyntaxColoring.CheckVariableDeclaration.Enabled](SyntaxColoringCheckVariableDeclarationEnabled.md)

[HTML Version](SyntaxColoringCheckVariableDeclarationEnable.shtml)