topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday March 18, 2024, 10:28 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FileDraft - display newest files in a menu  (Read 21197 times)

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
FileDraft - display newest files in a menu
« on: August 08, 2007, 12:06 PM »
This is a small ahk script i made for myself because i was looking for a way to easily access my latest downloads. Today i thought that maybe it could be useful to other people so i made little modifications and improvements and here it is.

* fileDraft.exe (292.56 kB - downloaded 1921 times.)

Here's how fileDraft works : put fileDraft.exe anywhere and create a shortcut to this exe with two parameters. First one is the folder you want to browse, second one is the number of files you want to display.

Example :
  • c:\fileDraft\fileDraft.exe "c:\downloads" 10 will display a menu showing the 10 most recent files in c:\downloads

FileDraft accepts a few keywords :
- <desktop> : desktop folder
- <user> : your "user folder" (i.e c:\documents and settings\username)
- <mydocs> : "My documents" folder
- <windir> : Windows folder

Examples :
  • c:\fileDraft\fileDraft.exe "<mydocs>\Torrent Downloads" 5 will display a menu showing the 5 most recent files in the "My Documents\Torrent Downloads"
  • c:\fileDraft\fileDraft.exe "<desktop>" 20 will display a menu showing the 20 most recent files on your desktop

The best way to use fileDraft is to place the shortcut on a toolbar or in the quicklaunch bar.

I hope someone will find it useful :)
« Last Edit: September 04, 2007, 09:47 PM by ak_ »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #1 on: August 08, 2007, 12:57 PM »
Thanks ak_!

Just one thing.. Could you post the ahk source?
So that other people can learn with your expertise ;)

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #2 on: August 08, 2007, 12:59 PM »
Just one thing.. Could you post the ahk source?
So that other people can learn with your expertise ;)
Of course ! I always hesitate before posting my sources because i feel that my code is quite messy.

Here it is :
; FileDraft
#NoTrayIcon
if 0 < 2
  ExitApp
 
WorkRep = %1%
StringCaseSense off
StringReplace WorkRep, Workrep, <desktop>, %A_Desktop%
StringReplace WorkRep, Workrep, <user>, %UserProfile%
StringReplace WorkRep, Workrep, <windir>, %A_Windir%
StringReplace WorkRep, Workrep, <mydocs>, %A_MyDocuments%
NFiles = %2%

Loop, %WorkRep%\*.*, 0
    FileList = %FileList%%A_LoopFileTimeModified%`t%A_LoopFileName%`n
Sort, FileList, R  ; Sort by date.

z = 1
Loop, parse, FileList, `n
{
    StringSplit, FileItem, A_LoopField, %A_Tab%  ; Split into two parts at the tab char.
    Menu, Fichiers, Add, %FileItem2%, LaunchFile
    if z = %NFiles%
      break
    z++
}

Menu, Fichiers, Show
return

LaunchFile:
run %WorkRep%\%A_ThisMenuItem%
ExitApp
return

MenzAgitat

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #3 on: August 09, 2007, 09:36 AM »
 
Simple but very useful.
Could you add right click support on listed files please ?

« Last Edit: August 09, 2007, 11:19 AM by MenzAgitat »

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #4 on: August 10, 2007, 12:29 PM »
I hope i'll be able to add icons and context-menu support in a future version :)
« Last Edit: August 10, 2007, 12:32 PM by ak_ »

SirSmiley

  • Member
  • Joined in 2007
  • **
  • Posts: 64
    • View Profile
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #5 on: September 02, 2007, 02:57 PM »
Very Cool.
I use a Windows Explorer Plugin called FindeXer & wrote a vbs drop script for anyone who wants it.
Dim fDraft,dirName,fCount,strCommand

fDraft="C:\FileDraft\fileDraft.exe" 'Path to the FileDraft.exe
fCount="10" 'Number of files to show
'Drop script insures only one item was dropped.
'No file/folder error checking so, please just drop folders on it.
If WScript.Arguments.Count = 0 And WScript.Arguments.Count > 1 Then
  WScript.Quit
Else
dirName = WScript.Arguments.Item(0)
End If
'Build the string
strCommand=fDraft&" "&Chr(34)&dirName&Chr(34)&" "&fCount

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Exec strCommand
WScript.Quit

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #6 on: September 03, 2007, 06:57 AM »
Wow great idea on showing a context menu like that. that would make an fantastic alt-tab replacement tool. I made a small ahk script before with a different solution: recent files RSS feeds from folders (see my sig)
« Last Edit: September 03, 2007, 06:59 AM by justice »

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #7 on: September 04, 2007, 09:52 PM »
SirSmiley> good idea ! So good i added drag n drop support to FileDraft :D So now you can drop a folder on a filedraft shortcut (or filedraft.exe) and it will show 10 most recent files. See first post for download.

Now i'm thinking that context-menu support could be nice. Something like :
right click on a folder > click "FildeDraft" in the context menu > shows 10 most recent files

I could even make a config file to specify default number of files to show.

I'll see that tomorrow :)
« Last Edit: September 04, 2007, 09:59 PM by ak_ »

SirSmiley

  • Member
  • Joined in 2007
  • **
  • Posts: 64
    • View Profile
    • Donate to Member
Re: FileDraft - display newest files in a menu
« Reply #8 on: October 06, 2007, 04:37 PM »
Sorry for the bump. I belong to way to many forums. :)

I'm not familiar with the specific registry area for the context menu but, have been playing around with Fast Explorer which also has com object for developers.

It's fairly straight forward and might be of use. http://thesoftpro.tr...wnloads/fe/index.htm