Constants - System Constants

Top  Previous  Next

System info plays very important role in adjustments of your project to work on various end-user machines; depending on retrieved info, your project will be able to select most suitable presentation for current machine. In MMB, system constants hold screen, window, processor and memory info and these constants are used as parameters for script commands.

For example:

ScriptCommand(SystemConstant(),Param2)

Script command will use system constant as it's first parameter. See descriptions of real script commands to find out which ones can accept this kind of parameters.

 

ScreenWidth()

returns width of computer display in pixels as an integer value

ConstantScreenWidth

Script example:

Message("Display width is: ","ScreenWidth()")

 

ScreenHeight()

returns height of computer display in pixels as an integer value

ConstantScreenHeight

Script example:

Message("Display height is: ","ScreenHeight()")

 

WorkAreaWidth()

returns width of computer display work area in pixels as an integer value

ConstantScreenWorkWidth

Script example:

Message("Display work area width is: ","WorkAreaWidth()")

 

 

WorkAreaHeight()

returns height of computer display work area in pixels as an integer value

ConstantScreenWorkHeight

Script example:

Message("Display work area height is: ","WorkAreaHeight()")

 

MouseX()

returns X (horizontal) screen position of mouse in pixels as an integer value

ConstantMouseX

Script example:

Message("Current mouse X position: ","MouseX()")

 

MouseY()

returns Y (vertical) screen position of mouse in pixels as an integer value

ConstantMouseY

Script example:

Message("Current mouse Y position: ","MouseY()")

 

 

MouseLButton()

MouseRButton()

MouseMButton()

returns a state of mouse buttons.

If mouse button is pressed then return value is 1 otherwise 0.

Script example:

To Page Start code insert ScriptTimer, which will start a global MouseState detection script

ScriptTimer("Timer1=Script","50")

Create new script object called Script and insert the below code into it:

MStateL=MouseLButton()

MStateM=MouseMButton()

MStateR=MouseRButton()

MState=MStateL+MStateM+MStateR

** one button is clicked

If (MState=1) Then

If (MStateR=1) Then

  LoadText("Text","RIGHT CLICK IS DETECTED")

End

If (MStateL=1) Then

  LoadText("Text","LEFT CLICK IS DETECTED")

End

If (MStateM=1) Then

  LoadText("Text","MIDDLE CLICK IS DETECTED")

End

ScriptTimer("Timer1=click","50")

Return()

Else

** none or more than one button is clicked

LoadText("Text"," ")

End

** restart mouse detection script

ScriptTimer("Timer1=click","50")

For more advanced example of mouse state detection procedure check the mousestatedetection.mbd example project.

 

WinVer()

returns major, minor and build version of running Windows as string (text) value

These values are separated with dot . so use MMB's advanced string functions to extract individual version values.

WinVersions

 

Script example:

var$=WinVer()

Message("Windows version : ","var$")

Returned value will be for e.g:

5.01.2600

Windows have somewhat standardized version numbers. Here's a list:

Windows 95

4.00.950

Windows 95 SP1

4.00.(>950) / 4.00.(<=1080)

Windows 95 OSR2

4.(<10).(>1080)

Windows 98

4.10.1998

Windows 98 SP 1

4.10.(>1998) / 4.10.(<2183)

Windows 98 SE

4.10.(>=2183)

Windows Me

4.90.3000

Windows NT 3.51

3.51.1057

Windows NT 4.0

4.00.1381

Windows 2000

5.00.2195

Windows XP/SP1

5.01.2600

Windows Vista

6.00.6000

 

 

UsingWinNT()

returns integer (number) value having one of two available states:

1 = machine runs WinNT-family operating system

0 = machine doesn't run WinNT-family operating system

Script example:

Message("WinNT-compatible OS present: ","UsingWinNT()")

If WinNT family OS is present, returned value will be:

1

 

ScreenColors()

returns number of colors currently being used by Windows & graphics card

 

Value returned is integer (number) and represents number of colors (16,256) for lower modes or number of bits (16, 32) for higher graphic modes.

Script example:

Message("Current graphics color mode: ","ScreenColors()")

Returned value will be for e.g:

32

 

ProcType()

returns manufacturer, type and speed of central processor unit (CPU) as string (text) value

Script example:

var$=ProcType()

Message("CPU in this machine is: ","var$")

Returned value will be for e.g:

Intel (R) Pentium (R) 4 CPU 2.40 GHz

 

ProcFreq()

returns speed of central processor unit (CPU) in MHz as an integer (number) value

Script example:

Message("CPU frequency in MHz: ","ProcFreq()")

Returned value will be for e.g:

2405

 

GetMemory()

returns quantity of Total and Free RAM memory as string (text) values.

 

These values are separated using slash / character, so use MMB's advanced string functions to extract individual memory values.

Script example:

Message("Machine memory status: ","GetMemory()")

Returned value will be for e.g:

512/231

(first value represents Total Memory, second Free Memory)