Diana (Cda) Posted May 21, 2010 Share Posted May 21, 2010 (edited) Hi, everyone! Was wondering how to do this task below today. I've been managing on my own in AI for quite a while now, but can't seem to figure this one out. I can have files named like this that are automatically generated when an app I have is recording: untitled.mp3 untitled[1].mp3 untitled[2].mp3 untitled[3].mp3 (etc...)There may be only the one "untitled.mp3" or there may be several files, named as above, with the app generating the numbering automatically in the square brackets. Is there a way to have AI rename all these files to something with this type of naming convention: Rad_CBC1- (date), (time) (needs trimming).mp3where the date itself gets taken from the documents' date and time stamp? After AI does its thing, a file dated April 22nd, 1:40 p.m. would have this type of filename: Rad_CBC1- 100422.Th, 13h40m02s (needs trimming).mp3 Thanks! Edited May 21, 2010 by Diana (Cda) Link to comment Share on other sites More sharing options...
jchd Posted May 22, 2010 Share Posted May 22, 2010 Build an array of filenames to process with _FileListToArray, then for every file use FileGetTime to grab its timestamp, format it as you whish with String functions and use FileMove to rename it. Everything you need is in the help file. What you wan to do isn't hard, you should be able to come up with something fairly easily. If you're stuck, post the code you have so that we can point out any problem. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 22, 2010 Share Posted May 22, 2010 (edited) Check the help file for FileFindFirstFile() and FileFindNextFile(), and the example scripts there. For each "untitled*.mp3" file found, rename it by way of FileMove(). Get the timestamp with FileGetTime(). Edit: Or, you could use jchd's method. He only types so fast because his RC time circuit is shorted out... Edited May 22, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now