DEtHMoroZ Posted September 29, 2012 Posted September 29, 2012 Hi there! I manage to make small helper program, that perform installation of several programs in a row w\o any additional clicks. And suddenly i run into small (and very unexpected problem). When i perform FileFindFirstFile search cant find files with dot in the name Example of file name: "VeryImportantConfigFileV0.65.cfg" Question: How to find\look for file with a dot in it's name? p.s. i had some experiments with this: and it is clearly shows that the problem is in dot. Thx in advantage, DEtH_MoroZ
Kyan Posted September 29, 2012 Posted September 29, 2012 use cmd "dir /B" with stringregexp Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
DEtHMoroZ Posted September 29, 2012 Author Posted September 29, 2012 Thx for your help. Can you give me please scripting example?
Kyan Posted September 29, 2012 Posted September 29, 2012 should do the job Global $output = '', $cmd $cmd = Run(@ComSpec & " dir /B *.*", "", @SW_HIDE, $STDOUT_CHILD) While ProcessExists($cmd) $line = StdoutRead($foo) If ($line) Then $output &= $line & @CRLF EndIf Sleep(100) WEnd MsgBox(0,"CMD Output",$output) ;first file $sFirstF = StringRegExp($output,"v+", 3) If IsArray($sFirstF) Then MsgBox(0,"First File",$sFirstF[0]) Exit Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
DEtHMoroZ Posted September 29, 2012 Author Posted September 29, 2012 Still not sure how to use it. However, thx for your help, now i know the direction to dig to.
Kyan Posted September 29, 2012 Posted September 29, 2012 Still not sure how to use it. However, thx for your help, now i know the direction to dig to. I create a function for easy use, just test it Global $STDOUT_CHILD = 0x2 $list = _listDir("c:windows", 1) MsgBox(0,"First File",$list[1]) Exit Func _listDir($slistdir, $nFilenumber = 1, $listForders = 0) ; [0] = all files list, [1] = Your 'n'th file selected (Default one is the first) Local $cmd, $line, $sReturn[2] = ['',''], $folTag = '' If $listForders Then $folTag = " /A:D" $hCMD = Run(@ComSpec & " /k dir /B" & $folTag & " *.*", $slistdir, @SW_HIDE, $STDOUT_CHILD) While 1 $line = StdoutRead($hCMD) If @error Then ExitLoop $sReturn[0] &= $line & @CRLF WEnd $sFirstF = StringRegExp($sReturn[0],"V+", 3) If IsArray($sFirstF) Then $sReturn[1] = $sFirstF[$nFilenumber-1] Return $sReturn EndFunc Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
DEtHMoroZ Posted September 30, 2012 Author Posted September 30, 2012 So, practically we just run cmd.exe and do a query to it (with what ever we need) and then parse callback back into auto it. O_o Nice, thx alot. Now i get it.
Spiff59 Posted September 30, 2012 Posted September 30, 2012 If you use "*" as the wildcard in FileFindFirstFile(), instead of "*.*" it will return a complete file list.
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