Handle Open File Dialog

Verb: handleOpenFileDialog

Available from: <Standard>

Handles a dialog box, originated from the action of opening a file. The dialog box is located, and then a specified file is opened through it.

Syntax

handleOpenFileDialog --filepath(String) [--useregex(Boolean)] [--title(String)] --regexPattern(String) [--regexOptions(DisplayableRegexOptions)] [--id(String)] [--processid(Numeric)] [--processname(String)] [--byparent(Boolean)] [--window(Window)] [--safesearch(Boolean)] [--timeout(TimeSpan)] (Window)=value (Numeric)=processId (Boolean)=success

Inputs

Script Designer Required AcceptedTypes Description
--filepath File Path Required Text Full path to the file that should be opened by the dialog box.
--useregex Use Regular Expression Optional Boolean When enabled, uses a regular expression to locate the dialog box.
--title Title Optional Text Title of the dialog box that should be handled to open the file.
--regexPattern Regular Expression Only whenUse Regular Expression is True Text Regular expression to find the dialog box based on its title.
--regexOptions Options Optional DisplayableRegexOptions Filtering options that assist in regular expression search:
  • Compiled
  • Culture Invariant
  • ECMA Script
  • Explicit Capture
  • Ignore Case
  • Ignore Pattern Whitespace
  • Multiline
  • Right To Left
  • Singleline
  • --titleAsRegex Title is regular expression(Obsolete) Optional Boolean When enabled, allows the use of a "Regular Expression" to search for the window title.
    This parameter is obsolete, the Use Regular Expression parameter should be used instead.
    --ignorecase Ignore case(Obsolete) Optional Boolean When enabled, specifies case-insensitive matching.
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --dotmatchesnewline Dot matches new line(Obsolete) Optional Boolean When enabled, the dot (.) character matches every character, instead of every character except "\n".
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --freespacing Ignore white space(Obsolete) Optional Boolean When enabled, eliminates blank spaces and breaks without adding a escape character.
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --explicitcapture Explicit capture(Obsolete) Optional Boolean When enabled, specifies that the only valid captures are explicitly named or numbered groups of the form (? ).
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --multiline Multiline(Obsolete) Optional Boolean When enabled, changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string.
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --id Id Optional Text Id of dialog that should be handled to open a file
    --processid Process Id Optional Number Process id in the operating system task managers associated to the dialog box.
    --processname Process Name Optional Text Name of the process in the operating system task manager, associated to the dialog box.
    --byparent Search in Attached Window Optional Boolean When enabled, searches for a child window, that is, the dialog box associated to a parent window, which initiated the open file action.
    --window Parent Window Optional Window Parent window used to search for the dialog box that should be handled to open the file in its child window.
    --safesearch Safe Search Optional Boolean When enabled, executes a better performance search algorithm.
    --timeout Timeout Optional Time Span, Number, Text Maximum time to wait for the action to be performed.
    In case no value is defined for the timeout parameter, the execution uses the context timeout defined by the Set Timeout command. If that command is not used on the script, the default timeout is 5 seconds.

    Outputs

    Script Designer AcceptedTypes Description
    value Dialog Window Window Returns data from the dialog window.
    processId Process Id Number Returns the process Id in the task manager of the operating system, associated to the dialog box that was handled to open a file.
    success Success Boolean Returns "True" if the dialog box was successfully handled, or "False" if it was not.

    Example

    The "My Documents" folder is obtained by the command Get System Folder Path, and the file to be saved in "My Documents" is created, using the command Write to File. Then, a "Notepad" window is opened and the "File > Open" options in the menu are clicked to open the dialog box. Then, the Handle Open File Dialog command is used to identify the open dialog box and select the file created earlier, so that it is opened in the current Notepad window.

    defVar --name notepadWindow --type Window
    defVar --name myDocumentsDirectory --type String
    defVar --name fileDirectory --type String
    defVar --name handleSuccess --type Boolean
    // The "My Documents" folder path is obtained to save the file that will be created by the "Write to File" command, so that it can be manipulated by the "Handle Open File Dialog" command.
    getSpecialFolder --folder "MyDocuments" myDocumentsDirectory=value
    writeToFile --value "This file will be opened by the action of the \"Handle Open File Dialog Box\" command during the execution of the documentation script.\r\n" --file "${myDocumentsDirectory}\\file.txt" fileDirectory=value
    // Open the Notepad so that, later, the "Handle Open File Dialog Box" command handles the dialog box that will open to obtain the created file.
    launchWindow --executablepath "notepad.exe" notepadWindow=value
    clickOnMenu --window ${notepadWindow} --menupath "file\r\nopen"
    handleOpenFileDialog --filepath "${fileDirectory}" --title Open --safesearch  --timeout 00:00:10 handleSuccess=success
    logMessage --message "The dialog box has been successfully handled: ${handleSuccess}" --type "Info"
    

    See Also

  • Attach Window
  • Cancel Token Source
  • Clear Cache
  • Click
  • Click on Cell
  • Click on Menu
  • Click on Value
  • Close Window
  • Control Screenshot
  • Count Windows
  • Expand Tree
  • Find Window
  • Find Windows
  • Focus
  • Focus Window
  • Get Barcode
  • Get Bounds
  • Get Cell Value
  • Get Control
  • Get Image Grid
  • Get Interval
  • Get Options
  • Get Table
  • Get Table Information
  • Get Tree Nodes
  • Get Value
  • Handle Save File Dialog
  • Launch and Attach Window
  • Launch or Attach Window
  • Map Image Grid
  • Maximize or Minimize Window
  • Offset Value
  • Screenshot Window
  • Select Row
  • Select Tab
  • Set Execution Throttling
  • Set Grid Value
  • Set Value
  • Update Window
  • Verify Enabled
  • Verify If Visible
  • Wait and Close Security Window
  • Wait Busy Window
  • Wait Control
  • Wait for Control to Enable
  • Wait for Window to Appear
  • Watch and Close Window