Are you testing search.available before trying to use it?
Actually no, because I'm new to java scripts and new to Adobe, so this topic just popped out out of nowhere.
Could you please elaborate how to use it?
If I use the exact path for the file (/C/etc/) it works just fine...
I'll take a look at it stat,
Yea, tell me about it, still in the mean time if anyone would have any suggestions on the matter I would be very grateful
Ok, I tried:
In the console in Acrobat it gave me true, but nothing in Reader upon clicking on the link.
However as I mentioned before after giving an exact path it works just fine.
The Cucumber example worked both in AA and AR
You should use search.available in the script itself, so you can deal gracefully with the case where search isn't available. Sorry, if search turns out to be available in Reader, I've no idea why this would even work in the first place, there's no mention of .. being valid in the DIPath or relative paths working in the document. It's easy to assume it would be relative to the file, but I see it as being relative to the current directory, whatever that might be.
Ok, I've found it written down (but not in the Acrobat document) that relative paths are anchored from the current document in all cases. If that's right, and if search is indeed available, AND if it isn't trying to use a restricted path like the root directory of a disk, then I've no idea, sorry.
Thanks to your suggestion I started digging into the directories, so here's what's funny:
Title Page - main folder
Page 1 - sub folder
Searched PDFs - sub sub folder
I open the Title Page, then using a bookmark I open a new file in the same window: Page 1. There i have site links that allow me to perform search.query()
And now to the funny part:
If I open the "Title Page" and from there go to Page 1 my directory has to be:
../Main Folder/Sub Folder/Sub Sub Folder
to perform the required search
However If I open the "Page 1" manually my directory for the same java script has to be:
../Sub Folder/Sub Sub Folder
otherwise I get an error.
Both don't seem to work in Reader....
One more check: when you say Reader is it the Adobe Reader window? Not a browser window?
It's an Adobe Reader Window
So regarding my previous post:
How do I extract the exact file location from the file itself?
1 person found this helpful
this.path returns the file's full path.
I started using it and it is very helpful, thanks for mentioning it, I was able to solve some of my other problems.
But still as you mentioned - I get a full file path:
And I only need to get to the catalogue :/ Can't figure out a way to get only the directory and use it further on in my search.query
1 person found this helpful
Manipulating strings containing folder paths is simple, you just split the string using the folder delineator (in this case "/").
if path = "/C/Myfolder/Subfolder/MyFile.pdf" then path.substring(0, path.lastIndexOf('/')) = "/C/Myfolder/Subfolder"
And if you only want "Subfolder", then you can use something like this:
var fileNameParts = this.path.split("/");
var parentFolder = fileNameParts[fileNameParts.length-2];
It finally worked...I tried it out on other PC's and it worked...
Thanks for your support guys