Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

WindowsScript.SetLanguage

Returns the Line of the Script that contains the error.

Component Version macOS Windows Linux Server iOS SDK
WindowsScript 1.1 ❌ No ✅ Yes ❌ No ✅ Yes, on Windows ❌ No
MBS( "WindowsScript.SetLanguage"; ScriptID; Language )   More

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 " & Quote(ScriptName);

VBScriptText =
"FUNCTION DoFMSCript(FileName, ScriptName)" & "¶" &

"Set fmApp = CreateObject(\"FMPro.Application\")" & "¶" &
"fmApp.Visible = True" & "¶" &
"Set fmDocs = fmApp.Documents" & "¶" &
"For Each fmDoc In fmDocs" & "¶" &
"If InStr(LCase(fmDoc.fullname), LCase(FileName)) > 0 Then" & "¶" &
" fmDoc.dofmscript (ScriptName)" & "¶" &
"End If" & "¶" &
"Next" & "¶" &

"END FUNCTION";

ScriptID = MBS("WindowsScript.Create");
lang= MBS("WindowsScript.SetLanguage"; ScriptID; "VBScript");
addcode = MBS("WindowsScript.AddCode"; ScriptID; VBScriptText)

];
Case(
Get ( SystemPlatform ) = 1;

// Mac OSX Case
MBS(
"AppleScript.Run";
Applescript
);

// Windows Case
MBS("WindowsScript.ExecuteFunction";ScriptID; "DoFMScript";FileName; ScriptName) &
MBS("WindowsScript.Close"; ScriptID)

)
)

Use JScript to Get System Date

Let(
[
JScriptText = "function TestDate(){var d =new Date();
return d.toGMTString();}";
scriptID = MBS("WindowsScript.Create");
SetLang = MBS("WindowsScript.SetLanguage";1;"JScript");
addcode = MBS("WindowsScript.AddCode";1;JScriptText);
theDate = MBS("WindowsScript.ExecuteFunction";1;"TestDate");
closeScript = MBS("WindowsScript.Close";1)

];

theDate

)

See also

Example Databases

This function is free to use.

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


WindowsScript.SetAllowUI - WindowsScript.SetTimeout