Run Program instead of Run Program As

Got a problem you cannot solve? Try here.
Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Run Program instead of Run Program As

Postby Tommy » Fri Oct 25, 2013 8:12 am

Hello

I am about getting familiar with MSIcode, respectively its code generator, though it seems to be working little inconsistent.
Even though I drag a "Run Program As" command all the time a "Run Program" command is _being_ dropped !

Please see pictures attached, which depicts "Run Program..." as source code.

Why is that ?

Regards,
Tommy
Attachments
RunProgram.png
"Run Program" as command inserted
RunProgram.png (19.47 KiB) Viewed 11794 times
RunProgramAs.png
"Run Program As" command is being draged
RunProgramAs.png (180.62 KiB) Viewed 11794 times

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run Program instead of Run Program As

Postby FrancescoT » Fri Oct 25, 2013 11:53 am

Dear Tommy,

if you enter a value for "User Name" with <Run Program As> command ... you will have "Run Program As" correctly spelled in your code.

Anyway, I will log a note to our dev team in order to fix what you reported.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Re: Run Program instead of Run Program As

Postby Tommy » Mon Oct 28, 2013 3:35 am

Hello,

I would like to specify an env var on the "Run Program As" dialog but my exe cannot be launched due to a LASTERROR=-11.
What does this error code mean ?
If the environment field is empty the exe starts.
Basic Setup project. IA18.

How can I define a new env var to the process, which is being spawned ?

Regards,
Tommy

Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Re: Run Program instead of Run Program As

Postby Tommy » Mon Oct 28, 2013 8:14 am

I have a workaround just by using "Run Program" and I defined a list of command line paramters for the cmd command :

Code: Select all

/K set PATH=$TARGETDIR$ & $SUPPORTDIR$\Setup.exe & exit


However, I would like to use "Run Program As" if it is possible.

Regards,
Tommy

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run Program instead of Run Program As

Postby FrancescoT » Mon Oct 28, 2013 11:27 am

Dear Tommy,

could you please try, with the help of a code snippet, to describe how you are trying to pass those parameters to the command?

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Re: Run Program instead of Run Program As

Postby Tommy » Tue Oct 29, 2013 1:37 am

Hello Francesco,

I call the following command with "Run Program":

Code: Select all

cmd /K set PATH=$TARGETDIR$ & $SUPPORTDIR$\Setup.exe & exit


But I would like to spawn this aforementioned Setup.exe through "Run Program As" using the "Environment" field, however it does not work due to a return code -11

Regards,
Tommy

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run Program instead of Run Program As

Postby FrancescoT » Tue Oct 29, 2013 12:50 pm

Dear John,

I don't know if the parameters you are trying to pass through are correct ... without knowing your EXE expected parameters.
At first look, these seem not correct.

The returned value by the "Run Program As" command, it is the one returned from the called EXE ... so the returned value meaning depends on the EXE and not on the IA command itself.

Anyway, supposing that you want to execute an hypothetical exe;
- available on target system as "C:\mysetup.exe"
- that requires a parameter as; TEST="TEST"

this is the the Run Program As to use;

Code: Select all

Set Variable MY_PROGRAM to C:\mysetup.exe
Set Variable MY_PARAMETERS to TEST="TEST"
Run Program as User \Admin: $MY_PROGRAM$ $MY_PARAMETERS$


The same as InstallAware Clipboard format;

Code: Select all

~InstallAware Clipboard Data~
~Run Program As~
~{EF5FF4B7-0E71-48C0-8775-32010184FCF1}~
~$MY_PROGRAM$~
~~
~$MY_PARAMETERS$~
~0~
~Admin~
~Admin~
~~
~~
~FALSE~
~~
~Set Variable~
~{577CC854-C015-496E-830D-273D27D34260}~
~MY_PARAMETERS$MYAH$MYAH$FALSE~
~TEST="TEST"~
~Set Variable~
~{3FE76360-57D4-418A-A7A7-C367A9116A95}~
~MY_PROGRAM$MYAH$MYAH$FALSE~
~C:\mysetup.exe~


Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Re: Run Program instead of Run Program As

Postby Tommy » Wed Oct 30, 2013 2:59 am

Hello,

The parameters are correct and my program launch works well with those parameters, which is called by "Run Program"

However Run Program As does not work if define an environment variable in the environment field. Why ?

Code: Select all

    Set Variable Proxy to $SUPPORTDIR$Proxy-3.2.1.144.0-Setup.exe
    Set Variable Environment to PATH=$TARGETDIR$
    Run Program as User \user: $Proxy$  (WAIT, get result into variable LASTERROR)




This program launch ends with error code -11.

Regards,
Tommy
Attachments
Untitled.png
Run Program As dialog
Untitled.png (14.42 KiB) Viewed 11748 times

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run Program instead of Run Program As

Postby FrancescoT » Wed Oct 30, 2013 11:37 am

Dear Tommy,

this happens "very probably", because the environment variable you are setting, in reality it is not available when you call the Run Program As command.

For what I see by the code you posted;

1- The "Set Variable Environment" is a Windows Installer command (Purple command) and due of this and unless you use IA Native Engine, the command execution is deferred until the Apply statement is run.
http://www.installaware.com/forum/viewtopic.php?f=2&t=4338

2- You can change environment variables at any time. However, this will only change the environment block for new processes executed after the change. Existing processes will keep on using their current environment block, which is the same as it was before you made the change.
New processes only will inherit the changed environment.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Re: Run Program instead of Run Program As

Postby Tommy » Thu Oct 31, 2013 7:41 am

Hello Francesco,

I just can't see the reason why Run Program As has the Environment field after all. Of course the env var is not available at the time I call Run Program As, otherweise I would invoke that external EXE with Run Program.

1. Set Variable Environment is not highlighted as purple command in my IA 18 MSIcode editor. Should it be so ?

How can I launch an external EXE with an env var which is just being intialized ?

Thank you !

Regards,
Tommy

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run Program instead of Run Program As

Postby FrancescoT » Thu Oct 31, 2013 1:03 pm

Dear Tommy,

1. Set Variable Environment is not highlighted as purple command in my IA 18 MSIcode editor. Should it be so ?

Probably, you modified your IA IDE Options. Please search for "Customizing Script Appearance" in IA documentation.

How can I launch an external EXE with an env var which is just being intialized ?

You must run a new process where the external EXE is effectively executed ... you can create a dummy setup package that just executes your exe (... based on the IA blank project template) and instead of calling the exe from your real installer, call the dummy setup exe (silently).

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tommy
Posts: 27
Joined: Wed Oct 23, 2013 5:36 am

Re: Run Program instead of Run Program As

Postby Tommy » Mon Nov 04, 2013 3:35 am

Hello Francesco,

1- The "Set Variable Environment" is a Windows Installer command (Purple command) and due of this and unless you use IA Native Engine, the command execution is deferred until the Apply statement is run.


After your hint I call Apply Install between Set Variable Environment and Run Program As to force the variable to be set before the new process is being spawned.

The variables are set according to the debug watch, however the result is the same the dedicated external program cannot be launched. How can I harness the Environment field of Run Program As ?

Regards,
Tommy

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run Program instead of Run Program As

Postby FrancescoT » Mon Nov 04, 2013 12:14 pm

Dear Tommy,

are you calling Run Program As from your Dummy package (... the new process)?

... I believe you didn't follow my suggestion correctly.

in sequence you need to call;

1- Set Variable Environment
2- Apply Install
3- Run Program (that runs your dummy setup package ...the one which effectively uses RUN PROGRAM AS).

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: vaibhavopkey and 76 guests