Author Topic: Open a pdf document issue  (Read 256 times)

Polaris

  • Newbie
  • *
  • Posts: 15
Open a pdf document issue
« on: September 27, 2024, 08:42:22 PM »
So sorry for such a trivial question but whatever I do I can not get VA to open pdf documents.
With a previous version and on windows 10 no issues.
With windows 11 everything works but opening targeted pdfs.
It just hangs the pdf  software for some reason without opening the desired document to the extent I need to stop the PDF windows process for pdf to work.
Adobe pdf reader.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #1 on: September 28, 2024, 03:46:21 AM »
But if you double-click a .pdf file, it does open correctly?

VoiceAttack is using standard Windows API methods to instruct Windows to open a file, which Windows will do using the handler assigned to it.


If you try opening a .pdf file using the "Run" dialog (Win+R on your keyboard), does the same issue occur?

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #2 on: September 28, 2024, 03:55:23 AM »
WIN + R works without issues.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #3 on: September 28, 2024, 03:57:56 AM »
Is VoiceAttack running as administrator? If so, does the issue still occur when it isn't?

Is the .pdf file you're attempting to open on a local drive?

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #4 on: September 28, 2024, 04:06:27 AM »
Administrator - check
Local drive - check
no change.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #5 on: September 28, 2024, 04:08:36 AM »
If you use the path to the file as an argument for the executable, does that work?

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #6 on: September 28, 2024, 04:16:15 AM »
This question I don’t understand.
The VA command use Other>Windows>Run an Application and you need to insert the full path to the PDF, including the pdf itself.
That’s how it had worked for me in the past and how I execute needed .exe files.
The issue is with .pdf files.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #7 on: September 28, 2024, 04:24:08 AM »
In the configuration of your "Run an Application" action, input the path to your PDF reader application's executable in the first field, then input the path to the PDF file in the "With these parameters" field, wrapped in double quotes, E.G.
Code: [Select]
"C:\path to my.pdf"

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #8 on: September 28, 2024, 04:35:00 AM »
A no go

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #9 on: September 28, 2024, 04:37:47 AM »
Do you have a screenshot of the configuration window of your "Run an Application" action? Just wanting to check what settings you're using

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #10 on: September 28, 2024, 05:12:59 AM »
Attached as requested.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #11 on: September 28, 2024, 05:18:50 AM »
There's no logical reason that comes to mind why that shouldn't work.

If you open the Windows Settings app, on the left-hand side choose "Apps", then in the center choose "Default Apps", in the "Enter a file or link type" input ".pdf", I assume the Adobe application is currently assigned as the default.

If you click the current default assignment, a dialog window should open allowing you to select a different application. If you select another application capable of opening .pdf files, E.G. a web browser, and try the VoiceAttack command again, does that application open without issue?

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #12 on: September 28, 2024, 05:44:12 AM »
Did something else…
Wiped out Adobe reader from my system…works like a charm.
Will try to make a clean Adobe reader install later and will report back.
Interesting.
Thanks for your help thus far !!!

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #13 on: September 28, 2024, 07:33:09 AM »
Status update…
Reinstalled Adobe Reader and checked it’s windows default for pdf.
Same issue: doesn’t open file and hangs the reader till process stopped through windows.
2 notes:
1. VA can open the file when the Adobe reader is already open.
2. I have a basic .bat file that opens a specific .pdf file without an issue when the app is clised.

I think there’s an issue with current VA version and current Adobe Reader version that prevents activating the adobe reader .exe file through VA.
It never happened, for me, in previous versions of VA, Adobe Reader and Windows.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #14 on: September 28, 2024, 07:35:30 AM »
If you use the "Run an Application" action to start Adobe Reader directly, without opening a file, does it hang then?

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #15 on: September 28, 2024, 07:44:33 AM »
Yes

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #16 on: September 28, 2024, 07:56:55 AM »
If you create an inline function ("Other >", "Advanced", "Execute an Inline Function", "C# Code") with these contents:
Code: [Select]
using System.Diagnostics;

public class VAInline
{
public void main()
{
Process p = new Process();
p.StartInfo.UseShellExecute = true;
p.StartInfo.FileName = @"C:\path to my.pdf";
p.Start();
}
}
changing the path to the PDF to one you're trying to open, or Adobe Reader, making sure not to modify anything outside the double quotes

Does the same issue occur?

This inline function will call basically the exact same API method VoiceAttack would use internally.


You can just overwrite the example in the inline function editor with what's in the "code" block above. You can use the "Test Run" button to execute it without needing to save the command, if you'd prefer.

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #17 on: September 28, 2024, 08:20:57 AM »
Same result.
Hanging when app is closed and working when open.
VA notified compiled suucessfuly without result.
What happens in Window i an opening of another Adobe Reader process that hangs the whole app without making it open the app.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 280
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Open a pdf document issue
« Reply #18 on: September 28, 2024, 01:57:39 PM »
What if you kill any active Adobe Reader process first, then as soon as it is closed, launch that inline function (or action to open the .pdf with Adobe)? (edit: forget this, edited and striked out - I re-read some of the posts here, and similar issues on stack overflow, I think I understand what might be happening...)

As a path format test, you should copy the .pdf file to the following literal path, and then try both the VoiceAttack 'Run an Application' action as well as Pfeil's inline function test above.

(test path - create this folder, copy pdf to it)
Code: [Select]
D:\test_folder\KTO_AIP.pdf
(and as a control, if you are so inclined)
Code: [Select]
D:\test folder\KTO_AIP.pdf
note the presence of a space in the path in the control, and use of underscore in the test path


This should uncover any formatting issues with the Adobe program and the path to the file to be opened, or rule them out as a likely potential culprit (which it is imho presently).

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #19 on: September 29, 2024, 12:51:59 PM »
A no go.
Did exactly as requested.
Do remember: the problem is not with the file's path for it can open the file when the app is already open as mentioned before.
The problem is either the way VA activates certain .exe programs or the way Adobe protects its .exe files.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: Open a pdf document issue
« Reply #20 on: September 29, 2024, 08:32:37 PM »
As Pfeil had mentioned, VA is using boilerplate basic .NET calls to launch applications.  It's been using this same code for almost a decade and a half, with little change (as there's no real need to change, there's no magic in launching executables).

When VoiceAttack launches an executable, the executable will run under the same security context as VoiceAttack (that would be current user if 'Administrator' or another user are not specified).  Have you tried any other PDFs?  Have you tried copying that particular PDF into, say, %APPDATA%/VoiceAttack  and launching with Acrobat Reader as the default app (just throwing a folder out there that I'm pretty sure VA has rights to)?

I went ahead and installed Adobe Reader to make sure I wasn't unaware of some weird situation that may suddenly exist.  I created a command that launched the PDF directly, so it would launch with Acrobat Reader as the default.  This worked without issue, as I had expected.  I will point out that not only did Acrobat Reader take (imho) a relative eternity to install, I had to tell the site probably five different times to NOT also install McAffee.  You'll want to make sure that McAfee didn't ride along with your installation and possibly be buggering things up (just something I would check - longshot, but you never know - and, yes - I did go into control panel to make sure McAfee didn't get slipped in o_O).  I will be uninstalling Acrobat Reader immediately lol.

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #21 on: September 29, 2024, 11:37:19 PM »
I appreciate your input.
Whatever the culprit is or at the issue remains for my system.
Glad to say no MacAfee  ;)

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 280
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Open a pdf document issue
« Reply #22 on: September 30, 2024, 02:44:18 PM »
A no go.
Did exactly as requested.
Do remember: the problem is not with the file's path for it can open the file when the app is already open as mentioned before.
The problem is either the way VA activates certain .exe programs or the way Adobe protects its .exe files.

If it can open the file when the Adobe Reader application is already opened, wouldn't then the solution be to ensure Adobe Reader is always open in the background?  Is that possible?

Also, this raises an eyebrow for me:
This question I don’t understand.
The VA command use Other>Windows>Run an Application and you need to insert the full path to the PDF, including the pdf itself.
That’s how it had worked for me in the past and how I execute needed .exe files.
The issue is with .pdf files.

Are you saying that opening PDF's like this in the past worked, similar to executing (non-Adobe) .exe and such?

If so, it might be smart to run the Microsoft File System Checker (with DISM steps) to see if there may be something amiss with the Windows OS - like if this worked before, and something changed, it could be the OS or some update or file system failure... could equally be the Adobe program and updates to how it functions, if it worked before like this but not now.  Worth checking the OS first, smart to do every so often regardless of any issues whatsoever.

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #23 on: September 30, 2024, 03:29:40 PM »
A no go.
Did exactly as requested.
Do remember: the problem is not with the file's path for it can open the file when the app is already open as mentioned before.
The problem is either the way VA activates certain .exe programs or the way Adobe protects its .exe files.

If it can open the file when the Adobe Reader application is already opened, wouldn't then the solution be to ensure Adobe Reader is always open in the background?  Is that possible?

Also, this raises an eyebrow for me:
This question I don’t understand.
The VA command use Other>Windows>Run an Application and you need to insert the full path to the PDF, including the pdf itself.
That’s how it had worked for me in the past and how I execute needed .exe files.
The issue is with .pdf files.

Are you saying that opening PDF's like this in the past worked, similar to executing (non-Adobe) .exe and such?

If so, it might be smart to run the Microsoft File System Checker (with DISM steps) to see if there may be something amiss with the Windows OS - like if this worked before, and something changed, it could be the OS or some update or file system failure... could equally be the Adobe program and updates to how it functions, if it worked before like this but not now.  Worth checking the OS first, smart to do every so often regardless of any issues whatsoever.

1. Adobe acrobat is a resources demanding program which I wish to use only when needed and not always.
2. I used VA with a different system a few months back with Windows 10.
Current system is totally new, runs Windows 11 and uses updated versions of both VA and Adobe PDF reader.
Some commands in the VA profile were used to open PDFs and had no issues.
Using the same method doesn't work and only with Adobe.
Deleting and installing Adobe reader changed nothing and the PC has no issues and its age is still measured in weeks :)

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 280
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Open a pdf document issue
« Reply #24 on: October 01, 2024, 01:46:17 PM »
Have you considered using a different PDF reader, even for a test?  Personally, I stopped using Adobe Reader for a number of reasons years ago, and since then have used Foxit Reader instead.

It would be nice to discover what the issue is with Adobe in Windows 11, but it might be time to investigate workarounds such as trying a different reader program.

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #25 on: October 01, 2024, 06:09:04 PM »
The file opens without Adobe Reader.
The issue is with that specific app and not with the extension itself (.pdf).

Polaris

  • Newbie
  • *
  • Posts: 15
Re: Open a pdf document issue
« Reply #26 on: October 01, 2024, 07:50:44 PM »
Update.
Issue solved.
Cause: Adobe Reader’s protection.
Solution:
Open Adobe Reader >
Menu > Preferences > Security (Enhanced) >
Uncheck “Enable Protected Mode at startup”

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Open a pdf document issue
« Reply #27 on: October 02, 2024, 02:49:26 AM »
Great that you found the cause!

It does seem there's a bug in their "protection" though, unless making the entire application freeze is somehow the intent ("Keep absolutely still! Its vision is based on movement").