Created
May 9, 2016 17:53
-
-
Save TLMcode/0d67c9044786376e5daef52b8595c36c to your computer and use it in GitHub Desktop.
Save/Open directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FolderArr := [], Folders := "" | |
FolderFile := A_ScriptDir "\FolderList.txt" | |
shObj := ComObjCreate( "shell.application" ).Windows | |
Gui, +AlwaysOnTop | |
Gui, Add, Button, section gOpen, Open Folders | |
Gui, Add, Text, vStat, % " " | |
Gui, Add, Button, gSave ys0, Save Folders | |
Gui, Show,, DirMember | |
Return | |
Save: | |
GuiControl,, Stat, Saving... | |
FileDelete % FolderFile | |
For item in shObj | |
if ( decode( item.LocationURL ) ) | |
Folders .= decode( item.LocationURL ) "`n" | |
FileAppend % Folders, % FolderFile | |
GuiControl,, Stat, Saved... | |
Sleep, 1000 | |
GuiControl,, Stat | |
Return | |
Open: | |
GuiControl,, Stat, Opening... | |
FileRead, FolderList, % FolderFile | |
For Each, Dir in StrSplit( FolderList, "`r`n" ) | |
if ( Dir && !WinExist( RegExReplace( Dir, ".*\\" ) ) ) | |
Run % Dir | |
GuiControl,, Stat, Opened... | |
Sleep, 1000 | |
GuiControl,, Stat | |
Return | |
FileRead, FolderList, % FolderFile := A_ScriptDir "\FolderList.txt" | |
For item in shObj | |
Folders .= decode( item.LocationURL ) "`n" | |
For each, Dir in StrSplit( FolderList, "`r`n" ) | |
Run % Dir | |
Return | |
GuiClose: | |
ExitApp | |
decode( url ) | |
{ | |
if ( url ) | |
return Homedrive . RegExReplace( [( o := ComObjCreate("HTMLfile") ).Write(".<script>document.body.innerHTML=decodeURI('" url "')</script>"), o.body.innerHTML ][ 2 ], "^file:\/{3}.{3}|\/", "\" ) | |
} | |
F2::Reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment