Precisely Speaking
May 21, 2012, 08:06:51 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: So what's news with you?  Tell us about it in "Getting To Know You"!
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: F3.PC.FILE: Select PC File  (Read 3367 times)
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1532



WWW
« on: December 02, 2007, 12:13:46 PM »

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,ext

As 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,CSV

The 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!
« Last Edit: December 04, 2007, 03:34:16 PM by precisonline » Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
Tom Pellitieri
Rock Star
*****
Posts: 171


Tom Pellitieri - Toledo, Ohio


« Reply #1 on: December 03, 2007, 06:45:38 AM »

I'm guessing that this only works if you're using SB Client, is that correct??

--Tom
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1532



WWW
« Reply #2 on: December 03, 2007, 10:58:25 AM »

Ah yes.  I did forget to mention that.  Thanks for clarifying!
Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
nmorgan
Professional
***
Posts: 40


Norman Morgan


WWW
« Reply #3 on: December 05, 2007, 10:08:12 AM »

Yep, anything that starts out TU. is going to be specific to SBClient, formerly known as TermUlator.  Us Accuteerm and Anzio users just have to watch and wish.
Logged

My wife says her life is like a fairy tale.
She married a prince and he turned into a toad.
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1532



WWW
« Reply #4 on: December 05, 2007, 10:34:55 AM »

There's got to be a way to do it in Anzio or Accuterm - those are pretty sophisticated emulators, as I recall (though I regret that I personally have no experience with them).  Dynamic Connect, on the other hand, yeah, that ain't gonna happen!
Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!