Are variables allowed in Weblocks?

Got a problem you cannot solve? Try here.
Post Reply
manticore
Posts: 8
Joined: Wed Apr 21, 2010 10:23 am

Are variables allowed in Weblocks?

Post by manticore »

I'm using web media blocks for common runtimes (.net, sql express, etc) in a compressed web-based setup (compression = best), and want to provide 2 locations for such runtimes, one is a URL in our web site and the other one a file located in the same directory that the main setup.exe

This is the URL definition of the media block:

Code: Select all

file:///$DIR_INSTALACION$/MSI_31.7zip
http://www.mysite.com/downloads/MSI_31.7zip
DIR_INSTALACION holds the value of SFXPATH variable, but I changed "\" for "/" by using ReplaceString command

Code: Select all

Set Variable DIR_INSTALACION to $SFXPATH$
Replace \ with / in variable DIR_INSTALACION
The problem is I get a script runtime error complaining about the $ character

Runtime error in setup script:
Line Number: 146
'$

Do I have to escape \ character in the replace command?
Are variables allowed in web media block's URLs?

Thanks in advance
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Are variables allowed in Weblocks?

Post by MichaelNesmith »

Variables are certainly allowed. Maybe it is the file:/// part that is causing the problem. Generally you don't need to escape anything in InstallAware.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
manticore
Posts: 8
Joined: Wed Apr 21, 2010 10:23 am

Re: Are variables allowed in Weblocks?

Post by manticore »

Ok, but is this approach correct?
Is there another way in which I can tell the media block to look first locally for the file and then try to download?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Are variables allowed in Weblocks?

Post by MichaelNesmith »

Ah, I missed that. You do not need to add a "link" to your file like that. If the weblock is already present on the same folder that your setup.exe is running from, then it will be picked up from there automatically. The online download step is invoked only when the weblock cannot be located there.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
manticore
Posts: 8
Joined: Wed Apr 21, 2010 10:23 am

Re: Are variables allowed in Weblocks?

Post by manticore »

Thank you for your help Michael, but I first tried by placing the media blocks in the same directory as my main setup.exe file, but it didn't work, because the installer poped up a message that the web blocks cannot be downloaded.

I'm sure I'm missing something, but I just can't figure out what it is.

Code: Select all

[DEFINE WEB MEDIA IE6_SP1, Exclude from Build, Encrypt with Password abcde]
    Include Script: setupie6
[OFFLINE CONTENT]
.
.
.
Media Block URL: "http://www.mysite.com/downloads/IE6_SP1.7zip" (no quotes)
Then I placed a file exactly named IE6_SP1.7zip in same folder than setup.exe and still tried to download it. :(

Any ideas?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Are variables allowed in Weblocks?

Post by MichaelNesmith »

When you say you placed "a file", is that to say you didn't place the actual web media block? That will trigger a download for sure! It knows how to identify its own web media blocks.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
manticore
Posts: 8
Joined: Wed Apr 21, 2010 10:23 am

Re: Are variables allowed in Weblocks?

Post by manticore »

MichaelNesmith wrote:When you say you placed "a file", is that to say you didn't place the actual web media block? That will trigger a download for sure! It knows how to identify its own web media blocks.
Nop, I meant the media block generated by IA (7zip file).

I deleted the "file:///" link (and the variable associated with it) and when I run setup IA generates a script runtime error complaining about a $ character exactly in the line where the media block is declared. This is confussing because there is not any variable nor $ character at all.
When I copy the weblock to notepad this is what I get

Code: Select all

~InstallAware Clipboard Data~
~Web Media Block~
~{A6E4256E-2BF2-47EB-96DE-73A80AE25747}~
~MDAC_28SP1~
~http://www.mysite.com/downloads/MDAC_28SP1.7zip~
~FALSE$MYAH_CARET$~
Same thing apply for all of the media blocks defined in my setup.
My guess is that $MYAH_CARET$ works as a separator between the build flag (TRUE, FALSE) and the password (when provided) in the form of ~FLAG$MYAH_CARET$PASSWORD~, if that's true, this is an expected syntax by IA, then why the runtime error?? Please correct me if I'm wrong

I also tried creating a fresh web mediablock and still appears the $MYAH_CARET$ even if I don't define a password, it's the only thing that has $ characters

Beyond those assumptions I don't get it. Where is the error? :(
manticore
Posts: 8
Joined: Wed Apr 21, 2010 10:23 am

Re: Are variables allowed in Weblocks?

Post by manticore »

Well a little update about this.
I copied the weblock declaration to notepad, removed the $MYAH_CARET$ in notepad and then copied it back to IA, and it worked!!
No more "$" error!!
But we are back to the original problem, Media Blocks are located in same directory that setup.exe and it doesn't recognize them because it tries to download the media block.

Any ideas?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Are variables allowed in Weblocks?

Post by MichaelNesmith »

Are you building setup in debug mode? Maybe that is the problem. The engine will look for the web media blocks next to the main self extracting file, which doesn't get built in debug mode.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
manticore
Posts: 8
Joined: Wed Apr 21, 2010 10:23 am

Re: Are variables allowed in Weblocks?

Post by manticore »

I'm compiling in compressed mode (Best) with no debug info, but finally get it to work.
After compiling my project once again, IA poped up an error message saying "Invalid Pointer Operation", I reboot my machine, recompiled, copied all of the blocks again and it worked, seems that something got corrupted in memory.

The only thing is, it worked with no password defined in the weblocks.

I appreciate your help Michael, I just would like to know about the $MYAH_CARET$
Post Reply