Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Tanya_sexy
Femeie
24 ani
Hunedoara
cauta Barbat
24 - 47 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [WINDOWS, AHK] Add New Folder / Text File / RTF to MAIN Context Menu Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2228
Do you want to add New Folder / New Text File to the MAIN context menu? By MAIN I mean right click and select New Folder or New Text File, without having to right click -> new -> text file.

SEE LAST POST FOR AN AUTOHOTKEY WAY, WHICH IS BETTER.

Sources:

Create New Folder in right click context menu insider folder and on desktop, without having to go through the cascaded New menu - make a .reg file with the following:

Windows Registry Editor Version 5.00

; Created by: Shawn Brink
; Created on: August 31st 2019
; Tutorial: https://www.tenforums.com/tutorials/139598-add-remove-new-folder-context-menu-windows-10-a.html


[HKEY_CLASSES_ROOT\Directory\Background\shell\Windows.newfolder]
"CanonicalName"="{E44616AD-6DF1-4B94-85A4-E465AE8A19DB}"
"CommandStateHandler"="{3756e7f5-e514-4776-a32b-eb24bc1efe7a}"
"CommandStateSync"=""
"Description"="@shell32.dll,-31237"
"Icon"="shell32.dll,-319"
"ImpliedSelectionModel"=dword:00000004
"InvokeCommandOnSelection"=dword:00000000
"MUIVerb"="@shell32.dll,-31236"
"Position"="Last"


Create New Text File in right click context menu insider folder and on desktop, without having to go through the cascaded New menu - make a .reg file with the following:

Windows Registry Editor Version 5.00

; Source:
; Credits: Anubis84


[HKEY_CURRENT_USER\Software\Classes\Directory\shell\NewTextFileAndOpen]
@="New Text File"
"Icon"="C:\\Windows\\System32\\shell32.dll,70"

;;;;;;; NOTE: below icon is REG_EXPAND_SZ and it was a link to an icon between "", like: "C:\Icons\Icon.ico"
;;;;;;; "Icon"=hex(2):22,00,43,00,3a,00,5c,00,74,00,6f,00,6f,00,6c,00,73,00,5c,00,5f,\
  00,49,00,43,00,4f,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,\
  69,00,63,00,6f,00,22,00,00,00


[HKEY_CURRENT_USER\Software\Classes\Directory\shell\NewTextFileAndOpen\command]
@="cmd /c cd %V & echo.>NewTextFile_%%random%%_%%date%%.txt"

;;;;;;; NOTE: command below also has the option to start the newly created text file
;;;;;;; @="cmd /c cd %V & echo.>NewTextFile.txt & start NewTextFile.txt"


[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\NewTextFileAndOpen]
@="New Text File"
"Icon"="C:\\Windows\\System32\\shell32.dll,70"

;;;;;;; NOTE: below icon is REG_EXPAND_SZ and it was a link to an icon between "", like: "C:\Icons\Icon.ico"
;;;;;;; "Icon"=hex(2):22,00,43,00,3a,00,5c,00,74,00,6f,00,6f,00,6c,00,73,00,5c,00,5f,\
  00,49,00,43,00,4f,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,\
  69,00,63,00,6f,00,22,00,00,00


[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\NewTextFileAndOpen\command]
@="cmd /c cd %V & echo.>NewTextFile_%%random%%_%%date%%.txt"

;;;;;;; NOTE: command below also has the option to start the newly created text file
;;;;;;; @="cmd /c cd %V & echo.>NewTextFile.txt & start NewTextFile.txt"


_______________________________________


pus acum 4 ani
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2228
Create RTF file with New context menu command, and also have a second option to create new TXT file on the same New context menu:


Windows Registry Editor Version 5.00

;;;; RTF

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\NewTextFileAndOpen_1]
@="Create DESCRIPTION.rtf"
"Icon"="C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\WORDICON.EXE,1"
;Icon in case you don't use Microsoft Word:
;"Icon"="C:\\Windows\\System32\\shell32.dll,1"


[HKEY_CURRENT_USER\Software\Classes\Directory\shell\NewTextFileAndOpen_1\command]
@="cmd /c cd %V & echo.{\rtf1}>DESCRIPTION.rtf & start DESCRIPTION.rtf"

[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\NewTextFileAndOpen_1]
@="Create DESCRIPTION.rtf"
"Icon"="C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\WORDICON.EXE,1"
;Icon in case you don't use Microsoft Word:
;"Icon"="C:\\Windows\\System32\\shell32.dll,1"


[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\NewTextFileAndOpen_1\command]
@="cmd /c cd %V & echo.{\rtf1}>DESCRIPTION.rtf & start DESCRIPTION.rtf"

;;;; TXT

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\NewTextFileAndOpen_2]
@="Create DESCRIPTION.txt"
"Icon"="C:\\Windows\\System32\\shell32.dll,70"

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\NewTextFileAndOpen_2\command]
@="cmd /c cd %V & echo.>DESCRIPTION.txt & start DESCRIPTION.txt"

[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\NewTextFileAndOpen_2]
@="Create DESCRIPTION.txt"
"Icon"="C:\\Windows\\System32\\shell32.dll,70"

[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\NewTextFileAndOpen_2\command]
@="cmd /c cd %V & echo.>DESCRIPTION.txt & start DESCRIPTION.txt"


_______________________________________


pus acum 1 an
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2228
In case you encounter a problem when trying to create a DESCRIPTION.rtf file for the first time:

"This file does not have an app associated with it for performing this action. Please install an app or, if one is already installed, create an association in the Default Apps Settings page"

Make sure to check in the registry if the following 2 keys have contents for the (Default) string:

Computer\HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\NewTextFileAndOpen_1\command
Computer\HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell\NewTextFileAndOpen_1\command


Both (Default) strings should contain the following data:

cmd /c cd %V & echo.{\rtf1}>DESCRIPTION.rtf & start DESCRIPTION.rtf


If they do not, there's the problem. Just manually edit both and paste the above line of data.

No need for PC restart.


_______________________________________


pus acum 1 an
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2228
If that still doesn't work  :x, you can try an AutoHotkey script.

Script adapted from source 1 will, upon pressing ALT+Q in a folder, create a file named DESCRIPTION.rtf and open it - just as I want.
It has adapted bring window to front from source 3.

Plus, using this version of obtaining the RTF file will not set the formatting to default, but instead keep the one in Normal.dotm template, the one I want. The Right Click menu option would reset it to default Word template and I would have 1,5 lines spacing and big page margins.


#IfWinActive, ahk_class CabinetWClass
!q:: ;explorer - create new rtf file and open it with Word

#IfWinActive, ahk_class ExploreWClass
!q:: ;explorer - create new rtf file and open it with Word

vPathWinWord := "C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"
vNameNoExt := "DESCRIPTION"
vDotExt := ".rtf"
vPath := ""
WinGet, hWnd, ID, A
for oWin in ComObjCreate("Shell.Application").Windows
{
    if (oWin.HWND = hWnd)
    {
        vDir := RTrim(oWin.Document.Folder.Self.Path, "\")
        if !InStr(FileExist(vDir), "D")
        {
            oWin := ""
            return
        }

        Loop
        {
            vSfx := (A_Index=1) ? "" : " (" A_Index ")"
            vName := vNameNoExt vSfx vDotExt
            vPath := vDir "\" vName
            if !FileExist(vPath)
                break
        }

        FileAppend,, % "*" vPath
        break
    }
}
oWin := ""
if FileExist(vPath)
    Run, "%vPathWinWord%" "%vPath%"

SetTitleMatchMode, 2 ;Allows you to search for an approximate window title match
WinWait, DESCRIPTION.rtf - Word,
IfWinNotActive, DESCRIPTION.rtf - Word, , WinActivate, DESCRIPTION.rtf - Word


Sleep, 100
Clipboard := "Game is updated to `n`nSavegames are located in `n`n`n"
Sleep, 100
;Msgbox, %Clipboard%
Send ^v

Sleep, 100
Clipboard := ""


return


Sources:
1.
2.
3.


_______________________________________


pus acum 1 an
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2228
Today the text adding part from the AHK script above stopped working. It creates and opens the RTF file, just won't insert the text. Until I figure why, here's a Word VBA snippet that put in the 2nd place of the QAT, with an ALT+2 combination will do the exact same thing I want (add the text and color it blue and embolden, then move to next rows with normal black text:


Sub Blue_Insert_Text()
    Selection.TypeBackspace
    Selection.TypeText Text:="Game is updated to "
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeText Text:="Savegames are located in "
    Selection.WholeStory
    Selection.Font.Color = wdColorBlue
    Selection.Font.Bold = wdToggle
    Selection.MoveRight unit:=wdCharacter, Count:=1
    Selection.TypeParagraph
    Selection.Font.Color = wdColorBlack
    Selection.Font.Bold = wdToggle
    Selection.TypeParagraph
End Sub


_______________________________________


pus acum 8 luni
   
Pagini: 1  

Mergi la