..... if "adobe"$LOWER(lcWinText) and hclass="#32770" ?'ERROR' oShell = CreateObject("WScript.Shell") IF oShell.AppActivate("Adobe Reader") oShell.SendKeys("{ENTER}") endif oShell=.null. exit endif .....>Thanks! This allows me to identify when an error occurs. Now another questin I have is it possible to programically close this error window put up by acrobat?
>>#DEFINE GW_HWNDLAST 1 >>#DEFINE GW_HWNDNEXT 2 >>#DEFINE GW_CHILD 5 >> >>DECLARE INTEGER GetDesktopWindow IN user32 >>DECLARE INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlag >>DECLARE INTEGER GetWindowText IN user32 INTEGER hwnd,; >> STRING @lpString, INTEGER cch >>DECLARE INTEGER GetClassName IN Win32Api INTEGER, STRING, INTEGER >> >>hWindow = GetDesktopWindow() >>hWindow = GetWindow(hWindow,GW_CHILD) >> >>DO WHILE hWindow <> GetWindow(hWindow, GW_HWNDLAST) >> hWindow = GetWindow(hWindow , GW_HWNDNEXT) >> lcWinText =iGetWinText(hWindow) >> hclass = SPACE(80) >> nlen = getclassname(hWindow, @hclass, 80) >> hclass = LEFT(ALLT(hclass),nlen) >> >> if "adobe"$LOWER(lcWinText) and hclass="#32770" >> ?'ERROR' >> exit >> endif >>ENDDO >> >> >>RETURN >>*--------------------------------------------------------------- >>FUNCTION iGetWinText(hWindow) >> LOCAL lnBufsize, lcBuffer >> lnBufsize = 1024 >> lcBuffer = Repli(Chr(0), lnBufsize) >> lnBufsize = GetWindowText(hWindow, @lcBuffer, lnBufsize) >>RETURN Iif(lnBufsize=0, "", Left(lcBuffer,lnBufsize)) >> >>>>
>>>.... if this is the first document then the following >>>Declare Integer ShellExecute ; >>> IN SHELL32.Dll ; >>> INTEGER nWinHandle,; >>> STRING cOperation,; >>> STRING cFileName,; >>> STRING cParameters,; >>> STRING cDirectory,; >>> INTEGER nShowWindow >>> >>>ShellExecute(0, "open", "acrord32.exe", " /p /h "+lcFile, "", 0) >>>... >>>...subsequent documents the following code >>> >>>ShellExecute(0,"print", lcFile,"","",0) >>> >>>>>>