PDA

View Full Version : Trying to set up a files to install to %userprofile%


tarheels2786
09-21-2007, 12:47 PM
I'm trying to install 2 files to C:\Documents and Settings\william rader\.yajhfc but it cannont be my name william rader. Not everyone has that path on there machine so I need to use %USERPROFILE% so it automatically goes to folder and makes the folder .yajhfc. Everytime I go to install it, it tells me that the folder cannot be created. This is where our online fax machine looks for its settings at and I need help on how to make this work Please Help Me

jassing
09-21-2007, 01:11 PM
where do you define %userprofile%?

tarheels2786
09-21-2007, 01:17 PM
1st I defined it in session variables and %USERPROFILE% is a variable automatically created by windows xp so if i said %yajhfc% and the path is %USERPROFILE%\.yajhfc it should install it to the documents and settings folder under there name correct?

jassing
09-21-2007, 01:22 PM
1st I defined it in session variables and %USERPROFILE% is a variable automatically created by windows xp so if i said %yajhfc% and the path is %USERPROFILE%\.yajhfc it should install it to the documents and settings folder under there name correct?

Environment variables are not the same as session variables.

You would need to read in userprofile from the registry & assign it to a session variable in your "on startup" code or somewhere along the lines.

tarheels2786
09-21-2007, 01:24 PM
How would I Do that then because what i'm trying to do is install the setup files back to the original place where they are installed from the real program which is in c:\documents and settings\william rader\.yajhfc but no all my other employees have my name they use there own logon information can you walk me through step by step.

jassing
09-21-2007, 01:27 PM
you need to read the registry (that's where environment variables are stored) See the Registry. actions
You need to assign that vaule to your %USERPROFILE% Session Variable. See the SessionVar. actions.

tarheels2786
09-21-2007, 01:30 PM
So I have to make a session variable and set my variable to the registry because I already made a session variable. Correct

jassing
09-21-2007, 01:31 PM
So I have to make a session variable and set my variable to the registry because I already made a session variable. Correct

what?

so you already have a SESSIONVARIABLE created called %USERPROFILE%?
This is NOT what you'd see in dos/cmd where you'd say "echo %userprofile%

What is the line that you are using to create your sessionvariable?

tarheels2786
09-21-2007, 01:34 PM
under settings / settings variables in setup factory 7.0 custom its called %yajhfc% and the path is %USERPROFILE%\.yajhfc

jassing
09-21-2007, 01:35 PM
under settings / settings variables in setup factory 7.0 custom its called %yajhfc% and the path is %USERPROFILE%\.yajhfc

so where do you define %USERPROFILE%????

tarheels2786
09-21-2007, 01:36 PM
its just like the %MyDocumentsFolder% i need 1 like that but not all the way to mydocuments i need it to stop right when it goes to your name no further. Walk me through the steps so i can recreated the varable

Adam
09-21-2007, 01:56 PM
Use this code to get that value:


USERPROFILE = Shell.GetFolder(40);
SessionVar.Set("%USERPROFILE%", USERPROFILE);


You will then have the correct variable set

Adam Kapilik

jassing
09-21-2007, 01:56 PM
its just like the %MyDocumentsFolder% i need 1 like that but not all the way to mydocuments i need it to stop right when it goes to your name no further. Walk me through the steps so i can recreated the varable

No, it's not like that -- mydocumentsfolder is a PREDEFINED sessionvar -- userprofile is not.

DO NOT CONFUSE ENVIRONMENT VARIABLES WITH SESSIONVARIABLES!!!

jassing
09-21-2007, 01:57 PM
Use this code to get that value:


USERPROFILE = Shell.GetFolder(40);
SessionVar.Set("%USERPROFILE%", USERPROFILE);


You will then have the correct variable set

Adam Kapilik

Not to mention that he'll need to move his "yggkdk" sessionvar definition out of the sessionvariable section and create it after creating userprofile.

tarheels2786
09-21-2007, 01:58 PM
do I use this under action startup or where do i put this code at? sorry i'm new at this and I have it all done just this one part.

jassing
09-21-2007, 02:03 PM
do I use this under action startup or where do i put this code at? sorry i'm new at this and I have it all done just this one part.

put both of your sessionvar definitions in On Startup

tarheels2786
09-21-2007, 02:06 PM
I Need the folder to be installed then the files need to go inside the folder right now only thing there are the files and I have to create the folder.

jassing
09-21-2007, 02:09 PM
I Need the folder to be installed then the files need to go inside the folder right now only thing there are the files and I have to create the folder.

so -- create the folder, or just install the files, if you install the files to your path, it will create it automatically.

jcuster
09-21-2007, 03:00 PM
Use this code to get that value:


USERPROFILE = Shell.GetFolder(40);
SessionVar.Set("%USERPROFILE%", USERPROFILE);


You will then have the correct variable set

Adam Kapilik


Do you know HOW LONG I've been looking for that code?

jassing
09-21-2007, 07:40 PM
Do you know HOW LONG I've been looking for that code?

A day? you just posted this morning -- not to mention; you didn't tell us that you had no idea how to create a sessionvariable.

Post questions, after you try for a few things, as you have them -- that way you don't get frustrated, and we can focus on singular issues rather than multiple issues at once.

if you had asked "how can I determine the user's profile directory" -- that's part one -- but you started with "the directory isn't being created" -- so the assumption is you've assigned the varaibles already.

Glad you're on the way to creating a successful install!

Regarding your PM to me about the older -- try posting that to the forum -- I really could not understand what your trying to do, what it is doing, and what your problem/question is -- I'm sorry.

-josh

jcuster
09-22-2007, 09:43 AM
A day? you just posted this morning -- not to mention; you didn't tell us that you had no idea how to create a sessionvariable.

Post questions, after you try for a few things, as you have them -- that way you don't get frustrated, and we can focus on singular issues rather than multiple issues at once.

if you had asked "how can I determine the user's profile directory" -- that's part one -- but you started with "the directory isn't being created" -- so the assumption is you've assigned the varaibles already.

Glad you're on the way to creating a successful install!

Regarding your PM to me about the older -- try posting that to the forum -- I really could not understand what your trying to do, what it is doing, and what your problem/question is -- I'm sorry.

-josh

I apoligize for the Miscommunication. I do know how to Create a session Variable but did not Ever see anything that directly refences the UserProfile from Shell.Folder

All the code I have seen is taking the Shell.Folder for something else the strip the last so many characters off.

The SUF Help does not have a technical reference with information like what Adam provided.