Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #SingleInstance Force
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- Menu Tray, Icon, shell32.dll, 85
- Gui -Caption -MinimizeBox -MaximizeBox -SysMenu +AlwaysOnTop +ToolWindow
- Gui Add, Text, x30 y3 w196 h17 +0x200, Directories To Jump Back?
- Gui Add, Edit, vBACK x160 y3 w23 h15 Center +Number, 01
- Gui Add, Text, x185 y3 w180 h17 +0x200, How Many Folders Forward?
- Gui Add, Edit, vFWD x320 y3 w15 h15 Center +Number, 1
- Gui Font, s6
- Gui Add, Button, gHELPME x0 y0 w29 h20, Help
- Gui Font
- Gui Add, Button, gDJUMP x340 y0 w150 h20, DIRECTORY JUMP
- Gui Add, Button, gXCLOSE x505 y0 w13 h20, X
- Gui Add, Text, x495 y3, ยง
- Gui Color, 0x80FF80
- Gui Show, x372 y5 w520 h20, Directory Jumper
- OnMessage( 0x200, "WM_MOUSEMOVE" )
- Return
- WM_MOUSEMOVE( wparam, lparam, msg, hwnd )
- {
- if wparam = 1 ; LButton
- PostMessage, 0xA1, 2,,, A ; WM_NCLBUTTONDOWN
- }
- IsItFoF:
- sel := Explorer_GetSelected()
- SplitPath, sel, OutFileName
- ;MsgBox, `tSelection is `n[%sel%] `n`n `tHighlighted File is `n[%OutFileName%]
- IfInString, OutFileName, .
- {
- HighlightedItem := 1 ; File detected
- Return
- }
- Else
- {
- HighlightedItem := 0 ; Folder detected
- Return
- }
- return
- DJUMP:
- {
- Gui, Submit, nohide
- WinActivate, ahk_class CabinetWClass
- Loop, %BACK%
- {
- SendInput, !{Up}
- }
- Send, {Down}
- Loop, %FWD%
- {
- Send, {Enter}
- GoSub, IsItFoF
- If (HighlightedItem=1)
- {
- MsgBox, File Detected - Stopping
- Break
- }
- Else
- {
- SoundBeep, SoundBeep, SoundBeep
- Return
- }
- }
- Return
- }
- HELPME:
- {
- MsgBox, , Directory Jumper, `tDirectory Jumper`nDirectory Jumper is a program that will jump into the next folder in a directory (or any number of subdirectories) and go into the next directory in a list.`nThis is great when you have to enter many subdirectories of the same location.`n`n`n`tTo use this program-`nTo use DirectoryJumper enter the amount of directories to go back and then the amount of directories to jump forward into.`n`nThe Jump Forward Box - This box is almost always 1 unless for some reason you want to go to every other directory (enter 2) or every 3rd directory etc.`n`nThe Jump Back Box - This is the main box. This tells Directory Jumper how many folders back it needs to go before it can go to the next directory. If this number is 1, it goes up one folder and then goes into the next folder. If each item has its own subfolder(s) you can increase this number to accommodate. `n`nFor Example- You have one directory with a ton of sub directories. Each of those directories has a sub directory that you want to enter. The BACK number should be 2 (so that it jumps up from the sub directory back into the main directory housing what you are investigating) and the FWD number should be the default 1 (Unless you want to check every other folder in that main investigation directory)`n`n`nThe X button just exits the program. Otherwise Directory Jumper will remain in the taskbar tray and only become visable when you are in a directory in Windows Explorer. `n`nYou can also move the window wherever you want by click and holding on any text field. It works well to the side of the Windows Explorer toolbar next to VIEW.
- Return
- }
- Explorer_GetSelected(hwnd="")
- {
- return Explorer_Get(hwnd,true)
- }
- Explorer_GetWindow(hwnd="")
- {
- WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
- WinGetClass class, ahk_id %hwnd%
- if (process!="explorer.exe")
- return
- if (class ~= "(Cabinet|Explore)WClass")
- {
- for window in ComObjCreate("Shell.Application").Windows
- if (window.hwnd==hwnd)
- return window
- }
- else if (class ~= "Progman|WorkerW")
- return "desktop" ; desktop found
- }
- Explorer_Get(hwnd="",selection=false)
- {
- if !(window := Explorer_GetWindow(hwnd))
- return ErrorLevel := "ERROR"
- if (window="desktop")
- {
- ControlGet, hwWindow, HWND,, SysListView321, ahk_class Progman
- if !hwWindow ; #D mode
- ControlGet, hwWindow, HWND,, SysListView321, A
- ControlGet, files, List, % ( selection ? "Selected":"") "Col1",,ahk_id %hwWindow%
- base := SubStr(A_Desktop,0,1)=="\" ? SubStr(A_Desktop,1,-1) : A_Desktop
- Loop, Parse, files, `n, `r
- {
- path := base "\" A_LoopField
- IfExist %path% ; ignore special icons like Computer (at least for now)
- ret .= path "`n"
- }
- }
- else
- {
- if selection
- collection := window.document.SelectedItems
- else
- collection := window.document.Folder.Items
- for item in collection
- ret .= item.path "`n"
- }
- return Trim(ret,"`n")
- }
- GuiEscape:
- GuiClose:
- XCLOSE:
- {
- ExitApp
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement