after looking over your examples more i found how to get the current edit fields. now its working great! thanks so much for your help as always and
im going to continue adding features to this. but if someone wants to move this to the ahk scripts for others to use they can. or i will eventually after i get things caught up.
Code: Select all
begin:
#SingleInstance, Force
string =
( `join
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume1
path \EFI\MICROSOFT\BOOT\BOOTMGFW.EFI
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
resumeobject {9b37dbc1-3950-11ee-a851-a33fbd0a893f}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30
Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.efi
description Windows 10
locale en-US
inherit {bootloadersettings}
recoverysequence {9b37dbc3-3950-11ee-a851-a33fbd0a893f}
displaymessageoverride Recovery
recoveryenabled Yes
isolatedcontext Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \Windows
resumeobject {9b37dbc1-3950-11ee-a851-a33fbd0a893f}
nx OptIn
bootmenupolicy Standard
Firmware Boot Manager
---------------------
identifier {fwbootmgr}
displayorder {bootmgr}
{b63c85a7-3c94-11ee-8006-806e6f6e6963}
{4af6a055-3c9c-11ee-800a-806e6f6e6963}
{99f012a0-3c9b-11ee-9c0a-8c7f7582acf8}
timeout 1
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume2
path \EFI\MICROSOFT\BOOT\BOOTMGFW.EFI
description Windows Boot Manager
locale en-us
inherit {globalsettings}
default {current}
resumeobject {bd1ef51f-3c9b-11ee-9c0a-8c7f7582acf8}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30
Firmware Application (101fffff)
-------------------------------
identifier {4af6a055-3c9c-11ee-800a-806e6f6e6963}
device partition=R:
path \EFI\BOOT\BOOTX64.EFI
description UEFI OS
Firmware Application (101fffff)
-------------------------------
identifier {99f012a0-3c9b-11ee-9c0a-8c7f7582acf8}
device partition=\Device\HarddiskVolume38
description UEFI: Samsung Flash Drive FIT 1100, Partition 2
Firmware Application (101fffff)
-------------------------------
identifier {b63c85a7-3c94-11ee-8006-806e6f6e6963}
device partition=R:
path \EFI\BOOT\BOOTX64.EFI
description UEFI: WDC PC SN730 SDBPNTY-512G-1032, Partition 5
)
;********************************************************************************
;if we dont use string output above. and run cmd with admin
string = ""
stringa = ""
stringb = ""
Runwait %comspec% /c bcdedit /enum | clip,,hide
stringa := % Clipboard
Clipboard := ""
StringReplace, stringa, stringa, identifier {bootmgr}, ,
Runwait %comspec% /c bcdedit /enum firmware | clip,,hide
stringb := % Clipboard
StringReplace, stringb, stringb, identifier {fwbootmgr}, ,
string = %stringa% . %stringb%
;***************************************************************************************
;******************************
SearchList := [ "Identifier" , "Description" , "Device" , "Path" , "Displayorder" , "Default" , "Locale", "Systemroot" , "Osdevice" , "Resumeobject" , "NX" , "Recoveryenabled"] ;List of items to filter for.
OutputLists := Get_InsertNameHere_Object( String , SearchList ) ;returns an [ array ] of { objects } ; ||| ; i.e. OutputLists[ 1 ].Path
;******************************
MyDisplayString := ""
Loop, % OutputLists.Length()
MyDisplayString .= OutputLists[ A_Index ].DisplayValue "|" ;creating a list to display in the dropdownlist control. "Item|Item|Item|"
;******************************
Gui, destroy
Gui, New, +AlwaysOnTop
Gui, Add, DDL, xm ym w300 r10 vMyDDL gChangeIt choose1 AltSubmit, % MyDisplayString
index := 1
for k , v in SearchList {
if( v = "Identifier" )
continue
Gui, Add, Text, xm y+3 w80 r5 , % v
Gui, Add, Edit, x+3 w230 r1 vEdit_%Index% , % OutputLists[ 1 ][ v ]
Index++
}
Gui, add, button, x10 y340 h25 w60 gSave, Save
Gui, add, button, x70 y340 h25 w60 gDelete, Delete
Gui, add, button, x130 y340 h25 w60 gExport, Export
Gui, add, button, x190 y340 h25 w60 gImport, Import
Gui, add, button, x250 y340 h25 w60 gDefault, Default
Gui, Show, , BCD Boot Entry Edit Tool
return ;<<<---- End of the auto execute section of the script.
;******************************************************************************************************
GuiClose: ;<<<--- Exit Routine.
GuiContextMenu:
*ESC::ExitApp
Save:
Gui, Submit, nohide
if (SelectedIndex ="")
SelectedIndex :=1
List :=% OutputLists[ SelectedIndex ][ "Identifier" ]
;msgbox, bcdedit /set %List% description "%Edit_1%"
Runwait, bcdedit /set %List% Description "%Edit_1%",,hide
Runwait, bcdedit /set %List% Device "%Edit_2%",,hide
Runwait, bcdedit /set %List% Path "%Edit_3%",,hide
Runwait, bcdedit /set %List% Displayorder "%Edit_4%",,hide
Runwait, bcdedit /set %List% Default "%Edit_5%",,hide
Runwait, bcdedit /set %List% Locale "%Edit_6%",,hide
Runwait, bcdedit /set %List% Systemroot "%Edit_7%",,hide
Runwait, bcdedit /set %List% Osdevice "%Edit_8%",,hide
Runwait, bcdedit /set %List% Resumeobject "%Edit_9%",,hide
Runwait, bcdedit /set %List% NX "%Edit_10%",,hide
Runwait, bcdedit /set %List% Recoveryenabled "%Edit_11%",,hide
goto, begin
Delete:
Gui, Submit, nohide
if (SelectedIndex ="")
SelectedIndex :=1
List :=% OutputLists[ SelectedIndex ][ "Identifier" ]
Runwait, bcdedit /delete %List%,,hide
goto, begin
Export:
Runwait, bcdedit /export "%A_ScriptDir%\bcd-backup.bcd",,hide
return
Import:
Runwait, bcdedit /import "%A_ScriptDir%\bcd-backup.bcd",,hide
goto, begin
Default:
return
;******************************
Changeit: ;called when something is selected in the dropdownlist
GuiControlGet, SelectedIndex ,, MyDDL
Index := 1
Loop, % SearchList.Length() {
if( ( keyname := SearchList[ A_Index ] ) = "identifier" )
continue
GuiControl, , % "Edit_" Index , % OutputLists[ SelectedIndex ][ KeyName ]
Index++
}
return
;******************************
Get_InsertNameHere_Object( String , SearchList ){ ;custom parsing function. returns arr[{}]
local OutputLists := []
SearchListString := ""
Loop, % SearchList.Length()
SearchListString .= SearchList[ A_Index ] "|"
clipArray := StrSplit( string , "`n" , "`r" )
Loop, {
if( pos := instr( string , "identifier" ,,, A_Index ) ){
tempObj := {}
for k , v in SearchList
tempObj[ v ] := ""
OutputLists.Push( tempObj )
if( A_Index = 1 ){
Start_%A_Index% := pos
}else{
num := A_Index - 1
End_%num% := pos - 1
Start_%A_Index% := pos
}
}else{
break
}
}
Sections := []
Loop, % OutputLists.Length() - 1
Sections.Push( subStr( string , Start_%A_Index% , End_%A_Index% - STart_%A_Index% ) )
num := OutputLists.Length()
Sections.Push( subStr( string , Start_%num% ) )
Loop, % Sections.Length() {
LineArray := StrSplit( Sections[ A_Index ] , "`n" , "`r" )
Index := A_Index
Loop, % LineArray.Length() {
if( InStr( SearchListString , ( out := StrSplit( Trim( LineArray[ A_Index ] ) , " " )[ 1 ] ) ) && out != "" ){
OutputLists[ Index ][ out ] := Trim( SubStr( Trim( LineArray[ A_Index ] ) , StrLen( out ) + 1 ) )
if( out = "identifier" )
OutputLists[ Index ][ "DisplayValue" ] := OutputLists[ Index ][ out ]
}
}
}
return OutputLists
}
;******************************