Declare Sleep IN Win32API; INTEGER dwMilliseconds Declare INTEGER GetActiveWindow ; IN Win32API Declare INTEGER GetWindow IN Win32API ; INTEGER HWND, INTEGER nType Declare INTEGER GetWindowText IN Win32API ; INTEGER HWND, STRING @cText, INTEGER nType Declare INTEGER BringWindowToTop IN Win32API ; INTEGER HWND Declare integer SetActiveWindow in user32.dll ; integer hwnd oShell = CREATEOBJECT("WScript.Shell") nhandler = 0 ntetivas = 0 * Do while nhandler = 0 .and. ntetivas < 99 nhandler = ais_running("My form caption") ntetivas = ntetivas + 1 Enddo * is running, so activate it If nhandler = 0 * application not running, run it Else BringWindowToTop(nhandler) Wait window "Activating windows.. Wait !!" nowait SetActiveWindow(nhandler) Endif return Function ais_running * check if a given application is running Lparameter ctitle * hnext = GetActiveWindow() * * iterate through the open windows Do WHILE hnext<>0 cText = REPLICATE(CHR(0),80) GetWindowText(hnext,@cText,80) && get window title If UPPER(ALLTRIM(ctitle)) $ UPPER(cText) * Return hnext Endif hnext = GetWindow(hnext,2) && next window Enddo * required window not found Return 0Claudio