how to get filnames...?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Bilde
Junior Coder
Posts: 31
Joined: Fri Nov 15, 2002 3:19 pm
Location: Denmark

how to get filnames...?

Post by Bilde » Sun Apr 13, 2003 6:51 pm

How to I make a script that print all my mp3's from a folder in notepad?

GetFileList>c:\files*.*,files
Separate>files,;,file_names

run>notepad
let>nr=0
label>start
let>nr=nr+1
if>nr>file_names_count,stop
send>file_names_%nr%
press enter

goto>start

label>stop


This script make a list of all the files in the folder, inc. folder structue.
How can I make sure I'm only getting the filetype .mp3, and how can I get rid of the folder adress of the files?

Lumumba

Post by Lumumba » Mon Apr 14, 2003 2:44 pm

Run Program>cmd /c dir /B /S /O:N /L C:\mydirectory\*.mp3 > MyMp3.txt

cmd = WINNT/W2K/XP
command = WIN9x/ME

Check the syntax of the dir command --> cmd /k dir /?

Lumumba

Post by Lumumba » Mon Apr 14, 2003 2:45 pm

Run Program>cmd /c dir /B /S /O:N /L C:\mydirectory\*.mp3 > C:\mydirectory\MyMp3.txt

cmd = WINNT/W2K/XP
command = WIN9x/ME

Check the syntax of the dir command --> cmd /k dir /?

Bilde
Junior Coder
Posts: 31
Joined: Fri Nov 15, 2002 3:19 pm
Location: Denmark

Post by Bilde » Mon Apr 14, 2003 4:23 pm

okay thx! :)

but i'm stil ending up with the folder adress, in from of the filename.
And special characters like æøå (often used in Denmark) are being replaced by "›" and "'". could I make Macro scheduler replace them automatic?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 14, 2003 5:33 pm

Hi,

What is wrong with the following version of your script:


GetFileList>C:\files\*.mp3,files
Separate>files,;,file_names

run>notepad
let>nr=0
label>start
let>nr=nr+1
if>nr>file_names_count,stop
send>file_names_%nr%
press enter

goto>start

label>stop


This lists all .mp3 files in c:\files\ in Notepad.
MJT Net Support
[email protected]

Bilde
Junior Coder
Posts: 31
Joined: Fri Nov 15, 2002 3:19 pm
Location: Denmark

Post by Bilde » Mon Apr 14, 2003 5:41 pm

I just need to get rid of "the files adress", it's not just only the filename the script returns...

script returns:
c:\files\blabla.mp3

I want it to return:
blabla.mp3

:)

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 14, 2003 5:53 pm

Hi,

Simple - just use MidStr to remove it. Here's your modified script:


Let>path=C:\files\
Let>ext=mp3

Length>path,lenp
Let>lenp=lenp+1
GetFileList>%path%*.%ext%,files
Separate>files,;,file_names

run>notepad
let>nr=0
label>start
let>nr=nr+1
if>nr>file_names_count,stop
Length>file_names_%nr%,lenf
MidStr>file_names_%nr%,lenp,lenf,file_name_only
send>file_name_only
Press Enter
Press Enter
goto>start

label>stop


Set the first two lines for the path and file extension you are interested in.
MJT Net Support
[email protected]

Bilde
Junior Coder
Posts: 31
Joined: Fri Nov 15, 2002 3:19 pm
Location: Denmark

Post by Bilde » Mon Apr 14, 2003 5:59 pm

okay!
thx a lot :D

Guest

Post by Guest » Sat Nov 08, 2003 12:05 am

Why the 2 Press Enter ?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts