Determine the path of an open file
Moderators: JRL, Dorian (MJT support)
Determine the path of an open file
Any ideas on how to determine the path of an open file? I can get the filename from the window; however, I would like path to the open file so I can move and rename it. In most cases I could just save the file to another location, however, I am using Acrobat Reader, not the full version so I cannot save it. The file will not always be opened from the same folder. For instance, it could be in My Documents or the temp folder.
Re: Determine the path of an open file
Hi kpassaur,kpassaur wrote:Any ideas on how to determine the path of an open file? I can get the filename from the window; however, I would like path to the open file so I can move and rename it. In most cases I could just save the file to another location, however, I am using Acrobat Reader, not the full version so I cannot save it. The file will not always be opened from the same folder. For instance, it could be in My Documents or the temp folder.
If I understand your question correctly couldn't use the Adobe Reader command "Save a Copy" without anything futher?
In any event, this should do the trick:
//Tested using Adobe Reader 7.05
Let>MSG_WIDTH=640
Let>MSG_HEIGHT=400
SetFocus>Adobe Reader*
Press CTRL
Send>d
Release CTRL
WaitReady>0
GetWindowText>Document Properties,PDFiNFO
PutClipBoard>%PDFiNFO%
Press ESC
Position>Location:,%PDFiNFO%,1,ps
Let>ps=ps+11
Position>File Size:,%PDFiNFO%,1,pe
Let>pe=%pe%-%ps%
Let>pe=%pe%-2
MidStr>%PDFiNFO%,ps,pe,thePath
Position>File:,%PDFiNFO%,1,fnStartTmp
Let>fnStart=fnStartTmp+7
Position>Title:,%PDFiNFO%,1,fnEnd
Let>theFileLength=%fnEnd%-%fnStart%
Let>theFileLength=%theFileLength%-2
MidStr>%PDFiNFO%,fnStart,theFileLength,theFile
Let>aaa=This is the path to the file:%CRLF%%CRLF%%thePath%%CRLF%%CRLF%%CRLF%
Let>bbb=This is the filename:%CRLF%%CRLF%%theFile%%CRLF%%CRLF%%CRLF%
Let>ccc=This is the fully qualified path:%CRLF%%CRLF%%thePath%%TheFile%
MessageModal>%aaa%%bbb%%ccc%
Best Wishes,
Monkster
Monkster