| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Nov 08, 2007 11:04 pm Post subject: Does "INFO @windir(Common AppData)" work for you? |
|
|
Say, does anyone get an error or data returned when using the following with VDS 5.x
INFO @windir(Common AppData) _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
trapper Contributor


Joined: 28 Jan 2005 Posts: 112 Location: Brisbane, Australia
|
Posted: Fri Nov 09, 2007 2:54 am Post subject: |
|
|
I've never heard of 'Common AppData'.
Try the following to see what parameters to the @windir() function are available: | Code: | list create, 1
list regvals,1,HCU,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
info @text(1) |
_________________ John Trappett |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Nov 09, 2007 11:32 am Post subject: |
|
|
Garrett,
You may be better off using an API function to get the paths to the special
system folders.
| Code: | SHGetSpecialFolderPath(
HWND hwndOwner, // window for displaying message boxes on error
LPTSTR lpszPath, // address of buffer to recieve path. Must be atleast 260 chars in size
int nFolder, // CSIDL of special folder of interest
BOOL fCreate // if TRUE, the folder will be created if it doesn't exist
); |
is the API to use for getting special system paths. This API is defined in the
shlobj.h header file and is in the Shell32.dll for systems other than
Windows 2000, where it's in the shlwapi.dll.
The CSIDL value (int nFolder) for Common AppData is -> 35.
HWND hwndOwner can be set to NULL. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Nov 09, 2007 2:50 pm Post subject: |
|
|
Garrett,
Try this code.
| Code: |
#-----------------------------------------------------------------------------#
# #
# A user defined function showing how to get a special folder path #
# #
# Author: Johnny Kinsey #
# #
# Copyright: Copyright © 2007 DragonSphere Software #
# #
#-----------------------------------------------------------------------------#
#DEFINE FUNCTION,GETSPECIALFOLDER
Title Get Special Folders
Info @GetSpecialFolder(PERSONAL)@cr()@GetSpecialFolder(APPDATA)@cr()
# Will only work with XP and above.
%%CDBURN_AREA = @GetSpecialFolder(CDBURN_AREA)
If @Null(%%CDBURN_AREA)
%A = @Ask(Would you like me to create a CDBURN AREA Folder?)
If %A
Info @GetSpecialFolder(CDBURN_AREA,1)@cr()
End
End
Exit
:GetSpecialFolder
%R =
LoadLib shell32.dll
LoadLib user32.dll
%S = 2
# *** Define Special Folder Constants
If @Equal(%1,PROGRAMS)
#Program Groups Folder
%S = 2
ElsIf @Equal(%1,PERSONAL)
#Personal Documents Folder
%S = 5
ElsIf @Equal(%1,FAVORITES)
#Favorites Folder
%S = 6
ElsIf @Equal(%1,STARTUP)
#Startup Group Folder
%S = 7
ElsIf @Equal(%1,RECENT)
#Recently Used Documents Folder
%S = 8
ElsIf @Equal(%1,SENDTO)
#Send To Folder
%S = 9
ElsIf @Equal(%1,STARTMENU)
#Start Menu Folder
%S = 11
ElsIf @Equal(%1,MYDOCUMENTS)
#My Documents folder
%S = 12
ElsIf @Equal(%1,MYMUSIC)
#My Music folder
%S = 13
ElsIf @Equal(%1,MYVIDEO)
#My Video folder
%S = 14
ElsIf @Equal(%1,DESKTOPDIRECTORY)
#Desktop Folder
%S = 16
ElsIf @Equal(%1,NETHOOD)
#Network Neighborhood Folder
%S = 19
ElsIf @Equal(%1,TEMPLATES)
#Document Templates Folder
%S = 21
ElsIf @Equal(%1,COMMON_STARTMENU)
#Common Start Menu Folder
%S = 22
ElsIf @Equal(%1,COMMON_PROGRAMS)
#Common Program Groups Folder
%S = 23
ElsIf @Equal(%1,COMMON_STARTUP)
#Common Startup Group Folder
%S = 24
ElsIf @Equal(%1,COMMON_DESKTOPDIRECTORY)
#Common Desktop Folder
%S = 25
ElsIf @Equal(%1,APPDATA)
#Application Data Folder
%S = 26
ElsIf @Equal(%1,PRINTHOOD)
#Printers Folder
%S = 27
ElsIf @Equal(%1,COMMON_FAVORITES)
#Common Favorites Folder
%S = 31
ElsIf @Equal(%1,INTERNET_CACHE)
#Temporary Internet Files Folder
%S = 32
ElsIf @Equal(%1,COOKIES)
#Cookies Folder
%S = 33
ElsIf @Equal(%1,HISTORY)
#History Folder
%S = 34
ElsIf @Equal(%1,COMMON_APPDATA)
#Common Application Data Folder
%S = 35
ElsIf @Equal(%1,WINDOWS)
# Windows folder
%S = 36
ElsIf @Equal(%1,SYSTEM)
# System folder
%S = 37
ElsIf @Equal(%1,PROGRAM_FILES)
# Program Files folder
%S = 38
ElsIf @Equal(%1,MYPICTURES)
# My Pictures folder
%S = 39
ElsIf @Equal(%1,PROFILE)
#Profiles folder
%S = 40
ElsIf @Equal(%1,SYSTEMX86)
#System folder on the X86 platform
%S = 41
ElsIf @Equal(%1,PROGRAM_FILESX86)
#Program Files folder on the X86 platform
%S = 42
ElsIf @Equal(%1,PROGRAM_FILES_COMMON)
#Common Program Files folder
%S = 43
ElsIf @Equal(%1,PROGRAM_FILES_COMMONX86)
#Common Program Files folder on the X86 folder
%S = 44
ElsIf @Equal(%1,COMMON_TEMPLATES)
#Common templates folder
%S = 45
ElsIf @Equal(%1,COMMON_DOCUMENTS)
#Common My Documents folder
%S = 46
ElsIf @Equal(%1,COMMON_ADMINTOOLS)
#Common Admin Tools folder
%S = 47
ElsIf @Equal(%1,ADMINTOOLS)
#Admin Tools folder
%S = 48
ElsIf @Equal(%1,CONNECTIONS)
#Connections folder
%S = 49
ElsIf @Equal(%1,COMMON_MUSIC)
#Common My Music folder
%S = 53
ElsIf @Equal(%1,COMMON_PICTURES)
#Common My Pictures folder
%S = 54
ElsIf @Equal(%1,COMMON_VIDEO)
#Common Video folder
%S = 55
ElsIf @Equal(%1,CDBURN_AREA)
#CDBurn Area folder
%S = 59
Else
If %1
%S = %1
End
End
%A = @fill(4096,,Z)
If %2
%2 = 1
Else
%2 =
End
%Z = @lib(shell32,SHGetSpecialFolderPathA,BOOL,INT:@lib(user32,GetDesktopWindow,INT),INT:@addr("%A"),INT:%S,BOOL:%2)
If %Z
%R = @Trim(%A)
End
FreeLib Shell32
FreeLib user32
Exit %R
|
Sorry Bill but this is VDS not C
Hey Garrett I thought you stopped using VDS Hmmm looks like VDS 6 demos
Updated to correctly handle the option to create the folder if it does not exist. _________________ Home of
Give VDS a new purpose!

Last edited by vdsalchemist on Fri Nov 09, 2007 10:41 pm; edited 1 time in total |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Nov 09, 2007 3:39 pm Post subject: |
|
|
BTW normally in C or C++ I use the function SHGetSpecialFolderLocation and extract the location from the PIDL with SHGetPathFromIDList. This way I can also get Virtual folders that are not file system folders. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Fri Nov 09, 2007 7:58 pm Post subject: |
|
|
Well I'm using the registry at the moment to get the path, it's under Local Machine, but I thought the VDS function would get this also, but seems not.
I'd prefer not to read from the registry at all, but rather use an api and let the OS itself bang it's head on getting the info.
And no, nothing to do with VDS 6, not any demo, and I didn't even beta test VDS 6. I'm simply converting some of my older VDS code to compensate for Vista, so need to move ini files and such into the Application Data folders. But in this case, I needed it to be available for all users and not just the current user, which is what @windir(AppData) will get you.
Such as this screensaver I've been sitting on since like 2003 here...
http://www.paraboliclogic.com/programs/pixelateddreams/
Now i've updated it to use the "\All Users\Application Data" so that all users on a single machine will have access to my screensaver without any issues, except that if they change the settings, then all users have to deal with it.. LOL Oh well.
Anyway, thanks everyone for the suggestions/ideas. Much appreciated.
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Nov 09, 2007 8:07 pm Post subject: |
|
|
| dragonsphere wrote: | Sorry Bill but this is VDS not C |
Johnny,
Since I'm not a registered VDS 5 user, I'd didn't figure it appropriate to
post code to accomplish this task. However, if you hadn't and I was asked
for an example of usage, I would have. Your function does however simplify
things for everyone else , ie; no searching for CSIDL values. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Nov 09, 2007 10:04 pm Post subject: |
|
|
| Garrett wrote: | Well I'm using the registry at the moment to get the path, it's under Local Machine, but I thought the VDS function would get this also, but seems not.
I'd prefer not to read from the registry at all, but rather use an api and let the OS itself bang it's head on getting the info.
|
Garrett,
Didn't you see my code above? You don't need to use the registry at all. I wrote the code to use the API. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Nov 09, 2007 10:43 pm Post subject: |
|
|
Hi All,
I have updated the code above to handle creating the requested folder if it does not exist. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Nov 10, 2007 3:52 am Post subject: |
|
|
dragonsphere, yeah, sorry, I meant to say thanks for that... Thanks  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Nov 10, 2007 3:54 am Post subject: |
|
|
On the note about XP and above, is that just for the CD Burn section, or all the code? _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Nov 10, 2007 11:38 pm Post subject: |
|
|
Garrett,
Some of these directories are only found on newer versions of Windows and CDBURN is one of them. I am pretty sure the code will work on any version of Windows if it has IE 5+ installed. I just have not tested it on other versions of Windows. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|