I have a program that searches for AcroRd32.exe on the user's computer, then it is to go to a network drive and open a pdf. Problem is, AcroRd32.exe is not in the same directory on every one's computers. Somertimes it's in the root of c, other times in program files, etc. When the program is run, it finds the file to open, but takes a long time to open it because it searches for Adobe too long. Below is the code we are using. If anyone can offer insight on how we can get it to open faster, please advise! Thank you!
LOCAL lCmd$
GetShortPathName lFilePath$ & CHR$(0), lOpenFile, SIZEOF (lOpenFile)
REPLACE ".pdf" WITH "" IN lFilePath$
lFilePath$=lFilePath$+".pdf"
lOpenFile=$DQ+lFilePath$+$DQ
gfType="AcroRD32.exe"
gStartPath="C:\"
StartAction
lAdobePath$=gPath$+"AcroRD32.exe"
CLOSE
ERRCLEAR
OPEN gPath$+"AcroRD32.exe" FOR INPUT AS #1
IF ERR THEN
MSGBOX "Adobe is NOT Installed! Contact IT!", %MB_ICONINFORMATION OR %MB_OK,"Adobe Reader"
END IF
CLOSE
lCmd$=gPath$+"Acrord32.exe "+lOpenFile
lResult&=SHELL(lCmd$,1)
IF lResult&=0 THEN
gAns&=EZ_Msgbox("OI","PDF ERROR!!! The PDF is missing! You can not proceed!"+$LF+lOpenFile+"{S}","Find PDF","OK")
END IF
EZ_UnloadForm "SPLASH"
CLOSE #100
EXIT SUB
LOCAL lCmd$
GetShortPathName lFilePath$ & CHR$(0), lOpenFile, SIZEOF (lOpenFile)
REPLACE ".pdf" WITH "" IN lFilePath$
lFilePath$=lFilePath$+".pdf"
lOpenFile=$DQ+lFilePath$+$DQ
gfType="AcroRD32.exe"
gStartPath="C:\"
StartAction
lAdobePath$=gPath$+"AcroRD32.exe"
CLOSE
ERRCLEAR
OPEN gPath$+"AcroRD32.exe" FOR INPUT AS #1
IF ERR THEN
MSGBOX "Adobe is NOT Installed! Contact IT!", %MB_ICONINFORMATION OR %MB_OK,"Adobe Reader"
END IF
CLOSE
lCmd$=gPath$+"Acrord32.exe "+lOpenFile
lResult&=SHELL(lCmd$,1)
IF lResult&=0 THEN
gAns&=EZ_Msgbox("OI","PDF ERROR!!! The PDF is missing! You can not proceed!"+$LF+lOpenFile+"{S}","Find PDF","OK")
END IF
EZ_UnloadForm "SPLASH"
CLOSE #100
EXIT SUB
Comment