MAINDEFINE ch base.Channel CLOSE WINDOW SCREEN IF base.Application.getArgumentCount() = 0 THEN -- start 3 programs and send a vbs script to the client LET ch = base.Channel.create() CALL ch.openFile("appActivate.vbs","w") CALL ch.writeLine('strWindowTitle = WScript.Arguments(0)') CALL ch.writeLine('set WshShell = WScript.CreateObject("WScript.Shell")') CALL ch.writeLine('WshShell.AppActivate strWindowTitle') CALL ch.close() CALL FGL_PUTFILE("appActivate.vbs","appActivate.vbs") RUN "fglrun appActivate aaa" WITHOUT WAITING RUN "fglrun appActivate bbb" WITHOUT WAITING RUN "fglrun appActivate ccc" WITHOUT WAITING ELSE -- open program that has 3 buttons that call vbscript to change the window/program with focus OPEN WINDOW w WITH FORM "appActivate" ATTRIBUTES(TEXT=base.Application.getargument(1)) MENU "" ON ACTION aaa CALL appactivate("aaa") ON ACTION bbb CALL appactivate("bbb") ON ACTION ccc CALL appactivate("ccc") ON ACTION calculator -- Calculator has to be running CALL appactivate("Calculator") ON ACTION close EXIT MENU END MENU END IFEND MAIN FUNCTION appactivate(window)DEFINE window STRINGDEFINE command STRINGDEFINE result INTEGER LET command = SFMT("appActivate.vbs %1", window) CALL ui.Interface.FrontCall("standard","shellexec",command,result)END FUNCTION
LAYOUT (MINHEIGHT=15)GRID{Click on button to make window active}ENDEND