DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: Alpha list of files with Numeric drop down to select and display  (Read 5,995 times)

schnarkle

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11
I play guitar at church and would like to be able to select a song order from a list of .pdf files, hit submit and have the songs display in correct order while I page down from one song to the next.

[attach]

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
:) Try AlphaList!

It's just a quick hack, but give it a go.
To change the folder, edit the line folder=.

Skrommel

Code
;AlphaList.ahk
; Order and run a list of PDF files, switch files using PgUp and PgDown
;Skrommel @ 2009

#NoEnv
#SingleInstance,Force
CoordMode,Mouse,Screen

;Edit this line to change folder
folder=C:\PDFs
type=*.pdf

Gui,1:Add,Button,Default GRUN,&Run
Gui,1:Add,ListView,GLISTVIEW Vlistview AltSubmit -ReadOnly,Order|Filename|Path
items=_
Loop,%folder%\%type%,0,1
{
  items=%items%|%A_Index%
  LV_Add("","_",A_LoopFileName,A_LoopFileLongPath)
}
Gui,1:+LastFound +Resize
guiid1:=WinExist()
LV_ModifyCol(2,"Auto")
LV_ModifyCol(3,0)
Gui,1:Show
Return


ITEM:
Gui,2:Submit
ToolTip,%item%.%row%
Gui,1:Default
LV_Modify(row,"",item)
Return


LISTVIEW:
If A_GuiEvent In E,Normal
{
  row:=A_EventInfo
  Gui,1:Default
  LV_GetText(order,row,1)
  MouseGetPos,mx,my
  Gui,2:Destroy
  Gui,2:+Owner1
  Gui,2:Margin,0,0
  Gui,2:-Caption ;+AlwaysOnTop
  Gui,2:Add,ListBox,% "GITEM Vitem Choose" order+1,%items%
  Gui,2:Show,% "X" mx "Y" my
}
Return


RUN:
LV_ModifyCol(1,"Sort")
rows:=LV_GetCount()
current=0
Gosub,NEXT
Return


#IfWinExist AlphaList
PgDn::
NEXT:
current+=1
If (current>rows)
  current=%rows%
Gosub,SHOW
Return


#IfWinExist AlphaList
PgUp::
PREVIOUS:
current-=1
If (current<rows)
  current=1
Gosub,SHOW
Return


SHOW:
LV_GetText(filename,current,3)
Run,%filename%
Return



GuiSize:
If A_EventInfo=1  ;Minimized
  Return
GuiControl,Move,listview,% "W" . (A_GuiWidth-20) . " H" . (A_GuiHeight - 40)
Return
« Last Edit: January 31, 2009, 05:09 PM by skrommel »

schnarkle

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11
skrommel,

Wow, fantastic!

Only problem is that it only loads the first pdf file for some reason and does not load the others at all?  A minor fix?

anyway I LOVE the implementation!

Original address: https://www.donationcoder.com/forum/index.php?topic=16837.0