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: Profil iulia2006
| Femeie 24 ani Bucuresti cauta Barbat 25 - 49 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 18 ani
Postari: 2241
|
|
The "rename it" part didn't work for me at the current state of my Windows (maybe I should restart or something), but the "create new text file" is what interests me anyway (an the fact that the file remains selected and I can press F2 manually to rename).
; Source: ; Creates a new file in the active folder in explorer (desktop otherwise) and renames it.
^!t:: ; Ctrl + t { ; Check if the active window is a Windows Explorer window or Desktop if WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass") || WinActive("Progman") { ; Get the path of the current folder or Desktop shellApp := ComObjCreate("Shell.Application") activeWindow := "" for window in shellApp.Windows { if (window.hwnd = WinExist("A")) { activeWindow := window break } }
; Set the default folder path to the Desktop if not found folderPath := activeWindow ? activeWindow.Document.Folder.Self.Path : A_Desktop
; Generate a unique filename for the new text file newFilePath := folderPath "\NewTextDocument.txt" i := 1 while FileExist(newFilePath) newFilePath := folderPath "\NewTextDocument(" i++ ").txt"
; Create the new empty text file FileAppend,, %newFilePath%
; Refresh the view and select the new file Sleep, 500 ControlSend,, {F5}, ahk_class CabinetWClass Sleep, 500
for item in activeWindow.Document.Folder.Items { if (item.Path = newFilePath) { activeWindow.Document.SelectItem(item, 17) ; 17 = SVSI_SELECT | SVSI_ENSUREVISIBLE Sleep, 500 ControlSend,, {F2}, ahk_class CabinetWClass break } } } } return |
_______________________________________
|
|
pus acum 42 ore |
|