板 1- 前 次 新 レス
スクリプト投稿スレ
[58]unnamed.ahk:05/01/23 14:22 ID:Lkiug8xg
メニューでディレクトリやファイルを再帰表示する
#NoTrayIcon
CoordMode, Menu, Screen
;表示するドライブを|を区切りで列挙する。\はつけない
DriveList = A:|C:|D:|G:|H:
init:
Loop,1
{
Path := %A_index%
}
Menu:
IfNotExist, %Path%
Goto, Drive
FileGetAttrib, Attrib, %Path%
IfInString, Attrib, D
Pattern = %Path%\*
else
{
SplitPath, Path, OutFileName, OutDir, OutExt, OutNameNoExt, OutDrive
Pattern = %OutDir%\*
}
Dir =
File =
;メニュー表示は、ディレクトリ→ファイルの順
;変数に入れる時にパスの区切りを`nにしている。|とかだと2バイト文字がうまくいかない感じだったので・・・
Loop, %Pattern%, 1, 0
{
FileGetAttrib, Attrib, %A_LoopFileFullPath%
IfInString, Attrib, D
{
Dir = %Dir%%A_LoopFileFullPath%`n
}
else
{
File = %File%%A_LoopFileFullPath%`n
}
}
Menu, Menu, Add, %Path%, Open
Loop, Parse, Dir, `n
{
if A_LoopField is not space
{
if A_index = 1
Menu, Menu, Add
Menu, Menu, Add, %A_LoopField%, Next
}
}
Loop, Parse, File, `n
{
if A_LoopField is not space
{
if A_index = 1
Menu, Menu, Add
Menu, Menu, Add, %A_LoopField%, Next
}
}
Menu, Menu, Add
Menu, Menu, Add, &Back, Back
Gosub, MenuShow
return
前 次