PDA

View Full Version : Predefined Folders w/ Installscript proj??



ChrisA
02-26-2008, 02:42 PM
I have two Installscript projects. I need to add a file to the user's "My Documents" folder. When I right-click "Destination Computer" to select "Show Predefined Folders" it is grayed out.

Are "Predefined Folders" not available for Installscript projects? If they are available, what would cause the graying out? If not available in Installscript projects, what's the best way to get something into "My Documents"??

-- Thanks

MarkEarle
02-27-2008, 02:41 PM
Chris,

If the predefined variables are not available you can get to "My Documents" by querying the environment variable USERPROFILE and append "My Documents" to the returned path.


if( GetEnvVar( "USERPROFILE", svProfilePath ) < 0 ) then
Sprintf( svMsg, @MSG_FIND_ENVVAR_FAIL, "USERPROFILE" );
MessageBox( svMsg, SEVERE );
abort;
else
svDocPath = svProfilePath ^ "My Documents";
endif;

This will work for English systems only. You will have to get "My Documents" translated for globalized installations.

Cheers,

ME

ChrisA
02-27-2008, 05:49 PM
ME,
I think it's possible for My Docs to be somewhere besides under UserProfile (though I'm not sure). But I also have to deal with different languages. I guess I need to try to call into the ShFolder dll.

I was hoping someone might explain why InstallShield doesn't show "Predefined Folders" for Installscript projects.

Thanks - Chris

MarkEarle
02-27-2008, 06:30 PM
Chris,

You are correct, My Documents can be anywhere. I don't know why predefined shell folders are not shown in InstallScript projects however you can find them in the registry easy enough without any issues with OS language. They are located at HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders.

The variable Personal contains the path to My Documents.

Hope someone from Macrovision can answer your question.

Cheers,

ME