Indigo Rose Software
  #1  
Old 07-04-2008
emu99 emu99 is offline
Indigo Rose Customer
 
Join Date: Jun 2008
Location: Germany / Duesseldorf
Posts: 5
Create events in eventlog

Hi,

since i rather prefer generating events during installations e.g. installation problems, starting, success i made some small function inside global functions, which uses the exe-file eventcreate.exe which comes with windows xp. With this util one can create individual events in eventlog.
during large deployments in company looking up the eventvwr to see what went wrong is in my opionen much fast than searching / looking up the setuplogfile....

so, maybe also others like this function, so here it is:

create inside global functions the function CREATE_EVENT:

function CREATE_EVENT(EVENT_TYPE, EVENT_TXT)
result = File.DoesExist(_SystemFolder.."\\eventcreate.exe") ;
if (result == true ) then
EVENT_TEXT = " /T " .. EVENT_TYPE .. " /ID 888 /L APPLICATION /SO " .. "\"".."TIVOLI-PACKAGE: "..SessionVar.Expand("%ProductName%").." "..SessionVar.Expand("%ProductVer%").."\"".. " /D " .. "\"" .. EVENT_TXT .. "\"";
File.Run(_SystemFolder.."\\eventcreate.exe", EVENT_TEXT, "", SW_MINIMIZE, true);
end
end


call the function with

as error-type:
EVENT_TYPE="ERROR"; EVENT_TXT="Installation error: " .. STATUS .. " - " .. STATUSMESSAGE ;
CREATE_EVENT(EVENT_TYPE, EVENT_TXT);

or e.g. as information-type:
EVENT_TYPE="INFORMATION"; EVENT_TXT="Installation successful ...";
CREATE_EVENT(EVENT_TYPE, EVENT_TXT);

the variables STATUS and STATUSMESSAGE e.g. can be filled with Application.GetLastError() and tblErrorMessages[error].
On action "at startup" at the beginning i define them, just in case, Trap() wasn't called before using the function CREATE_EVENT, just to make sure, values are not empty... if during Trap() error occured both values with be filled autom. with the errorcode and text which occured...

STATUS = 0;
STATUSMESSAGE = "OK";

for detailed info about eventcreate.exe just call inside cmd eventcreate.exe /? or visit page like this one:
http://windowsitpro.com/windowsscrip...s-sampler.html



In my installations i created a function Trap() in the global functions, which i call after vital operations to check, if error occured, if not silent (using variable _SilentInstall ~= true) error message pops up for 5 secs:


function Trap()
error = Application.GetLastError();
if (error ~= 0) then
if (_SilentInstall ~= true) then
Dialog.TimedMessage("Error occured !", _tblErrorMessages[error], 5000, MB_ICONEXCLAMATION);
end
STATUS=error; STATUSMESSAGE=_tblErrorMessages[error];
end
end
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Example: Creating Animated Images Corey AutoPlay Media Studio 5.0 Examples 1 03-04-2006 01:44 AM
HOWTO: Create a Project Template Support AutoPlay Media Studio 4.0 Examples 0 10-28-2002 02:49 PM
HOWTO: Create a Page Template Support AutoPlay Media Studio 4.0 Examples 0 10-26-2002 06:20 AM
HOWTO: Create an Empty Folder Support Setup Factory 6.0 Knowledge Base 0 10-21-2002 04:21 PM
HOWTO: Create Nested Shortcuts in the Start Menu Support Setup Factory 6.0 Knowledge Base 0 09-24-2002 11:26 AM


All times are GMT -6. The time now is 07:55 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software