-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get filepath to the active document in a particular SumatraPDF window via SendMessage #1412
Comments
Better yet, start with the simplest thing:
When that works, this change would probably be enough:
(you don't need std::wstring because srcFileName is already of type |
Thank you. After editing (snippet below) it works now with 32bit SumatraPDF compiles at least. Will read up more on SendMessage/WM_COPYDATA and bitness next.
Also updated in gist. |
Hello @kjk, @nod5 |
@Mark-Joy the general point of SumatraPDF is a runtime.exe importing some control data not lib.dll exporting internal data that is what is supplied commercially by MuPDF and this project is heavily abused by commercial applications (reputedly selling millions of copies without SumatraPDF badging). Although I still use multi way commands together, it is via the built in internal calling methods. So although no longer using pipes with LaTeX the DDE methods they depended on have been greatly expanded since the discussion above. |
Yet there is no DDE command at Perhaps a current, fragile workaround is to set up a custom external viewer and give it a custom shortcut, based on But the overarching problem here is that @kjk seem decided on not adding features to help external tools interact with SumatraPDF in ways that add enhanced features. Such as my now defunct HighlightJump (enhanced annotations and navigation), custom toolbars, custom search of annotated text, and much more. It seems kjk prefers to implement any and all features on his own (and as a result many features are not implemented). As long as that is the case any time spent on external tools through this or that fragile workaround risk being wasted by breaking changes in any future SumatraPDF release. To change that situation there would need to be ways to output more state data (filepath, X Y position, array of annotations and their type, page and position, ...) and input more actions (navigate to a particular annotation, hide/show annotations by type, ...) and an official statement that those output/input features will persist. |
@nod5 agreed the list shows you can call ANY named commands. by supply filename, that is a viewers user functionality, the reason for SumatraPDF, however ASK current file is a totally opposing function that allows much ab-use I very much use external viewers to SEND current file to downstream but do not expect upstream to ask, only feed/supply filename your past workaround to read current file data was brilliant thinking |
@GitHubRulesOK your point is correctly applied to user's viewpoint, but not to a developer who want to extend the use of sumatraPDF to give more benefit to other users. |
@Mark-Joy |
@GitHubRulesOK |
@Mark-Joy is this familiar ? all yours for $159 discounted to only $119 they enhanced SumatraPDF newer code abilities greatly but have not open sourced those enhancements |
OMG, what software is this? |
@Mark-Joy
>The product has gained popularity due to its ease of use, intuitive interface, and robust functions for working with PDF. What’s more, it saves you time on routine tasks, working quickly and efficiently regardless of the number of pages.
...
...
|
@GitHubRulesOK I believe it's easy for them to do both of the above, right? Codewise, they already made enhancements far more complex than our some petty functionalities here. |
hmm google sells sun java based code applications and oracle owned sun java but google won ? much the same with most software it's the bigger cracked pots pays the lawyers. If you can workout how the altered code enhancements can be applied without direct copy then SumatraPDF could only improve but i think that revenue must be paying a lot of salaries. |
@GitHubRulesOK |
@Mark-Joy |
@kjk can this topic be closed as a result of DDE enhancements in 3.5 ? |
@GitHubRulesOK from what I can see at |
@nod5 |
Request: Add method for external programs to get the filepath to the active document in a particular SumatraPDF window via SendMessage.
Why: Makes it easier for external programs to interact with the document file and its related .smx annotations file.
What is already possible: If advanced setting
FullPathInTitle = true
is set then the active document's filepath can be parsed from the window title. Works, but at the cost of filename not visible to user in the window title if the path is very long.Code for illustration/discussion: Below are my two hacky attempts to add this to SumatraPDF.
1. clipboard method: Makes SumatraPDF receptive to a new message and in reaction add the active document filepath to the clipboard.
Gist with code to add to two SumatraPDF source files.
https://gist.github.com/nod5/51c906f89f6a04995f5ced920e4c909d
Tested on SumatraPDF source from 2020-01-15.
This clipboard method works quickly and reliably so far. The external program can be made to backup/restore the previous clipboard data before/after the extraction. But still, it would be better to avoid using clipboard I think.
2. wm_copydata method: Makes SumatraPDF receptive to a new message and in reaction pass the active document filepath via WM_COPYDATA
Gist with code to add to two SumatraPDF source files.
https://gist.github.com/nod5/086cd1ebbe7ed94520abae1c17646e2b
Tested on SumatraPDF source from 2020-01-15.
The wm_copydata code is not yet working! I successfully receive a message back to the external program and get correct dwData from it. Looks like cbData is correct too. But lpData turns out garbled/"asian characters". Can you spot errors in my code? (Can also be errors in my receiver code, I'll keep troubleshooting that too.)
The text was updated successfully, but these errors were encountered: