lordicast Posted April 21, 2009 Share Posted April 21, 2009 (edited) I cannot figure out how this works ! the help file is very hard to understand on this topic below I have a less then stellar example. its suspose to get all the audio files from this folder and move them to another folder. HotKeySet('{esc}','esc') Func esc() exit 0 EndFunc While 1 $media = '(wma|mp3|wav)' $good = StringRegExp(@ScriptDir & "\*.*",@ScriptDir & "\*."&$media,0) if $good = 1 then FileMove(@ScriptDir & "\*."&$media, @ScriptDir & "\Music\", 9) else sleep(100) endif WEnd Edited April 21, 2009 by lordicast [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
exodius Posted April 21, 2009 Share Posted April 21, 2009 (edited) You're not looking for StringRegExp (which is used to match strings based on regular expressions), you're looking for FileFindFirstFile/FileFindNextFile or _FileListToArray. Edited April 21, 2009 by exodius Link to comment Share on other sites More sharing options...
Mat Posted April 21, 2009 Share Posted April 21, 2009 (edited) you can only search strings with stringregexp. use filefindfirstfile, wildcards are supported. put it in a loop with filefindnextfile, thats all pretty well documented i think. Edit: Why am I always second? Edited April 21, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Qousio Posted April 21, 2009 Share Posted April 21, 2009 Even though Exodius answered your question, try looking at the "Tutorial - Regular Expression". Its very easy to follow. Link to comment Share on other sites More sharing options...
lordicast Posted April 21, 2009 Author Share Posted April 21, 2009 Thanks to all the responded! very good advise and will follow the filefindfirstfile approach. from help. $search = FileFindFirstFile("*.*") ;<--- where do i add my extenstions for the files? ie; (mp3,wma,wav) that are exceptable? If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd FileClose($search) [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
Mat Posted April 21, 2009 Share Posted April 21, 2009 (edited) $search = FileFindFirstFile("*.*") ;<--- where do i add my extenstions for the files? ie; (mp3,wma,wav) that are exceptable? do three searches would be a simple method... Dim $Ext[3] = ["mp3", "wma", "wav"] For $i = 0 to ubound ($ext) While Not @Error ;Search for File "*." & $Ext[$i] Wend Next bound to have errors, just typed it out as an example. MDiesel edit: wow.... got practically exactly the same as rudi, but I got there first. Edited April 21, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
rudi Posted April 21, 2009 Share Posted April 21, 2009 Hi. $search = FileFindFirstFile("*.*") ;<--- where do i add my extenstions for the files? ie; (mp3,wma,wav) that are exceptable? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
lordicast Posted April 21, 2009 Author Share Posted April 21, 2009 Thanks everyone. FYI if anyone wants to know HotKeySet('{esc}','esc') Func esc() exit 0 EndFunc while 1 _Move() WEnd ;===aMove func _Move() dim $MyExt[4]=["wav","mp3","wma","wmv"] for $i In $MyExt $search = FileFindFirstFile("*."&$i) While 1 $file = FileFindNextFile($search) If @error Then ExitLoop TrayTip("Found File:", "Moving file "&$file,10) FileMove(@ScriptDir & "\"&$file, @ScriptDir & "\Music\", 9) WEnd FileClose($search) next EndFunc [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
trancexx Posted April 21, 2009 Share Posted April 21, 2009 This is related to post #1: $sMediaExtensions = "wma|mp3|wav" $aMediaExtensions = StringSplit($sMediaExtensions, "|") For $i = 1 To UBound($aMediaExtensions) FileMove(@ScriptDir & "\*." & $aMediaExtensions[$i], @ScriptDir & "\Music\", 9) Next ♡♡♡ . eMyvnE 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