albertmaathuis Posted February 15, 2013 Share Posted February 15, 2013 Hi, I would like to know if it is possible to retrieve the name and the full path of an adobe PDF document which is actually opened. _Wingettitle() gives me the full name (test.pdf), but i would like to know what the location (C:\documents\) of the document is. Adobe 10 doen't display it in the windowtitle, but it is there in te properties tab (file-properties-location) I searched the forums, but I can only find a way to retrieve the path of the Adobe application(and that is not what I'm looking for) Any ideas? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2013 Moderators Share Posted February 15, 2013 albertmaathuis, Do you not have a path to open the PDF file in the first place? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 Yes and No, Of course I have opened the PDF docs in the first place, but i open e.g 10 PDF's from differt locations. After that I am going to manipulate one ore more PDF's (add other PDF or overlay with watermark and so on) For saving the document in the right place I would like to know its first name and location, verify if its the right one and then save it with a different name on the same location. Link to comment Share on other sites More sharing options...
guinness Posted February 15, 2013 Share Posted February 15, 2013 Maybe _PathSplit? _PathSplit UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 _Pathsplit would be nice if I knew the path. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2013 Moderators Share Posted February 15, 2013 albertmaathuis,But you have just told us that you do! Of course I have opened the PDF docs in the first place, but i open e.g 10 PDF's from differt locationsSo save those locations in an array which you can then access later:For saving the document in the right place I would like to know its first name and locationYou pull the location of that first PDF from the array and use _PathSplit to extract the data. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted February 15, 2013 Share Posted February 15, 2013 (edited) File menu, properties (ctrl d, or WinMenuSelectItem): Location. Edited February 15, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 I'm sorry perhaps I didn't explain it clearly. I open the PDF e.g by double clicing on the document, or I have made the pdf from word or excel by saving it to a PDF printer. So the PDF's are opened and on the desktop. Then I start my program, and I attach to lets say PDF document number3 The program sets an overlay (e.g. a logo) on PDF document3 and then saves it on the original location (which i do not know) under a differnt name. If the PDF's wher openend from within autoit, then there would be no problem. Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 Hello Jdelaney, Thats correct, i can see the location is there, but how can I get it into a variable? Link to comment Share on other sites More sharing options...
jdelaney Posted February 15, 2013 Share Posted February 15, 2013 Use the autoit info tool. I believe that window should be stagnant, so you can get the control's handle by instance (use the controlNN, examples are present). Help file for: ControlGetHandle, and ControlGetText IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 I tried it on my PDF document, but it only gives me the name of the document, not the location. It also gives me the handle of the window and the class, and two handles of controls, but ther is nothing to see as location Link to comment Share on other sites More sharing options...
jdelaney Posted February 15, 2013 Share Posted February 15, 2013 (edited) you have to show us what you are working with (your script: only the part about manipulating the properties window), so we can help. Edited February 15, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 Ok, I will post it tomorrow. Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 15, 2013 Author Share Posted February 15, 2013 Here is part of the script I'm working on. Open a PDF document and a Word document, than run the script (no need to make an executable, just run it in the scite editor) Running the script will show from the PDF document only the name and from the word document the path name I realize that the PDF part is different from the word part, but that is the reason for this post. ;Open a PDF document by double click or start adobe reader and open a PDF document ;Running this script will only show the title (=name) of then PDF document $handle = WinGetHandle("test.pdf", "") msgbox(0,"handle=",$handle) $test = WinGetTitle($handle) msgbox(0,"windowtitle=",$test) ;this is the way it works with Microsoft Word ;Open a word document and run the script $oWord = ObjGet("","Word.Application") $oDocs = $oWord.Documents $wordaanwezig=0 For $o In $oDocs msgbox(0,"Pathname=",$o.Path) msgbox(0,"Fullname=",$o.FullName) Next Link to comment Share on other sites More sharing options...
jdelaney Posted February 15, 2013 Share Posted February 15, 2013 (edited) Not sure what your question is...if you can't find the pdf handle, use something like this (loop through the array, and grab the handle you need) #include <Array.au3> $aPDF = WinList("[Class:AcrobatSDIWindow]") _ArrayDisplay($aPDF) Edited February 15, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 16, 2013 Author Share Posted February 16, 2013 Tried, but it only gives me the handle of the active PDF document (with the name) and the handle of adobe reader.Not the filepath, and with the handles I cann't find the path of the active document.I was hoping there would be something simular as in the word environment:Something like:$oPDF = ObjGet("","[Class:AcrobatSDIWindow]")$oPDFs = $oPDF.DocumentsFor $o In $oPDFs msgbox(0,"Pathname=",$o.Path) msgbox(0,"Fullname=",$o.FullName)NextBut this gives me an error on "documents" ( Variable must be of type object)Perhaps the line $oPDF.Documents is not document, but something else...? Searching the internet I found something which doesn't make me happy.http://forums.adobe.com/message/1161198#1161198So I think it is not possible to extract the path in a simple way. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2013 Moderators Share Posted February 16, 2013 albertmaathuis, Just look at the list of recently opened files in the Registry. This code works for my Acrobat Reader - just substitute the relevant location for your Adobe version: ; Set the location Local $sReg = "HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\7.0\AVGeneral\cRecentFiles" ; Extract the recent file keys For $i = 1 To 100 Local $sKey = RegEnumKey($sReg, $i) If @error <> 0 Then ; No more keys ExitLoop Else ; Read the key - it is stored in binary so convert it Local $sVal = BinaryToString(RegRead($sReg & "\" & $sKey, "tDIText")) MsgBox(4096, $i, $sVal) EndIf Next That should get you what you need. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
albertmaathuis Posted February 16, 2013 Author Share Posted February 16, 2013 Hi M23, That works indeed, it gives me the path and the filename. Thanks a lot, now I can go on with my program. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2013 Moderators Share Posted February 16, 2013 albertmaathuis, Glad I could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now