Hi,
I created an Object setup, and then created a regular setup and included my Object into it as a component..
While the regular setup is running, i set the Object properties, (I set the objects target using a script defined variable.)
Now when Maintain mode is running, i need to retrieve what the object properties were set to during installation. For example i need to know where the object was installed by reading the target value.
How do i save and retrieve this information? Do I use WriteProperties() and ReadProperties()?
Thanks
WJSavoye
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Persisting Object Properties
Started by
WJSavoye
, Oct 04 2002 19:14
1 reply to this topic
Posted 24 October 2002 - 19:08
I encountered this same problem recently.
Here's how I got around it. Use the log. Here's some sample code. The function GetLog() will retrieve the log file of the install. Just write the properties in here. Then in maintenance mode just read them back. Works for numbers, strings, and bools. Just haven't tried arrays yet.
In the code below, assume there is an InstanceName property. I look in the log for a property (must be string literal and not a string variable). If an exception is thrown, the property doesn't exist so I just return the default.
In the code I initialize the properties if it is maintenance mode. Also, I do this OnRebooted, because I needed it here too.
GetLog is not documented. Wrappers for it are exposed/documented in Pro 7.
Here's how I got around it. Use the log. Here's some sample code. The function GetLog() will retrieve the log file of the install. Just write the properties in here. Then in maintenance mode just read them back. Works for numbers, strings, and bools. Just haven't tried arrays yet.
In the code below, assume there is an InstanceName property. I look in the log for a property (must be string literal and not a string variable). If an exception is thrown, the property doesn't exist so I just return the default.
In the code I initialize the properties if it is maintenance mode. Also, I do this OnRebooted, because I needed it here too.
GetLog is not documented. Wrappers for it are exposed/documented in Pro 7.
Code Sample |
function STRING get_InstanceName() object oLog; string szValue; begin try set oLog = GetLog(); if (IsObject(oLog)) then szValue = oLog.Property("InstanceName"); m_strInstanceName = szValue; endif; catch endcatch; set oLog = NOTHING; return m_strInstanceName; end; function void put_InstanceName(newVal) object oLog; begin if (m_strInstanceName != newVal) then //Setup author is setting a new instance name through script if (CheckReqs(newVal)) then m_strInstanceName = newVal; try set oLog = GetLog(); if (IsObject(oLog)) then oLog.Property("InstanceName") = m_strInstanceName; endif; catch endcatch; set oLog = NOTHING; endif; endif; end; function OnBegin() begin if (MAINTENANCE) then InitObjectProperties(); endif; function OnRebooted() begin InitObjectProperties(); function void InitObjectProperties() begin get_InstanceName(); |