AutoHotkey Community

It is currently May 24th, 2012, 10:06 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: April 10th, 2007, 1:06 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2007, 1:20 pm 
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.


Report this post
Top
  
Reply with quote  
PostPosted: April 10th, 2007, 3:02 pm 
Offline

Joined: May 27th, 2005, 4:14 pm
Posts: 35
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2007, 5:01 pm 
Thank you very much!
Both!
:D :D


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Cephei1, Google [Bot] and 67 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group