parameter cwmyapptit, cwmyappexe, cwkeysto set escape on if parameter()=0 cwmyapptit = "Coloque aqui o caption da outra aplicação" cwmyappexe = "C:\appl_transfer\Transf.exe" cwkeysto = chr(13)+"depois de um enter e após umTAB"+chr(09)+"depois de um TAB.."+chr(13)+chr(09) endif cwthiscap = _screen.caption * =go_declare() * oShell = CREATEOBJECT("WScript.Shell") * if file(cwmyappexe) nhandler = ais_running(cwmyapptit) if nhandler = 0 RUN /N &cwmyappexe =Sleep(800) endif else wait window nowait "Aplicativo "+cwmyappexe+" inexistente !!" return endif = Sleep(100) do while !empty(cwkeysto) cwkey = substr(cwkeysto,1,1) oShell.SendKeys(cwkey) cwkeysto = stuff(cwkeysto,1,1,"") if empty(cwkeysto) else if stuff(cwkeysto,1,1,"") = chr(13) = Sleep(400) && Pause VFP for a 1/10 of a second else = Sleep(100) && Pause VFP for a 1/10 of a second endif endif enddo ** neste programa ele ainda aguarda o fim do outro aplicativo * do aguarda_assistente with cwmyapptit, cwmyappexe, cwkeysto 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 0 ENDFUNC FUNCTION go_declare 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 returnClaudio