/build/static/layout/Breadcrumb_cap_w.png

Using AppDataFolder

I know this is a stupid question, but I just don't know what I'm doing wrong. I want to put files into the %USERPROFILE%\Application Data\Microsoft\Word\Startup folder, and I thought the best way is to use the AppDataFolder property.

So I'm using InstallShield, I goto Files and Folders and I add a new folder called AppDataFolder (also tried [AppDataFolder]), but both of these result in the folder structure created under C:\. What am doing wrong??

Please help me correct the error of my ways,
Johan

0 Comments   [ + ] Show comments

Answers (16)

Posted by: wiseapp 17 years ago
Second Degree Green Belt
0
Hi Johan:

Have you also tried LocalAppDataFolder property?
Posted by: JohanE 17 years ago
Senior Yellow Belt
0
Yes I've tried LocalAppDataFolder. When I checked it for ICE errors, I got a few 38's and 91's, so I'm guessing it has something to do with linking it to a HKCU key??
Posted by: wiseapp 17 years ago
Second Degree Green Belt
0
Hi Johnan:

I am not aware how you set the InstallDir property but by just typing in the folder structure it won't help, do the following

1. Create the folder structure with [AppDataFolder]Test\Abc
2. Write a custom action(Call VbScript from embedded code) that would change the Installdir before the installation starts
3. The following should be the code in the script
Dim strInstall
strInstall=Session.property("AppDataFolder")
Session.Property("INSTALLDIR") = strInstall
4. Sequence this custom action right after FindRelatedProducts action (in Installshield) and in Wise Right after MigrateFeatureStates Action in the UI tab...
5. Put a condition on this custom action Not REMOVE~="All" or Not Installed so that it runs only on installation and not uninstall action.
6. Compile your MSI and see whether this works or not?

What I can feel is you set the appdatafolder in folder structure but at runtime InstallDir changes its value to the original value therefore it does not create the folder in AppDataFolder...Try this and revert back..
Posted by: gmorgan618 17 years ago
Blue Belt
0
I believe LocalAppDataFolder and AppDataFolder Properties are for Windows Installer 4.0 only...

You are running the installer on Windows Vista right?
Posted by: nheim 17 years ago
10th Degree Black Belt
0
Hi Johan,
did you check the log file?
This system folders should be resolved automatically, very early in the installation process.
Do you have a line, which looks something like this:
MSI (c) (F8:30) [18:15:53:301]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\Profilename\Application Data

If yes, search through the log for 'AppDataFolder' and look, if its being changed somewhere.

Do you have the line TARGETDIR=SourceDir in the Directory table?

@Grant: This systemfolder resolving has been there for a long time, at least from Ver 2.0 onward.
Although, they have been changed significantly again for Vista.

Regards, Nick
Posted by: gmorgan618 17 years ago
Blue Belt
0
Nick,

I actually thought I recognized this property also...

but when I checked the Installer reference on MSDN... It states a requirement of Installer 4.0 or later on Vista...

http://msdn2.microsoft.com/en-us/library/aa367565.aspx

Maybe MS screwed up their information...

---------------------------

JohanE...

Check your directory table, maybe the value is getting changed there.

Just a thought
Posted by: nheim 17 years ago
10th Degree Black Belt
0
Hi Grant,
typical SDK jargon: "Beginning with Windows Vista, applications should use the SHGetKnownFolderPath function and the REFKNOWNFOLDERID type to determine the full path to this folder. Existing applications that use the SHGetFolderPath function and the CSIDL type will continue to work."
The problem here is, that the first sentence refers to Vista, because 'SHGetKnownFolderPath' is the new API class to call in Vista. It supersedes 'SHGetFolderPath' which is used up to XP for this purpose.
Hope this clarifies this.
Regards, Nick
Posted by: JohanE 17 years ago
Senior Yellow Belt
0
Thanks for all your help, I couldn't get any of the suggestions to work properly (my fault no doubt), so I ended up writing a quick VB script and added it to Custom Actions.


On Error Resume Next

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")

AppData = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\AppData"
AppDataPath = WshShell.RegRead (AppData)

If oFSO.FileExists ("C:\Program Files\EndNote X\EN10CWYW.dot") And oFSO.FolderExists (AppDataPath & "\Microsoft\Word\STARTUP\") Then
'WScript.Echo AppDataPath & "\Microsoft\Word\STARTUP\"
oFSO.DeleteFile (AppDataPath & "\Microsoft\Word\STARTUP\En*.wll") 'Delete previous EndNote Templates
oFSO.DeleteFile (AppDataPath & "\Microsoft\Word\STARTUP\En*.dot") 'Delete previous EndNote Templates
oFSO.CopyFile "C:\Program Files\EndNote X\EN10CWYW.dot", AppDataPath & "\Microsoft\Word\STARTUP\"
oFSO.CopyFile "C:\Program Files\EndNote X\EN10Cwyw.wll", AppDataPath & "\Microsoft\Word\STARTUP\"
oFSO.CopyFile "C:\Program Files\EndNote X\EN10Cwyw.WordXP.wll", AppDataPath & "\Microsoft\Word\STARTUP\"
oFSO.CopyFile "C:\Program Files\EndNote X\ENWebCwyw.dot", AppDataPath & "\Microsoft\Word\STARTUP\"
End If

Set oFSO = Nothing
Set WshShell = Nothing
WScript.Quit

I don't really know about writing scripts and adding to MSI's, so is this a problem how I've written it. Also I added it after Cost Finalize in a binary??

Thanks for all your help thus far.

Cheers,
Johan
Posted by: jmcfadyen 17 years ago
5th Degree Black Belt
0
you can also try this

session.targetpath = "d:\xxxxx\"
Posted by: JohanE 17 years ago
Senior Yellow Belt
0
Is there a way to debug code within InstallShield 12 for an individual custom action script?
Posted by: wiseapp 17 years ago
Second Degree Green Belt
0
What error does it gives you when you include it to the MSI? and try to include in the end after InstallFinalise action if you want this script to run in the end....I hope this would help you...
Posted by: JohanE 17 years ago
Senior Yellow Belt
0
I've been looking throught the posts on appdeploy and other sites and I'm pretty sure the way I'm doing this is all wrong. I really should be using self healing so that it installs the missing files for all users folders.

I checked out the most excellend post of http://itninja.com/question/how-do-you-roll-out-new-machines?4146&mpage=1&key=active%2Csetup, but I have a question.

How do I put a component into a certain feature?

I'm sorry if these are annoyingly easy questions, is there perhaps a good reference anyone can recommend I can look at.

Many Thanks,
Johan
Posted by: AngelD 17 years ago
Red Belt
0
You connect a component to a feature using the FeatureComponents table.

Having the SDK help-file (MSI.CHM) beside you helps ;)
Posted by: nheim 17 years ago
10th Degree Black Belt
0
Hi Johan,
why didn't you tell us, that you are playing around with Endnote?
That would have made things a lot easier. This is a perfect Task for Active Setup!
Do the following:
Open ENX.MSI in ORCA
Choose a new transform.
Change the following line in the 'Component table':
CurrentUser {8E5C9AD2-8766-44E2-9560-3AEE0CE0DFEA} TARGETDIR 4 registry48 <-- change this!

Add the following lines to the 'Registry table':
RegHKLM3 2 SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode] [ProductName] User Setup EndNote.exe
RegHKLM2 2 SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode] Version 10,0 EndNote.exe
RegHKLM1 2 SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode] Stubpath msiexec /i [ProductCode] REINSTALL=Complete REINSTALLMODE=up /qn EndNote.exe

That' it.

Regards, Nick
Posted by: JohanE 17 years ago
Senior Yellow Belt
0
Nick:

It probably would have saved a lot of hassle if I told you the app name, I guess I'd prefer to learn why things work so I can apply the knowledge further down the track. Regarding your step-by-step instructions, I've tried to follow what you've written, but I'm a little confused about where registry48 is suppose to go. Is it a keypath?

Also since people hotdesk a fair bit, and are using different versions of EndNote (mainly 7 & 9), what would be the best way to delete previous add-ins for the user, without uninstalling the programs?

Kim:

Thanks for the helpfull hint :)

Bhupesh, John & Greg:

Thanks for giving me some great food for thought.

Cheers,
Johan
Posted by: nheim 17 years ago
10th Degree Black Belt
0
Hi Johan,
yes, it is the keypath for that component.
Good attitude about to find out how things work.
You don't need to care about the previous addins, because Thomson uses a Custom Action (i think, its 'RSInstallFinalize') to copy this stuff to the users profile and also delete the older ones (AFAIK).
You can see this, if you install it unaltered and have older addins in the profile of the installing admin user.
If you change the keypath of the 'CurrentUser' component to registry key in the profile, it's being checked each time EN is started trough a entry point.
You can try to change just this key, install it and see what happens. You get of course no Word addins, but if you start EN with the start shortcut, it should begin to repair.
Now if your current user has admin rights and the source (ENX.msi) is available, it should repair just fine, but if the user has standard rights, you will get all kinds of errors,
because the self heal goes through the hole MSI and tries to reinstall a lot more than needed.
Here Active Setup comes into play and we reinstall proactive the user profile registry settings and missing files. This does the trick.

But you could easily achieve similar results be doing this only with self healing.
Read this post from John McFadyen carefully:
http://itninja.com/question/how-do-you-roll-out-new-machines?4146&mpage=1&key=active%2Csetup幺

You would then go to the 'FeatureComponents' table and move two component to different features:
Sort the table for component column and search for the 'Endnote.exe' component. You can see that this component belongs to the two features 'Complete' and 'Program_Program'
Don't know what this should be good for, its enough, that this component is called once through the 'Program_Program' feature.
Delete the line which links 'Complete' and 'Endnote.exe'
Search for the 'CurrentUser' component and change the feature to 'Complete'.
This should repair the app smoothly, even as a standard user, as soon as you start it from the shortcut (although, i have not tested this).

I decided to use Active Setup to do the profile install, because the most of the users will start EN through Word. With self healing, the users would not have the EN entries in Word and therefore would think that the app wasn't installed complete. So the proactive approach of AS suits this situation better.

This got way to long, but hope it helps a bit to understand, how this changes materialized.
Regards, Nick
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ