does someone can send me just a simple jscript with a messagebox, that doesn't end with a 2740.
A js-file or a script to include in the CA will be fine.
Many thanks in advance.
Johannes
Posted 01 October 2001 - 10:44
does someone can send me just a simple jscript with a messagebox, that doesn't end with a 2740.
A js-file or a script to include in the CA will be fine.
Many thanks in advance.
Johannes
Posted 18 October 2001 - 17:46
You can send messages to the installer and get it to display a message box for you though... Check out Session.Message in the help. It's a bit fiddly but you can get error, warning or whatever dialogs out if you want.
If you need more information, I can probably knock something up for you if you let me know what you need.
Graham
Posted 19 October 2001 - 12:51
It's like the first steps in C++, when you write a program that writes "Hello world!" on the screen.
I wish, I had a js-file, that's running, not getting an 2740 error and I'm getting a reaction on the screen.
Perhaps getting a string out of a property and showing this string in a messagebox.
That would be great, many thanks in advance!
Johannes
Posted 19 October 2001 - 15:49
MsgBox Session.Property("INSTALLDIR")
I guess in JScript it would be quite similar.
Posted 22 October 2001 - 10:29
Unfortunately J[ava]Script was not designed with Win32 as a sole target like VBScript and so no UI features are included natively in the language at all. It is expected that the code will run in some kind of context that provides objects to do this work - hence the window.alert() method in DHTML, and the WScript.Echo() method in the Windows Scripting Host.
In Windows Installer the only context we have available is the Session object. Fortunately, we can persuade this object to show a message box for us.
The following JScript CA should demonstrate how to do this - it's a bit simple and there's an awful lot more you can do with it but it's a start...
Hope this helps...
Graham
Quote |
// Message level var msiMessageTypeFatalExit = 0x00000000; var msiMessageTypeError = 0x01000000; var msiMessageTypeWarning = 0x02000000; var msiMessageTypeUser = 0x03000000; var msiMessageTypeInfo = 0x04000000; // Button styles // default button // return values // MessageBox function: var objRecord = Session.Installer.CreateRecord(1); return Session.Message(lngOptions, objRecord); // Custom action entry point return 1; |
Posted 22 October 2001 - 13:48
many, many thanks!
That's great! It's working without problems!
Yes, you'r right, it thought it would be easier, but that doesn't matter now.
This will be the beginning of my great J-Script career.
:-)
Thanks for your effort!
Johannes
Posted 25 October 2001 - 11:46
var shell = new ActiveXObject("WScript.Shell");
shell.Popup("Hello", 0 , "My Script", 16);
Posted 25 October 2001 - 12:26
I'd only noticed the WScript.Echo function before, but you can't create that object from a non-WSH hosted script. Didn't realise there was another message box function hidden away so wrote my own interface to the Installer one.
Cheers
Graham