Difference between revisions of "Documentation/BASIC Guide/Other Functions (Runtime Library)"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
(4 intermediate revisions by 4 users not shown)
Line 6: Line 6:
 
|runtime=block
 
|runtime=block
 
}}
 
}}
{{DISPLAYTITLE:Other Functions ({{OOo}} Runtime Library)}}
+
{{DISPLAYTITLE:Other Functions ({{AOo}} Runtime Library)}}
 
__NOTOC__  
 
__NOTOC__  
 
== Beep ==
 
== Beep ==
Line 12: Line 12:
 
The <tt>Beep</tt> function causes the system to play a sound that can be used to warn the user of an incorrect action. <tt>Beep</tt> does not have any parameters:
 
The <tt>Beep</tt> function causes the system to play a sound that can be used to warn the user of an incorrect action. <tt>Beep</tt> does not have any parameters:
  
<source lang="oobas">
+
<syntaxhighlight lang="oobas">
 
Beep    ' creates an informative tone
 
Beep    ' creates an informative tone
</source>
+
</syntaxhighlight>
  
 
== Shell ==
 
== Shell ==
Line 20: Line 20:
 
External programs can be started using the Shell function.
 
External programs can be started using the Shell function.
  
<source lang="oobas">
+
<syntaxhighlight lang="oobas">
Shell(Pathname, Windowstyle, Param)
+
Shell(Pathname, Windowstyle, Param, bSync)
</source>
+
</syntaxhighlight>
  
<tt>Pathname</tt> defines the path of the program to be executed.
+
; Pathname : the path of the program to be executed.
 +
: In MS-Windows, use <tt>ConvertToURL(Pathname)</tt> otherwise the command will not work if <tt>Pathname</tt> contains spaces or national characters.
  
<tt>Windowstyle</tt> defines the window in which the program is started.  
+
; Windowstyle : the window in which the program is started.
 +
:The following values are possible:
 +
:* <tt> 0</tt> - The program receives the focus and is started in a concealed window.
 +
:* <tt> 1</tt> - The program receives the focus and is started in a normal-sized window.
 +
:* <tt> 2</tt> - The program receives the focus and is started in a minimized window.
 +
:* <tt> 3</tt> - The program receives the focus and is started in a maximized window.
 +
:* <tt> 4</tt> - The program is started in a normal-sized window, without receiving the focus.
 +
:* <tt> 6</tt> - The program is started in a minimized window, the focus remains in the current window.
 +
:* <tt>10</tt> - The program is started in full screen mode.  
  
The following values are possible:  
+
; Param : command line parameters to be transferred to the program to be started.
  
* <tt>0</tt> - The program receives the focus and is started in a concealed window.
+
; bSync : wait for shell command to finish flag
* <tt>1</tt> - The program receives the focus and is started in a normal-sized window.
+
:* <tt>true</tt> - wait for shell command to finish
* <tt>2</tt> - The program receives the focus and is started in a minimized window.
+
:* <tt>false</tt> - don't wait for shell command to finish
* <tt>3</tt> - The program receives the focus and is started in a maximized window.
+
* <tt>4</tt> - The program is started in a normal-sized window, without receiving the focus.
+
* <tt>6</tt> - The program is started in a minimized window, the focus remains in the current window.
+
* <tt>10</tt> - The program is started in full screen mode.
+
  
The third parameter, <tt>Param</tt>, permits command line parameters to be transferred to the program to be started.
+
== Wait and WaitUntil ==
  
== Wait ==
+
The <tt>Wait</tt> statement suspends program execution for a specified time. The waiting period is specified in milliseconds. The command:
  
The <tt>Wait</tt> function terminates program execution for a specified time. The waiting period is specified in milliseconds. The command
+
<syntaxhighlight lang="oobas">
 
+
<source lang="oobas">
+
 
Wait 2000
 
Wait 2000
</source>
+
</syntaxhighlight>
 +
 
 +
specifies a delay of 2 seconds (2000 milliseconds).
 +
 
 +
The <tt>WaitUntil</tt> statement provides a greater degree of compatibility with VBA parameter usage. <tt>WaitUntil</tt> takes a parameter of type <tt>Date</tt>, with a combined date and time value. The command:
 +
 
 +
<syntaxhighlight lang="oobas">
 +
WaitUntil Now + TimeValue("00:00:02")
 +
</syntaxhighlight>
  
specifies an interrupt of 2 seconds (2000 milliseconds).  
+
specifies the same delay, 2 seconds, as the previous example.
  
 
== Environ ==
 
== Environ ==
  
The <tt>Environ</tt> function returns the environmental variables of the operating system. Depending on the system and configuration, various types of data are saved here. The following call determines the environment variables of temporary directory of the operating system:
+
The <tt>Environ</tt> function returns the environmental variables of the operating system. Depending on the system and configuration, various types of data are saved here. The following call determines the environment variables of the temporary directory of the operating system:
  
<source lang="oobas">
+
<syntaxhighlight lang="oobas">
 
Dim TempDir
 
Dim TempDir
 
TempDir=Environ ("TEMP")
 
TempDir=Environ ("TEMP")
</source>
+
</syntaxhighlight>
  
 
   
 
   
 
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Other Functions (Runtime Library)}}
 
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Other Functions (Runtime Library)}}
 
{{PDL1}}
 
{{PDL1}}

Latest revision as of 12:16, 30 January 2021


Beep

The Beep function causes the system to play a sound that can be used to warn the user of an incorrect action. Beep does not have any parameters:

Beep     ' creates an informative tone

Shell

External programs can be started using the Shell function.

Shell(Pathname, Windowstyle, Param, bSync)
Pathname 
the path of the program to be executed.
In MS-Windows, use ConvertToURL(Pathname) otherwise the command will not work if Pathname contains spaces or national characters.
Windowstyle 
the window in which the program is started.
The following values are possible:
  • 0 - The program receives the focus and is started in a concealed window.
  • 1 - The program receives the focus and is started in a normal-sized window.
  • 2 - The program receives the focus and is started in a minimized window.
  • 3 - The program receives the focus and is started in a maximized window.
  • 4 - The program is started in a normal-sized window, without receiving the focus.
  • 6 - The program is started in a minimized window, the focus remains in the current window.
  • 10 - The program is started in full screen mode.
Param 
command line parameters to be transferred to the program to be started.
bSync 
wait for shell command to finish flag
  • true - wait for shell command to finish
  • false - don't wait for shell command to finish

Wait and WaitUntil

The Wait statement suspends program execution for a specified time. The waiting period is specified in milliseconds. The command:

Wait 2000

specifies a delay of 2 seconds (2000 milliseconds).

The WaitUntil statement provides a greater degree of compatibility with VBA parameter usage. WaitUntil takes a parameter of type Date, with a combined date and time value. The command:

WaitUntil Now + TimeValue("00:00:02")

specifies the same delay, 2 seconds, as the previous example.

Environ

The Environ function returns the environmental variables of the operating system. Depending on the system and configuration, various types of data are saved here. The following call determines the environment variables of the temporary directory of the operating system:

Dim TempDir
TempDir=Environ ("TEMP")


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools