Name=Open:

From BR Wiki
Revision as of 20:13, 12 February 2016 by John (talk | contribs)
Jump to navigation Jump to search

When using Name=Open: BR will prompt the operator to select a file, and then open the file using the Windows API.

In the following example, an Open File Dialog Box will open, and will open to the "Last Selected Folder", Name Open: has memory, and will remember file history and default file location.

Please note the * (asterisk) wild card is supported but the ? (question mark) wild card is not.

00010 open #1: "name=OPEN:text documents (*.txt) |*.txt,recl=1,shr",external,input ioerr 100
00020 print File$(1)
00030 close #1: 
00100 print "Operation Canceled: Err=";Err
00200 XIT: !

In the example above:

  • "name=OPEN:"instructs BR to open a Open File Dialog Box.
  • "text documents (*.txt)" defines the label for the filter combo box (Lower Right Corner).
  • The Pipe (|) is a separator.
  • (*.txt) is the actual filter that will be used when displaying files.

When using file dialogs with client server, @: or @:: is needed. The file dialog runs on the client side and doesn't have access to server side files - except through windows networking.

See the following Client Server example:

00010 open #1: "name=OPEN:@:text documents (*.txt) |*.txt,recl=1,shr",external,input ioerr 100
00020 print File$(1)
00030 close #1: 
00100 print "Operation Canceled: Err=";Err
00200 XIT: !
  • "@:" instructs the program to use the "Client Default Folder" as the default folder.
  • "@::" instructs the program to use the "A Client Folder" as the default folder.

It is possible to specify a specific folder as well as specify multiple filters.

The following example will display all ".ini" files as well as ".txt" files in the C:\Windows folder.

Remember that @: & @:: are required for Client Server.

00010   OPEN #1: "name=OPEN:C:\Windows\ Text Files (*.ini;*.txt)|*.ini;*.txt,recl=1,shr",EXTERNAL,INPUT IOERR 100
00020   PRINT File$(1)
00030   CLOSE #1: 
00100   PRINT "Operation Canceled: Err=";Err
00200 XIT: !
  • "NAME=Open:" instructs BR to open a Open File Dialog Box.
  • "C:\Windows\" is the Windows Path, it is important to include the final "\" and not include any filters.
  • The space Between \ & the Filter Combo Box Description is not required, but may aid in understanding the syntax.
  • "Text Files (*.ini;*.txt)" is the Filter Combo Box Description and will be displayed in the Combo Box Filter. (It is optional).
  • The Pipe (|) is a separator.
  • "*.ini;*.txt" is a list of actual filters that will be used when displaying files. Delimit the list with a ";"


The following is a much less complicated example that simply allows the user to pick an "Ini" file from the C:\Windows Folder.

00010   OPEN #1: "name=OPEN:C:\Windows\*.ini,recl=1,shr",EXTERNAL,INPUT IOERR 100
00020   PRINT File$(1)
00030   CLOSE #1: 
00100   PRINT "Operation Canceled: Err=";Err
00200 XIT: !

See also: