/build/static/layout/Breadcrumb_cap_w.png

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.

0 Comments   [ + ] Show comments

Answers (16)

Posted by: jmaclaurin 13 years ago
Third Degree Blue Belt
0
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
Senior Purple Belt
0
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 ...
Posted by: SandeepPanat 13 years ago
Orange Senior Belt
0
What was the application name?
Posted by: Agathorn 13 years ago
Senior Purple Belt
0
LightPOS
Posted by: pjgeutjens 13 years ago
Red Belt
0
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
Posted by: Agathorn 13 years ago
Senior Purple Belt
0
I have already distributed the program so "case closed" so to say :)

But anyway I thought about the same solution but the folder is created when then program launches so I´m unable to determind the foldername before launch. Or you don´t mean as a broken keypath?
Posted by: pjgeutjens 13 years ago
Red Belt
0
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
Posted by: Agathorn 13 years ago
Senior Purple Belt
0
The folder is created by the application during launch of the app. If you copy the correct file after programlaunch it´s not used and the user has the wrong configuration. Or maybe I dont understand what you are suggesting :)
Posted by: pjgeutjens 13 years ago
Red Belt
0
No I think you do, my suggestion was indeed to wait till after the folder was created during app launch, and then to copy the settings file. But if that then does not get used...
Posted by: Agathorn 13 years ago
Senior Purple Belt
0
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)
Posted by: pjgeutjens 13 years ago
Red Belt
0
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
Posted by: Agathorn 13 years ago
Senior Purple Belt
0
Well the problem would be the timing as I see it. There is no time to copy the file since once the file is in place (created by the program) the user is already using the program with the wrong settings.
Posted by: pjgeutjens 13 years ago
Red Belt
0
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
Posted by: Agathorn 13 years ago
Senior Purple Belt
0
Actually yes, that would be a viable solution I guess :)
Thank god I don´t have to implement it since my programming skills are slim to say the least!
Posted by: itolutions 13 years ago
Purple Belt
0
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
Red Belt
0
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.
 
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