Spiff59 Posted July 11, 2009 Share Posted July 11, 2009 Can someone point out what it takes to get the PathMatchSpec or PathMatchSpecW function working? $str = "C:\CONFIG.SYS" ;$str = "C:\CONFIG.SYS" & Chr(0) $mask = "*.SYS" ;$mask = "*.SYS" & Chr(0) & Chr(0) If DllCall("shlwapi.dll","int","PathMatchSpecW","wstr",$str,"wstr",$mask) Then Beep(800,100) Thanks. Link to comment Share on other sites More sharing options...
trancexx Posted July 11, 2009 Share Posted July 11, 2009 (edited) What a dumb function*. DllCall() returns an array. $sFile = "C:\CONFIG.SYS" $sFileType = "*.SYS" $aCall = DllCall("shlwapi.dll", "int", "PathMatchSpecW", "wstr", $sFile, "wstr", $sFileType) ; error checking missing here If $aCall[0] Then Beep(800, 100) $sFile = "C:\CONFIG.SYS" If StringRegExpReplace($sFile, ".*\.", "") = "SYS" Then Beep(800, 100) edit: * for use with AutoIt Edited July 11, 2009 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Spiff59 Posted July 11, 2009 Author Share Posted July 11, 2009 (edited) Well, it does what it does, matches a string against a DOS filename filter.StringRegExp's (like the one above) are bogging down the last test version I posted in this thread: FileListToArrayI just thought I'd see if a DLL call could get any where near competing as far as performance. It doesn't. The PathMatchSpecEx function looked interesing, it accepts a semi-colon delimited string containing multiple filename filters. Unfortunately, it is Vista only (and likely still slower than a complex StringRegExp that uses alternation).Edit: By the way, thank you for the answer. MSDN said PathMatchSpecExW returned an integer, I'd overlooked that my return was actually coming from DLLCall. It was 1:30am and I'm not sure both my brain cells were firing at the time. Edited July 11, 2009 by Spiff59 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