local tFolder
put field myFolder into tFolder
Answer tFolder -- shows my default folder from myFolder field
if tFolder is NOT blank then
set the defaultFolder to tFolder - Not working like I want it to
end if
answer folder "Please choose the folder you want to work with:"

Last edited by BarrySumpter on Mon May 09, 2011 1:27 pm, edited 2 times in total.

See 'defaultFolder in the LiveCode dictionary.... and a snippet from the 'defaultFolder' entry... 'When a LiveCode application starts up, the defaultFolder initially contains whatever the working directory was at the time the application was launched. Typically this is the folder that the application resides in, however this is not always the case and shouldn't be relied on. It is best always to set the defaultFolder before using relative paths.'

So, for example... the script below will set the 'defaultFolder' to be wherever it is you have placed your stack on your hard drive.

according to Murphys law the defaultfolder will change when you least exspect it!
Or just call it "personal preference based on long time experience"

And when you can set the defaultfolder to "Harry*'s Boojums" then you know where to find this folder and can
do "regular" actions with that folder like using it as a parameter for "answer folder...".
Know what I mean?

Really starting to like LiveCode.
And geting used to the language structure.

Doco is a bit light though.

That specialFolderPath object is rich!
But still missing the application path.
(unless I missed it.)

Use the specialFolderPath function to place preferences in the Preferences folder, save files to the Documents folder, find out which files are installed in the System or Fonts folders, and so on.

Parameters:
The folderIdentifier is one of the following:

For Mac OS systems:
Desktop: The Desktop folder, where files or folders on the desktop are placed
System: The active System Folder
Apple: The Apple Menu Items folder inside the System Folder
Control: The Control Panels folder inside the System Folder
Extension: The Extensions folder inside the System Folder
Fonts: The Fonts folder inside the System Folder
Preferences: The Preferences folder inside the System Folder
Temporary: For storage of temporary files

For OS X systems:
Home: The current user's home directory (e.g. "/Users/Fred")
Desktop: The user's Desktop folder
System: The active System Folder
Fonts: The system Fonts folder
Preferences: The Preferences folder inside the user's Library folder
Temporary: For storage of temporary files
Documents: For user documents

Note: Some special folder constants are meaningful only on Mac OS or only on OS X but not both. Not all special folder constants work on all system versions.

For Windows systems:
Home : The current user's home directory (e.g. "C:/Documents and Settings/Fred")
Desktop: For icons on the desktop
System: For system components
Start: For items in the Start menu
Documents: For user documents
Fonts: For font storage
Temporary: For storage of temporary files

Note: Not all CSIDL numbers work on all Windows versions, refer to the link above to find out more about CSIDLs.

For Unix systems:
Home: The current user's home directory (e.g. "/home/fred")
Desktop: The current user's desktop (e.g. "/home/fred/Desktop")
Temporary: For storage of temporary files (typically "/tmp")

Value:
The specialFolderPath function returns a folder name and location.

Comments:
If the folder is not found, the specialFolderPath function returns empty. If the folderIdentifier is either not supported on the current platform or doesn't exist on the current system, the result is set to "folder not found".
Some of the special folders you can specify with the specialFolderPath function need not have the standard names. (For example, the System Folder on Mac OS systems is not necessarily named "System Folder".) For this reason, the specialFolderPath function returns the full path to the folder, including the name of the folder.

Or me, not that I was either bored or an admin... I spent a little while investigating this, as in fact 0x0a is 10 in base 10 and as Ken Ray's page shows, no folder for CSIDL value 10 is applicable. specialFolderPath (10) will not return a value. This is understandable as the recycle bin is a virtual folder. CSIDL_BITBUCKET will not resolve to anything unless you hook directly into KNOWNFOLDERID calls. (Actually not even then.)