![]() |
DISK I/OForce FILES$ to use a given directory
In response to recent questions about how a program can specify which folder should be initially displayed in an "Open" or "Save" dialog, I have put together a DCOD which does the trick. It works like the FILES$(_fOpen,...) and FILES$(_fSave,...) functions, but has a couple extra parameters which let you specify the initial folder. It works regardless of how the user's preference is set in the "General Controls" control panel.
You can download it from the following location: http://www.incolor.com/rbrown/ware/ChooseFile.sit Rick
Been to the moon and back in a goat's mouth with this one :BR>
Try this...It is Andy's and is on the STAZ site.
CLEAR LOCAL MODE
DIM pBlock.128
DIM Noerr&
LOCAL FN SetFilesFolder(Vref%)
pBlock.ioVRefNum% = Vref%
LONG IF FN GETCATINFO(@pBlock) = _NoErr
& _CurDirStore , pBlock.ioDirID&
pBlock.ioWDProcID& = 0
pBlock.ioWDVRefNum% = 0
LONG IF FN GETWDINFO(@pBlock) = _NoErr
% _SFSaveDisk , - pBlock.ioWDVRefNum%
END IF
NoErr& = FN FLUSHVOL(@pBlock)
END IF
END FN
Please note that this only works with the FB volRefNum% which is really a Working Directory Reference Number. That is OK 99% of the FB time, but I had to have Rick bail me out when I used the PG FN UseAlias which returns a vol% that is not the Working Directory Reference Number. If you need the conversion I can send that also. Sounds like you will just use the SYSTEM(_aplVol) I mention the FN UseAlias as I have had great luck with using alias saved to resources to store the kind of thing you are doing, but when I want the save in say a users folder on a server. Working Directory Reference Number won't work if saved in this instance as it can be different each time the server is mounted.
Also, if you users have system 7.5 + and have set General Settings to Last Folder Used By Application you won't have much luck forcing the Folder for the save and open dialogs. Of course if you can get them there the first time then the above setting will keep them there in subsequent runs of the app... George
|