Jump to content

Recommended Posts

Posted (edited)

By default Windows 10 opens PDF files in EDGE

Question 1:
How do you check which default viewer for PDF is set in Windows?

Question 2:
How do you check where Acrobat Reader is located?

Question 3:
Do you have any working solution to change the default PDF Viewer to Acrobat Reader?

 

EDIT:
I usually find that kind of thing in Registry so ....
According to 
https://social.msdn.microsoft.com/Forums/vstudio/en-US/630ed1d9-73f1-4cc0-bc84-04f29cffc13b/what-registry-keys-are-responsible-for-file-extension-association?forum=netfxbcl
 

The key should be located somewhere here:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf
HKEY_CURRENT_USER\Software\Classes\.pdf
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.pdf
HKEY_CLASSES_ROOT\.pdf
 

But I can not find a way to check if EDGE is still default viewer.

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Hello

1:

With this you can get the program Id based in an extension

Local Const $sCLSID_ApplicationAssociationRegistration = "{591209c7-767b-42b2-9fba-44ee4615f2c7}"
Local Const $sIID_IApplicationAssociationRegistration = "{4e530b0a-e611-4c77-a3ac-9031d022281b}"
Local Const $sTagIApplicationAssociationRegistration = "QueryCurrentDefault hresult(wstr;int;int;wstr*);"
Local $oApplicationAssociationRegistration = ObjCreateInterface($sCLSID_ApplicationAssociationRegistration, $sIID_IApplicationAssociationRegistration, $sTagIApplicationAssociationRegistration)
ConsoleWrite("IsObj($oApplicationAssociationRegistration): " & IsObj($oApplicationAssociationRegistration) & @CRLF)


Local $sDefaultPDF=""
$oApplicationAssociationRegistration.QueryCurrentDefault(".pdf", 0, 1, $sDefaultPDF)
ConsoleWrite("$sDefaultPDF: " & $sDefaultPDF & @CRLF)

2:

I can see Install path here

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Adobe\Acrobat Reader\DC\InstallPath

 3:

In windows 7 It's very easy to change default App but Windows 10 It's complex. I wrote a tool (not in AutoIt) to set an App as Default You can use it as base. You can check here

 

Saludos

Edited by Danyfirex
Posted

In Windows 10 you can use:

#include <StringConstants.au3>
Opt("ExpandEnvStrings", 1)
Local $iPDFDefault, $sPDFDefaultExt = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice", "ProgId")
Local $sPDFDefaultExe = RegRead("HKCR\" & $sPDFDefaultExt & "\shell\open\command", "")
    $sPDFDefaultExe = StringRegExp($sPDFDefaultExe, '^"(.+?)"', $STR_REGEXPARRAYMATCH)[0]
ConsoleWrite("Prog ID: " & $sPDFDefaultExt & @CRLF & "Command: " & $sPDFDefaultExe & @CRLF)

Normally I use PowerShell to export file associations from a configured machine.  During image build we import them using PowerShell.  Initially we used Group Policy to import the file associations xml file, however staff weren't able to change the associations, example if they were using Adobe Acrobat rather than Adobe Reader.  If I do need to modify an extension I just export the "UserChoice" key above and use either Group Policy preferences or script to add the key to clients.  We also use the following to stop Edge from hijacking file extensions, using NoOpenWith and NoStaticDefaultVerb (see : https://www.winhelponline.com/blog/edge-hijack-pdf-htm-associations/).

Posted

Thanks to all.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 3 months later...
Posted

Are there any ways to do this without admin permissions? Writing to that portion of the registry is blocked and Ftype requires admin. I can set the default using the "Open With..." dialog, but I can't do it programmatically?

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents
Posted

@seadoggie01 You can check the way to do it in my blog (it's not programmed in AutoIt)

 

Saludos

Posted

@Danyfirex Oh! Thank you for re-pointing me there, I saw that you found a way, but jumped right over the link that explained how :D

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...