PDA

View Full Version : Display File Description in the "While Installing" progress bar screen


jassing
11-15-2008, 10:30 AM
I had a client that wanted to display the file's description in the progress bar screen (while installing). Someone told him he couldn't do it.

ie: "Application Help File" instead of
"c:\program files\My Application\docs\Help.chm"

He had already done the "hard part" of putting the descriptions in for each of the files he wanted to display the description for.

I opened up a few LUA files, as I knew I had saved the code from other projects; and sent it off...

He was so impressed; that I now guess it isn't as common as I thought it was...

Here's what I do:

In the "While Installing" you need to edit the "On Preload" and "on progress" actions.

On PreloadtFileList = SetupData.GetFileList(ARCHIVE_LIST);

On Progress
if e_Stage == INSTALL_STAGE_INSTALLING_FILES then
local nIndex;
local tPropTable;

for nIndex, tPropTable in tFileList do
-- Goofy Bit
local cFile = SessionVar.Expand( String.Replace( tPropTable.Destination,"\\","\\\\") ).."\\"..tPropTable.FileName;
cFile = String.Replace(cFile,"\\\\","\\");
if String.Lower( cFile ) == String.Lower( e_CurrentItemText ) then
-- We have a match! Show the description instead, but only IF there's a description
if String.Length( tPropTable.FileDescription ) > 0 then
e_CurrentItemText = tPropTable.FileDescription;
end
break;
end
end
end

The goofy bit :
local cFile = SessionVar.Expand( String.Replace( tPropTable.Destination,"\\","\\\\") ).."\\"..tPropTable.FileName;
cFile = String.Replace(cFile,"\\\\","\\");

I'm not sure that's still needed, IR may have fixed it; but at one point, you wouldn't always get the right name, sometimes there'd be a %AppFolder% in with it; so you had to use SessionVar.Expand(). However, with only one '\' it screwed it up; so you have to be sure there's doubles in there; the reuslt is usually "good" but sometimes, there remains a double; so you need to remvoe them, once you expand the sessionvar. Goofy, I know; but it was my experience; and that was the work around....

So now you can do anything you want; display just the file name instead of the path; display the size along side the file name, etc...