scripting@wanadoo.nl




AllSpecialFolders()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
13 December 2002 AllSpecialFolders()
AuthorChris S.
Action Dynamically sets variables with the path of all available Windows special folders.
SyntaxAllSpecialFolders () 
Parameters 
RemarksThis function retrieves paths to special folders using the special folder name as the index. A special folder's path depends on the user environment. The information stored in a special folder is unique to the user logged onto the computer system. If several different users have accounts on the same computer system, several different sets of special folders are stored on the hard disk. If the special folder does not exist (e.g. AllUsersPrograms on a Windows 95 computer), then the resulting string will be empty.

The following strings will be created:

$AllUsersDesktop
$AllUsersStartMenu
$AllUsersPrograms
$AllUsersStartup
$AppData
$Desktop
$Favorites
$Fonts
$MyDocuments
$NetHood
$PrintHood
$Programs
$Recent
$SendTo
$StartMenu
$Startup
$Templates 
ReturnsPath to special folder item
@ERROR = 0 : Operation Completed Successfully
@ERROR = 1 : Unable to instantiate WScript.Shell object 
DependenciesKiX 4.02 (or higher)
Windows Scripting Host (WSH) 1.0 (or higher) 
Examples
AllSpecialFolders()

$AllUsersDesktop ?
$AllUsersStartMenu ?
$AllUsersPrograms ?
$AllUsersStartup ?
$AppData ?
$Desktop ?
$Favorites ?
$Fonts ?
$MyDocuments ?
$NetHood ?
$PrintHood ?
$Programs ?
$Recent ?
$SendTo ?
$StartMenu ?
$Startup ?
$Templates ?

 
Source
FUNCTION AllSpecialFolders ()
  DIM $sallfolders, $objwshshell, $folder, $nul
  GLOBAL $allusersdesktop, $allusersstartmenu, $allusersprograms, $allusersstartup,
   $appdata, $desktop, $favorites, $fonts, $mydocuments, $nethood, $printhood,
   $programs, $recent, $sendto, $startmenu, $startup, $templates
  $sallfolders="AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUsersStartup "+
   "AppData Desktop Favorites Fonts MyDocuments NetHood PrintHood Programs Recent "+
   "SendTo StartMenu Startup Templates"
  $objwshshell = CreateObject("WScript.Shell")
  IF @error
    EXIT(1)
  ENDIF
  ;
  FOR EACH $folder IN Split($sallfolders)
    $nul=Execute("$"+$folder+" = $$objWshShell.SpecialFolders($$Folder)")
  NEXT
  $objwshshell=''
  EXIT(0)
ENDFUNCTION ; - AllSpecialFolders -
 
  original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
          printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


Site Meter