AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AHkxplorer: thinking a file manager with AHK

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  

Are you interested in this application?
Yes, and I'll contribute like I can(suggestions,code,test,comments)
30%
 30%  [ 4 ]
Yes, I'll wait for new releases
46%
 46%  [ 6 ]
Not at all, I like my file manager
15%
 15%  [ 2 ]
No, I think it's useless
7%
 7%  [ 1 ]
Total Votes : 13

Author Message
kiu



Joined: 18 Dec 2005
Posts: 229
Location: Italy - Galatro(RC)

PostPosted: Sun Feb 19, 2006 11:10 am    Post subject: AHkxplorer: thinking a file manager with AHK Reply with quote

I start this topic for comments and suggestion only. Especially to know if someone is interested in it. At this stage you can try the application, but the work is only at the beginning.
N.B.: For starting this project I look at the example in AHK documentation

The program should look "like" this on bottom.
v0.0.1alpha
New:
-double panel now works better
-initial support for tabs
Todo:
-back to previous folder
-menu File|Edit|.....
-Status bar on bottom
-context menus
-dragging support
-search option
-some buttons in the middle of the panel to speed copy and paste between panels
-...(How many things can be done in AHK? Wink )



This is the code for this release (alpha):
Code:
; MAIN EXAMPLE
; The following is a working script that is more elaborate than the one near the top of this page.
; It displays the files in a folder chosen by the user, with each file assigned the icon associated with
; its type. The user can double-click a file, or right-click one or more files to display a context menu.
tab_number:=1
debugOn:=1
tab_el=Desktop|
tab_el_path=%A_Desktop%|
Menu,tab_menu,add,New,tabActions
Menu,tab_menu,add,Close,tabActions
DriveGet, drv,List,Fixed
StringSplit, d, drv
Loop,%d0%
   {
      tem:=d%A_Index% ":\"
      Menu,drive,add,%tem%,gotoFolder
   }

; Allow the user to maximize or drag-resize the window:
Gui +Resize

; Create some buttons:
Gui, Add, Button, Default gButtonLoadFolder, Load a folder
Gui, Add, Button, x+20 gButtonClear, Clear List
Gui, Add, Button, x+20, Switch View
Gui, Add, Button, x+20, Jump To
Gui, Add, Button, x+20, Last
Gui, Add, Button, x+20 gRoot, Root
Gui,Add,Button,x+20 ,Tab

Gui,add,Edit,vaddress cblue x5 w500,
Gui,Add,Button,x+5,Go
Gui,add,tab, -Wrap Left AltSubmit x2 w100 y64 vtabs gtabs,%tab_el%
Gui,add,tab, -Wrap Right AltSubmit x680 y64 w65 vtabs2,Desktop
Gui,Tab,
; Create the ListView and its columns:
Gui, Add, ListView, x20 y64 r20 w350 vMyListView gMyListView AltSubmit, Name|In Folder|Size (KB)|Type
Gui,add,ListView,x375 y64 r20 w350 h400 vMyListView2 gMyListView AltSubmit,Name|In Folder|Size (KB)|Type
currentListView=MyListView2
LV_ModifyCol(3, "Integer")  ; For sorting, indicate that the Size column is an integer.

; Create an ImageList so that the ListView can display some icons:
ImageListID1 := IL_Create(10)
ImageListID2 := IL_Create(10, 10, true)  ; A list of large icons to go with the small ones.
ImageListID3 := IL_Create(20)
ImageListID4 := IL_Create(20, 20, true)  ; A list of large icons to go with the small ones.
; Attach the ImageLists to the ListView so that it can later display the icons:
LV_SetImageList(ImageListID3)
LV_SetImageList(ImageListID4)
Gui, ListView, MyListView
LV_ModifyCol(3, "Integer")  ; For sorting, indicate that the Size column is an integer.

; Attach the ImageLists to the ListView so that it can later display the icons:
LV_SetImageList(ImageListID1)
LV_SetImageList(ImageListID2)
; Create a popup menu to be used as the context menu:
Menu, MyContextMenu, Add, Open, ContextOpenFile
Menu, MyContextMenu, Add, Properties, ContextProperties
Menu, MyContextMenu, Add, Clear from ListView, ContextClearRows
Menu, MyContextMenu, Add,Roots,:drive
Menu, MyContextMenu, Default, Open  ; Make "Open" a bold font to indicate that double-click does the same thing.

; Display the window and return. The OS will notify the script whenever the user
; performs an eligible action:

Folder=%A_Desktop%
loadThisFolder()
Gui, ListView, MyListView2
Folder=%A_Desktop%
loadThisFolder()
Gui, Show
return

tabs:
   Gui,submit,nohide
   StringSplit, tab_el, tab_el, |
   StringSplit, tab_el_path, tab_el_path, |
   Folder:=tab_el_path%tabs%
   loadThisFolder()
   tabsOn:=1
return
tabActions:
   if(A_ThisMenuItem="new")
      {
         if(debugOn)
            msgbox,tab_number=%tab_number% %tab_el%
         tab_number++
         tab_el=%tab_el%Desktop|
         tab_el_path=%tab_el_path%%A_Desktop%|
         GuiControl,,tabs,|%tab_el%
      }
return

ButtonLoadFolder:
Gui +OwnDialogs  ; Forces user to dismiss the following dialog before using main window.
FileSelectFolder, Folder,, 3, Select a folder to read:
if not Folder  ; The user canceled the dialog.
   return
loadThisFolder()
return


ButtonClear:
LV_Delete()  ; Clear the ListView, but keep icon cache intact for simplicity.
return

ButtonSwitchView:
if not IconView
   GuiControl, +Icon, %currentListView%    ; Switch to icon view.
else
   GuiControl, +Report, %currentListView%  ; Switch back to details view.
IconView := not IconView             ; Invert in preparation for next time.
return

ButtonJumpTo:
   Gui,submit,nohide
   Menu,currentFolders,add
   Menu,currentFolders,deleteAll
   StringSplit, dir, Folder, \
   Loop,%dir0%
      {
         currentDir:=dir%A_Index%
         toAdd=%toAdd%%currentDir%\
         Menu,currentFolders,add,%toAdd%,gotoFolder
      }
   Menu,currentFolders,add,Root,Root
   Menu,currentFolders,show
return
gotoFolder:
   toAdd=
   Folder:=A_ThisMenuItem
   loadThisFolder()
return

ButtonGo:
   Gui,submit,nohide
   Folder=%address%
   loadThisFolder()
return

ButtonLast:
   StringSplit,dir_story,last10,|
   Menu,story,add
   Menu,story,deleteAll
   Loop,%dir_story0%
      {
         this_dir_Story:=dir_story%A_Index%
         Menu,story,add,%this_dir_Story%,gotoFolder
      }
   Menu,story,add,Root,Root
   Menu,story,show
return
Root:
   Menu,drive,show
return

ButtonTab:
   Menu,tab_menu,show
return

MyListView:
GuiControl, +BackgroundE6F0FF, %currentListView% ;switch color for inactive listview
currentListView=%A_GuiControl% ;update active listview
GuiControl, +BackgroundFFFFFF#99ccff, %currentListView% ;switch color for active listview
Gui, ListView,%currentListView%
if A_GuiEvent = DoubleClick  ; There are many other possible values the script can check.
{
   LV_GetText(FileName, A_EventInfo, 1) ; Get the text of the first field.
   LV_GetText(FileDir, A_EventInfo, 2)  ; Get the text of the second field.
   FileGetAttrib, Attributes, %FileDir%\%FileName%
   IfInString, Attributes, D
      {
         Folder=%FileDir%\%FileName%
         loadThisFolder()
         GuiControl, , tabs,  |%tab_el%
      }
   else
      Run %FileDir%\%FileName%,, UseErrorLevel
   if ErrorLevel
      MsgBox Could not open "%FileDir%\%FileName%".
}
else
   tooltip,%A_GuiEvent% in %A_GuiControl% with %A_EventInfo%
return

GuiContextMenu:  ; Launched in response to a right-click or press of the Apps key.
if A_GuiControl <> MyListView  ; Display the menu only for clicks inside the ListView.
   return
; Show the menu at the provided coordinates, A_GuiX and A_GuiY.  These should be used
; because they provide correct coordinates even if the user pressed the Apps key:
Menu, MyContextMenu, Show, %A_GuiX%, %A_GuiY%
return

ContextOpenFile:  ; The user selected "Open" in the context menu.
ContextProperties:  ; The user selected "Properties" in the context menu.
; For simplicitly, operate upon only the focused row rather than all selected rows:
FocusedRowNumber := LV_GetNext(0, "F")  ; Find the focused row.
if not FocusedRowNumber  ; No row is focused.
   return
LV_GetText(FileName, FocusedRowNumber, 1) ; Get the text of the first field.
LV_GetText(FileDir, FocusedRowNumber, 2)  ; Get the text of the second field.
IfInString A_ThisMenuItem, Open  ; User selected "Open" from the context menu.
   Run %FileDir%\%FileName%,, UseErrorLevel
else  ; User selected "Properties" from the context menu.
   Run Properties "%FileDir%\%FileName%",, UseErrorLevel
if ErrorLevel
   MsgBox Could not perform requested action on "%FileDir%\%FileName%".
return

ContextClearRows:  ; The user selected "Clear" in the context menu.
RowNumber = 0  ; This causes the first iteration to start the search at the top.
Loop
{
   ; Since deleting a row reduces the RowNumber of all other rows beneath it,
   ; subtract 1 so that the search includes the same row number that was previously
   ; found (in case adjacent rows are selected):
   RowNumber := LV_GetNext(RowNumber - 1)
   if not RowNumber  ; The above returned zero, so there are no more selected rows.
      break
   LV_Delete(RowNumber)  ; Clear the row from the ListView.
}
return

GuiSize:  ; Allows the ListView to grow or shrink in response user's resizing of window.
if A_EventInfo = 1  ; The window has been minimized.  No action needed.
   return
; Otherwise, the window has been resized or maximized. Resize the ListView to match.
GuiControl, Move, MyListView, % "W" . (350) . " H" . (400)
return

GuiClose:  ; When the window is closed, exit the script automatically:
ExitApp
;when setting the var folder, it will show that folder in current active listview
loadThisFolder()
   {
      global
         last10=%Folder%|%last10%
         LV_Delete()
         Gui,submit,nohide
         SplitPath, Folder, OutFileName
         StringSplit, tab_el, tab_el, |
         StringSplit, tab_el_path, tab_el_path, |
         tab_el=
         tab_el_path=
         Loop,% tab_el0 - 1
            {
               if(tab_el%A_Index%!="")
                  if(A_Index!=tabs)
                     {
                        tab_el_path_temp:=tab_el_path%A_Index%
                        temp_var:=tab_el%A_Index%
                        tab_el=%tab_el%%temp_var%|
                        tab_el_path=%tab_el_path%%tab_el_path_temp%|
                     }
                  else
                     {
                        tab_el=%tab_el%%OutFileName%|
                        tab_el_path=%tab_el_path%%Folder%|
                     }
            }
         GuiControl,Text,address,%Folder%
         ; Check if the last character of the folder name is a backslash, which happens for root
         ; directories such as C:\. If it is, remove it to prevent a double-backslash later on.
         StringRight, LastChar, Folder, 1
         if LastChar = \
            StringTrimRight, Folder, Folder, 1  ; Remove the trailing backslash.
         
         ; Ensure the variable has enough capacity to hold the longest file path. This is done
         ; because ExtractAssociatedIconA() needs to be able to store a new filename in it.
         VarSetCapacity(Filename, 260)
         
         ; Gather a list of file names from the selected folder and append them to the ListView:
         Loop %Folder%\*.*,1
         {
            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 = EXE
            {
               ExtID = EXE  ; Special ID as a placeholder.
               IconNumber = 0  ; Flag it as not found so that EXEs can each have a unique icon.
            }
            else  ; Non-EXE, so calculate this extension's unique ID.
            {
               ExtID = 0  ; Initializize 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
                  IconNumber := DllCall("ImageList_ReplaceIcon", UInt, ImageListID3, Int, -1, UInt, hIcon) + 1
                  DllCall("ImageList_ReplaceIcon", UInt, ImageListID2, Int, -1, UInt, hIcon)
                  DllCall("ImageList_ReplaceIcon", UInt, ImageListID4, 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
               }
            }
         
            ; Create the new row in the ListView and assign it the icon number determined above:
            LV_Add("Icon" . IconNumber, A_LoopFileName, A_LoopFileDir, A_LoopFileSizeKB, FileExt)
         }
         LV_ModifyCol()  ; Auto-size each column to fit its contents.
         LV_ModifyCol(3, 60) ; Make the Size column at little wider to reveal its header.
      return
   }


_________________
____________________
______________________
kiu
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 4063
Location: Pittsburgh

PostPosted: Sun Feb 19, 2006 3:38 pm    Post subject: Reply with quote

It sounds like a good idea, but it has a large number of competitors. Before I would switch over from Powerdesk explorer, I would like to see many new features, fixes.

Problems:
- Tooltip does not disappear when active window changes
- Icons are messed up (the first one in the listview is shown for all unknown icons, instead of the default)
- ListViews do not resize
- The button [Tab]/New opens the same folder once more
- The button [Tab]/Close does not do anything
- The side tab does not update when directory changes

Wish list:
- Menu bar
- Extensible context list
- File operations:
--- copy (to other panel, to clipboard)
--- cut (to clipboard for move with paste)
--- move
--- recycle
--- delete
--- shred
--- encrypt
--- --- Windows, AES-128, AES-256, Twofish, TEA, RC4...
--- hash
--- --- MD5, Whirlpool, SHA-1, SHA-256, SHA-512...
- Compress: Windows / Zip...
- Create folder
- View/Set file properties
- Open/Run
- Open with...
- Default / configurable double-click action
- View file content in native-format / hex / text
- Send To: Email / application... / drive / desktop...
- Associate
- Copy Filename / FilePath
- Filters in, to show only specified files
- Filters out, to hide specified files
- Navigate: up one directory level
- Favorite folders list
- Favorite applications list
- Preferences: startup directory (last, specified), fonts, panels, default/last view, shortcuts, context menus...
- Compare folders
- Help
Back to top
View user's profile Send private message
kiu



Joined: 18 Dec 2005
Posts: 229
Location: Italy - Galatro(RC)

PostPosted: Sun Feb 19, 2006 4:25 pm    Post subject: Reply with quote

Laszlo wrote:
It sounds like a good idea, but it has a large number of competitors. Before I would switch over from Powerdesk explorer, I would like to see many new features, fixes.

Problems:
- Tooltip does not disappear when active window changes
- Icons are messed up (the first one in the listview is shown for all unknown icons, instead of the default)
- ListViews do not resize
- The button [Tab]/New opens the same folder once more
- The button [Tab]/Close does not do anything
- The side tab does not update when directory changes

-tooltip is for test at this stage
-bug, thanks
-bug, thanks
-function not yet implemented
-function not yet implemented
-function not yet implemented

Because the project is too hard, I start this topic only to see how many people are interested in and if someone want eventually to contribute.
The application is almost useless at this stage
_________________
____________________
______________________
kiu
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 6212

PostPosted: Sun Feb 19, 2006 7:06 pm    Post subject: Reply with quote

I voted & Yes, I'll wait for new releases Smile

Edit:
Well, I dont have much experience in AHK and so I cannot contribute anything meaningful, but maybe some suggestions....
_________________
Back to top
View user's profile Send private message
ashamed
Guest





PostPosted: Mon Feb 20, 2006 6:32 am    Post subject: Reply with quote

it is surely a stupid question,

but I don't understand how to get to the place
where one can put a mouseclick for polling?
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6212

PostPosted: Mon Feb 20, 2006 6:43 am    Post subject: Reply with quote

Dear ashamed,
It think that kiu has closed the poll
Confused Shocked Crying or Very sad
_________________
Back to top
View user's profile Send private message
ashamed
Guest





PostPosted: Mon Feb 20, 2006 8:26 am    Post subject: Reply with quote

dear goyyah,

thanks for your response.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6212

PostPosted: Mon Feb 20, 2006 8:34 am    Post subject: Reply with quote

But ashamed, do post of what you think of this topic
Regards, Smile
_________________
Back to top
View user's profile Send private message
kiu



Joined: 18 Dec 2005
Posts: 229
Location: Italy - Galatro(RC)

PostPosted: Mon Feb 20, 2006 7:12 pm    Post subject: Reply with quote

For ashamed:
I don't know why you can't do it, but I never closed the poll. Also I see other people voted, so maybe you can't cause you are not registered.
If some moderator knows about, please let we know
_________________
____________________
______________________
kiu
Back to top
View user's profile Send private message Visit poster's website
himself
Guest





PostPosted: Mon Feb 20, 2006 7:14 pm    Post subject: Reply with quote

I confirm : to vote you must be registred.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6212

PostPosted: Mon Feb 20, 2006 7:19 pm    Post subject: Reply with quote

Oh, I am very sorry kiu Sad !
I did'nt know that once voted , It will be disabled for that particular login!
I should not have posted that way without knowing the facts Sad

Sorry again Exclamation
_________________


Last edited by SKAN on Sat Sep 08, 2007 11:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
ashamed
Guest





PostPosted: Mon Feb 20, 2006 7:21 pm    Post subject: Reply with quote

ok, I have to register
Back to top
kiu



Joined: 18 Dec 2005
Posts: 229
Location: Italy - Galatro(RC)

PostPosted: Mon Feb 20, 2006 8:14 pm    Post subject: Reply with quote

no problem, I didn't know how it worked too Wink
_________________
____________________
______________________
kiu
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group