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: sexyindianca Profile
 | Femeie 24 ani Ilfov cauta Barbat 24 - 53 ani |
|
Mrrrr
AdMiN
 Inregistrat: acum 18 ani
Postari: 2270
|
|
Key words: AHK CTRL SHIFT rename files custom tooltip tray icon
The following AHK script will make 4 keyboard shortcuts. Additionally, the first line of code will help set a custom tray icon tooltip, so that when you hover your mouse over the tray icon of the AHK file, it will show the text you want, like the keyboard shortcuts and their use.
If you are just interested in the keyboard shortcut creating and custom tooltip tray icon parts of the AHK file, the first 16 lines of the AHK script will do, and you can skip the following text.
The 3rd and 4th keyboard shortcut sections have more than just keyboard shortcut creating - they have code that does stuff as well.
The 3rd shortcut points to a VBS script that will rename files. - In AHK this is followed by a snippet for detecting the active Windows Explorer window, where the AHK will then copy the VBS file - If you - like me - keep windows open when you turn your PC off, to have them re-open at startup, this window detection snippet will be a bit faulty because of the way Windows Explorer detects which window was opened first at startup - might not be the first Window on the taskbar as you'd probably expect. - Best way to ensure this detects the correct window from 1st try, is to have just one open, or close everything then open just 1 and navigate to the desired folder.
The 4th shortcut will help create a new text file in the active folder. - Within that code there is a line where I typed CUSTOM TEXT GOES HERE, where you can add the text you desire to appear by default in your new text file. - If you want it empty, simply remove that text and leave the two commas.
Both the 3rd and 4th shortcut codes can still be improved.
Comments are with this color.
; Set a custom tray icon tooltip Menu, Tray, Tip, CTRL+SHIFT+q = file names to s.txt CTRL+SHIFT+r = rename files
; LEGEND: ^=CTRL +=SHIFT !=ALT More: https://www.autohotkey.com/docs/v1/lib/Send.htm
^+i:: ; CTRL + SHIFT + i Hotkey to search the name of 1 file on google
Run, "wscript.exe" "D:\! Mrrrr IMPROVEMENTS\Search selected file name on google [VBS]\SearchGOOGLE v1.0 OK.vbs" return
^+q:: ; CTRL + SHIFT + q Hotkey to copy selected files names to s.txt file
Run, "wscript.exe" "D:\! Mrrrr IMPROVEMENTS\Rename files with desired names [VBS]\Copy selected files names to s.txt.vbs" return
^+r:: ; CTRL + SHIFT + r Hotkey to rename files
FileName := "! RENAME FILES (instructions included on run) v1.6.vbs" SourceFile := "D:\! Mrrrr IMPROVEMENTS\Rename files with desired names [VBS]\" . FileName ExplorerPath := ""
; Use COM to retrieve the active Explorer window path For window in ComObjCreate("Shell.Application").Windows { ; Check if this is the active window if (window.hwnd = WinActive("A")) { ExplorerPath := window.Document.Folder.Self.Path break } }
; If a valid path is found, proceed if (ExplorerPath) { ; Copy the file to the active folder DestinationFile := ExplorerPath . "\" . FileName FileCopy, %SourceFile%, %DestinationFile% if !ErrorLevel { MsgBox, File copied successfully to %ExplorerPath%.
; Run the copied VBS script RunWait, % "wscript.exe """ . DestinationFile . """"
; Delete the VBS script after it runs FileDelete, %DestinationFile%
; Confirm deletion if !FileExist(DestinationFile) MsgBox, File executed and deleted successfully from %ExplorerPath%. else MsgBox, File could not be deleted from %ExplorerPath%. Please check permissions. } else { MsgBox, Failed to copy the file to %ExplorerPath%. Please check permissions or file existence. } } else { MsgBox, Could not determine the active folder. Please make sure a Windows Explorer window is active. } return
^!t:: ; CTRL + ALT + t Hotkey to create new text file in the active folder
{ ; 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, CUSTOM TEXT GOES HERE, %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, 1000 ControlSend,, {F2}, ahk_class CabinetWClass break } } } } return |
_______________________________________

|
|
pus acum 3 zile |
|