Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating User Defined File Names At Run-Time

Status
Not open for further replies.

TomHAFC

Programmer
Feb 18, 2002
5
US
Hi,
Does Aspect have a dialog box that can both browse and take input for a file name (the way many installation programs allow a user to both search drives and enter directory names)?

I'd like to allow a user to specify a given (mounted) drive, a (existing) directory (no need to create a new directory) and be able to specify a file name.

If Aspect doesn't have this capability, what alternative does Aspect offer to opening a new file (in a specified drive/directory) to accept user input?

Thanks, in advance, for your help.

Tom Hemmingsen
 
Tom,

On the Procomm Plus 4.8 CD there are some good examples about Dialog Boxes. That would be a good place to Start. One of these Scripts will get you in the BallPark. Also the FOPEN Command allows you Create a New File in the Directory you Specify .

Hope this helps.

Hank
 
ASPECT doesn't quite have this functionality, but it has something close. You can use the dirlistbox command, which will display the list of files in a specified directory. The user can also switch to a different drive or directory using this control. The only thing lacking is a way to enter a filename. You could create a dialog with a dirlistbox control and an edit field, which would be used by the user to enter the filename they want to create. You could then get the filename from the edit field and the current path from the dirpath command (the example script for the dirlistbox command shows how to use this command), then strcat the path and filename together to end up with the fully-qualified filename. You could then use the fopen command to create a new file with the specified name, or your script could take some other action on the file later on.

The only possible sticking point I am aware of is that the dirlistbox command has some issues on Win2K I believe. The problem I've seen reported in the past was that the directory specified in the dirlistbox command would sometimes not be the default directory displayed by the control. Unfortunately, I'm not aware of any workaround for this problem. I'm not sure if this problem also affected the dirpath command, but I would not be surprised if it did.
 
Knob,
Thank you for those very helpfull suggestions.

Before you sent your suggestions, I was able to get a dialog box with both dirlistbox and dirpath (to show the full path), but I didn't see anything in the help screens, or ASPECT Script User's Guide, with examples of how to specify a file name at run-time. With your suggestions I should be able to create the user-specified files at run-time.

I'm hoping that dirpath with also display the chosen filename. But, the ASPECT Script User's Guide doesn't seem to indicate that. Is there another dialog box control that does display the currently opened file? If so, I'll use it. But, my window is quickly becoming very "busy", and I'll need to add groupboxes to try to clearly show what selects a drive/directory from what selects a filename.

Thanks (again), in advance, for your help.

Tom Hemmingsen
 
I think the only way to show the current file would be in an edit box. I believe the only way to do what you want is to display the path using the dirlistbox command, then let the user enter a filename in the edit box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top