Hi,
I'm trying to check if a document (IPXV_Document) is already opened in the control by a file name.
I'm intercepting the e.document.beforeRunAction for a Link annotation, getting the target document if GoToR, and trying to see if the target document is already opened.
I'm using FindDocBySrcFileName2 with Get_WinPath from IPXC_FileSpec returned from Get_Target of the IPXC_Action_Goto.
FindDocBySrcFileName2 is returning null for a document that IS opened.
Also, if FindDocBySrcFileName2 is not to be used, how do I go from IPXC_FileSpec to IAFS_File (for FindDocBySrcFile) or IAFS_Name (for FindDocBySrcFileName) ?
-ž
FindDocBySrcFileName2 returning null for opened document SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: FindDocBySrcFileName2 returning null for opened document
Hello zarkogajic,
Try using the get_DIPath method of the IPXC_FileSpec interface and then pass it to the FindDocBySrcFileName2 method with bDIPath set to true.
Also, here's how to convert string to IAFS_Name:
https://sdkhelp.pdf-xchange.com/view/PXV:IAFS_Name
Cheers,
Alex
Try using the get_DIPath method of the IPXC_FileSpec interface and then pass it to the FindDocBySrcFileName2 method with bDIPath set to true.
Also, here's how to convert string to IAFS_Name:
https://sdkhelp.pdf-xchange.com/view/PXV:IAFS_Name
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: FindDocBySrcFileName2 returning null for opened document
Hi Alex,
Thanks.
I ended up iterating over all docs in Instance and comparing my fileName with aDoc.CoreDoc.SrcInfo.ActualFileName.
That way I can look up only for documents opened in the same frame where I want the fileName to be opened.
A question though: since there is a way to open the same document multiple times (even in the same Frame): all of those Inst.FindDocBySrcXXX will return the first document found, correct?
-ž
Thanks.
I ended up iterating over all docs in Instance and comparing my fileName with aDoc.CoreDoc.SrcInfo.ActualFileName.
That way I can look up only for documents opened in the same frame where I want the fileName to be opened.
A question though: since there is a way to open the same document multiple times (even in the same Frame): all of those Inst.FindDocBySrcXXX will return the first document found, correct?
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: FindDocBySrcFileName2 returning null for opened document
Hello zarkogajic,
Nope, you can duplicate the tab - then there will be two of the same documents.
Cheers,
Alex
Nope, you can duplicate the tab - then there will be two of the same documents.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: FindDocBySrcFileName2 returning null for opened document
Yes, and Inst.FindDocBySrcXXX will find only the "first" one of them ....
-ž
-ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: FindDocBySrcFileName2 returning null for opened document SOLVED
Hello zarkogajic,
Of course, if you just need to see whether that document was already opened - that will work for you.
Cheers,
Alex
Of course, if you just need to see whether that document was already opened - that will work for you.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ