 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Mon Mar 31, 2008 10:22 pm Post subject: File Manager |
|
|
For the past few day I have been making a file manger in ahk. It isn't made to be perfect and everything, I might not even end up using it. Its mostly made for experience. I plan to make it into a shell eventually.
*Menu
*Open folders and run files
*Copy,paste,delete,cut,rename(fixed!)
*Go up one directory
*Change views, from details to icons
*Change Drives
*Filter
*Tabs!
*If you type a website in address bar and click go, it opens in your web browser
| Code: | #NoEnv
#SingleInstance, force
Setworkingdir %A_ScriptDir%\
SetBatchLines, -1
Hotkey,IfWinActive,AHK Explorer
Hotkey,^c,Copy
Hotkey,^v,Paste
Hotkey,^x,Cut
Hotkey,Delete,Delete
;Add Right Click Menu
Menu, Menu, Add, Rename, Cut
Menu, Menu, Add, Copy, Copy
Menu, Menu, Add, Paste, Paste
Menu, Menu, Add, Delete, Delete
Menu, Menu, Add, Rename, Rename
Menu, Menu, Add
Menu, Menu, Add, New Folder, NewFolder
FileReadLine, HomeFolder, settings.ini, 1 ;Finds the home folder, the folder to start at
If ErrorLevel
HomeFolder = %A_MyDocuments%
FileReadLine,Quote,settings.ini,2
If ErrorLevel
q = "
If HomeFolder = MyDocuments
HomeFolder := A_MyDocuments
CurrentLocation := HomeFolder
CurrentLocation := RegExReplace(HomeFolder, "\\$") ; removes tailing backslashes
driveGet, drives, List ;Get the drives so you can go other places than C:
Loop, Parse,drives
{
drive%A_Index% := A_LoopField ":"
drive := A_Loopfield ":"
driveget,drivename,label,%drive%
addtoddl := addtoddl "|" drivename "(" drive%A_Index% ")"
}
StringReplace, addtoddl, addtoddl, | ;Removes Empty part from DropDownList
;Create Gui
Gui, Add, Tab,x0 y0 w300 h300 buttons gCurrentTab vTab, 1|2|3|4
CurrentTab := 1
loop 4
{
CurrentLocation%A_Index% := CurrentLocation
Gui,Tab, %A_Index%
Gui, Add, Button, x807 y25 gGo,Go
Gui, Add, Button, x6 y26 w60 h50 gUp, ^
Gui, Add, DropDownList,x316 y53 w200 gChangeDrive vCurrentDrive%A_Index%,%addtoddl%
Gui, Add, ListView, x5 y81 w830 h560 Sort Count Report gOpen vListView%A_Index%, File|Size|Type
Gui, Add, Edit, x68 y27 w736 h20 VLocation%A_Index%, % CurrentLocation%CurrentTab%
Gui, Add, Button, x66 y48 w90 h30 gView, View
Gui, Add, Button, x156 y48 w90 h30 gMyDocs, MyDocs
Gui, Add, Button, x247 y48 h30 gNewFolder, New Folder
Gui, Add, Edit, x674 y55 w130 h20 gFilter vFilterText%A_Index%,
Gui, Add, Button, x807 y55 w20 h20 gClear, X
Gui, Add, Text, x640 y57 w30 h20 , Filter
Gui, Show, Center, AHK Explorer
;Fill the ListView
OpenFolder(null,CurrentLocation%CurrentTab%,2,A_Index)
}
return
Go:
Gui,Submit,nohide
If Instr(Location%CurrentTab%,"www.")
Run, % Location%CurrentTab%
else
OpenFolder(null,CurrentLocation%CurrentTab%,2,CurrentTab1)
return
CurrentTab:
Gui,Submit, nohide
;StringReplace,tab,tab,%A_Space%,,a ;Remove Spaces
CurrentTab := Tab
return
GuiContextMenu:
Menu, Menu, Show ;Shows the menu
return
Rename: ;Renames a file or folder
Gui,Tab,%CurrentTab%
Loop % LV_GetCount("Column")
RowNumber := LV_GetNext(A_Index,F)
LV_GetText(FileName,RowNumber)
InputBox, newname , Rename, What would you like to rename %FileName% to?
FileGetAttrib, Folder, % source%A_Index%
If InStr(Folder, "D") ;If its a folder, D stands for directory
FileMoveDir, CurrentLocation%CurrentTab% "\" FileName, CurrentLocation%CurrentTab% "\" NewName,R
Else ;If its a file
{
FileCopy, CurrentLocation%CurrentTab% "\" FileName, CurrentLocation%CurrentTab% "\" NewName
FileDelete,CurrentLocation%CurrentTab% "\" FileName
}
OpenFolder(null,CurrentLocation%CurrentTab%,2,CurrentTab)
return
NewFolder:
InputBox, foldername , New Folder, What do you want your new folders name to be?
newfolder := CurrentLocation%CurrentTab% "\" Foldername
FileCreateDir,%newFolder%
OpenFolder(null,CurrentLocation%CurrentTab%,2,CurrentTab)
return
Copy:
Gui,Tab,%CurrentTab%
Loop %source0% ;Removes files that could of been previously copied
source%A_Index% :=
s0 := 0
RowNumber = 0 ; This causes the first loop iteration to start the search at the top of the list.
Loop
{
RowNumber := LV_GetNext(RowNumber) ; Resume the search at the row after that found by the previous iteration.
if not RowNumber ; The above returned zero, so there are no more selected rows.
break
LV_GetText(FileName, RowNumber)
source%A_Index% := CurrentLocation%CurrentTab% "\" Filename
s0++
}
return
Paste:
Gui,Tab,%CurrentTab%
If source1 :=
{
Msgbox, You did not Copy anything
return
}
Loop %s0%
{
FileGetAttrib, Folder, % source%A_Index%
If InStr(Folder, "D") ;If its a folder, D stands for directory
FileCopyDir, % source%A_Index%, CurrentLocation%CurrentTab% "\"
Else ;If its a file
FileCopy, % source%A_Index%, CurrentLocation%CurrentTab% "\"
}
OpenFolder(null,CurrentLocation%CurrentTab%,2,CurrentTab)
return
Delete:
Gui,Tab,%CurrentTab%
if del0 !=
Loop %del0% ;Removes files that could of been previously deleted
del%A_Index% :=
x := 0
Loop
{
RowNumber := LV_GetNext(RowNumber) ; Resume the search at the row after that found by the previous iteration.
if not RowNumber ; The above returned zero, so there are no more selected rows.
break
LV_GetText(FileName, RowNumber)
del%A_Index% := CurrentLocation%CurrentTab% "\" FileName
x++
}
Loop %x%
{
FileGetAttrib, Folder, % del%A_Index%
If InStr(Folder, "D") ;If its a folder, D stands for directory
FileRemoveDir, % del%A_Index% ,1
Else ;If its a file
FileDelete, % del%A_Index%
}
OpenFolder(null,CurrentLocation%CurrentTab%,2,CurrentTab)
return
Cut:
Gui,Tab,%CurrentTab%
Gosub,Copy ;Copy Files
Gosub,Delete ;Then Delete
return
ChangeDrive:
Gui,Tab,%CurrentTab%
Gui,Submit,nohide
StringGetPos, where, CurrentDrive%CurrentTab%,( ;Removes the name and parentheses
Stringtrimleft currentdrive%currenttab%, currentdrive%CurrentTab%, % where+1
StringReplace currentdrive%CurrentTab%, currentdrive%CurrentTab%,)
Openfolder(null,CurrentDrive%CurrentTab%,2,CurrentTab)
CurrentLocation%CurrentTab% := CurrentDrive%CurrentTab%
Guicontrol,,Location%CurrentTab%,% CurrentLocation%CurrentTab%
return
Clear: ;Clear the Filter
Gui,Tab,%CurrentTab%
Guicontrol,,Filtertext%CurrentTab%,
return
Filter: ;Like search function but only in current folder
Gui, Submit, nohide
Gui,Tab,%CurrentTab%
Gui, ListView,ListView%CurrentTab%
Lv_Delete()
If FilterText%CurrentTab% =
{
OpenFolder(null,CurrentLocation%CurrentTab%,2,CurrentTab)
Return
}
Loop, % CurrentLocation%CurrentTab% "\"*,1 ;Put the names of the files in the listview
{
If Instr(A_LoopFileName, FilterText%CurrentTab%) ;If what is in the Filter edit box is in the file name add it
{
FileName := A_LoopFileFullPath ; Must save it to a writable variable for use below.
; Build a unique extension ID to avoid characters that are illegal in variable names,
; such as dashes. This unique ID method also performs better because finding an item
; in the array does not require search-loop.
SplitPath, FileName,,, FileExt ; Get the file's extension.
if FileExt in EXE,ICO,ANI,CUR
{
ExtID := FileExt ; Special ID as a placeholder.
IconNumber = 0 ; Flag it as not found so that these types can each have a unique icon.
}
else ; Some other extension/file-type, so calculate its unique ID.
{
ExtID = 0 ; Initialize to handle extensions that are shorter than others.
Loop 7 ; Limit the extension to 7 characters so that it fits in a 64-bit value.
{
StringMid, ExtChar, FileExt, A_Index, 1
if not ExtChar ; No more characters.
break
; Derive a Unique ID by assigning a different bit position to each character:
ExtID := ExtID | (Asc(ExtChar) << (8 * (A_Index - 1)))
}
; Check if this file extension already has an icon in the ImageLists. If it does,
; several calls can be avoided and loading performance is greatly improved,
; especially for a folder containing hundreds of files:
IconNumber := IconArray%ExtID%
}
if not IconNumber ; There is not yet any icon for this extension, so load it.
{
; Get the icon associated with this file extension:
hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, FileName, UShortP, iIndex)
if not hIcon ; Failed to load/find icon.
IconNumber = 9999999 ; Set it out of bounds to display a blank icon.
else
{
; Add the HICON directly to the small-icon and large-icon lists.
; Below uses +1 to convert the returned index from zero-based to one-based:
IconNumber := DllCall("ImageList_ReplaceIcon", "uint", ImageListID1, "int", -1, "uint", hIcon) + 1
DllCall("ImageList_ReplaceIcon", UInt, ImageListID2, Int, -1, UInt, hIcon)
; Now that it's been copied into the ImageLists, the original should be destroyed:
DllCall("DestroyIcon", Uint, hIcon)
; Cache the icon to save memory and improve loading performance:
IconArray%ExtID% := IconNumber
}
}
FileGetAttrib, Folder
If InStr(Folder, "D") ;If its a folder, D stands for directory
{
Filesize := "Folder"
Fileext := "File Folder"
}
Else ;If its a file
{
Filesize := A_LoopFileSizeKB "kb"
Fileext := "." A_LoopFileExt
}
LV_Add(Icon . IconNumber,A_LoopFileName,Filesize,Fileext) ;Add the filename filesize and extension
}
}
LV_ModifyCol()
return
;Opens or goes into folder
Open:
Gui,Tab,%CurrentTab%
if A_GuiEvent = DoubleClick ;If DoubleClicked
{
LV_GetText(RowText, A_EventInfo) ; Get the text from the row's first field.
LV_GetText(IsFolder?, A_EventInfo,3) ;Get The extension
If isfolder? = Type ;If there is nothing were clicked
return
If IsFolder? = File Folder
{
OpenFolder(RowText,CurrentLocation%CurrentTab%,1,CurrentTab) ;Update the ListView for the new folder
CurrentLocation%CurrentTab% := CurrentLocation%CurrentTab% "\" RowText
Guicontrol,,Location%CurrentTab%, % CurrentLocation%CurrentTab%
}
Else
RunFile(RowText, CurrentLocation%CurrentTab%,Quote)
}
return
GuiClose:
ExitApp
MyDocs: ;Go to My Documents
Gui,Tab,%CurrentTab%
Openfolder(null,A_MyDocuments,2,CurrentTab)
CurrentLocation%CurrentTab% := A_MyDocuments
Guicontrol,,Location%CurrentTab%,%A_MyDocuments%
return
View:
Gui,Tab,%CurrentTab%
Gui, ListView,ListView%CurrentTab%
if not IconView
GuiControl, +Icon, ListView%CurrentTab% ; Switch to icon view.
else
GuiControl, +Report, ListView%CurrentTab% ; Switch back to details view.
IconView := not IconView ; Invert in preparation for next time.
LV_ModifyCol()
return
Up:
Gui,Tab,%CurrentTab%
StringLen,isdrive?,CurrentLocation%CurrentTab%
if isdrive? = 2 ;Prevents weird thing with icons
return
StringGetPos, pos, CurrentLocation%CurrentTab%, \, R
StringLeft, CurrentLocation%CurrentTab%, CurrentLocation%CurrentTab%, pos
OpenFolder(pos,CurrentLocation%CurrentTab%,2,CurrentTab)
Guicontrol,,Location%currenttab%,% CurrentLocation%CurrentTab%
return
;Opens a Folder
OpenFolder(FolderName,CurrentLocation,UporDown,Tab)
{
Gui,Tab,%Tab%
Gui, ListView,ListView%Tab%
Lv_Delete()
If UporDown = 1
currentlocation := CurrentLocation "`\" FolderName "`\"
If UporDown = 2
currentlocation := CurrentLocation "`\"
ImageListID1 := IL_Create(10) ; Create an ImageList to hold 10 small icons.
ImageListID2 := IL_Create(10, 10, true) ; A list of large icons to go with the small ones.
LV_SetImageList(ImageListID1) ; Assign the above ImageList to the current ListView.
LV_SetImageList(ImageListID2)
VarSetCapacity(Filename, 260)
sfi_size = 352
VarSetCapacity(sfi, sfi_size)
Loop, %currentlocation%*,1 ;Put the names of the files int he listview
{
FileName := A_LoopFileFullPath ; Must save it to a writable variable for use below.
; Build a unique extension ID to avoid characters that are illegal in variable names,
; such as dashes. This unique ID method also performs better because finding an item
; in the array does not require search-loop.
SplitPath, FileName,,, FileExt ; Get the file's extension.
if FileExt in EXE,ICO,ANI,CUR
{
ExtID := FileExt ; Special ID as a placeholder.
IconNumber = 0 ; Flag it as not found so that these types can each have a unique icon.
}
else ; Some other extension/file-type, so calculate its unique ID.
{
ExtID = 0 ; Initialize to handle extensions that are shorter than others.
Loop 7 ; Limit the extension to 7 characters so that it fits in a 64-bit value.
{
StringMid, ExtChar, FileExt, A_Index, 1
if not ExtChar ; No more characters.
break
; Derive a Unique ID by assigning a different bit position to each character:
ExtID := ExtID | (Asc(ExtChar) << (8 * (A_Index - 1)))
}
; Check if this file extension already has an icon in the ImageLists. If it does,
; several calls can be avoided and loading performance is greatly improved,
; especially for a folder containing hundreds of files:
IconNumber := IconArray%ExtID%
}
if not IconNumber ; There is not yet any icon for this extension, so load it.
{
; Get the icon associated with this file extension:
hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, FileName, UShortP, iIndex)
if not hIcon ; Failed to load/find icon.
IconNumber = 9999999 ; Set it out of bounds to display a blank icon.
else
{
; Add the HICON directly to the small-icon and large-icon lists.
; Below uses +1 to convert the returned index from zero-based to one-based:
IconNumber := DllCall("ImageList_ReplaceIcon", "uint", ImageListID1, "int", -1, "uint", hIcon) + 1
DllCall("ImageList_ReplaceIcon", UInt, ImageListID2, Int, -1, UInt, hIcon)
; Now that it's been copied into the ImageLists, the original should be destroyed:
DllCall("DestroyIcon", Uint, hIcon)
; Cache the icon to save memory and improve loading performance:
IconArray%ExtID% := IconNumber
}
}
FileGetAttrib, Folder
If InStr(Folder, "D") ;If its a folder
{
Filesize := "Folder"
Fileext := "File Folder"
}
Else ;If its a file
{
Filesize := A_LoopFileSizeKB "kb"
Fileext := "." A_LoopFileExt
}
LV_Add("Icon" . IconNumber,A_LoopFileName,Filesize,Fileext)
}
LV_ModifyCol()
return
}
;Runs a file
RunFile(FileName, CurrentLocation,q)
{
location := CurrentLocation "\" FileName
;StringReplace,location, location,%A_Space% , `%20, 1
Run, %q%%location%%q% ;Runs the file
} |
To do List
*Window Manager
*Maybe add antivirus scan
*Make the add icon code into a function
*Anything you suggest
 _________________

Last edited by System Monitor on Tue Apr 08, 2008 5:00 am; edited 18 times in total |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 571
|
Posted: Mon Mar 31, 2008 10:26 pm Post subject: |
|
|
It is possible to mkae it into a shell. _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 571
|
Posted: Mon Mar 31, 2008 10:27 pm Post subject: |
|
|
Also instead of buttons make a toolbar.
Search forum for toolbar. _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Mon Mar 31, 2008 10:38 pm Post subject: |
|
|
I searched toolbar and did not find anything? _________________
 |
|
| Back to top |
|
 |
Ian
Joined: 15 Jul 2007 Posts: 1151 Location: Enterprise, Alabama
|
|
| Back to top |
|
 |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Tue Apr 01, 2008 2:32 am Post subject: |
|
|
Thx Ian
I don't think that I am going to use that because I don't ever plan to add Back and foward buttons. The only icon that I like is the new folder but I will just make a button. _________________
 |
|
| Back to top |
|
 |
Imapow (guest) Guest
|
Posted: Tue Apr 01, 2008 10:53 am Post subject: |
|
|
can it rename files?
can it copy and paste?
u can alsow put in a tab funcjon so you only need one window |
|
| Back to top |
|
 |
Imapow (guest) Guest
|
Posted: Tue Apr 01, 2008 10:55 am Post subject: |
|
|
| insted of a ^ button on top u can put in a ".." Dir on the list |
|
| Back to top |
|
 |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Tue Apr 01, 2008 4:38 pm Post subject: |
|
|
I am working on copy and paste currently
Forgot about rename , but I will do that to.
Intrestingly I was thinking the exact thing about tabs  _________________
 |
|
| Back to top |
|
 |
user
Joined: 05 Oct 2006 Posts: 423
|
Posted: Wed Apr 02, 2008 12:29 am Post subject: |
|
|
I am currently in search of a file manager that will be able to open fast a folder with large number of files:
is it possible?
all file managers I tested have difficulties opening this monster
does this file manager use 'explorer.exe' to get the files and folders list? or cmd? or directly from the hard disk or OS?
thanks
PS: sorry if I spoil your topic |
|
| Back to top |
|
 |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Wed Apr 02, 2008 12:33 am Post subject: |
|
|
Done with copy,paste,delete,cut and rename
It would be nice if someone could help make the icon part of the OpenFolder function into a function so I can use it for filter. _________________
 |
|
| Back to top |
|
 |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Wed Apr 02, 2008 12:37 am Post subject: |
|
|
If you remove the icons it might be able to work. No it does not use explorer.exe
Here is modified code-Not Tested
| Code: | #NoEnv
#SingleInstance, force
Setworkingdir %A_ScriptDir%\
SetBatchLines, -1
Hotkey,IfWinActive,AHK Explorer
Hotkey,^c,Copy
Hotkey,^v,Paste
Hotkey,^x,Cut
Hotkey,Delete,Delete
Menu, Menu, Add, Rename, Rename
FileReadLine, HomeFolder, settings.ini, 1 ;Finds the home folder, the folder to start at
If ErrorLevel
HomeFolder = %A_MyDocuments%
FileReadLine,Quote,settings.ini,2
If ErrorLevel
q = "
If HomeFolder = MyDocuments
HomeFolder := A_MyDocuments
CurrentLocation := HomeFolder
CurrentLocation := RegExReplace(HomeFolder, "\\$") ; removes tailing backslashes
driveGet, drives, List ;Get the drives so you can go other places than C:
Loop, Parse,drives
{
drive%A_Index% := A_LoopField ":"
drive := A_Loopfield ":"
driveget,drivename,label,%drive%
addtoddl := addtoddl "|" drivename "(" drive%A_Index% ")"
}
FileREmoveDir, C:\Documents and Settings\Shay\My Documents\New Folder
StringReplace, addtoddl, addtoddl, | ;Removes Empty part from DDL
;Create Gui
Gui, Add, Button, x6 y6 w60 h50 gUp, ^
Gui, Add, DropDownList,x316 y33 w200 gChangeDrive vCurrentDrive,%addtoddl%
Gui, Add, ListView, x5 y60 w810 h560 Sort Count Report gOpen vListView, File|Size|Type
Gui, Add, Edit, x68 y7 w736 h20 VLocation, %CurrentLocation%
Gui, Add, Button, x66 y28 w90 h30 gView, View
Gui, Add, Button, x156 y28 w90 h30 gMyDocs, MyDocs
Gui, Add, Button, x248 y28 h30 gNewFolder, New Folder
Gui, Add, Edit, x674 y35 w130 h20 gFilter vFilterText,
Gui, Add, Button, x805 y35 w20 h20 gClear, X
Gui, Add, Text, x640 y37 w30 h20 , Filter
Gui, Show, Center w825, AHK Explorer
Gui, 1:Default
;Fill the ListView
OpenFolder(null,CurrentLocation,2)
return
GuiContextMenu:
Menu, Menu, Show
return
Rename: ;Renames a file or folder
LV_GetText(FileName, A_EventInfo)
Msgbox %A_EventInfo%
return
NewFolder:
InputBox, foldername , New Folder, What do you want your new folders name to be?
newfolder := CurrentLocation "\" Foldername
FileCreateDir,%newFolder%
OpenFolder(null,CurrentLocation,2)
msgbox %newfolder%
return
Copy:
Loop %source0% ;Removes files that could of been previously copied
source%A_Index% :=
s0 := 0
RowNumber = 0 ; This causes the first loop iteration to start the search at the top of the list.
Loop
{
RowNumber := LV_GetNext(RowNumber) ; Resume the search at the row after that found by the previous iteration.
if not RowNumber ; The above returned zero, so there are no more selected rows.
break
LV_GetText(FileName, RowNumber)
source%A_Index% := CurrentLocation "\" Filename
s0++
}
msgbox %source1%
return
Paste:
If source1 :=
{
Msgbox, You did not Copy anything
return
}
Loop %s0%
{
FileGetAttrib, Folder, % source%A_Index%
If InStr(Folder, "D") ;If its a folder, D stands for directory
FileCopyDir, % source%A_Index%, CurrentLocation "\"
Else ;If its a file
FileCopy, % source%A_Index%, CurrentLocation "\"
}
OpenFolder(null,CurrentLocation,2)
return
Delete:
if del0 !=
Loop %del0% ;Removes files that could of been previously deleted
del%A_Index% :=
x := 0
Loop
{
RowNumber := LV_GetNext(RowNumber) ; Resume the search at the row after that found by the previous iteration.
if not RowNumber ; The above returned zero, so there are no more selected rows.
break
LV_GetText(FileName, RowNumber)
del%A_Index% := CurrentLocation "\" FileName
x++
}
Loop %x%
{
FileGetAttrib, Folder, % del%A_Index%
If InStr(Folder, "D") ;If its a folder, D stands for directory
FileRemoveDir, % del%A_Index% ,1
Else ;If its a file
FileDelete, % del%A_Index%
}
OpenFolder(null,CurrentLocation,2)
return
Cut:
Gosub,Copy ;Copy Files
Gosub,Delete ;Then Delete
return
ChangeDrive:
Gui,Submit,nohide
StringGetPos, where, CurrentDrive,( ;Removes the name and parentheses
Stringtrimleft currentdrive, currentdrive, % where+1
StringReplace currentdrive, currentdrive,)
Openfolder(null,CurrentDrive,2)
CurrentLocation := CurrentDrive
Guicontrol,,Location,%CurrentLocation%
return
Clear: ;Clear the Filter
Guicontrol,,Filtertext,
return
Filter: ;Like search function but only in current folder
Gui, Submit, nohide
Lv_Delete()
If FilterText =
{
OpenFolder(null,CurrentLocation,2)
Return
}
Loop, %CurrentLocation%\*,1 ;Put the names of the files in the listview
{
If Instr(A_LoopFileName, FilterText) ;If what is in the Filter edit box is in the file name add it
{
FileGetAttrib, Folder
If InStr(Folder, "D") ;If its a folder, D stands for directory
{
Filesize := "Folder"
Fileext := "File Folder"
}
Else ;If its a file
{
Filesize := A_LoopFileSizeKB "kb"
Fileext := "." A_LoopFileExt
}
LV_Add("",A_LoopFileName,Filesize,Fileext) ;Add the filename filesize and extension
}
}
LV_ModifyCol()
return
;Opens or goes into folder
Open:
if A_GuiEvent = DoubleClick ;If DoubleClicked
{
LV_GetText(RowText, A_EventInfo) ; Get the text from the row's first field.
LV_GetText(IsFolder?, A_EventInfo,3) ;Get The extension
If isfolder? = Type ;If there is nothing were clicked
return
If IsFolder? = File Folder
{
OpenFolder(RowText,CurrentLocation,1) ;Update the ListView for the new folder
CurrentLocation := CurrentLocation "\" RowText
Guicontrol,,Location,%CurrentLocation%
}
Else
RunFile(RowText, CurrentLocation,Quote)
}
return
GuiClose:
ExitApp
MyDocs: ;Go to My Documents
Openfolder(null,A_MyDocuments,2)
Guicontrol,,Location,%A_MyDocuments%
return
View:
if not IconView
GuiControl, +Icon, ListView ; Switch to icon view.
else
GuiControl, +Report, ListView ; Switch back to details view.
IconView := not IconView ; Invert in preparation for next time.
LV_ModifyCol()
return
Up:
StringLen,isdrive?,CurrentLocation
if isdrive? = 2 ;Prevents weird thing with icons
return
StringGetPos, pos, CurrentLocation, \, R
StringLeft, CurrentLocation, CurrentLocation, pos
OpenFolder(pos,CurrentLocation,2)
Guicontrol,,Location,%CurrentLocation%
return
;Opens a Folder
OpenFolder(FolderName,CurrentLocation,UporDown)
{
Lv_Delete()
If UporDown = 1
currentlocation := CurrentLocation "`\" FolderName "`\"
If UporDown = 2
currentlocation := CurrentLocation "`\"
Loop, %currentlocation%*,1 ;Put the names of the files int the listview
{
FileGetAttrib, Folder
If InStr(Folder, "D") ;If its a folder
{
Filesize := A_LoopFileSizeKB "kb"
Fileext := "File Folder"
}
Else ;If its a file
{
Filesize := A_LoopFileSizeKB "kb"
Fileext := "." A_LoopFileExt
}
LV_Add("",A_LoopFileName,Filesize,Fileext)
}
LV_ModifyCol()
return
}
;Runs a file
RunFile(FileName, CurrentLocation,q)
{
location := CurrentLocation "\" FileName
;StringReplace,location, location,%A_Space% , `%20, 1
Run, %q%%location%%q% ;Runs the file
} |
If it works, tell me  _________________
 |
|
| Back to top |
|
 |
user
Joined: 05 Oct 2006 Posts: 423
|
Posted: Wed Apr 02, 2008 12:53 am Post subject: |
|
|
it didnt make the pc freeze as the others did!
works very well!!! thanks !!! |
|
| Back to top |
|
 |
Guest
|
|
| Back to top |
|
 |
System Monitor
Joined: 09 Mar 2007 Posts: 392 Location: Unknown
|
Posted: Wed Apr 02, 2008 8:55 pm Post subject: |
|
|
Thx
That should give me ideas on what to do! _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|