PDA

View Full Version : Lua script action is not executed via DoAction on button click


psulek
05-13-2008, 09:21 AM
I have custom action called SetupSummary whic is run lua script. On this action there is no timing set.

On dialog WelcomeScreen on button Next, in Published Events i add event DoAction with argument set to SetupSummary (name of custom action) and place it at first place before NewDialog event.

Now i wait that lua script is executed when i press Next, but script is not executed.

When i do same as above but custom action is Run Executable and run for example notepad.exe everything works like a charm and notepad is opened after i press Next button.

Can you confirm that this behavior is a bug, or explain to me how to execute custom action of type Run LuaScript on button click?

psulek
05-13-2008, 02:07 PM
I test same scenario in custom action but for VB Script, and its working OK.

This is the testing VB Script:
MsgBox "Hello from VB Script ", vbCritical, "Test"

but custom action of type Run LuaScript does not executed.

Any help will be appreciated.

Lorne
05-13-2008, 02:18 PM
What are the contents of the Lua script file you're running?

(Note: it needs to contain a valid Lua script, not VB commands -- Lua is an interpreted scripting language with a different syntax from VB.)

Adam
05-13-2008, 02:20 PM
I was able to get this working with a simple hello world lua script:


Dialog.Message("","Hello world");


So this makes me think the issue is with your Lua script. What is included in the script? It could be being launched but an error occurs so it appears to not launch?

Adam Kapilik

psulek
05-13-2008, 03:31 PM
I have a valid LUA script, not VB. I just wrote that if i have valid VB script, then it is working, but executing valid LUA script in Run LuaScript does not works for me.

Se attached demo, a try to help me out where is the problem, pls.
6479

Lorne
05-13-2008, 05:08 PM
There is no DoAction event published on the Next button on your Welcome dialog. All I see there is the original NewDialog event. (See the attached screenshot.)

I added a DoAction with EXEC_LUA as the argument to the Next button in your project and it worked -- I got the "Hello World" dialog when I clicked Next.

psulek
05-14-2008, 12:43 AM
In my posted example, i havent event on Next button on Welcome dialog but on second dialog LicenseAgreementDlg have placed new button Exec LUA and there is event DoAction. And this is not executed. Sorry for missunderstanding.

But i think there is an bug.
Check my updated example 6482.

When i set DoAction on Next button on first dialog in First Install sequence (WelcomeDlg) to execute lua script, then this script is executed and all other lua scripts on other dialogs are also executed, like in my example on second dialog on button Exec LUA. But when first dialog does not execute any lua script, or have condition 0 (which does not execute lua script also) then executions of others lua scripts on other than first dialog are not functional.

See my example, on WelcomeDlg, Next button, there is DoAction, but have condition 0, on second LicenseAgreementDlg, there is Exec LUA button which have DoAction. When you build and run this setup, no lua script is executed. Now try change condition to 1 of DoAction on WelcomeDlg, build and run and you will see that lua script is executed on Next button click on first dialog, but also click on Exec LUA is also executed.

Can you confirm, that is bug, or am i still doing something wrong? :huh

psulek
05-14-2008, 03:40 AM
I found workaround for this :yes, but i think its definitely bug.
When i generate WIX files, in file msifactui.wxs i found within button element this sub element (which is probably auto-generated by MSI Factory):
<Publish Property="RUNLUAFILE" Value="lua1.lua">1</Publish> on first occurrence of running lua script (on button click in first dialog), but on next occurrences of executing lua script on published events with DoAction, there is missing such element, and this it is not executed.

When i manually add published evet to create property with name RUNLUAFILE and value set to file name of lua script(without path) e.g. lua1.lua and place this published property at first place before DoAction event, then everything is ok and lua script is executed.

Another hint is that, if you want to execute lua script action e.g. EXEC_LUA1 (which is in file lua1.lua) in first dialog, and in second dialog want to execute another lua script action e.g. EXEC_LUA2 (which is in another file lua2.lua) then each published property RUNLUAFILE must have different value for file (lua1.lua for this published property, lua2.lua for second published property)

Can you confirm this? I can work with this workaround, but if it is bug, that this could be fixed quickly i think.

Lorne
05-14-2008, 10:35 AM
A condition of 0 evaluates to false, and will not be performed. (Note that the RUNFLUAFILE property's condition matches that of the DoAction event.)

I believe the RUNLUAFILE property tells the LuaScript.dll what file to execute. I don't know why it isn't being added for both controls...it does look like a bug.

For example, if you set up a second Run LuaScript custom action to run a different lua file, no RUNLUAFILE property is added before its DoAction event either.

I've logged it for investigation. REF: 17412