Page 1 of 1

Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 5:45 am
by gagandeep.sharma
Hi Guys, I'm having some issue with MSI Scripting and the automation code.

Basically, I hav my IA project ready with msi script and every thing. Now I'm creating a .NET project to create same IA project dynamically using automation template.
here i'm having problem with its msicoding style in writing many syntax.

this time i'm unable to write Compile If into my C# code to create automation. See my attachments :-

Image1 : It describe the code written into msi coding, which I need to automate in C#.

Image2 : describe the C# code written for simple if. I wanted same code style for the [Compiler If]. Please help.

It would be good if you can refer any keyword reference for the automation as I'm finding difficulties into their manipulation. For example I guess the integer value "0" for "Administrative Right" being used some where into the script. Any help will be appreciable.
thanks :)

Re: Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 7:34 am
by gagandeep.sharma
May be I have not explained my question well. My question in simple language : "how to write automation command in C# for 'Compile If' statement as shown into the image" ?.

I'm also having same problem for the other command also like "(Un)Install MSI Package" is an script option which is generating some script as "Install/Remove msi package blaa blaa blaa" ...Now how to write this into the C# automation command for automation interface. Basically I wanted some reference where i could see the msi command and their corresponding automation commands in C# particularly.

Re: Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 8:16 am
by bokkie
Its been a long time since I used the automation.

What happens if you insert a statement like iaScript.AddCommand("[compiler if Variable QQQ Equals 34]", "")?

If it emits the statement into the MSIcode without a problem, you could think about building the string and replacing QQQ and 34 with your values when you create the project. I've never tried it but while waiting for a simpler answer, you've got nothing to lose while you're waiting. :wink:

Re: Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 9:34 am
by gagandeep.sharma
Hi bokkie

Thanks for you reply, I will try this solution too. Although i did many hit n try but couldn't succeeded. I was wondering about any documentation related to the automation command syntax, do you hav any reference or any link for automation syntax of msi coding command ? bcoz this seems very crucial if i'm gonna change my whole project into automated project which is having around 500+ line of msi coding.

I would be happy, if somebody could provide exact help. Thanks

Re: Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 11:33 am
by FrancescoT
Dear Users,

The easiest way to understand how the Automation code syntax has to be passed with the respective Automation SDK command, it is with inspecting how the equivalent IA command is stored by IA internally.

For example, supposing that you want to issue via automation a command to Display a MessageBox, type the command within the MSI code editor in IA IDE;

Code: Select all

MessageBox: Dialog Title, Dialog Message

Select the code statement and copy it as InstallAware Clipboard format (right click and select Copy ... not Copy as Text), then past the Clipbord contens in a Text file (NotePad is perfect) and you will have;

Code: Select all

~InstallAware Clipboard Data~
~MessageBox~
~{CF1A00E6-162A-4122-A476-721DDF20532F}~
~Dialog Title~
~Dialog Message~
~0~
~1~
~~

Due the above command sequence, the MessageBox command requires the following 5 parameters;

Code: Select all

"(1)Dialog Title","(2)Dialog Message","(3)0","(4)1","(5)"

Finally, the correct syntiax to issue the command via Automation using the "AddCommand" API Function will be (the following code uses the Escape character sequence required by C#);

Code: Select all

AddCommand("MessageBox", "\"Dialog Title\",\"Dialog Message.\",\"\"0\",\"1\",\"\"");


Anyway, the same description on how to "discover the exact parameters of any command" accepted by the Automation interface ... it is reported with that available IA documentation.

That's it!

Regards

Re: Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 11:52 am
by gagandeep.sharma
Hye FrancescoT, I think you resolved my all prob :D tomorrow morning I will try this first. thanks a lot :) :)

Re: Automation MSI Script Syntax

Posted: Wed Sep 11, 2013 12:16 pm
by FrancescoT
:D :D :D