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 

retrieve the first 5 digit of every name in my list

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Lista
Guest





PostPosted: Tue Apr 10, 2007 12:06 pm    Post subject: retrieve the first 5 digit of every name in my list Reply with quote

Please, how to retrieve the first 5 digit of every name in my list?
My list.txt:
Code:
E:\MP3\MP6\wettyu\12832-Wamdue Project.King of my castle(extended armin van buuren version).MP3
D:\MP3\MP6\wettyu\12853-Wasteland Simple Minds.mp3
E:\MP3\MP6\wettyu\12854-Watch That Man 077. David Bowie-1973-Aladdin Sane.mp3
D:\MP3\MP1\12857-Water No Get Enemy 078. Anikulapo Kuti & Africa '70-1975-Expensive Shit.mp3
D:\MP3\MP1\12858-Waterfront ('89 Remix) Simple Minds.mp3
D:\MP3\MP1\09529-remy and sven piano power Underworld.mp3
D:\MP3\MP1\09530-Renascer (Moses) Focus Ennio Morricone e Dulce Pontes Focus.mp3
D:\MP3\MP1\09297-Purple Om Armageddon Dub @@.mp3
E:\MP3\MMU\09298-Purple Rain Prince.mp3
E:\MP4\SRT\DDR\09300-Push - Strange World (2000 Remake).mp3
D:\MP3\MP1\09301-Push - Universal Nation (Live Mix).mp3
D:\MP3\MP1\08721-oscar peterson night train nme.mp3
D:\MP3\MP1\08724-Osman Ismen Kale.mp3

I need to retrieve the first 5 digit of every name
Code:

E:\MP4\SRT\DDR\09300-Push - Strange World (2000 Remake).mp3
= 09300
D:\MP3\MP1\09301-Push - Universal Nation (Live Mix).mp3
= 09301

My best:
Code:

FullFileName = C:\Documents\List.txt
name = List.txt
dir = C:\Documents
ext = txt
name_no_ext = List
drive = C:

Thanks in advance.
Lista
Back to top
BoBo
Guest





PostPosted: Tue Apr 10, 2007 12:20 pm    Post subject: Reply with quote

Code:
Loop, Read, List.txt, Out.txt
{
   SplitPath, A_LoopReadLine, FileName
   StringSplit, Number, FileName, -
   ToolTip, %FileName% = %Number1%
   FileAppend, %FileName% = %Number1%`n
   }
ToolTip
Run, Notepad Out.txt
Not tested.
Back to top
Venia Legendi



Joined: 27 May 2005
Posts: 35

PostPosted: Tue Apr 10, 2007 2:02 pm    Post subject: Same using regular expressions Reply with quote

I tend to use regexps for this kind of stuff:
Code:

l =
(
E:\MP3\MP6\wettyu\12832-Wamdue Project.King of my castle(extended armin van buuren version).MP3
D:\MP3\MP6\wettyu\12853-Wasteland Simple Minds.mp3
E:\MP3\MP6\wettyu\12854-Watch That Man 077. David Bowie-1973-Aladdin Sane.mp3
D:\MP3\MP1\12857-Water No Get Enemy 078. Anikulapo Kuti & Africa '70-1975-Expensive Shit.mp3
D:\MP3\MP1\12858-Waterfront ('89 Remix) Simple Minds.mp3
D:\MP3\MP1\09529-remy and sven piano power Underworld.mp3
D:\MP3\MP1\09530-Renascer (Moses) Focus Ennio Morricone e Dulce Pontes Focus.mp3
D:\MP3\MP1\09297-Purple Om Armageddon Dub @@.mp3
E:\MP3\MMU\09298-Purple Rain Prince.mp3
E:\MP4\SRT\DDR\09300-Push - Strange World (2000 Remake).mp3
D:\MP3\MP1\09301-Push - Universal Nation (Live Mix).mp3
D:\MP3\MP1\08721-oscar peterson night train nme.mp3
D:\MP3\MP1\08724-Osman Ismen Kale.mp3
)
stringsplit, l,l, `n,`r
loop %l0%
    if (regexmatch(l%A_index%, "([^\\]{5})[^\\]*$", o))
        msgbox % l%A_Index% " -> "  o1
Back to top
View user's profile Send private message
Lista
Guest





PostPosted: Tue Apr 10, 2007 4:01 pm    Post subject: Reply with quote

Thank you very much!
Both!
Very Happy Very Happy
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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