Even if the windows is visible you can call win.show(). I use the folowing script to ShowOrRun a program.
args request, pgm
local hWnd= Win.Handle(request)
if ( win.exists(hwnd) == 1 ) do
win.show(hwnd)
elseif ( pgm != "" )
file.runwait(0,pgm)
endif
If you wnt to detect minimized windows, you can use win.minned or
win.trayminned.
