Title= Tweax v0.3 ;;; bLisTeRinG 2006 #SingleInstance force deFolder= %1% FileInstall, Tweax.ico, %A_ScriptDir%\Tweax.ico, 0 FileInstall, Tweax2.ico, %A_ScriptDir%\Tweax2.ico, 0 RegRead, app1, HKLM, Software\bLisTeRinG\Tweax, RegEdit If not app1 { app1=%A_WinDir%\RegEdit.exe /s } RegRead, app2, HKLM, Software\bLisTeRinG\Tweax, TxtEdit If not app2 { app2=%A_ProgramFiles%\Tools\ePad\EditPad.exe } RegRead, defEd, HKLM, Software\bLisTeRinG\Tweax, DefEdit If defEd=%app2% { app=%app2% edt=Edit ebt=Modify } Else { app=%app1% edt=Modify ebt=Edit } RegRead, app3, HKLM, Software\bLisTeRinG\Tweax, RegFileEd If app3= { app3=%A_ScriptDir%\RegFileEd.exe } RegRead, dBug, HKLM, Software\bLisTeRinG\Tweax, Confirm If dBug= { dBug=1 } RegRead, regCol, HKLM, Software\bLisTeRinG\Tweax, Colour If regCol= { regCol=green } RegRead, regWPos, HKLM, Software\bLisTeRinG\Tweax, WinPosition If regWPos= { regWPos=x11 y10 w318 h261 } regPic=%A_ScriptDir%\Tweax2.ico tog=All Gui, +Resize +OwnDialogs Gui, Color, %regCol% ;GuiControl, +backgroundred Cred, Clear Gui, Add, Button, x13 y10 w36 h18, More Gui, Add, Button, x53 y10 w36 h18, Clear Gui, Add, Button, x93 y10 w36 h18 gSelectAllToggle, %tog% Gui, Add, Button, x133 y10 w42 h18, %ebt% Gui, Add, Checkbox,x179 y13 Checked%dBug% gdBug, Confirm? Gui, Add, Button, x259 y10 w36 h18 Default, OK Gui, Add, ListView, x10 y90 r10 vDeClick gDeClick +Checked +Resize, Application|Name|Size|Path Gui, Add, Picture, x10 y10 gregHelp vregHelp w80 h-1 0x4000000, %regPic% Gui, -MaximizeBox Menu, MyContextMenu, Add, Open, ContextOpenFile Menu, MyContextMenu, Add, Properties, ContextProperties Menu, MyContextMenu, Add, Clear from List, ContextClearRows Menu, MyContextMenu, Default, Open ButtonMore: Gui, Show, +Hide StringLen, sLen, deFolder If deFolder { IfNotExist, %deFolder% { MsgBox, 4096, Tweax Error,Folder:`n%deFolder%`nNot Found! deFolder= } } FileSelectFolder, DirN, %deFolder%,,Choose a Folder containing Registry files (.reg) If not DirN { If not DirS Goto GuiClose Gui, Restore Return } DirS=1 SetWorkingDir, DirN Tooltip, Please wait - Gathering data Loop, %DirN%\*.reg,,1 { if not A_LoopFileFullPath break SplitPath, A_LoopFileFullPath,,DName StringGetPos, DPos, DName, \, R1 DPos+=1 StringTrimleft, DName, DName, %DPos% LV_Add("", DName, A_LoopFileName, A_LoopFileSize, A_LoopFileFullPath) LV_ModifyCol() LV_ModifyCol(3, "Integer") LV_ModifyCol(4, "120") } LV_ModifyCol(1, "Sort") Gui, Restore Gui, Show, %regWPos%, %A_Space%%A_Space%%edt% regFiles/Registry. Tooltip, Return GuiEscape: GuiClose: WinGetPos, regWx, regWy, regWw, regWh, A regWw -= 12 regWh -= 34 regWpos=x%regWx% y%regWy% w%regWw% h%regWh% RegWrite, REG_SZ, HKLM, Software\bLisTeRinG\Tweax, WinPosition, %regWPos% ExitApp DeClick: If A_GuiEvent = DoubleClick { regRow := LV_GetNext(0, "F") If not regRow Return LV_GetText(reg4, regRow, 4) Run, %app3% "%reg4%",, UseErrorLevel ; MsgBox, 4096, Tweax, %app3% "%reg4%" } Return ButtonOK: Gui, -AlwaysOnTop RowNumber=0 Job= Loop { RowNumber := LV_GetNext(RowNumber,"C") If not RowNumber Break LV_GetText(jb, RowNumber,4) Job=%Job%"%jb%"`n } If dBug = 1 { Gui, Show, +Hide MsgBox, 4100, %edt%?, You have chosen to %edt%:`n%Job% Gui, Restore } IfMsgBox, No Return If Job="" Return Loop, parse, job, `n { StringLen, SLen, A_LoopField If SLen < 4 Break RunWait %app% %A_LoopField% Tooltip, %app% %A_LoopField% } Gui, +AlwaysOnTop Tooltip, Return ButtonClear: LV_Delete() Return ButtonModify: ButtonEdit: If defEd=app1 { app=%app2% defEd=app2 ebt=Modify edt=Edit } Else { app=%app1% defEd=app1 ebt=Edit edt=Modify } Gui, Show,, %A_Space%%A_Space%%edt% ControlSetText, %edt%, %ebt%, RegWrite, REG_SZ, HKLM, Software\bLisTeRinG\Tweax, DefEdit, %defEd% Return regHelp: Gui, Show, +Hide MsgBox, 4096, Help, %Title%`nbLisTeRinG`n`nUse Tweax to merge a group of .reg files into the Windows Registry, or to edit them in notepad.`n`nTo edit-merge-save individual .reg files, double-click a line to open it in RegFileEditor. Gui, Restore Return SelectAllToggle: If tog = All { tog=None LV_Modify(0, "Check") ControlSetText, None, %Tog%, } Else { tog=All LV_Modify(0, "-Check") ControlSetText, All, %Tog%, } Return dBug: If dBug = 1 { dBug=0 GuiControl,, dBug, 0 } Else { dBug=1 GuiControl,, dBug, 1 } RegWrite, REG_SZ, HKLM, Software\bLisTeRinG\Tweax, confirm, %dBug% Return GuiSize: If A_EventInfo = 1 Return GuiControl, Move, DeClick, % "W" . (A_GuiWidth - 20) . " H" . (A_GuiHeight - 100) Return GuiContextMenu: ; Launched in response to a right-click or press of the Apps key. if A_GuiControl <> DeClick ; Display the menu only for clicks inside the ListView. return ; Show the menu at the provided coordinates, A_GuiX and A_GuiY. These should be used ; because they provide correct coordinates even if the user pressed the Apps key: Menu, MyContextMenu, Show, %A_GuiX%, %A_GuiY% Return ContextOpenFile: ; The user selected "Open" in the context menu. ContextProperties: ; The user selected "Properties" in the context menu. ; For simplicitly, operate upon only the focused row rather than all selected rows: FocusedRowNumber := LV_GetNext(0, "F") ; Find the focused row. If not FocusedRowNumber ; No row is focused. Return LV_GetText(FName, FocusedRowNumber, 4) IfInString A_ThisMenuItem, Open ; User selected "Open" from the context menu. Run %FName%,, UseErrorLevel else ; User selected "Properties" from the context menu. Run Properties "%FName%",, UseErrorLevel If ErrorLevel MsgBox, 4096, Tweax Error, %ErrorLevel%`nCould``nt`n"%FName%" Return ContextClearRows: ; The user selected "Clear" in the context menu. RowNumber = 0 ; This causes the first iteration to start the search at the top. Loop { ; Since deleting a row reduces the RowNumber of all other rows beneath it, ; subtract 1 so that the search includes the same row number that was previously ; found (in case adjacent rows are selected): RowNumber := LV_GetNext(RowNumber - 1) If not RowNumber ; The above returned zero, so there are no more selected rows. break LV_Delete(RowNumber) ; Clear the row from the List. } Return