Improved handling of open/edit for .au3 files in PreShell interface.

This commit is contained in:
Homes32
2025-01-06 20:36:53 -06:00
parent 1c11e52823
commit f9bb949fd5

View File

@@ -181,10 +181,14 @@ End
// with AutoIt so they have access to documentation, syntax checker, autocomplete, function reference, etc. // with AutoIt so they have access to documentation, syntax checker, autocomplete, function reference, etc.
// To get around this issue we attempt to resolve the editor in the following order: // To get around this issue we attempt to resolve the editor in the following order:
// 1. Check to see if the .au3 file extension is registered on the host computer. // 1. Check to see if the .au3 file extension is registered on the host computer.
// If so launch ShellExecute with the 'Edit' verb to open the default editor associated with .au3 files. // If so check to see if the 'Edit' verb is defined, if so launch ShellExecute with the 'Edit' verb
// 2. If the .au3 file extension is not registered, read the default custom editor from PEBakery's settings. // to open the default editor associated with .au3 files.
// 2. If the 'Edit' verb is not defined check to see of the 'Open' verb is. It could be that AutoIt
// is not installed but another application has been registered to open .au3. If this is the case
// launch ShellExecute with the 'Open' verb.
// 3. If the .au3 file extension is not registered at all, read the default custom editor from PEBakery's settings.
// If a custom editor is defined, then launch ShellExecute with the 'Open' using the custom editor. // If a custom editor is defined, then launch ShellExecute with the 'Open' using the custom editor.
// 3. If the .au3 file extension is not registered and no custom editor is defined in the settings, then // 4. If the .au3 file extension is not registered and no custom editor is defined in the settings, then
// edit with notepad.exe. // edit with notepad.exe.
// Related........: btn_EditProjectConfig // Related........: btn_EditProjectConfig
// =============================================================================================================================== // ===============================================================================================================================
@@ -193,10 +197,14 @@ Echo,"Opening PhoenixPE.au3 in your default editor.#$x#$xPlease close the editor
ExtractAllFiles,%ScriptFile%,config,%ProjectTemp% ExtractAllFiles,%ScriptFile%,config,%ProjectTemp%
Hash,SHA256,"%ProjectTemp%\PhoenixPE.au3",%PreEditHash% Hash,SHA256,"%ProjectTemp%\PhoenixPE.au3",%PreEditHash%
If,ExistRegSubKey,HKCR,".au3",ShellExecute,Edit,"%ProjectTemp%\PhoenixPE.au3" Set,%au3DefaultValue%,"DummyValue"
If,ExistRegSubKey,HKCR,".au3",RegRead,HKCR,".au3","",%au3DefaultValue%
If,ExistRegSubKey,HKCR,"%au3DefaultValue%\Shell\Edit\Command",ShellExecute,Edit,"%ProjectTemp%\PhoenixPE.au3"
Else,If,ExistRegSubKey,HKCR,"%au3DefaultValue%\Shell\Open\Command",ShellExecute,Open,"%ProjectTemp%\PhoenixPE.au3"
Else,Begin Else,Begin
// The .au3 file extension is not associated with anything; fallback to the PEBakery custom editor. // Fallback to the PEBakery custom editor or notepad.
IniRead,"%BaseDir%\PEBakery.ini","Interface","CustomEditorPath",%CustomEditorPath%,"Default=notepad.exe" IniRead,"%BaseDir%\PEBakery.ini","Interface","CustomEditorPath",%CustomEditorPath%
If,%CustomEditorPath%,Equal,"",Set,%CustomEditorPath%,"notepad.exe" If,%CustomEditorPath%,Equal,"",Set,%CustomEditorPath%,"notepad.exe"
ShellExecute,Open,%CustomEditorPath%,"%ProjectTemp%\PhoenixPE.au3" ShellExecute,Open,%CustomEditorPath%,"%ProjectTemp%\PhoenixPE.au3"
End End
@@ -304,7 +312,7 @@ fb_UserConfigFile=,1,13,15,245,517,20,file,"Title=Select your config file","Filt
lbl_AdditionalConfig="You may choose to include an additional AutoIt3 or PECMD configuration script in your project.#$x#$xThis script will be executed after the initial project configuration has been completed, but before the shell (explorer, etc.) is started.#$x#$xThe script will be placed on the root of the boot media as [PhoenixPE-UserConfig]. This allows the configuration to be manually edited on-the-fly (if the media is Read/Write) without rebuilding the project.",1,1,17,130,602,92,8,Normal lbl_AdditionalConfig="You may choose to include an additional AutoIt3 or PECMD configuration script in your project.#$x#$xThis script will be executed after the initial project configuration has been completed, but before the shell (explorer, etc.) is started.#$x#$xThe script will be placed on the root of the boot media as [PhoenixPE-UserConfig]. This allows the configuration to be manually edited on-the-fly (if the media is Read/Write) without rebuilding the project.",1,1,17,130,602,92,8,Normal
btn_GenerateSampleConfig="Sample Config",1,8,539,245,80,20,GenerateSampleConfig,0,True,"__Generate a sample configuration file." btn_GenerateSampleConfig="Sample Config",1,8,539,245,80,20,GenerateSampleConfig,0,True,"__Generate a sample configuration file."
bvl_AdvancedOptions="Advanced Options",0,12,5,290,625,71,8,Bold bvl_AdvancedOptions="Advanced Options",0,12,5,290,625,71,8,Bold
cb_CustomConfigFile="Override the project config and use a custom PhoenixPE.au3 file. (DANGER!)",0,3,15,308,508,18,False,"__If enabled this PhoenixPE.au3 file will be used instead of the project's configuration.#$x#$xWARNING: This option is absolutely unsupported and, unless you are a developer,#$xthere is a good probability that you will break things. Use at your own risk." cb_CustomConfigFile="Override the project config and use a custom PhoenixPE.au3 file.",0,3,15,308,508,18,False,"__If enabled this PhoenixPE.au3 file will be used instead of the project's configuration.#$x#$xWARNING: This option is absolutely unsupported and, unless you are a developer,#$xthere is a good probability that you will break things. Use at your own risk."
fb_CustomConfigFile=,0,13,15,328,602,20,file,"Title=Select your custom PhoenixPE.au3 file","Filter=AutoIt3 Scripts|*.au3|All Files|*.*" fb_CustomConfigFile=,0,13,15,328,602,20,file,"Title=Select your custom PhoenixPE.au3 file","Filter=AutoIt3 Scripts|*.au3|All Files|*.*"
[InterfaceEncoded] [InterfaceEncoded]