ScriptContext() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the requested property of a script dialog that is being displayed.

Syntax

ret = ScriptContext(property, [, variable])

property is is the requested property of the script dialog.

Property Value Return Type Remarks
SCRIPT_CONTEXT_WINDOWID 1 Integer

Used when prompting for a window variable or a layer variable. This returns the current window id being evaluated.

To choose a map window

print Input("Choose Window", "_Select a Window:",frontwindow(), 
"", "window","windowinfo(ScriptContext(1), 3)=1")
SCRIPT_CONTEXT_TABLEALIAS 2 String

Used when prompting for a table or column variable. This returns the current table alias being evaluated.

To choose a point table

dim t as string
t = Input("Input", "_Table:", "usa", "table", 
"HelpText=Pick a dang table", "TableInfo(ScriptContext(2), 
TAB_INFO_DOMINANT_OBJECT_TYPE)=2")
select * from t
SCRIPT_CONTEXT_COLUMNALIAS 3 String

Used when prompting for a column variable. This returns the current column alias being evaluated.

To choose a character column from usa table:

Open Table "C:\work\Data\USA\USA.TAB"
dim col as Alias
col = Input("Input", "_Column:", "URL", "column", "", 
"TableInfo(ScriptContext(2), TAB_INFO_NAME)=""USA""
And ColumnInfo(ScriptContext(2), ScriptContext(3),COL_INFO_TYPE)=1")
browse col from usa
SCRIPT_CONTEXT_LAYER_NUM 4 Integer Used when prompting for a Layer variable. This returns the current layer number being evaluated.

Return Value

Any standard variable type like String, Integer, LargeInt, Float, Logical, Date, DateTime, or Time.

Description

Returns the requested property of a script dialog that is being displayed.