Jump to content

Register file type .au3 for PSPad to start by double click


Recommended Posts

I am looking for information on how to register the file extension ".au3" so that this file can be double clicked to open with PSPad. NOT searched for is registering for the "Open with" context menu of Windows Explorer! :P

In PSPad4AutoIt3, the user should be given a way to register .au3 files for PSPad in the Improvement Kit settings. In PSPad's own settings this possibility already exists, but it is general (PSPad can be used for over 200 programming languages) and quite hidden. In the ImpKit I want to provide the user with a simple setting option, specialized for ".au3" and ".ppr" (PSPad Project) files.

The registry has always been a mystery and since 64 bit Windows has become popular, there are even more pitfalls. Searches in the INet have brought to the topic "file type register", "file extension with program link", etc. unspeakably many hits. After I tried "all" ;), came the disillusionment. Most are simply no longer valid on Win 10 and simply do not work. Also solutions with "ASSOC" and "FTYPE" do not work reliably. Therefore I decided to find out the needed entries in the registry and enter them with my script as soon as the user gives the OK.

What I found out:

There are several places in the registry, some of them have different programs entered to open the file type. So I don't know for sure which ones are actually needed to reliably register a file extension. I had the impression during tests on Win 10 that the first pair of entries were sufficient (colored blue).

Spoiler

"HKEY_CLASSES_ROOT\.au3\" => (Standard), REG_SZ, au3file
"HKEY_CLASSES_ROOT\au3file\Shell\Open\Command\" => "Path to the Prog, with which AU3s are opened" "%1"

"HKEY_CURRENT_USER\Software\Classes\.au3" => (Standard), REG_SZ, au3file
"HKEY_CURRENT_USER\Software\Classes\au3file\Shell\Open\Command\" => "Path to the Prog, with which AU3s are opened" "%1"

"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.au3\" => (Standard), REG_SZ, au3file
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\au3file\Shell\Open\Command\" => "Path to the Prog, with which AU3s are opened" "%1"

"HKEY_USERS\S-1-5-21-3283306847-3230872699-3813378835-1001\Software\Classes\.au3\" => (Standard), REG_SZ, au3file
"HKEY_USERS\S-1-5-21-3283306847-3230872699-3813378835-1001\Software\Classes\au3file\" => "Path to the Prog, with which AU3s are opened" "%1"

"HKEY_USERS\S-1-5-21-3283306847-3230872699-3813378835-1001_Classes\.au3\" => (Standard), REG_SZ, au3file
"HKEY_USERS\S-1-5-21-3283306847-3230872699-3813378835-1001_Classes\au3file\Shell\Open\Command" => "Path to the Prog, with which AU3s are opened" "%1"

The following entries are IMHO not relevant:

"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3\OpenWithProgids\" au3file, REG_NONE, binary value ... 0

"HKEY_USERS\S-1-5-21-3283306847-3230872699-3813378835-1001\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3\OpenWithProgids\" au3file, REG_NONE, binary value ... 0

"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" au3file_.au3

"HKEY_USERS\S-1-5-21-3283306847-3230872699-3813378835-1001\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" au3file_.au3

 

Unfortunately, some operations in the registry are not quite clear to me. For example, I can delete the key "HKEY_CLASSES_ROOT\.au3\", then press F5 (refresh) and poof the key is back! :shocked::lmao::huh2:

My questions are accordingly formulated quite generally: Which entries have to be set in the registry to "link" (register) ".au3" files with PSPad? Can the same entries be used under Win 7 - 10? Is there an easier or safer method?

Link to comment
Share on other sites

Link to comment
Share on other sites

1 hour ago, Zedna said:

Look at Regshot utility.

https://github.com/Seabreg/Regshot

I had the same idea, see Posting #7 in German forum :P Thanks for the link to version 1.9.0, I was still using 1.7.2.

I have a VirtualBox VM set up with Windows 7 that has never had AutoIt, SciTE or PSPad installed and never used .au3. I created a backup point. Then I did the following steps, always taking a regshot in between.

- AutoIt installed
- SciTE installed
-- VM reset to backup point
- PSPad portable => .au3 and .ppr registered
-- VM reset to backup point
- Custom script => .au3 and .ppr registered per "ASSOC" and "FTYPE".

After that I tried to evaluate the regshots. But yesterday I was too tired and I saw only asterisks in front of registry keys. :yawn:

Today I looked at the regshot differences again and I think some keys stand out.  I will now study them more closely and do tests on the VM.

 

1 hour ago, Nine said:

Under Win7 : HKEY_CLASSES_ROOT\AutoIt3Script\Shell\Run\Command

In my research I had the impression that this is a key for SciTE4AutoIt3. I can't tell what the key is for. Are you sure that this key registers .au3 files for PSPad?  :huh2:

Link to comment
Share on other sites

Link to comment
Share on other sites

This key does not exist until AutoIt3 is installed. The .au3 files should be registered for PSPad independently of AutoIt and SciTE. - Imagine a fresh windows on which no .au3 file has ever been used and on which no AutoIt or SciTE has ever been installed. PSPad should be able to be used independently of any other program. ;)

Link to comment
Share on other sites

Yes on win7 I think there is kind of a copy into root (if I remember correctly).  I always used root and I know it is working fine.  I used to have a different editor for au3 when I was choosing Edit instead of Open.

Link to comment
Share on other sites

9 minutes ago, Professor_Bernd said:

I assume that "HKLM\SOFTWARE\Classes\" is the correct master key. What do you think?

https://docs.microsoft.com/en-us/windows/win32/sysinfo/hkey-classes-root-key

Link to comment
Share on other sites

49 minutes ago, Nine said:

Yes on win7 I think there is kind of a copy into root (if I remember correctly).

That seems to be correct. The link from TheXman confirms: In HKEY_CLASSES_ROOT the keys of HKEY_LOCAL_MACHINE\Software\Classes and HKEY_CURRENT_USER\Software\Classes are merged.

45 minutes ago, TheXman said:

Excerpt from the MS Docs article:

Quote

To change the default settings, store the changes under HKEY_LOCAL_MACHINE\Software\Classes. If you write keys to a key under HKEY_CLASSES_ROOT, the system stores the information under HKEY_LOCAL_MACHINE\Software\Classes. If you write values to a key under HKEY_CLASSES_ROOT, and the key already exists under HKEY_CURRENT_USER\Software\Classes, the system will store the information there instead of under HKEY_LOCAL_MACHINE\Software\Classes.

That's why it can work with HKEY_CLASSES_ROOT, but it can also go wrong if there is already an entry under HKEY_LOCAL_MACHINE\Software\Classes HKEY_CURRENT_USER\Software\Classes. Now I understand that was what was confusing me in my testing! - If you know how to do it, it's easy! :P

 

@TheXman The linked page has important information that I need for this. This information is like me trying to solve a crossword puzzle for days to no avail and then someone comes up with the answers! I'm going to study those in depth. Thanks a lot! :thumbsup:

 

Thank you all so much guys! Prof Bernd :graduated:

Edited by Professor_Bernd
Sorry, got a wrong key! ;-)
Link to comment
Share on other sites

  • Developers

Here is how you change the Edit option:

In the registry you either use:
"HKCR\AutoIt3Script\shell" or "HKCR\AutoIt3ScriptBeta\shell" and then change the "HKCR\AutoIt3Script\shell\Edit\Command" to the PSPad.exe.
You can then change the preffered  double click option by setting the default in "HKCR\AutoIt3Script\shell\" to either "Run" or "Edit".

That's all. 

Oh, and when there is any field:"Application" in key "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3", somebody did an "Always open with" which obviously overrides the original setting and you want to remove that.

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Interesting thing! I'll do tests in VB to find out how exactly this is related. "AutoIt3Script" is a key that is first set by AutoIt. I'll look at what SciTE writes about it and what changes when I register PSPad for ".au3" and "au3file". When I see through that, I'll report back.

Thanks for the information! :)

 

Link to comment
Share on other sites

Ok, I think I have understood it so far. It's quite complex, so I won't go into too much detail. :) All my tests and findings are for Windows 7 for now, I will do tests for Windows 10 later.

Basically there are 2 possibilities (I leave out SciTE4AutoIt3 portable):

1. the bundle of AutoIt3 + SciTE4AutoIt3.
2. PSPad

When you install AutoIt + SciTe, the entry is created:
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.au3" (Default) AutoIt3Script

"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoIt3Script\Shell"
has several keys "Compile", ..., "Edit", ..., "Run". Here you can make the settings you mentioned in the previous post. I'll leave them out now too.
  ;)

If now PSPad with its own function (NOT mine) registers the file extension .au3 for itself, the following entry is set or changed:
"HKEY_CURRENT_USER\Software\Classes\.au3" (Default) au3file

This is good for PSPad to write this entry without admin rights. - But not so good if you want to register .au3 files for SciTE again later. Even if you reinstall AutoIt and SciTE, .au3 files will still be opened with PSPad.

This is because for the interactive user the entries in "HKEY_CURRENT_USER\Software\Classes" have priority over the entries in "HKEY_LOCAL_MACHINE\Software\Classes". See MS Docs HKEY_CLASSES_ROOT Key (link from TheXman): "The user-specific settings have priority over the default settings."

Now, when I write my own routine to register .au3 files to be opened by double-clicking them with PSPad, I will try to use the same settings as PSPad because of compatibility with PSPad: entries in "HKEY_CURRENT_USER\Software\Classes".

Link to comment
Share on other sites

  • Developers

I've explained what the SciTE4AutoIt3 installer does and it is pretty strait forward.... but whatever makes you happy ;)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

15 hours ago, Jos said:

.... but whatever makes you happy ;)

My English is not good and I am not sure what you mean. Is this something good you mean or did I do something wrong? :(

@Jos That sounds like my mother saying, "Then do what you want!" And that was never good with my mother! :P

Edited by Professor_Bernd
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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