PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Lifespan of a dynamic automation object
  • Allocating a dynamic object
  • Passing parameters to a method
  • Automation objects and WEBDEV
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Dynamic Automation object
In french: Automation Dynamique
A dynamic automation object is an automation object allocated upon request, during the program execution. The Automation objects are used to handle software such as Office 2007 (Word, Excel, ...).
WEBDEV - Server code Using the Automation type in a Web site may cause problems. In Intranet, the automation objects can be used with great care in specific cases. On Internet, the automation objects constitute a dangerous conception and they are not recommended.
Example
// Declare a dynamic automation object
MyDynamicObject is dynamic Automation object
// Create a dynamic automation object
MyDynamicObject = new Automation object MyServer
// Calling a method of a dynamic automation object
MyDynamicObject>>OpenFile(DocName)
Syntax

Declaring a dynamic automation object Hide the details

<Name of Dynamic Automation Object> is dynamic automation object
<Name of Dynamic Automation Object>: Character string (without quotes)
Name of the dynamic automation object to declare.

Allocating a dynamic automation object Hide the details

<Name of Dynamic Automation Object> = new automation object <Name of Automation Server>
<Name of Dynamic Automation Object>: Character string (without quotes)
Name of the dynamic automation object to allocate. This object was declared beforehand.
<Name of Automation Server>: Character string
Name of the server of dynamic automation object.

Call a method of a dynamic automation object Hide the details

<Name of Dynamic Automation Object>>><Method Name>([<Parameters>])
<Name of Dynamic Automation Object>: Character string (without quotes)
Name of the dynamic automation object to use. This object was previously declared and allocated.
<Method Name>: Character string
Name of the method of the dynamic automation object to run. This method is given by the server.
Note: The list of available methods depends on the automation server. See the documentation about the server for more details.
<Parameters>: Any type (optional)
Parameters passed to the method.
Remarks

Lifespan of a dynamic automation object

The dynamic automation object is created when allocating the object.
The dynamic automation object is automatically destroyed at the end of the process containing its declaration or when a new allocation is performed on the object.
A dynamic automation object declared "global" in the code:
  • that initializes a window will be destroyed at the end of the closing process of the window.
  • that initializes a project will be destroyed at the end of the closing process of the first project window.
To explicitly free a dynamic automation object, use the following syntax:
Delete <Name of Dynamic Automation Object>

Allocating a dynamic object

  • When allocating a dynamic automation object, the automation server is automatically started.
  • To allocate a dynamic automation object with an existing instance of an automation server, use GetActiveObject.

Passing parameters to a method

  • The methods of automation servers can accept one or more parameters.
  • When calling a method, the sequence of parameters must be respected (see the documentation for more details).
  • With some automation servers, some method parameters are not valued: only the presence of the parameter is important. The value taken by this parameter has no importance.
    For example, the "EditReplace" method of Word Basic accepts 10 parameters, the last one (ReplaceAll) being not valued.
    In WLanguage, any ordinary value can be passed to non-valued parameters.
  • The methods of some automation servers can accept optional parameters located anywhere in the list of parameters.
In WLanguage, the optional parameters must necessarily be found after the mandatory parameters.
To give any ordinary value to an optional parameter, assign the * character to the optional parameter. On the contrary, this character will not be required for the optional parameters found after the last mandatory parameter.
WEBDEV - Server code

Automation objects and WEBDEV

Using the Automation type in a site may cause problems. In Intranet, the automation objects can be used with great care in specific cases. In Intranet, using the automation objects is a dangerous conception and they are not recommended.
The following problems may occur:
  • Large memory consumption.
  • Limit regarding the number of users.
  • Workload of the automation objects used not controlled properly.
  • Concurrent access to the resources and especially to the files.
  • Potential locking windows of the automation object that open on the server.
We recommend that you find another solution if possible. For example:
  • Using a Back Office: Save the elements to run in a file (HyperFileSQL, text, ...) and run it via a WINDEV application that operates in background task on the server.
  • Using Web services, ...
Note: In most cases, the use of automation objects requires a specific server configuration (for security reasons). See the provider for more details.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment