This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Getting the value of [#filekey] in InstallScript
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
04:08 AM
Getting the value of [#filekey] in InstallScript
I have a Basic MSI Project and uses a custom InstallScript Action.
How can I evaluate the value of the property [#filekey] in InstallScript. MsiGetProperty (hMSIHandle, "#filekey", szReturn, nvBuf) does not work. :confused:
[#filekey] is replaced by the full path of the file, with the value filekey used as a key into the File table, e.g. as a value of a regestry entry or used as a command line for a custom action and so on.
More infos to formatted values:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa368609(v=vs.85).aspx
How can I evaluate the value of the property [#filekey] in InstallScript. MsiGetProperty (hMSIHandle, "#filekey", szReturn, nvBuf) does not work. :confused:
[#filekey] is replaced by the full path of the file, with the value filekey used as a key into the File table, e.g. as a value of a regestry entry or used as a command line for a custom action and so on.
More infos to formatted values:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa368609(v=vs.85).aspx
(11) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
08:00 AM
Does that qualify as a property?
I just tried to set a property in Property manager (manually in the IDE) with #TEST and that doesn't allow me to do.....
I just tried to set a property in Property manager (manually in the IDE) with #TEST and that doesn't allow me to do.....
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
08:02 AM
You need to call MsiFormatRecord().
[CODE]#include "ifx.h"
export prototype MyFunction(HWND);
function MyFunction(hMSI)
NUMBER nvBufferSize;
STRING svPropertyValue, svResult;
HWND hRecord;
begin
nvBufferSize = MAX_STRING;
hRecord = MsiCreateRecord(0);
MsiRecordSetString(hRecord, 0, "[#notepad.exe]");
nvBufferSize = MAX_STRING;
MsiFormatRecord(hMSI, hRecord, svResult, nvBufferSize );
MessageBox( svResult, INFORMATION);
return ERROR_SUCCESS;
end;[/CODE]
[CODE]#include "ifx.h"
export prototype MyFunction(HWND);
function MyFunction(hMSI)
NUMBER nvBufferSize;
STRING svPropertyValue, svResult;
HWND hRecord;
begin
nvBufferSize = MAX_STRING;
hRecord = MsiCreateRecord(0);
MsiRecordSetString(hRecord, 0, "[#notepad.exe]");
nvBufferSize = MAX_STRING;
MsiFormatRecord(hMSI, hRecord, svResult, nvBufferSize );
MessageBox( svResult, INFORMATION);
return ERROR_SUCCESS;
end;[/CODE]
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
08:07 AM
You could create a set-property custom action that sets MYFILEPATH to [#sample.exe] and then use MsiGetProperty to get MYFILEPATH; or call MsiFormatRecord.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
08:19 AM
Hehe, that's cheating. Course as fun as C/C++/InstallScript make calling MSI API, I could understand why you'd do this. (See my example above.)
In C#/DTF it's a bit simpler:
[CODE]
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
string filePath = session.Format("[#notepad.exe]");
return ActionResult.Success;
}
[/CODE]
In C#/DTF it's a bit simpler:
[CODE]
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
string filePath = session.Format("[#notepad.exe]");
return ActionResult.Success;
}
[/CODE]
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
10:04 AM
and what about Script, please?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 08, 2013
10:11 AM
What kind of Script?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 18, 2013
12:44 AM
RobertDickau wrote:
You could create a set-property custom action that sets MYFILEPATH to [#sample.exe] and then use MsiGetProperty to get MYFILEPATH; or call MsiFormatRecord.
Thanks Christopher and Robert. Both suggestions work...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 18, 2013
03:37 AM
Hi Christopher,
how to realize it using IS-Script, please?
how to realize it using IS-Script, please?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 18, 2013
06:09 AM
My reply above (message #3 in the thread) is an InstallScript answer.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 18, 2013
07:18 AM
yes. Thanks.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 03, 2013
12:11 PM
You are welcome.
