SelectURL Method

NI DataSocket

SelectURL Method

Syntax

CWDataSocket.SelectURL ( [startURL] [, Title] [, Options] [, Filters])

Return Type

Boolean

Purpose

Enables interactive browsing and selection of data items, on DataSocket, OPC servers, Fieldpoint devices, Lookout objects, and of files so that users can easily create data URLs, rather than constructing the URLs themselves, or it displays a simple text box in which users can enter HTTP and FTP URLs.

Parameters

startURL As Variant

[Optional] String containing the URL. If startURL is "opc:", "dstp:", "logos:", "file", or if you omit this parameter, this method opens a browser to enable users to interactively find and select data items. You can prompt users to create a Web or FTP location with the "http:" or "ftp:" URL schemes. You also can use an entire URL, such as "dstp://localhost/wave".

Title As Variant

[Optional] Title of the SelectURL dialog box.

Options As Variant

[Optional] Flags to pass to the dialog:

0x00002000 (CREATEPROMPT): Opens a dialog box to prompt the user for permission to create the file if that file does not already exist. If the user chooses to create the file, the dialog box closes and the function returns the specified name; otherwise, the dialog box remains open.

0x00001000 (FILEMUSTEXIST): Specifies that the user can type only names of existing files in the File Name entry field. If this flag is specified and the user enters an invalid name, the dialog box procedure displays a warning in a message box.

0x00000004 (HIDEREADONLY): Hides the Read Only check box.

0x00000008 (NOCHANGEDIR): Restores the current directory to its original value if the user changed the directory while searching for files.

0x00100000 (NODEREFERENCELINKS): Directs the dialog box to return the path and filename of the selected shortcut (.LNK) file. If this value is not given, the dialog box returns the path and filename of the file referenced by the shortcut.

0x00008000 (NOREADONLYRETURN): Specifies that the returned file does not have the Read Only check box checked and is not in a write-protected directory.

0x00010000 (NOTESTFILECREATE): Specifies that the file is not created before the dialog box is closed. This flag should be specified if the application saves the file on a create-nonmodify network share. When an application specifies this flag, the library does not check for write protection, a full disk, an open drive door, or network protection. Applications using this flag must perform file operations carefully, because a file cannot be reopened once it is closed.

0x00000002 (OVERWRITEPROMPT): Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.

0x00000800 (PATHMUSTEXIST): Specifies that the user can type only valid paths and filenames. If this flag is used and the user types an invalid path and filename in the File Name entry field, the dialog box function displays a warning in a message box.

0x00000001 (READONLY): Causes the Read Only check box to be checked initially when the dialog box is created.

0x00000020 (SAVEAS): Causes the file dialog to be a Save As file dialog, rather than an Open file dialog.

Filters As Variant

[Optional] Filter string to pass to the dialog. For example, All Files(*.*)|*.*

Example

'Browse for data items.
CWDataSocket1.SelectURL "opc:"

'Browse for files in the test directory.
CWDataSocket1.SelectURL "file:c:\test", "Choose File", True

See Also

URL

ActualURL