Attach Office Application
Connects to an Office application that is open.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
officeAttach --type(OfficeApplicationType) [--useregex(Boolean)] --regexPattern(String) [--regexOptions(DisplayableRegexOptions)] [--title(String)] [--processid(Numeric)] [--keepvisible(Boolean)] (OfficeApplication)=officeapplication (Numeric)=processid
Dependencies
- Microsoft™ Office 2010 or higher is required.
- Ensure that the architecture (bitness) of your Office apps, IBM RPA, and your operating system match. For example, if you are using a 64-bit operating system, IBM RPA and Office must be 64-bit too.
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Type | type |
Required |
OfficeApplicationType |
Type of Office application. See the type parameter options. |
Use regex | useregex |
Optional |
Boolean |
Enables the Regex pattern and Regex options fields to fetch the application to be connected. |
Regex pattern | regexPattern |
Required when the Use regex parameter is enabled |
Text |
Regular expression used to search for the application to connect to. |
Regex options | regexOptions |
Optional |
DisplayableRegexOptions |
Options for searching Regex pattern .See the regexoptions parameter options. |
Title | title |
Optional |
Text |
Title of the Office application's window. |
Process ID | processid |
Optional |
Number |
Office application's Process ID. |
Keep visible | keepvisible |
Optional |
Boolean |
Parameter used to keep the office application visible on the computer toolbar. |
type
parameter options
The following table displays the options available for the type
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Word | Word |
Matches the Microsoft Word application. |
Excel | Excel |
Matches the Microsoft Excel application. |
Power Point | PowerPoint |
Matches the Microsoft PowerPoint application. |
regexOptions
parameter options
The following table displays the options available for the regexOptions
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Compiled | Compiled |
Compile regex expressions instead of interpreting. |
Culture Invariant | CultureInvariant |
Ignore cultural differences in language. |
ECMA Script | ECMAScript |
Interprets ECMA Script expressions. |
Ignore Case | IgnoreCase |
Case-insensitive search. |
Explicit Capture | ExplicitCapture |
The only valid captures are explicitly named or numbered groups of the form (?<name> subexpression ). |
Ignore Pattern Whitespace | IgnorePatternWhitespace |
Ignore whitespace characters, and enable comments after a number sign (#). |
Right To Left | RightToLeft |
Read regex expressions from right to left, or from last to first. |
Singleline | Singleline |
Changes the meaning of the dot (.), which matches every character except . |
Multiline | Multiline |
Allows the caret (^) and dollar sign ($) symbols to match newline characters. |
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Office application | officeapplication |
Office Application |
Office application attached. |
Process ID | processid |
Number |
Process ID of the connected office application. |
Example
Connects to an Excel application, opened by the Open Office File command and closed using the Close Office Application command.
defVar --name applicationExcelConnected --type OfficeApplication
//Use a sample file.
officeOpen --path "Sample file" --type "Excel" --keepvisible
officeAttach --type "Excel" --title "tableExcelCompanyCity - Excel" applicationExcelConnected=officeapplication
officeClose --officeapplication ${applicationExcelConnected}
❕ Important: To use the sample script, insert the file's path in the File Path
parameter of the Open Office File command.