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 

Script to turn folders into menus

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



Joined: 31 Mar 2006
Posts: 127
Location: New York

PostPosted: Sun Aug 31, 2008 2:44 pm    Post subject: Script to turn folders into menus Reply with quote

Here's a script that turns folders into menus. I know this has already been done, but what the hell. This variation is a bit unorthodox, but it works. Just pass the folder to the script as a command line parameter and make sure to enclose it in quotes if it contains spaces. If you run it without parameters, it works on the folder containing the script. Holding down the Shift key while selecting a file will ask if you want to delete it. It's very basic, but I probably won't be improving it very much since it already does most of what I want. If anyone else cares enough to work on it feel free. It would be nice if I could figure out how to remove file extensions, but I suspect that would be somewhat difficult using this approach.

Code:
#NoTrayIcon
#SingleInstance Ignore
SetBatchLines -1
Folder = %1%
If 1 =
Folder = %A_ScriptDir%
Loop %Folder%\*.*, 2, 1
{
SubDir = %A_LoopFileDir%\%A_LoopFileName%
Menu %SubDir%, Add
Menu %SubDir%, DeleteAll
Menu %A_LoopFileDir%, Add, %A_LoopFileName%, :%SubDir%
}
Loop %Folder%\*.*,, 1
Menu %A_LoopFileDir%, Add, %A_LoopFileName%, Run
Menu %Folder%, Show
Return

Run:
GetKeyState ShiftState, Shift
If ShiftState = D
{
MsgBox 4, Confirm File Delete, Are you sure you want to delete '%A_ThisMenuItem%'?
IfMsgBox Yes
FileDelete %A_ThisMenu%\%A_ThisMenuItem%
}
      Else
Run %A_ThisMenu%\%A_ThisMenuItem%
ExitApp
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Fri Oct 24, 2008 5:21 pm    Post subject: Reply with quote

I get Error: Menu does not exist. The current thread will exit. when I try to run this script.
_________________

Back to top
View user's profile Send private message Visit poster's website
Diamond



Joined: 31 Mar 2006
Posts: 127
Location: New York

PostPosted: Fri Oct 24, 2008 5:33 pm    Post subject: Reply with quote

Titan wrote:
I get Error: Menu does not exist. The current thread will exit. when I try to run this script.


I have no idea what could be causing the problem. It works for me.
Back to top
View user's profile Send private message
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