PDA

View Full Version : Not installing files



MarkF
05-12-2009, 12:26 PM
I am enclosing a script that doesn't work. I am attempting to use the Dynamic File Linking to copy files from one directory to another. For example:

C:\Program Files\MarkenPro (working dir)
C:\Program Files\MarkenPro\Download (download dir)

The files I want to be copied will be placed in the download directory prior to running the SB script. The script should be copying whatever's in the download dir to the working directory by using wild cards: *.*.

What happens when I run the script in debug is that after the install line, I check the %_SB_ERRORCODE% and is shows 0 (zero) for a successful operation, but in fact nothing has happened. In fact at this point there are multiple %_SB_ERRORCODE% showing in the list, all with a value of 0???
The next step in the debugger indicates that in fact the errorcode is not zero as it takes the negative argument in the IF statement.

linder
05-12-2009, 11:40 PM
Mark,

You are using "runtime variables" (e.g. %MKP_PROGRAMDIR_DOWNLOAD%) at script compile time. Of course, this is not allowed at all, because a runtime variable is only visible at installer runtime, not at compile time.

For example, the following line (110) does not make sense at all:

Install File "%MKP_PROGRAMDIR_DOWNLOAD%\*.*" to "%MKP_PROGRAMDIR%\*.*" (Always Install) [CRC]

I assume, your intention was to use a compiler variable here, right? Fix this and you are done.

Line 117 is also wrong:

Install File "%MKP_DATADIR_DL2_DOWNLOAD%\*.*" to "%MKP_DATADIR_DL2_DATA%\*.*" (Always Install) [CRC]

Does this help?

Friedrich

linder
05-12-2009, 11:49 PM
Mark,

And you should not ignore the compiler report. See attached screenshot. It tells you that both Install File actions did not add any file to the installer.

Friedrich

MarkF
05-13-2009, 09:04 AM
Thanks for the update. After I posted the script, I found the error you noted as well as another one that I had overlooked regarding the return variable.

Where I'm at now is that when I use the Install File(s) command, nothing happens. If I change it to the Copy File(s) command, the files will copy IF the directory that I specify is NOT located in the C:\Program Files.

I presume the failure of the Install File(s) command is because I have not specified any files in the script. I was hoping to use this because of the automated backup and rollback if there was an installation failure. But I have worked around this with the Copy File(s) command and processing each file individually.

However, I'm still left with the issue of not being able to copy files to the application folder under C:\Program Files. This is a protected directory and involves UAC. Is there a way 1) to override the UAC so that I can write the files there and 2) run the whole script silently?

Thanks,

Mark

linder
05-13-2009, 09:19 AM
Mark,

There is no need to specify any file in the script nor to use the Copy File(s) "workaround". You are definitely still doing something wrong in your project.

BTW, you can always check the compiler .htm log file to see which files are included in your setup.exe and what the final target location for the file(s) is. Perhaps this already gives you an idea.

But to be honest, I don't understand the logic in .sb6 project that you posted :( What you are trying to do can be done (and completely automated) without writing code. Why are you writing all that script stuff?

Why do you hard-code C:\Program Files\MarkenPro (you should never do this). Why do you use Set Variable %_SB_ROOT% to "C:\ProgramData" (completely wrong and should never be done because %_SB_ROOT% is pre-defined and points to the root letter of your installation folder).

Friedrich

linder
05-13-2009, 09:24 AM
And then you set (in the General Propertis) the compiler variable [INSTALLDIR] to %_SB_INSTALLDIR%

And in the script you have:

Set Variable %_SB_INSTALLDIR% to "[INSTALLDIR]"

This does not make any sense, because you do not define a default installation folder at all. Then later in your script, you are doing again strange things with the default installation folder. I thought the script you posted was some kind of test script -- this project file will never do any useful thing. But I can be wrong, because I don't understand the logic that is behind that script.

Friedrich