[futurebasic] Default Folder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2007 : Group Archive : Group : All Groups

From: David Bailey <dbail@...>
Date: Fri, 14 Sep 2007 11:50:39 -0700
I found the commented part of this routine on an obscure apple-script  
board.  Response from others said it works.

I am not sure if this can be done but I decided to post it to see if  
somebody can figure out the quotes and place to put your application  
name.



David




Dim gAEResponse As Str255
include "Subs AppleScript.INCL"


/*
Found on an obscure applescripting board

Every applet choosing a folder should generate an entry in a plist file
auto-generated, determining the last choosen path. So, the next time  
you run
your app, it will map to such folder.
I think you can alter such preference:

set yourApp to quoted form of "chooseFolder"
set defaultFolder to quoted form of "file://localhost/Users/x/ 
Documents/"
do shell script "defaults write " & yourApp &
" 'AppleNavServices:ChooseFolder:0:Path'" & defaultFolder
choose folder

For a "choose file name" you may write the defaults for
"AppleNavServices:PutFile:0:Path" (untested, but may work)

*/

clear local
dim err
local fn setthedefaultfolder
Route _toAppleScript
print "set FB_Temp to quoted form of chooseFolder""
print "set defaultFolder to quoted form of " + "file://localhost/ 
Users/x/Documents/""
print "do shell script " + "defaults write" + "&" " FB_Temp " + "&"  
+"'AppleNavServices:ChooseFolder:0:Path'" + "& defaultFolder"
print "choose folder"
err = usr AppleScriptRun( gAEResponse )
route _toscreen
print "Applescript Response =",gAeResponse
end fn

window 1,"Default Folder",(80,80)-(700,400)
fn setthedefaultfolder


dim temp$
dim fs as FSSpec

temp$ = files$(_fsspecfolder,"","test",fs)

do
handleevents
until 0