So you have this cool program that prompts for a file name and then transfers that file from the PC to the host via the TU.. library for processing in your SB+ application. Wouldn't it be cool if the user could press F3 and bring up the standard Windows File | Open dialog for selecting the file to be transferred? Well, here's a quick little BASIC subroutine that does exactly that.
(And what's cool is that it's not specific to GUI - it works just fine in character mode.)
SUBROUTINE F3.PC.FILE
*
$INCLUDE DMSKELCODE COMMON
*
START.PATH = FIELD(PARAM,',',1)
FILE.DESC = FIELD(PARAM,',',2)
FILE.EXT = FIELD(PARAM,',',3)
RESULT = ''
FILE.ERROR = ''
CALL TU.FORM.OPENDOS("", START.PATH, FILE.DESC:@SM:"*.":FILE.EXT, RESULT, FILE.ERROR)
*
IF NOT(FILE.ERROR) THEN
VALUE = RESULT
END ELSE
VALUE = ''
END
*
RETURN
Assuming you create a /PD.B to run this (called F3.PC.FILE) you can put this on an Intuitive Help slot with:
F3.PC.FILE,path,desc,extAs to the variables,
path is the path you want to start in (like
C:\Temp)
desc is the description of the files you want to select (like
Comma Separated Value) and
ext is the extension you want to select (like
CSV - note: no dot). So the whole thing all together might look like this:
F3.PC.FILE,C:\TEMP,Comma Separated Value,CSVThe fully qualified file name (with drive letter, colon, and path) is then returned for you to use as you see fit.
I've added this to my
Standard Processes document - and a big THANK YOU to Jim Jedrey for the tip on TU.FORM.OPENDOS!