using SHELL for open/save dialog

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
joq85
Newbie
Posts: 2
Joined: Tue Mar 25, 2008 8:12 pm
Location: NY

using SHELL for open/save dialog

Post by joq85 »

It has been so long since I last used QB and there are some things I've forgotten that are driving me mad.

I remember I always hated using a 'INPUT "Open which file? ", a$' type dialogs to ask a user to find a file. Then the user would have to figure out where the file was by randomly guessing at directories and my program would keep replying "File not found." This was my preferred (and only) method used in my programs until I found a very glitchy and unfinished 'paint' clone that actually had windows style open/save dialogs! I was amazed and I had to know how it worked, but of course there was no source code.

It was probably another year before I finally figured it out, and oddly, I can't remember how or where I found the code. But I know that it involved the SHELL command. I tested it out and I was able to take individual lines from the 'SHELL "dir"' command and put them into a string variable, making it easy to create dialogs with scroll bars and such displaying the directories and files, of course without printing DOS nonsense all over the screen.

Now I have been desperately searching google for the answer and it seems all hope is lost of me ever recalling how it all worked. If anyone has any clue what I'm talking about, please tell me I'm not crazy, because I know it was some method so simple that is probably right under my nose.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

You need to pipe DIR

Post by burger2227 »

SHELL "DIR > Files.txt" for current directory or you need a path. You can later access the text file and it can be used as a string name. You can list them in a program and allow a selection from the files listed.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
joq85
Newbie
Posts: 2
Joined: Tue Mar 25, 2008 8:12 pm
Location: NY

thx

Post by joq85 »

aha! I remember now, thank you burger :D
Post Reply