PBb7U‖ScriptForge.Basic service

G5jAV‖The ScriptForge.Basic service proposes a collection of LibreOfficeDev Basic methods to be executed in a Python context. Basic service methods reproduce the exact syntax and behaviour of Basic builtin functions.

Bb7Br‖Typical example:


   fBDsN‖bas.MsgBox('Display this text in a message box from a Python script')
  
warning

kGyCd‖ScriptForge.Basic service is limited to Python scripts.


biAQa‖Service invocation

note

pNUsj‖Before using the Basic service, import the CreateScriptService() method from the scriptforge module:



    from scriptforge import CreateScriptService
    bas = CreateScriptService("Basic")
  

E6SaA‖Properties

bLzCe‖Name

5FcQt‖ReadOnly

N5DD5‖Type

qXwST‖Description

MB_OK, MB_OKCANCEL, MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL

KuiAD‖Yes

Integer

7DG4F‖Values: 0, 1, 5, 4, 3

MB_ICONEXCLAMATION, MB_ICONINFORMATION, MB_ICONQUESTION, MB_ICONSTOP

8ie8B‖Yes

Integer

DQkGQ‖Values: 48, 64, 32, 16

MB_ABORTRETRYIGNORE, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3

mCpye‖Yes

Integer

h3hZE‖Values: 2, 128, 256, 512

IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK, IDRETRY, IDYES

kLst4‖Yes

Integer

Tmtc2‖Values: 3, 2, 5, 7, 1, 4, 6
Constants indicating MsgBox selected button.

StarDesktop

BDtqm‖Yes

SKW53‖UNO
object

jAEFy‖Returns the StarDesktop object that represents the LibreOfficeDev application.

ThisComponent

tBCGv‖Yes

JFnmw‖UNO
object

3wZPC‖If the current component refers to a LibreOfficeDev document, this method returns the UNO object representing the document. This property returns None when the current component does not correspond to a document.

ThisDatabaseDocument

hjufN‖Yes

DgnfQ‖UNO
object

hdhY2‖If the script is being executed from a Base document or any of its subcomponents this method returns the main component of the Base instance. This property returns None otherwise.


vXq8C‖List of Methods in the Basic Service

CDate
CDateFromUnoDateTime
CDateToUnoDateTime
ConvertFromUrl (*)
ConvertToUrl (*)
CreateUnoService
CreateUnoStruct (*)
DateAdd

DateDiff
DatePart
DateValue
Format
GetDefaultContext
GetGuiType (*)
GetPathSeparator (*)
GetSystemTicks

GlobalScope.BasicLibraries
GlobalScope.DialogLibraries
InputBox (*)
MsgBox (*)
Now
RGB
Xray


note

z7PPA‖Python alternatives exist for methods marked with (*).


CDate

GvjSD‖Converts a numeric expression or a string to a datetime.datetime Python native object.

note

Myvas‖This method exposes the Basic builtin function CDate to Python scripts.


FVEx2‖Syntax:

svc.CDate(expression: any): obj

WADQ4‖Parameters:

xvPTA‖expression: a numeric expression or a string representing a date.

Doxp9‖When you convert a string expression, the date and time must be entered either in one of the date acceptance patterns defined for your locale setting (see - Languages and Locales - General) or in ISO date format (momentarily, only the ISO format with hyphens, e.g. "2012-12-31" is accepted). In numeric expressions, values to the left of the decimal represent the date, beginning from December 31, 1899. Values to the right of the decimal represent the time.

EFSA4‖Example:


    d = bas.CDate(1000.25)
    bas.MsgBox(str(d)) # 1902-09-26 06:00:00
    bas.MsgBox(d.year) # 1902
  

CDateFromUnoDateTime

aBGSG‖Converts a UNO date/time representation to a datetime.datetime Python native object.

FVEx2‖Syntax:

svc.CDateFromUnoDateTime(unodate: uno): obj

WADQ4‖Parameters:

qhCRh‖unodate: A UNO date/time object of one of the following types: com.sun.star.util.DateTime, com.sun.star.util.Date or com.sun.star.util.Time

EFSA4‖Example:

GQ2hL‖The following example creates a com.sun.star.util.DateTime object and converts it to a datetime.datetime Python object.


    uno_date = bas.CreateUnoStruct('com.sun.star.util.DateTime')
    uno_date.Year = 1983
    uno_date.Month = 2
    uno_date.Day = 23
    new_date = bas.CDateFromUnoDateTime(uno_date)
    bas.MsgBox(str(new_date)) # 1983-02-23 00:00:00
  

CDateToUnoDateTime

JXsJN‖Converts a date representation into a com.sun.star.util.DateTime object.

FVEx2‖Syntax:

svc.CDateToUnoDateTime(date: obj): uno

WADQ4‖Parameters:

7LW9r‖date: A Python date/time object of one of the following types: datetime.datetime, datetime.date, datetime.time, float (time.time) or time.struct_time.

EFSA4‖Example:


    from datetime import datetime
    current_datetime = datetime.now()
    uno_date = bas.CDateToUnoDateTime(current_datetime)
    bas.MsgBox(str(uno_date.Year) + "-" + str(uno_date.Month) + "-" + str(uno_date.Day))
  

ConvertFromUrl

vaMxs‖Returns a system path file name for the given file: URL.

FVEx2‖Syntax:

svc.ConvertFromUrl(url: str): str

WADQ4‖Parameters:

2G8oc‖ url: An absolute file: URL.

bBBqF‖Return type:

nmEbg‖A system path file name.

EFSA4‖Example:


    filename = bas.ConvertFromUrl( "file:///C:/Program%20Files%20(x86)/LibreOffice/News.txt" )
    bas.MsgBox(filename)
  
tip

dwoXY‖uno module fileUrlToSystemPath() method returns a system path using an identical syntax.



    import uno
    filename = uno.fileUrlToSystemPath( "file:///C:/Program%20Files%20(x86)/LibreOffice/News.txt" )
    bas.MsgBox(filename)
  

ConvertToUrl

7YMKT‖Returns a file: URL for the given system path.

FVEx2‖Syntax:

svc.ConvertToUrl(systempath: str): str

WADQ4‖Parameters:

ZdzNY‖systempath: A system file name as a string.

bBBqF‖Return type:

BYkqo‖A file: URL as a string.

EFSA4‖Example:


    url = bas.ConvertToUrl( 'C:\Program Files(x86)\LibreOffice\News.txt' )
    bas.MsgBox(url)
  
tip

8mZ6G‖uno module systemPathToFileUrl() method returns a file URL for the given system path.



    from uno import systemPathToFileUrl as ConvertToUrl
    filename = ConvertToUrl( 'C:\Program Files(x86)\LibreOffice\News.txt' )
    bas.MsgBox(filename)
  

CreateUnoService

kyZyo‖Instantiates a UNO service with the ProcessServiceManager.

FVEx2‖Syntax:

svc.CreateUnoService(servicename: str): uno

WADQ4‖Parameters:

SF7gE‖servicename: A fully qualified service name such as com.sun.star.ui.dialogs.FilePicker or com.sun.star.sheet.FunctionAccess.

EFSA4‖Example:


    dsk = bas.CreateUnoService('com.sun.star.frame.Desktop')
  

CreateUnoStruct

o4TnR‖Returns an instance of a UNO structure of the specified type.

FVEx2‖Syntax:

svc.CreateUnoStruct(unostructure: str): uno

WADQ4‖Parameters:

ojWzv‖unostructure: A fully qualified structure name such as com.sun.star.beans.Property or com.sun.star.util.DateTime.

EFSA4‖Example:


    date_struct = CreateUnoStruct('com.sun.star.util.DateTime')
  
tip

zDyBD‖uno module createUnoStruct() method creates an instance of a Uno structure type.



    import uno
    p = uno.createUnoStruct( 'com.sun.star.beans.Property' )
    bas.MsgBox(p)
  

DateAdd

rZoCx‖Adds a date or time interval to a given date/time a number of times and returns the resulting date.

FVEx2‖Syntax:

svc.DateAdd(interval: str, number: num, date: datetime): datetime

WADQ4‖Parameters:

8iwAj‖ interval: A string expression from the following table, specifying the date or time interval.

yKYH5‖interval (string value)

BrkDy‖Explanation

yyyy

uCMGD‖Year

q

aAbFF‖Quarter

m

DnwYQ‖Month

y

5ceAL‖Day of year

w

zMz7B‖Weekday

ww

Wknbt‖Week of year

d

QUMAr‖Day

h

bW8VY‖Hour

n

E7sMZ‖Minute

s

saACB‖Second


Vx3AB‖number: A numerical expression specifying how often the interval value will be added when positive or subtracted when negative.

CCveG‖date: A given datetime.datetime value, the interval value will be added number times to this datetime.datetime value.

bBBqF‖Return type:

Zcf9q‖A datetime.datetime value.

EFSA4‖Example:


    dt = datetime.datetime(2004, 1, 31)
    dt = bas.DateAdd("m", 1, dt)
    print(dt)
  

DateDiff

HAVdW‖Returns the number of date or time intervals between two given date/time values.

FVEx2‖Syntax:

svc.DateDiff(interval: str, date1: datetime, date2: datetime, firstdayofweek = 1, firstweekofyear = 1): int

WADQ4‖Parameters:

68XgA‖interval: A string expression specifying the date interval, as detailed in above DateAdd method.

DQFt3‖date1, date2: The two datetime.datetime values to be compared.

hjbSu‖ firstdayofweek: An optional parameter that specifies the starting day of a week.

wpCoP‖firstdayofweek value

gmaR8‖Explanation

A5RkW‖0

Xt9Xx‖Use system default value

6UMdD‖1

uV8iz‖Sunday (default)

zuFMX‖2

vUz3C‖Monday

2YAp3‖3

KCW5A‖Tuesday

8rkEA‖4

hhEsB‖Wednesday

3F47C‖5

Zv7Dn‖Thursday

aP5Bd‖6

EbThD‖Friday

CmnqZ‖7

BjBfG‖Saturday


UFDDA‖ firstweekofyear: An optional parameter that specifies the starting week of a year.

e3gQd‖firstweekofyear value

zAFFS‖Explanation

XEzpc‖0

jXczC‖Use system default value

sqUf8‖1

65vhA‖Week 1 is the week with January, 1st (default)

7KXnC‖2

wFZe8‖Week 1 is the first week containing four or more days of that year

85UKo‖3

xAkGk‖Week 1 is the first week containing only days of the new year


bBBqF‖Return type:

ZR7AD‖A number.

EFSA4‖Example:


    date1 = datetime.datetime(2005,1, 1)
    date2 = datetime.datetime(2005,12,31)
    diffDays = bas.DateDiff('d', date1, date2)
    print(diffDays)
  

DatePart

K4Lp7‖The DatePart function returns a specified part of a date.

FVEx2‖Syntax:

svc.DatePart(interval: str, date: datetime, firstdayofweek = 1, firstweekofyear = 1): int

WADQ4‖Parameters:

vCQGJ‖interval: A string expression specifying the date interval, as detailed in above DateAdd method.

KuDhD‖date: The date/time from which the result is calculated.

P3vuB‖firstdayofweek, firstweekofyear: optional parameters that respectively specify the starting day of a week and the starting week of a year, as detailed in above DateDiff method.

bBBqF‖Return type:

5Yz25‖The extracted part for the given date/time.

EFSA4‖Example:


    print(bas.DatePart("ww", datetime.datetime(2005,12,31)
    print(bas.DatePart('q', datetime.datetime(1999,12,30)
  

DateValue

Dc9Cs‖Computes a date value from a date string.

FVEx2‖Syntax:

svc.DateValue(date: str): datetime

WADQ4‖Parameters:

rK8mE‖date: A string that contains the date that will be converted to a Date object.

note

2CiE4‖The string passed to DateValue must be expressed in one of the date formats defined by your locale setting (see - Languages and Locales - General) or using the ISO date format "yyyy-mm-dd" (year, month and day separated by hyphens).


bBBqF‖Return type:

qTtuh‖The computed date.

EFSA4‖Example:


    dt = bas.DateValue("23-02-2011")
    print(dt)
  

Format

GuCbF‖Converts a number to a string, and then formats it according to the format that you specify.

FVEx2‖Syntax:

svc.Format(expression: any, format = ''): str

WADQ4‖Parameters:

DfHNL‖ expression: Numeric expression that you want to convert to a formatted string.

WWFYq‖ format: String that specifies the format code for the number. If format is omitted, the Format function works like the LibreOfficeDev Basic Str() function.

bBBqF‖Return type:

Mh6xN‖Text string.

8DmPW‖Formatting Codes

bNjDE‖ In BASIC, a format code can be divided into three sections that are separated by semicolons. The first part defines the format for positive values, the second part for negative values, and the third part for zero. If you only specify one format code, it applies to all numbers.

uBU7T‖You can set the locale used for controlling the formatting numbers, dates and currencies in LibreOfficeDev Basic in - Languages and Locales - General. In Basic format codes, the decimal point (.) is always used as placeholder for the decimal separator defined in your locale and will be replaced by the corresponding character.

6NcoV‖The same applies to the locale settings for date, time and currency formats. The Basic format code will be interpreted and displayed according to your locale setting.

4TDkj‖The following list describes the codes that you can use for formatting a numeric expression:

Pt9sX‖Code

EFZDt‖Description

zJHDb‖0

NwnPA‖ If expression has a digit at the position of the 0 in the format code, the digit is displayed, otherwise a zero is displayed.

MRyQ7‖If expression has fewer digits than the number of zeros in the format code, (on either side of the decimal), leading or trailing zeros are displayed. If the expression has more digits to the left of the decimal separator than the amount of zeros in the format code, the additional digits are displayed without formatting.

bYkcA‖Decimal places in the expression are rounded according to the number of zeros that appear after the decimal separator in the format code.

#

trcKE‖If expression contains a digit at the position of the # placeholder in the format code, the digit is displayed, otherwise nothing is displayed at this position.

Mst5g‖This symbol works like the 0, except that leading or trailing zeroes are not displayed if there are more # characters in the format code than digits in the expression. Only the relevant digits of the expression are displayed.

. (period)

LD9wU‖ The decimal placeholder determines the number of decimal places to the left and right of the decimal separator.

ehB5x‖If the format code contains only # placeholders to the left of this symbol, numbers less than 1 begin with a decimal separator. To always display a leading zero with fractional numbers, use 0 as a placeholder for the first digit to the left of the decimal separator.

A8QmE‖The use of a period as a thousands and decimal separator is dependent on the regional setting. When you enter a number directly in Basic source code, always use a period as decimal delimiter. The actual character displayed as a decimal separator depends on the number format in your system settings.

%

fFBhT‖Multiplies the expressionby 100 and inserts the percent sign (%) where the expression appears in the format code.

E- E+ e- e+

XkBBj‖ If the format code contains at least one digit placeholder (0 or #) to the right of the symbol E-, E+, e-, or e+, the expression is formatted in the scientific or exponential format. The letter E or e is inserted between the number and the exponent. The number of placeholders for digits to the right of the symbol determines the number of digits in the exponent.

jhCb5‖If the exponent is negative, a minus sign is displayed directly before an exponent with E-, E+, e-, e+. If the exponent is positive, a plus sign is only displayed before exponents with E+ or e+.

- + $ ( ) space

fXnnv‖ : A plus (+), minus (-), dollar ($), space, or brackets entered directly in the format code is displayed as a literal character.

\

PyKZq‖To display characters other than the ones listed here, you must precede it by a backslash (\), or enclose it in quotation marks (" ").

DAVUP‖The backslash displays the next character in the format code.

CBbYy‖Characters in the format code that have a special meaning can only be displayed as literal characters if they are preceded by a backslash. The backslash itself is not displayed, unless you enter a double backslash (\\) in the format code.

L4LbT‖Characters that must be preceded by a backslash in the format code in order to be displayed as literal characters are date- and time-formatting characters (a, c, d, h, m, n, p, q, s, t, w, y, /, :), numeric-formatting characters (#, 0, %, E, e, comma, period), and string-formatting characters (@, &, <, >, !).


tSB7E‖Predefined formats

BCQqy‖You can also use the following predefined number formats. Except for "General Number", all of the predefined format codes return the number as a decimal number with two decimal places.

fkPvC‖If you use predefined formats, the name of the format must be enclosed in quotation marks.

BMm8E‖Code

Xu5bE‖Description

yQiH6‖"<"

RQGGS‖Convert expression to lower case

">"

Jy7GF‖Convert expression to upper case.

"c" or "General Date"

XyvCU‖Returns the numeric expression in short date format, optionally with "H:MM:SS AM/PM". If expression is a string, returns the string.

"n"

GFNk7‖Returns the minute of the numeric expression, with 1 or 2 digits.

"nn"

USDix‖Returns the minute of the numeric expression with two digits.

"w"

4CFFH‖Returns the week day of the numeric expression. 1 is Sunday and 7 is Saturday.

"General Number"

ZgoEi‖Returns the numeric expression with 12 digits (0.############).

"Currency"

GAVBt‖Returns the numeric expression in the currency of the locale.

"Fixed"

FAqZG‖Returns the numeric expression with 2 decimal places (0.00).

"Standard"

gos3n‖Returns the numeric expression with thousands separators and 2 decimals (@0.00).

"Percent"

DFrD2‖Returns the numeric expression as percent value (0.00%).

"Scientific"

DaijZ‖Returns the numeric expression in scientific notation (#.00E+00);

"Yes/No"

EQyb4‖Returns "Yes" if the numeric expression is not equal to zero, "No" otherwise. "Yes" and "No" are localized.

"True/False"

pFCh8‖Returns "True" if the numeric expression is not equal to zero, "False" otherwise. "True" and "False" are localized.

"On/Off"

EBKVo‖Returns "On" if the numeric expression is not equal to zero, "Off" otherwise. "On" and "Off" are localized.

"Long Date" or "dddddd"

BxLE7‖Returns the numeric expression in system long date format, and depends on the locale.

"Medium Date"

PRktQ‖Returns the numeric expression in date format DD-MMM-YY, and depends on the locale.

"Short Date" or "ddddd"

uDW2X‖Returns the numeric expression in system short date format, and depends on the locale.

"Long Time" or "ttttt"

rvgEv‖Returns the numeric expression in system long time format, and depends on the locale("H:MM:SS AM/PM").

"Medium Time"

yJBXL‖Returns the numeric expression in system medium time format, and depends on the locale (HH:MM AM/PM)

"Short Time"

yxDLM‖Returns the numeric expression in system short time format, and depends on the locale (HH:MM).


uBU7T‖You can set the locale used for controlling the formatting numbers, dates and currencies in LibreOfficeDev Basic in - Languages and Locales - General. In Basic format codes, the decimal point (.) is always used as placeholder for the decimal separator defined in your locale and will be replaced by the corresponding character.

6NcoV‖The same applies to the locale settings for date, time and currency formats. The Basic format code will be interpreted and displayed according to your locale setting.

EFSA4‖Example:


    txt = bas.Format(6328.2, '##.##0.00')
    print(txt)
  

GetDefaultContext

osJdR‖Returns the default context of the process service factory, if existent, else returns a null reference.

q4pGq‖GetDefaultContext is an alternative to the getComponentContext() method available from XSCRIPTCONTEXT global variable or from uno.py module.

FVEx2‖Syntax:

svc.GetDefaultContext(): uno

bBBqF‖Return type:

8RLUK‖The default component context is used, when instantiating services via XMultiServiceFactory. See the Professional UNO chapter in the Developer's Guide on api.libreoffice.org for more information.

EFSA4‖Example:


    ctx = bas.GetDefaultContext()
  

GetGuiType

LACDh‖Returns a numerical value that specifies the graphical user interface. This function is only provided for backward compatibility with previous versions.

i7FGf‖Refer to system() method from platform Python module to identify the operating system.

FVEx2‖Syntax:

svc.GetGuiType(): int

EFSA4‖Example:


    n = bas.GetGuiType()
  
note

8AiAQ‖Wiser script instructions are available from Identifying the operating system help page.


tip

NSGNm‖• ScriptForge.Platform service provides a collection of properties about the current execution environment and context, that include platform detection.

• Extensive operating system name identification is available from INFO("system") Calc formula.


GetPathSeparator

BJTbw‖Returns the operating system-dependent directory separator used to specify file paths.

U4CR2‖Use os.pathsep from os Python module to identify the path separator.

FVEx2‖Syntax:

svc.GetPathSeparator(): str

EFSA4‖Example:


    sep = bas.GetPathSeparator()
  

GetSystemTicks

Jvd3v‖Returns the number of system ticks provided by the operating system. You can use this function to optimize certain processes. Use this method to estimate time in milliseconds:

FVEx2‖Syntax:

svc.GetSystemTicks(): int

EFSA4‖Example:


    ticks_ini = bas.GetSystemTicks()
    time.sleep(1)
    ticks_end = bas.GetSystemTicks()
    bas.MsgBox("{} - {} = {}".format(ticks_end, ticks_ini,ticks_end - ticks_ini))
  
vAKxi‖

GlobalScope.BasicLibraries

KRHNc‖Returns the UNO object containing all shared Basic libraries and modules.

MCrF8‖This method is the Python equivalent to GlobalScope.BasicLibraries in Basic scripts.

FVEx2‖Syntax:

svc.GlobalScope.BasicLibraries(): uno

bBBqF‖Return type:

com.sun.star.script.XLibraryContainer

EFSA4‖Example:

DEARA‖The following example loads the Gimmicks Basic library if it has not been loaded yet.


    libs = bas.GlobalScope.BasicLibraries()
    if not libs.isLibraryLoaded("Gimmicks"):
        libs.loadLibrary("Gimmicks")
  
GWLB8‖

GlobalScope.DialogLibraries

jusQK‖Returns the UNO object containing all shared dialog libraries.

QEFwP‖This method is the Python equivalent to GlobalScope.DialogLibraries in Basic scripts.

FVEx2‖Syntax:

svc.GlobalScope.DialogLibraries(): uno

bBBqF‖Return type:

com.sun.star.comp.sfx2.DialogLibraryContainer

EFSA4‖Example:

8ozVo‖The following example shows a message box with the names of all available dialog libraries.


    dlg_libs = bas.GlobalScope.DialogLibraries()
    lib_names = dlg_libs.getElementNames()
    bas.MsgBox("\n".join(lib_names))
  
nzDmi‖

InputBox

FVEx2‖Syntax:

svc.InputBox(prompt: str, [title: str], [default: str], [xpostwips: int, ypostwips: int]): str

WADQ4‖Parameters:

XLiFg‖ prompt: String expression displayed as the message in the dialog box.

2n2xA‖ title: String expression displayed in the title bar of the dialog box.

5nqgR‖ default: String expression displayed in the text box as default if no other input is given.

tUL75‖ xpostwips: Integer expression that specifies the horizontal position of the dialog. The position is an absolute coordinate and does not refer to the window of LibreOfficeDev.

MCG7B‖ ypostwips: Integer expression that specifies the vertical position of the dialog. The position is an absolute coordinate and does not refer to the window of LibreOfficeDev.

5EWrw‖If xpostwips and ypostwips are omitted, the dialog is centered on the screen. The position is specified in twips.

bBBqF‖Return type:

String

EFSA4‖Example:


    qRtw5‖txt = s.InputBox('Please enter a phrase:', "Dear user")
    B2mnv‖s.MsgBox(txt, s.MB_ICONINFORMATION, "Confirmation of phrase")
  
note

znSLr‖For in-depth information please refer to Input/Output to Screen with Python on the Wiki.


eJjWs‖

MsgBox

ogocf‖Displays a dialog box containing a message and returns an optional value.
MB_xx constants help specify the dialog type, the number and type of buttons to display, plus the icon type. By adding their respective values they form bit patterns, that define the MsgBox dialog appearance.

FVEx2‖Syntax:

bas.MsgBox(prompt: str, [buttons: int], [title: str])[: int]

WADQ4‖Parameters:

DGAJA‖ prompt: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).

stGAc‖ title: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.

nARDU‖ buttons: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. buttons represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:

bBBqF‖Return type:

5adLA‖An optional integer as detailed in above IDxx properties.

EFSA4‖Example:


    qRtw5‖txt = s.InputBox('Please enter a phrase:', "Dear user")
    B2mnv‖s.MsgBox(txt, s.MB_ICONINFORMATION, "Confirmation of phrase")
  
note

znSLr‖For in-depth information please refer to Input/Output to Screen with Python on the Wiki.


HaBRd‖

Now

f96nJ‖Returns the current system date and time as a datetime.datetime Python native object.

FVEx2‖Syntax:

svc.Now(): datetime

EFSA4‖Example:


    bas.MsgBox(bas.Now(), bas.MB_OK, "Now")
  
GeEFL‖

RGB

vBVsk‖Returns an integer color value consisting of red, green, and blue components.

FVEx2‖Syntax:

svc.RGB(red:int, green: int, blue: int): int

WADQ4‖Parameters:

JVhSY‖ red: Any integer expression that represents the red component (0-255) of the composite color.

MeGD7‖ green: Any integer expression that represents the green component (0-255) of the composite color.

iP9Sd‖ blue: Any integer expression that represents the blue component (0-255) of the composite color.

c4KCL‖The resulting Long value is calculated with the following formula:
Result = red×65536 + green×256 + blue.

warning

RktBy‖Under VBA compatibility mode (Option VBASupport 1), the Long value is calculated as
Result = red + green×256 + blue×65536
See RGB Function [VBA]


tip

Fo6ZS‖The color picker dialog helps computing red, green and blue components of a composite color. Changing the color of text and selecting Custom color displays the color picker dialog.


bBBqF‖Return type:

Integer

EFSA4‖Example:


    YELLOW = bas.RGB(255,255,0)
  
uh3jm‖

Xray

TwoGN‖Inspect Uno objects or variables.

FVEx2‖Syntax:

svc.Xray(obj: any)

WADQ4‖Parameters:

CDCQx‖obj: A variable or UNO object.

EFSA4‖Example:


    bas.Xray(bas.StarDesktop)
  
warning

uzETY‖All ScriptForge Basic routines or identifiers that are prefixed with an underscore character "_" are reserved for internal use. They are not meant be used in Basic macros or Python scripts.