PDA

View Full Version : Renaming a previous install prior to new install



arrigob
09-26-2013, 12:53 PM
Hi There,

I have a new install that I am making and I am having trouble in one area of it. At the beginning of the install I need to rename a folder to a new name. Then I will create and install a new folder that utilizes the same name as the folder I recently renamed.

To do this, I have been trying to use the rename command in my script. But when I run the install to fails to do so. It's like it pretty much did nothing. I have tried moving the command to different areas in the script but have not had much success.

Anybody have any useful ideas of how I could better handle this? Thanks,

Brandon

linder
09-27-2013, 02:12 AM
Brandon,

The rename function (a wrapper around the MoveFile Windows API) only fails if:

1. The current name of the directory on the local computer and/or the new name for the directory is incorrect.

-or-

2. The current name of the directory is locked (shared, permission issue, etc.).

-or-

3. The new name does already exist.

Do you rename the folder after the "Ready to Install" dialog? That means, are the old/new folder name variable values set? If you are interested, send your project to support [at] lindersoft [dot] com and we can review the script logic for you.

Friedrich

Unregistered
10-07-2013, 02:57 PM
Brandon,

The rename function (a wrapper around the MoveFile Windows API) only fails if:

1. The current name of the directory on the local computer and/or the new name for the directory is incorrect.

-or-

2. The current name of the directory is locked (shared, permission issue, etc.).

-or-

3. The new name does already exist.

Do you rename the folder after the "Ready to Install" dialog? That means, are the old/new folder name variable values set? If you are interested, send your project to support [at] lindersoft [dot] com and we can review the script logic for you.

Friedrich

Email sent!

linder
10-08-2013, 02:03 AM
There was no attachment to your email; can you please resend it with the attachment?

Friedrich

linder
10-08-2013, 10:24 AM
Brandon,

See attached screenshots. Tested on Windows 7 Ultimate x64. The code renamed c:\fpa to c:\FPA Archive.

In Windows, rename is handled via the MoveFileA API (the "Rename File/Folder" function is a wrapper around this API).

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365239(v=vs.85).aspx

Friedrich

arrigob
10-08-2013, 10:38 AM
Yes, I changed the position and tried this right before I sent it to you. I see it is working here as well. Do the copy command further down in my code look efficient as well? Right now my installer if finishing without copying any files. Can you see any reason why that would be?

linder
10-08-2013, 11:12 AM
I would recommend not to perform any action BEFORE the "Ready to Install" dialog. You rename folders and create the uninstall app before that dialog. This should be done AFTER the "Ready to Install" dialog (to give the user a "choice"; install or not install).

And I don't think that your "Get INI Value" script function to set the %DATAPATH% variable value succeeds. You set "INI Item" to "Datapath=" but it should be "Datapath" only.

In other words, the installer can't copy files because the source location is incorrect or not set at all :)

BTW, you should move your last "Run Program" action AFTER the last "Loop Wizard/End" statement. Otherwise, the installer launches the aas2.exe before the Finish dialog is displayed.

And please note that you have developed a per-user ("asInvoker") install. So all your "per-machine" actions will fail (e.g. the OCX registrations for exportmodeller.dll and crtslv.dll).

Does this help?

Friedrich

Unregistered
10-09-2013, 09:54 AM
Friedrich,

That helped a lot. I am going to clean up all my installs with your information.

The installer is working pretty well now but I am having an issue with it on some workstations. I made the installer run requiring administrator versus asinvoker now. It seems that if a workstation with Windows 7 or Windows 8 has UAC turned on or something, my installer will not copy its files correctly. It runs the programs I ask it too and copies some files but it skipping my script where it copies all dlls, exes, and etc.

Any ideas on why that would happen? On workstation that have UAC turned off, everything seems to install correctly. By the way, I greatly appreciate all the help you have given me. Lindersoft support is top notch!

linder
10-09-2013, 10:15 AM
Thank you for your kind words :)

I think the copy process does not work correctly on some machines (with UAC enabled) because your source location is still incorrect on these machines. I would suggest to add some code to the script to detect such an incorrect source location scenario. It's not caused by the elevated running installer. "Something" in your application design is not UAC-aware/compliant.

I noticed that you read from a protected folder (e.g. %WINDIR%\aas2.ini to set the %CALLINGPATH% value). Only elevated running and UAC-aware!!! applications can write to this INI file. So I think that one of your apps that previously wrote the path to this INI file is not UAC-aware and as a result, virtualization kicks in and redirects the write action to another folder. So the "real" %WINDIR%\aas2.ini does not have the value you are looking for, only the virtualized one.

You should never store your data in the Windows folder. You have to make your applications UAC-aware to follow the Windows development guidelines.

Does this help?

Friedrich

arrigob
10-09-2013, 11:36 AM
I see. Well I changed my script to not poll or use anything in the windows folder anymore. I also used message boxs in my script to confirm my datapath and callingpath are being collected right. So far both of those message boxes are confirming that it has the correct value. Neither of these issues have fixed my issue though.

Could this be because my installer and applications do not have a UAC manifest?

linder
10-10-2013, 12:35 AM
Your installer HAS an UAC-manifest and is UAC-aware and UAC-compliant :)

What value does your %DATAPATH% have in a typical update scenario? Just for fun, add a "Display Message Box..." script function before the first Copy File(s) command and display the value. What value is displayed?

BTW, and I just noticed that you are using this in some Copy File(s) commands:

Source: %DATAPATH%\help\*.*
Destination: %_SB_INSTALLDIR%\help\*.*

The Destination specification is incorrect. It should be:

Source: %DATAPATH%\help\*.*
Destination: %_SB_INSTALLDIR%\help

And in another command, you are using this:

Source: %DATAPATH%\crystal
Destination: %_SB_INSTALLDIR%\crystal

The Source specification is incorrect. It should be:

Source: %DATAPATH%\crystal\*.*
Destination: %_SB_INSTALLDIR%\crystal

Friedrich

arrigob
10-23-2013, 10:21 AM
Ok, thanks for the changes. My install is running very well now. I have one last issue with it though. I have it running as a silent install. I also have a prerequisite for .net framework 4. PCs that do not have .net framework 4 are not installing it like it should. I have other installers that are not silent installs and the prerequisites always work. I am thinking this is due to it being a silent install, what do you think? I did see under details for the prerequisite that it has a ask user area. I am going to try and change ask user from a 1 to a 0 and see if that helps. Any info would be great.

linder
10-23-2013, 10:39 AM
Hello,

Note: If you set DOTNET4_ASK_USER to "0" then it will never display the "Install Core PreRequisite?" question (silent or not-silent installs).

I would suggest to add the following three lines to the include script to handle your silent scenario (see attached screenshot). If the installer is running in silent mode then it will not skip the .NET4 install.

Does this help?

Friedrich

arrigob
10-23-2013, 10:56 AM
Super, I will turn that back on and give this a try. Thanks again!

linder
10-23-2013, 10:58 AM
You are very welcome :)

Please keep us posted.

Friedrich

arrigob
10-23-2013, 03:13 PM
Friedrich,

What am I missing? I am trying to add one of the lines you suggested. I am trying to add this line specificly, "If %_SB_INSTALLERFLAG% Equals "1" on Position "$SB_SILENTMODEFLAG$" Then".

How do I add an if statement that uses the on option like you are using? I see the option for and, or, then, but no on. What am I missing? Thanks.

arrigob
10-23-2013, 03:16 PM
Nevermind on the last post. Found it.

linder
10-24-2013, 04:17 AM
Thanks for the update!

Friedrich