WindowsScript.SetLanguage
-------------------------

Returns the Line of the Script that contains the error.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WindowsScript](component_WindowsScript.md) | [1.1](newinversion11.md) | ❌ No | ✅ Yes | ❌ No | ✅ Yes, on Windows | ❌ No |

MBS( "WindowsScript.SetLanguage"; ScriptID; Language ) 

**MBS**( **"WindowsScript.SetLanguage";** /\* Returns the Line of the Script that contains the error. \*/  
**$ScriptID**; /\* The ID of a WindowsScript in memory. \*/   
**$Language**) /\* The scripting language you want to usee.g. "VBScript" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ScriptID | The ID of a WindowsScript in memory. |  |
| Language | The scripting language you want to use | "VBScript" |

### Description

Returns the Line of the Script that contains the error.   
For ex. "FUNCTION myFunction(string" This line of a script is missing a ")" at the end of the line.  
### Examples

Trigger a FileMaker Script Using OS Scripting

 Let(  
\[  
// --- the name of the script to run ------------------  
  
ScriptName = "Triggered Script";  
FileName = Get(FileName);  
  
//------------------------------------------------------------  
  
//--- don't need to edit anything below this line --------  
  
  
Applescript = "do script " &amp; Quote(ScriptName);  
  
VBScriptText =   
"FUNCTION DoFMSCript(FileName, ScriptName)" &amp; "¶" &amp;   
  
"Set fmApp = CreateObject(\\"FMPro.Application\\")" &amp; "¶" &amp;   
"fmApp.Visible = True" &amp; "¶" &amp;   
"Set fmDocs = fmApp.Documents" &amp; "¶" &amp;  
"For Each fmDoc In fmDocs" &amp; "¶" &amp;  
"If InStr(LCase(fmDoc.fullname), LCase(FileName)) &gt; 0 Then" &amp; "¶" &amp;  
" fmDoc.dofmscript (ScriptName)" &amp; "¶" &amp;  
"End If" &amp; "¶" &amp;  
"Next" &amp; "¶" &amp;  
  
"END FUNCTION";  
  
ScriptID = MBS ("[WindowsScript.Create](WindowsScriptCreate.md)");  
lang= MBS ("WindowsScript.SetLanguage"; ScriptID; "VBScript");  
addcode = MBS ("[WindowsScript.AddCode](WindowsScriptAddCode.md)"; ScriptID; VBScriptText)  
  
\];  
Case(  
Get ( SystemPlatform ) = 1;  
  
// Mac OSX Case  
MBS (   
"[AppleScript.Run](AppleScriptRun.md)";  
Applescript  
);  
  
// Windows Case  
MBS ("[WindowsScript.ExecuteFunction](WindowsScriptExecuteFunction.md)";ScriptID; "DoFMScript";FileName; ScriptName) &amp;   
MBS ("[WindowsScript.Close](WindowsScriptClose.md)"; ScriptID)  
  
)  
)  
Use JScript to Get System Date

 Let(  
\[  
JScriptText = "function TestDate(){var d =new Date();  
return d.toGMTString();}";  
scriptID = MBS ("[WindowsScript.Create](WindowsScriptCreate.md)");  
SetLang = MBS ("WindowsScript.SetLanguage";1;"JScript");  
addcode = MBS ("[WindowsScript.AddCode](WindowsScriptAddCode.md)";1;JScriptText);  
theDate = MBS ("[WindowsScript.ExecuteFunction](WindowsScriptExecuteFunction.md)";1;"TestDate");  
closeScript = MBS ("[WindowsScript.Close](WindowsScriptClose.md)";1)  
  
\];  
  
theDate  
  
)  
### See also

- [AppleScript.Run](AppleScriptRun.md)
- [WindowsScript.AddCode](WindowsScriptAddCode.md)
- [WindowsScript.Close](WindowsScriptClose.md)
- [WindowsScript.Create](WindowsScriptCreate.md)
- [WindowsScript.ExecuteFunction](WindowsScriptExecuteFunction.md)
- [WindowsScript.GetLanguage](WindowsScriptGetLanguage.md)

### Example Databases

- [OS Scripting/Trigger Scripts Using OS Scripting](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/OS%20Scripting/Trigger%20Scripts%20Using%20OS%20Scripting.shtml#1292FieldAnchor_)
- [OS Scripting/VBScript Example](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/OS%20Scripting/VBScript%20Example.shtml#12ScriptAnchor_)
- [Window/WindowEffects](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Window/WindowEffects.shtml#1CustomFunctionAnchor_)

This function is free to use.

Created 18th August 2014 , last changed 18th August 2014

  
[WindowsScript.SetAllowUI](WindowsScriptSetAllowUI.md) - [WindowsScript.SetTimeout](WindowsScriptSetTimeout.md)

[HTML Version](WindowsScriptSetLanguage.shtml)