 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Lista Guest
|
Posted: Tue Apr 10, 2007 12:06 pm Post subject: retrieve the first 5 digit of every name in my list |
|
|
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
|
Posted: Tue Apr 10, 2007 12:20 pm Post subject: |
|
|
| 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
|
Posted: Tue Apr 10, 2007 2:02 pm Post subject: Same using regular expressions |
|
|
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 |
|
 |
Lista Guest
|
Posted: Tue Apr 10, 2007 4:01 pm Post subject: |
|
|
Thank you very much!
Both!
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|