Execute command by button

I have very big problem. I have 2 hidden buttons on my form. Under 1 button I have: @Command([ToolsRunMacro]; “name_agent”). Agent is in Loyus Script. Under my 2 button I have: msg=open(“form_name”,“DisplayWindow”,“toolbar=no,directories=no,menubar=no,height=100,width=600”); - in Java Script :).

On form I have hotspot, too. Under hotspot I have 2 commends:

document.forms[0].button1.click();

document.forms[0].button2.click();

The problem is that, I click on hotspot, then first is clicking on the fisrt button. And It’s ok. But, click on the second button is doing, befor ending execute agent feom first button.

What have I to do, the command from second button execute after ending command form first button ?

P.S.

It’s important, then dialog box, which is opening after clicking on second button, gets data which are selecting by agent from first button.

Subject: Execute command by button

One way u can do this as

in on completion of agent you have to set one dummy variable

for eg. doc.agentStatus = “Completed”

onload of form check in js

if(document.forms[0].agentStatus.value = “Completed”)document.forms[0].button2.click();

Subject: RE: Execute command by button

No, it wasn’t work well. Because it click only once. When by first clicking field doesn’t set, “if” doesn’t execute.

Subject: RE: Execute command by button

If am not wrong ur requirement is

onclick of Hotspot Button below actions will fire

Button1.click - Calls some xxx Agent

button2.click - Calls some window.open in js

so u want after completion xxx agent open window.open js of button2 action am i rite

if this is the case whtever i have mentioned previous msg will work cause i have used this method in my application

Subject: RE: Execute command by button

Yes, I want after completion xxx agent open window.open js of button2 action.

I try so your case now.

Subject: Greate !

Thx! It goes very well. Wow!