[futurebasic] Re: VolRefNum Revisited- Homing in

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Sat, 13 Dec 1997 10:43:35 -0600
George wrote:
>  Rick suggested something like this:
> 
> 
> CLEAR LOCAL
> DIM osErr
> DIM useAlias
> DIM RECORD fsSpec
>   DIM fsVrefNum%
>   DIM fsParID&
>   DIM 63 fsName$
> DIM END RECORD .fsSpec
> 
> DIM myFSSpec.fsSpec
> LOCAL FN SeeAboutAQuickOpen
>   
>   osErr=FN useAlias(1003,myFSSpec)
> 
>     % _SFSaveDisk, -myFSSpec.fsVrefNum%
>     & _CurDirStore, myFSSpec.fsParID&
>  
>     But alas, after trying these ideas in as many combinations I could think
> of, the next GetFile is not pointing to the folder in which the original of
> the alias resides.

Here's a strange tale:
I thought surely the above would work, so last night I tried it, and
sure enough, it did work.  So I resolved to reply to your message the
next morning.

The next morning (today), I tried it again "for good measure."  And as
always seems to be the case with such things, this morning it did _not_
work.

So I fiddled around variously, but nothing seemed to help.  No matter
what I put into _SFSaveDisk and _CurDirStore, the program seemed to have
a mind of its own regarding what directory to display on opening the
dialog.

Then I remembered that Apple changed the way this "initial directory"
gets chosen, with the release of OS 7-point-something (I have v7.5).  I
opened the "General Controls" control panel, and found an option that
says this:

  When opening or saving a document, take me to:
  * Folder which contains the application.
  * Last folder used in the application.
  * Documents folder.

(The *'s are radio buttons).  I had "Last folder used in the
application" marked.  So I changed that to "Folder which contains the
application," and closed the control panel.

And whaddya know--now it works!  Now the open & save dialogs use the
directory I've specified in _SFSaveDisk and _CurDirStore as the "initial
directory."

I speculate that the "Folder which contains the application" option
really means: "do it the old-fashioned way."

The "take me to:" option seems to be stored in Parameter RAM somewhere,
but I haven't figured out where yet.

So, here's a possibility: if we can figure out where in PRAM this "take
me to:" option is stored, we can temporarily change it (to "Folder which
contains the application"), and then set _SFSaveDisk and _CurDirStore,
just before opening the open/save dialog.  Then, when the dialog gets
closed, reset the PRAM option back to its original state.

If we _can't_ figure out where in PRAM that option is, then a slightly
less elegant option would be to have users set the option manually using
the "General Controls" control panel.  However, since this is a global
option, it would also affect the way their other app's work as well.

Sound like a promising lead?

- Rick