SysGetSpecialFolderLocation

From kwiki

Jump to: navigation, search
This article is written by Konrad, thus using rather nonstandard English:)

SysGetSpecialFolderLocation (DNM Script function)

Contents

full declaration

string SysGetSpecialFolderLocation (int nEnum)

return value

string

description

Returns a special directory (like a desktop folder, user documents folder), specified by nEnum.

nEnum may be one of the following:


CSIDL_INTERNET                        // Internet Explorer (icon on desktop)
CSIDL_PROGRAMS                        // Start Menu\Programs
CSIDL_CONTROLS                        // My Computer\Control Panel
CSIDL_PRINTERS                        // My Computer\Printers
CSIDL_PERSONAL                        // My Documents
CSIDL_FAVORITES                       // <user name>\Favorites
CSIDL_STARTUP                         // Start Menu\Programs\Startup
CSIDL_RECENT                          // <user name>\Recent
CSIDL_SENDTO                          // <user name>\SendTo
CSIDL_BITBUCKET                       // <desktop>\Recycle Bin
CSIDL_STARTMENU                       // <user name>\Start Menu
CSIDL_MYDOCUMENTS                     // logical "My Documents" desktop icon
CSIDL_MYMUSIC                         // "My Music" folder
CSIDL_MYVIDEO                         // "My Videos" folder
CSIDL_DESKTOPDIRECTORY                // <user name>\Desktop
CSIDL_DRIVES                          // My Computer
CSIDL_NETWORK                         // Network Neighborhood (My Network Places)
CSIDL_NETHOOD                         // <user name>\nethood
CSIDL_FONTS                           // windows\fonts
CSIDL_TEMPLATES                 
CSIDL_COMMON_STARTMENU                // All Users\Start Menu
CSIDL_COMMON_PROGRAMS                 // All Users\Start Menu\Programs
CSIDL_COMMON_STARTUP                  // All Users\Startup
CSIDL_COMMON_DESKTOPDIRECTORY         // All Users\Desktop
CSIDL_APPDATA                         // <user name>\Application Data
CSIDL_PRINTHOOD                       // <user name>\PrintHood


CSIDL_LOCAL_APPDATA                    // <user name>\Local Settings\Applicaiton Data (non roaming)


CSIDL_ALTSTARTUP                       // non localized startup
CSIDL_COMMON_ALTSTARTUP                // non localized common startup
CSIDL_COMMON_FAVORITES          


CSIDL_INTERNET_CACHE            
CSIDL_COOKIES                   
CSIDL_HISTORY                   
CSIDL_COMMON_APPDATA                   // All Users\Application Data
CSIDL_WINDOWS                          // GetWindowsDirectory()
CSIDL_SYSTEM                           // GetSystemDirectory()
CSIDL_PROGRAM_FILES                    // C:\Program Files
CSIDL_MYPICTURES                       // C:\Program Files\My Pictures


CSIDL_PROFILE                          // USERPROFILE


CSIDL_PROGRAM_FILES_COMMON             // C:\Program Files\Common


CSIDL_PROGRAM_FILES_COMMONX86          // x86 Program Files\Common on RISC
CSIDL_COMMON_TEMPLATES                 // All Users\Templates


CSIDL_COMMON_DOCUMENTS                 // All Users\Documents

CSIDL_CONNECTIONS                      // Network and Dial-up Connections
CSIDL_COMMON_MUSIC                     // All Users\My Music
CSIDL_COMMON_PICTURES                  // All Users\My Pictures
CSIDL_COMMON_VIDEO                     // All Users\My Video
CSIDL_RESOURCES      

Examples

 //let's get documents and settings/current user/start menu folder
 $s=SysGetSpecialFolderLocation(CSIDL_STARTMENU);
 MessageBox($s);

 //documents and settings/current user/start menu/programs folder
 $s=SysGetSpecialFolderLocation(CSIDL_PROGRAMS);
 MessageBox($s);

 //documents and settings/current user/desktop folder
 $s=SysGetSpecialFolderLocation(CSIDL_DESKTOPDIRECTORY);
 MessageBox($s);

 //documents and settings/current user/my documents folder
 $s=SysGetSpecialFolderLocation(CSIDL_PERSONAL);
 MessageBox($s);

 //documents and settings/all users/start menu folder
 $s=SysGetSpecialFolderLocation(CSIDL_COMMON_STARTMENU);
 MessageBox($s);

 //let's create a text file in current user/desktop
 $s=SysGetSpecialFolderLocation(CSIDL_DESKTOPDIRECTORY);
 var $sTextFilePath=UrlJoin($s,"example text file.txt");
 TextFileSave($sTextFilePath,"Hello world!");
 MessageBox("File created:"+$sTextFilePath);


keywords: get special folder location get retrieve directory desktop settings start menu profile
Personal tools
konradp.com