cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kellelein
Level 4

How to insert Date/revision number on a Dialog

Hi

I would like to insert a date or revision number on a Dialog, how do I do this?

Cheers

Kellelein
Labels (1)
0 Kudos
(9) Replies
J_anitha
Level 8

You may customize dialog, use EzDefineDialog().
Create a new text field on dialog for version\date.
Insert version\date by CtrlSetText() function from your script.
0 Kudos
Kelter
Level 10

This solution will only work with InstallScript "Sd..." (Script defined) dialogs. What is your project type? (e.g. InstallScript, InstallScript MSI, Basic MSI)
0 Kudos
kellelein
Level 4

It is a InstallShield 2008 project and just a normal Basic MSI project.

Have tried a lot of things now and nothing worked 😞

CtrlSetText()
GetFileDate()
SRCDIR

Just want to write, to a Text field!!!!! on InstallWelcome dialog

Version 1.0
Revision xxxx-xx-xx

I use CtrlSetText('InstallWelcome', ???????, 'test');

Where do I find the Text ID?

Best regards

Kellelein
0 Kudos
Kelter
Level 10

Aha! Ignore that CtrlSetText stuff as you're not using an InstallScript project. InstallScript projects are all about scripted logic, whereas basic MSI is all about the tables. Set the text box control's "text" field equal to a property name in brackets. For instance, set it to [PRODUCT_VERSION]. Then just set the property value sometime before the dialog comes up, either by using a "Set a property" custom action or by means of a scripted custom action.

In my setups, I like to take the version information from the same header file as is used by the rest of the product. I therefore use an InstallScript CA that uses constants defined in our "Version.h" file to assign all version-related strings in my installer.

Assuming your header file defines, for example, [CODE][FONT="Courier New"]#define VERSION_STRING "1.0.0.1234"[/FONT] [/CODE]
Just use MsiSetProperty( "PRODUCT_VERSION", VERSION_STRING ); and you should be all set.
0 Kudos
kellelein
Level 4

Still can't get it to work 😞

where do I call MsiSetProperty() from? do I have to make an InstallScript, and call it from there???

Cheers

Kellelein
0 Kudos
Kelter
Level 10

Okay, if you just want to statically set a date or rivision number (which would require manual interaction at every build, and therefore be unadvisable) you simply need to create the text box on the dialog using the dialog design view and enter the literal values. this is trivial, therefore i'm going to assume you're not asking the forum how to use the dialog designer.

i'm assuming you are really trying to automate this stuff so you don't have to modify it manually on every build. (you weren't really this specific in your question.) The next question would be "Where is the date/version info coming from?" I further assumed that you have a header file with this information, and you want to display the information which is in that header file on the dialog. since InstallScript can understand most stuff from a regular c style header file, i would recommend using an installscript custom action to take information from the header file, and use it to set the property. start by writing the function in installscript (make sure to use "export" in your function prototype) and then use the custom action wizard to create an immediate-execution InstallScript Custom Action that calls your exported function.
0 Kudos
kellelein
Level 4

Ok, what I want, is to insert a date on a dialog, this has to be done automatic. I have made an InstallScript and can set a text on a dialog now. I do this with a custom action, where I call the script (I forgot to insert this in the Installation Sequence and that's why I couldn't get it to work first).

I want to use the date from the setup.msi file. I can locate the file, with my script, but my GetFileDate, dosen't seem to work and I can't figure out to debug the script....

My Script look like this:

#include "ifx.h"

export prototype MyFunction(HWND);
prototype GetFileDate (BYREF string, string);


//MyFunction---------------------------------------------------------
function MyFunction(hMSI)

string fileInfo;
string file;

begin
file = SRCDIR^"UniLock.msi";
GetFileDate(file, fileInfo);
MsiSetProperty(NULL, "UNILOCK_REVISION", fileInfo);
end;
//-------------------------------------------------------------------

//GetFileDate--------------------------------------------------------
function GetFileDate (fileName, fileDate)

string fileTime;
number dummy;

begin
if !Is (FILE_EXISTS, fileName) then fileDate = "???";
return;
endif;

GetFileInfo (fileName, FILE_DATE, dummy, fileDate);

fileDate [4] = "-";
fileDate [7] = "-";

GetFileInfo (fileName, FILE_TIME, dummy, fileTime);
StrSub (fileTime, fileTime, 0, 5);
fileDate = fileDate + " " + fileTime;
end;
//-------------------------------------------------------------------
0 Kudos
Kelter
Level 10

there's a few ways you can debug. You can throw in a bunch of calls to MessageBox() to spit out some info, but since you're dealing with an immediate execution custom action, i'd recommend using the debugger. if you click the white "!" icon at the top of the IS IDE, then it'll run your installation, and for every InstallScript Custom Action, it will launch a debug window, wherein you can step through your InstallScript to see what's happening.

Your code looks logically correct, but i'll try to spend a few more minutes on your problem this evening if you haven't come up with your answer by then.
0 Kudos
kellelein
Level 4

Problem solved....Thank you very much for your help...

I debuged the script and found that the prototype defenition for GetFileDate missed a BYREF on the returning string...

The script ended up by this...

//Included headers-----------------------------------------
#include "ifx.h"
//---------------------------------------------------------

//Functions definitions------------------------------------
export prototype MyFunction(HWND);
prototype GetFileDate (BYREF string, BYREF string);
//---------------------------------------------------------

//MyFunction-----------------------------------------------
function MyFunction(hMSI)

string fileInfo;
string file;
number dummy;

begin
file = SRCDIR^"UniLock.msi";
GetFileDate(file,fileInfo);
MsiSetProperty(NULL, "UNILOCK_REVISION", fileInfo);
end;
//---------------------------------------------------------

//GetFileDate----------------------------------------------
function GetFileDate(fileName, fileDate)

string fileTime;
number dummy;

begin
if !Is (FILE_EXISTS, fileName) then fileDate = "???";
return;
endif;

GetFileInfo(fileName, FILE_DATE, dummy, fileDate);

fileDate [4] = "-";
fileDate [7] = "-";

GetFileInfo(fileName, FILE_TIME, dummy, fileTime);
StrSub(fileTime, fileTime, 0, 5);
fileDate = fileDate + " " + fileTime;
end;
//---------------------------------------------------------
0 Kudos