NAME=OPEN

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

NAME=OPEN

Post by GomezL »

I am looking for some documentation about a really nice feature in BR 4.18.

00010 OPEN #1: "name=OPEN:.,recl=1,shr",EXTERNAL,INPUT IOERR 100

The above line will return either an error if they cancel, or FILE$(1) will return the name that the user selected.
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

similar feature documentation is here:

http://brwiki.ads.net/index.php?title=Name%3DSave:

ultimately the Open (disambiguation) page should probably link to the document:

http://brwiki.ads.net/index.php?title=Open
John Bowman
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Post by Gabriel »

I have no documentation, but I do have experience getting this feature to work under both BR Native, and even under BR Client Server.

If you have any specific questions, I'd be happy to try to answer them.

Gabriel
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

It is very usefull.

I thought it might be usefull for some to see the program that I use to select and paunch programs to read various types of files from within BR. The program uses the FNMSEXE$ function from FNSNAP that in turn uses Davud Blankenship's registry reader to find the installed location of various Microsoft registered programs.

Line 170 tests for the existence of the selected file. If EXISTS=2 then the file exists, if EXISTS=1 then the directory exists. I am only interested in the existence of the file. So, if the selected file exists then the following routines load the specific program to process the file and BR continues.
  • 00010 DIM POST$*100,OPT$*100
    00020 !
    00030 LIBRARY ENV$("PD")&"VOL002\FNSNAP.DLL": FNGETFILE$,FNMSEXE$,FNGETHANDLE
    00040 EXECUTE "proc *"&ENV$("PD")&"vol002\tt"
    00050 ! LET CURDRV=10
    00060 IF FILE(CURDRV)>-1 THEN LET CURDRV+=1 : GOTO 60
    00070 OPEN #(CURDRV=FNGETHANDLE): "name=curdrv,replace",DISPLAY,OUTPUT
    00080 DIM GETFILE$*100
    00090 LET GETFILE$=FILE$(CURDRV)(1:POS(FILE$(CURDRV),"\curdrv"))
    00100 CLOSE #CURDRV,FREE:
    00110 LET CURDRV=0
    00120 IF POST$="" THEN LET POST$="*.*"
    00130 IF OPT$="" THEN LET OPT$="audatc\"
    00140 IF NOT OPT$(LEN(OPT$):LEN(OPT$))="\" THEN LET OPT$=OPT$&"\"
    00150 OPEN #(GETFILE=FNGETHANDLE): "name=OPEN:"&OPT$&POST$&",recl=1,shr",EXTERNAL,INPUT IOERR 170
    00160 LET GETFILE$=FILE$(GETFILE) !:
    CLOSE #GETFILE: !:
    LET GETFILE=0
    00170 IF NOT EXISTS(GETFILE$)=2 THEN LET GETFILE$="" !:
    LET MSGBOX("No file was selected.")
    00180 IF TRIM$(GETFILE$)>"" THEN LET GETFILE$=OS_FILENAME$(GETFILE$)
    00190 IF TRIM$(GETFILE$)<="" THEN GOTO EOJ
    00200 IF POS(LWRC$(GETFILE$),".doc") OR POS(GETFILE$,".rtf") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("winword.exe")&" """&GETFILE$&"""" !:
    GOTO 300
    00210 IF POS(LWRC$(GETFILE$),".xls") OR POS(GETFILE$,".csv") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("excel.exe")&" """&GETFILE$&"""" !:
    GOTO 300
    00220 IF POS(LWRC$(GETFILE$),".txt") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("editpadpro.exe")&" """&GETFILE$&"""" !:
    GOTO 300
    00230 IF POS(LWRC$(GETFILE$),".fp") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("fpdisp5a.exe")&" """&GETFILE$&"""" ERROR 240 !:
    GOTO 300
    00240 IF POS(LWRC$(GETFILE$),".fp") THEN !:
    EXECUTE "sys -w -c C:\Windows\System32\spool\drivers\x64\3\fpdisp6.exe """&GETFILE$&"""" !:
    GOTO 300
    00250 IF POS(LWRC$(GETFILE$),".pdf") AND EXISTS(FNMSEXE$("acrobat.exe")) THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("acrobat.exe")&" """&GETFILE$&"""" : GOTO 300 !:
    ELSE IF POS(LWRC$(GETFILE$),".pdf") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("acrord32.exe")&" """&GETFILE$&"""" !:
    GOTO 300
    00260 IF POS(LWRC$(GETFILE$),".mdb") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("msaccess.exe")&" """&GETFILE$&"""" !:
    GOTO 300
    00270 IF POS(LWRC$(GETFILE$),".ppt") THEN !:
    EXECUTE "sys -w -c "&FNMSEXE$("powerpnt.exe")&" """&GETFILE$&"""" !:
    GOTO 300
    00280 IF POS(LWRC$(GETFILE$),".sbw") THEN !:
    EXECUTE "sys -w -c "&"""C:\Program Files\Savings Bond Wizard\SBWizard.exe"""&" """&GETFILE$&"""" !:
    GOTO 300
    00290 EXECUTE "sys start """&GETFILE$&""""
    00300 EOJ: LET MENU_NAME$="AUSYSC" !:
    LET MENU_SEQ$="001" !:
    CHAIN ENV$("PD")&"workmenu.br",MENU_NAME$,MENU_SEQ$
FNGEORGE
      Attachments
      getfile.br
      (5.57 KiB) Downloaded 391 times
      Susan Smith
      Posts: 717
      Joined: Sun Aug 10, 2008 4:24 am
      Location: Southern California

      Post by Susan Smith »

      This is really helpful George. Thanks.

      -- Susan
      Post Reply