Getting file in run-time-name-generated folder
Hi all!
I have a vendor MSI to a program. The only configuration I´m suppose to do is to set the language to swedish. I located the setting to a file in %appdatafolder%. The issue is that the folder creates at run time and the name of the folder is different from computer to computer. From installation to installation.
Does anyone have any suggestion how to solve this issue? The only idea I can think of is to create a script that starts the program and after that looks for the folder (I know the name of the parent folder) and copies the configuration file. But then the user has to start the program all over again, or he/she might configure the program and write over the configfile etc ...
I barely know any scripting either with is a bummer. I can copy a file etc in vbscript. Apart from that I just google for scripts and slightly modify them.
I have a vendor MSI to a program. The only configuration I´m suppose to do is to set the language to swedish. I located the setting to a file in %appdatafolder%. The issue is that the folder creates at run time and the name of the folder is different from computer to computer. From installation to installation.
Does anyone have any suggestion how to solve this issue? The only idea I can think of is to create a script that starts the program and after that looks for the folder (I know the name of the parent folder) and copies the configuration file. But then the user has to start the program all over again, or he/she might configure the program and write over the configfile etc ...
I barely know any scripting either with is a bummer. I can copy a file etc in vbscript. Apart from that I just google for scripts and slightly modify them.
0 Comments
[ + ] Show comments
Answers (16)
Please log in to answer
Posted by:
jmaclaurin
13 years ago
I would check the property table in the MSI and see if there is a way to specify the language. I'd also look to see if there is an Active Setup that is used to manage the language. If not, you could make one. You will need to find a way to identify the random name of the target folder which I would guess is set in the registry or maybe an enviromental variable.
Posted by:
Agathorn
13 years ago
Just an update on this:
I have checked and checked again and there were no apparent way to set the language. Nor to set the com-port to be used (which were another request by the application owner all of a sudden). I saw that the foldername under appdatafolder were actually the same from installation to installation. The problem was that if I created this folder in an .MST file the installer would just create another folder with a different name and use that instead. I have sniffed with filemon and regmon and recorded the startup of the application with InstallShield but I´m unable to spot any file that has a record of "the folder in appdata is already created, dont create it again".
BUT I saw a configurationfile in the programfilesfolder that was a template for the individual user settings so it worked out, finally! And thas was after having consulted the vendor about the error two times. But all they said were: "There is no way to configure user settings automatically". Humm, yeah, right ...
I have checked and checked again and there were no apparent way to set the language. Nor to set the com-port to be used (which were another request by the application owner all of a sudden). I saw that the foldername under appdatafolder were actually the same from installation to installation. The problem was that if I created this folder in an .MST file the installer would just create another folder with a different name and use that instead. I have sniffed with filemon and regmon and recorded the startup of the application with InstallShield but I´m unable to spot any file that has a record of "the folder in appdata is already created, dont create it again".
BUT I saw a configurationfile in the programfilesfolder that was a template for the individual user settings so it worked out, finally! And thas was after having consulted the vendor about the error two times. But all they said were: "There is no way to configure user settings automatically". Humm, yeah, right ...
Posted by:
pjgeutjens
13 years ago
David,
once that random named folder is created in AppData, could you recognise it in a script as the one that you would need to put the data? I could imagine putting a script in the HKCU Run key, checking if that folder has been created, if so, putting the settings file in place and removing said RUN key so the script doesn't run again for that user.
PJ
once that random named folder is created in AppData, could you recognise it in a script as the one that you would need to put the data? I could imagine putting a script in the HKCU Run key, checking if that folder has been created, if so, putting the settings file in place and removing said RUN key so the script doesn't run again for that user.
PJ
Posted by:
Agathorn
13 years ago
Posted by:
pjgeutjens
13 years ago
What I meant was, once that folder has been created, after the initial installation, would it be possible to recognise some structure in the naming? Say the folders all started with the same sequence of characters...
You could then write a vbs that you would run every time a user logs on basically containing the following checks:
1) has the settings folder been created after the user runs the program first time?
2) if no, stop -> let the script run again next time
3) if yes, put the settings file in place and delete the RUN key for that user, so the script does not run anymore.
This would mean the settings-propagation would only be done after a logoff-logon for the user once the folder has been created.
Hope you catch my drift,
PJ
You could then write a vbs that you would run every time a user logs on basically containing the following checks:
1) has the settings folder been created after the user runs the program first time?
2) if no, stop -> let the script run again next time
3) if yes, put the settings file in place and delete the RUN key for that user, so the script does not run anymore.
This would mean the settings-propagation would only be done after a logoff-logon for the user once the folder has been created.
Hope you catch my drift,
PJ
Posted by:
Agathorn
13 years ago
Posted by:
pjgeutjens
13 years ago
Posted by:
Agathorn
13 years ago
Maybe a stupid question but how could I, at launch-time, copy the settingsfile? If that is what you are suggesting. I guess, in theory, it could work to:
1. Click the shortcut of the application
2. Fast as **** copy the settings-file to the generated folder (somehow)
3. Hoping that the settings are in affect within the application.
I just don´t know how this would be achieved.
(Once again, the problem is solved by the system wide settings-file I found. So this is just to "interresting" from now on, hehe)
1. Click the shortcut of the application
2. Fast as **** copy the settings-file to the generated folder (somehow)
3. Hoping that the settings are in affect within the application.
I just don´t know how this would be achieved.
(Once again, the problem is solved by the system wide settings-file I found. So this is just to "interresting" from now on, hehe)
Posted by:
pjgeutjens
13 years ago
My idea was to use a mechanism outside of the startup, to wait untill after this folder has been created and then copy in the settings file. By running a script every time the user logs in that, if it finds that this folder has been created since the last logoff-logon, copies in the settings. Problem with any MSI related intervention (like self-heal or so) is that it would happen BEFORE the application logic kicks in, hence before said folder is created.
Would it be an option to track down the settings file that was created by the app and then to make the necessary changes to the text inside it, instead of completely overwriting it, or does this result in the same behavior where it's simply ignored? Anyway, moot discussion if there's a system-wide settings file, since this is undoubtedly the basis for the individual ones for the users.
PJ
Would it be an option to track down the settings file that was created by the app and then to make the necessary changes to the text inside it, instead of completely overwriting it, or does this result in the same behavior where it's simply ignored? Anyway, moot discussion if there's a system-wide settings file, since this is undoubtedly the basis for the individual ones for the users.
PJ
Posted by:
Agathorn
13 years ago
Posted by:
pjgeutjens
13 years ago
how about creating a wrapper around the exe that - and this is off the top of my head -
1) launches the application
2) waits for abit and checks for the folder
3) kills the application
4) updates the settings
(5) maybe sets a check in the registry so this operation does not get done unnecessary once it's successfull.
6) relaunches the application
This is kinda quick&dirty, but the best I can come up with right now
PJ
1) launches the application
2) waits for abit and checks for the folder
3) kills the application
4) updates the settings
(5) maybe sets a check in the registry so this operation does not get done unnecessary once it's successfull.
6) relaunches the application
This is kinda quick&dirty, but the best I can come up with right now
PJ
Posted by:
Agathorn
13 years ago
Posted by:
itolutions
13 years ago
ORIGINAL: Agathorn
Hi all!
I have a vendor MSI to a program. The only configuration I´m suppose to do is to set the language to swedish. I located the setting to a file in %appdatafolder%. The issue is that the folder creates at run time and the name of the folder is different from computer to computer. From installation to installation.
Does anyone have any suggestion how to solve this issue? The only idea I can think of is to create a script that starts the program and after that looks for the folder (I know the name of the parent folder) and copies the configuration file. But then the user has to start the program all over again, or he/she might configure the program and write over the configfile etc ...
I barely know any scripting either with is a bummer. I can copy a file etc in vbscript. Apart from that I just google for scripts and slightly modify them.
if the filename is constant you can use "file search" (windows installer system search) + vbscript to edit it.
Posted by:
pjgeutjens
13 years ago
if the filename is constant you can use "file search" (windows installer system search) + vbscript to edit it.
problem there is the file only gets created after the application starts, at which point Windows Installer is no longer in scope, unless you trigger a repair every time using the RUN key or so...
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.