Ascend4nt Posted September 4, 2008 Author Posted September 4, 2008 SmOke_N said: Yes it does... That's how I wrote it. You can't make an exception? If StringRegExp($s_value, ".*?\..*?\.\w+\z") = 0 ThenThat will only allow files without them in it. Sorry, that code crashes as well. It also returns true only for files with more than one dot in it. I'm just looking to exclude files with *any* number of dots - from 1 to whatever. But it seems some are getting frustrated so might as well close this thread. I just wanted to see if something was possible with StringRegExp() that apparently isn't (or that we couldn't find) Thanks to all for trying My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
enaiman Posted September 4, 2008 Posted September 4, 2008 I almost regret that I tried to help ...What is pissing me off is: you never tried to understand the StringRegExp patterns and to play with them - you wanted everything to be ready for use, wrapped in a golden paper and presented on a silver plate ... well, you better hope others will do it because I won't!I said "OP" because it is fastest way - I don't have to go all the time back to look at your name (and I don't have any reason to memorize it).About extensions - I guess I should quote myself: Quote the number of characters after the "." is established here {0,3}I can't imagine what more could you want? to tell you: for 2 characters use {0,2}, for 3 {0,3}, for 4 {0,4} ?... I thought you can figure that out ... I apologize, I guess I've been hoping for too much.Anyway - I'm out of here, and I truly regret my involvement. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
BrettF Posted September 4, 2008 Posted September 4, 2008 Haven't bothered to read the whole thread, the last page is enough. Basically think to the saying you get what you put in. Im with my mate Enaimam here... You want in handed to you in gold paper and on a silver plate. That shouldn't and won't happen. If you want scripts written for you, go to http://www.rentacoder.com. Simple yeah? Also it seems to me that you think you know more than everyone, just let me tell you now... you don't. I'd advise you to post all of your code, and any attempts. Also post your AutoIt version along with SciTE. Perform error checking on every function you use.Cheers,Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Moderators SmOke_N Posted September 4, 2008 Moderators Posted September 4, 2008 (edited) ascendant said: Sorry, that code crashes as well. It also returns true only for files with more than one dot in it. I'm just looking to exclude files with *any* number of dots - from 1 to whatever. But it seems some are getting frustrated so might as well close this thread. I just wanted to see if something was possible with StringRegExp() that apparently isn't (or that we couldn't find) Thanks to all for trying You need to use the right tools for the right situation. Though I'm fond of RegExp's, they're not always the practical solution. If you want to exclude any file that has a dot in it, all you need is StringInStr(), it's faster anyway. You might submit a bug ticket for the RegEx with a replicator script of the 3rd parameter failing for you. If StringInStr($file, ".") = 0 Then Edited September 4, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Ascend4nt Posted September 4, 2008 Author Posted September 4, 2008 (edited) BrettF said: Haven't bothered to read the whole thread, the last page is enough. Basically think to the saying you get what you put in. Im with my mate Enaimam here... You want in handed to you in gold paper and on a silver plate. That shouldn't and won't happen. If you want scripts written for you, go to http://www.rentacoder.com. Simple yeah? Also it seems to me that you think you know more than everyone, just let me tell you now... you don't. I'd advise you to post all of your code, and any attempts. Also post your AutoIt version along with SciTE. Perform error checking on every function you use. Cheers, Brett I'm glad Enaimam brought you here to stick up for him, and that you were ignorant enough to not read through the whole thread. I don't want the world handed to me on a "gold paper and on a silver plate", I just wanted to see if someone knew of a *Regular Expression* that would return False if there were any dots (.) in the name. That's one string of characters, not a whole piece of code! And for Enaimam, as I've said, I've tried numerous combinations - and done tons of reading. I wouldn't have posted if I hadn't done otherwise. Your extension idea will not work no matter how many digits you put as a maximum - Windows allows an almost infinite # of letters after the final dot (up to maximum file/pathname size), but again - I wasn't looking for extensions. And who says I think I know more than everyone? I've TESTED every Regular Expression myself - so I know what I see when the program crashes. And if you want code, here it is, performed AFTER filling an array with filenames. The bottom element contains the count of elements. (So if [0]=14000, the array contains precisely 14001 elements, the 14000'th element [edit: sorry, I meant the index # of which would be 14000] being the last filename). The array was even verified with _ArrayDisplay(): ConsoleWrite("Attempting new Regular expression on files") For $i=1 to $aFilesArray[0] StringRegExp($aFilesArray[$i],".*?\..*?\.\w+\z",0) Next ConsoleWrite("If we made it here, no crashes") This is but one of a few that cause crashes, guess why - it's StringRegExp(). The first ConsoleWrite() is written, the second never gets written. (and I've tried with and without the final 0 parameter) Whether it's a bug in AutoIT or not, I really don't know. It could be, but I really have had a hard time trying to understand AutoIT's Regular Expressions - not only in that it doesn't seem to completely match the PCRE specs on the page the Documentation links to, but because it causes crashes too. Thanks to all those who have offered help and not tried to make me sound like something I've never pretended to be. Ascend4nt Edited September 4, 2008 by ascendant My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Moderators SmOke_N Posted September 4, 2008 Moderators Posted September 4, 2008 (edited) ascendant said: I'm glad Enaimam brought you here to stick up for him, and that you were ignorant enough to not read through the whole thread. I don't want the world handed to me on a "gold paper and on a silver plate", I just wanted to see if someone knew of a *Regular Expression* that would return True if there were any dots (.) in the name. That's one string of characters, not a whole piece of code! And for Enaimam, as I've said, I've tried numerous combinations - and done tons of reading. I wouldn't have posted if I hadn't done otherwise. Your extension idea will not work no matter how many digits you put as a maximum - Windows allows an almost infinite # of letters after the final dot (up to maximum file/pathname size), but again - I wasn't looking for extensions. And who says I think I know more than everyone? I've TESTED every Regular Expression myself - so I know what I see when the program crashes. And if you want code, here it is, performed AFTER filling an array with filenames. The bottom element contains the count of elements. (So if [0]=14000, the array contains precisely 14001 elements, the 14000'th being the last filename). The array was even verified with _ArrayDisplay(): ConsoleWrite("Attempting new Regular expression on files") For $i=1 to $aFilesArray[0] StringRegExp(aFilesArray[$i],".*?\..*?\.\w+\z",0) Next ConsoleWrite("If we made it here, no crashes") This is but one of a few that cause crashes, guess why - it's StringRegExp(). The first ConsoleWrite() is written, the second never gets written. (and I've tried with and without the final 0 parameter) Whether it's a bug in AutoIT or not, I really don't know. It could be, but I really have had a hard time trying to understand AutoIT's Regular Expressions - not only in that it doesn't seem to completely match the PCRE specs on the page the Documentation links to, but because it causes crashes too. Thanks to all those who have offered help and not tried to make me sound like something I've never pretended to be. Ascend4ntAre you using Scite? There should be an error display there in the console. This is wrong.. ConsoleWrite("Attempting new Regular expression on files") For $i=1 to $aFilesArray[0] StringRegExp(aFilesArray[$i],".*?\..*?\.\w+\z",0) Next ConsoleWrite("If we made it here, no crashes") Edit: I see you edited it. Edited September 4, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Ascend4nt Posted September 4, 2008 Author Posted September 4, 2008 SmOke_N said: Are you using Scite? There should be an error display there in the console. This is wrong.. ConsoleWrite("Attempting new Regular expression on files") For $i=1 to $aFilesArray[0] StringRegExp(aFilesArray[$i],".*?\..*?\.\w+\z",0) Next ConsoleWrite("If we made it here, no crashes") Edit: I see you edited it. Yeah, sorry about that - I was just trying to rename the array to make it more understandable for others here, forgot the '$' at first. Here's one with @error checking too. ConsoleWrite("Attempting new Regular expression on files" & @CRLF) For $i=1 to $aFilesArray[0] StringRegExp($aFilesArray[$i],".*?\..*?\.\w+\z",0) If (@error==2) Then ConsoleWrite("Bad Pattern error, @extended: " & @extended & @CRLF) Next ConsoleWrite("If we made it here, no crashes") I've tried it compiled and in Scite, with version 3.2.12.1 of AutoIT. There are no error displays in the console, and the 'Bad Pattern error' is never echoed. So perhaps it is a bug then? My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
BrettF Posted September 4, 2008 Posted September 4, 2008 How many filenames do you need to parse? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Moderators SmOke_N Posted September 4, 2008 Moderators Posted September 4, 2008 ascendant said: Yeah, sorry about that - I was just trying to rename the array to make it more understandable for others here, forgot the '$' at first. Here's one with @error checking too. ConsoleWrite("Attempting new Regular expression on files" & @CRLF) For $i=1 to $aFilesArray[0] StringRegExp($aFilesArray[$i],".*?\..*?\.\w+\z",0) If (@error==2) Then ConsoleWrite("Bad Pattern error, @extended: " & @extended & @CRLF) Next ConsoleWrite("If we made it here, no crashes") I've tried it compiled and in Scite, with version 3.2.12.1 of AutoIT. There are no error displays in the console, and the 'Bad Pattern error' is never echoed. So perhaps it is a bug then?Sounds to me like the RegEx engine isn't freeing the string personally, and the que has reached its limit. But I don't know 100% how Jon implemented it. I'm fairly sure there was a bug found in the 3rd parameter use in another thread, but don't know if it was ever corrected in the betas or even addressed or found. I'd look to see if a RegEx bug has been opened, and if not, post a replicator script that can be easily used to replicate the issue so the devs can see for themselves. For your issue, just use StringInStr as I stated before for the time being. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
BrettF Posted September 4, 2008 Posted September 4, 2008 I ran this directly from Scite. expandcollapse popupDim $aFilesArray[5000] $aFilesArray[0] = UBound ($aFilesArray) - 1 $pre = "C:\My Documents\"; Set to "" to not have a directory in there... ConsoleWrite ("STARTING TO GENERATE RANDOM FILENAMES" & @CRLF) For $x = 1 to $aFilesArray[0] $aFilesArray[$x] = $pre & "_MyFilename_" & GenerateName("cv(r,v)(en)vc") & Random(0,100, 1) & "_" & $x & ".ext" ConsoleWrite ($x & "." & @TAB & "File: " & $aFilesArray[$x] & @CRLF) Next ConsoleWrite ("GENERATE RANDOM FILENAMES FINISHED" & @CRLF & "STARTING TO PARSE FILENAMES" & @CRLF) For $i=1 to $aFilesArray[0] $ret = StringRegExp($aFilesArray[$i],".*?\..*?\.\w+\z",0) If @error Then Switch @error Case 2 ConsoleWrite("Bad Pattern error, Offset: " & @extended & @CRLF) Case Else ConsoleWrite("Unknown Error? @EXTENDED = " & @extended & @CRLF) EndSwitch Else ConsoleWrite ($i & "." & @TAB & "File: " & $aFilesArray[$i] & @TAB & "Matched? " & $ret & @CRLF) EndIf Next ConsoleWrite ("We Made it to the end! Parsed " & $i & " filenames! Awesome!" & @CRLF) ;NameGenerator $TestPattern = "cvxvc" Func GenerateName($Pattern) Dim $Consonants[21] = ["B","C","D","F","G","H","J","K","L","M","N","P","Q","R","S","T","V","W","X","Y","Z"] Dim $Vowels[5] = ["A","E","I","O","U"] If StringInStr($Pattern, "(") Or StringInStr($Pattern, ")") Then If CharCount($Pattern, "(") > 9 OR CharCount($Pattern,")") > 9 then SetError(2,"Too Many Groups",-1) If CharCount($Pattern, "(") <> CharCount($Pattern,")") Then SetError(3,"Parenthesis",-1) $Groups = StringRegExp($Pattern, "\("&".*?"&"\)",3) $PlaceHolder= $Pattern For $i = 0 to Ubound($Groups)-1 $PlaceHolder = StringReplace($PlaceHolder, $Groups[$i], $i,1) Next $chars = StringSplit($PlaceHolder,"") $Limit = $chars[0] Local $Randomchr[$Limit+1] For $i = 1 to $Limit If $chars[$i] = "c" then $Randomchr[$i] = $Consonants[Random(0,20,1)] ElseIf $chars[$i] = "v" Then $Randomchr[$i] = $Vowels[Random(0,4,1)] Else $RandomChr[$i] = $chars[$i] EndIf Next local $Newstring ="" For $i = 1 to $Limit $Newstring&=$RandomChr[$i] Next Local $Replacer[Ubound($Groups)] For $i = 0 to Ubound($Groups)-1 If StringInStr($Groups[$i],",") then $Choices = StringSplit(StringTrimLeft(StringTrimRight($Groups[$i],1),1), ",") $chr = $Choices[Random(1,$Choices[0],1)] Else $Chr = StringTrimLeft(StringTrimRight($Groups[$i],1),1) EndIf $Replacer[$i] = $chr $NewString= StringReplace($Newstring, String($i), $Replacer[$i]) Next $Final = $NewString Else $Chars = StringSplit($Pattern,"") $Limit = $Chars[0] If $Limit>0 then Local $Randomchr[$Limit+1] For $i = 1 to $Limit If $Chars[$i] = "c" then $Randomchr[$i] = $Consonants[Random(0,20,1)] ElseIf $Chars[$i] = "v" Then $Randomchr[$i] = $Vowels[Random(0,4,1)] Else $RandomChr[$i] = $chars[$i] EndIf Next local $Final ="" For $i = 1 to $Limit $Final&=$RandomChr[$i] Next EndIf EndIf Return StringUpper(StringLeft($Final,1))&StringLower(StringTrimLeft($Final,1)) EndFunc Func CharCount($String, $Chr, $CaseSense=0) Local $Count = 0 $Characters = StringSplit($String, "") For $i = 1 to $Characters[0] If $CaseSense then If $Characters[$i] == $Chr then $Count+=1 Else If $Characters[$i] = $Chr then $Count+=1 EndIf Next Return $Count EndFunc Outputted everything I needed correctly. Almost- no matches though. But most importantly no crashes. If I changed the file name to be a PATH, the results were the same, no crash but no matches either. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
therks Posted September 4, 2008 Posted September 4, 2008 Maybe I missed something, but does this not work? Dim $files[5] $files[0] = 'file1.ext' $files[1] = 'file2.ext' $files[2] = 'file3' $files[3] = 'file4.txt' $files[4] = 'file5' For $i = 0 to UBound($files)-1 ConsoleWrite('Has no dot: ' & StringRegExp($files[$i], '^[^.]+$') & @LF) Next Although like Smoke offered earlier, StringInStr would work just as well, and I'd assume it's faster. My AutoIt Stuff | My Github
Ascend4nt Posted September 4, 2008 Author Posted September 4, 2008 RobSaunders said: Maybe I missed something, but does this not work? Dim $files[5] $files[0] = 'file1.ext' $files[1] = 'file2.ext' $files[2] = 'file3' $files[3] = 'file4.txt' $files[4] = 'file5' For $i = 0 to UBound($files)-1 ConsoleWrite('Has no dot: ' & StringRegExp($files[$i], '^[^.]+$') & @LF) Next Although like Smoke offered earlier, StringInStr would work just as well, and I'd assume it's faster. Yes!! That's it! Thanks so much RobSaunders! Works perfectly. AND doesn't crash AutoIT =) I'd give you a big fat kiss if I were a woman Thanks alot, that totally solved the problem. My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Ascend4nt Posted September 4, 2008 Author Posted September 4, 2008 BrettF said: I ran this directly from Scite.{code cut for post-length}Outputted everything I needed correctly. Almost- no matches though. But most importantly no crashes. If I changed the file name to be a PATH, the results were the same, no crash but no matches either.BrettF, thanks for giving it a hearty try - looks like that took a bit of time to do. I appreciate the effort. One thing though - I don't see you allowing for unicode characters, and I'm not clear if there are random dots placed in your generated filenames? But I've only took a brief look at it.. I'm gonna try it out and see what is generated.It's kinda making me wonder if certain characters (possibly special characters like © or other special unicode chars) are what's crashing AutoIT's RegEx functions?In any case, seems like RobSaunders solved the problem I originally posted about though I'm grateful to everyone for their tries! Wow, what a chore that was hehe My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
BrettF Posted September 4, 2008 Posted September 4, 2008 Not really that long to do... Paulie did all the work with the random name generator Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
trancexx Posted September 4, 2008 Posted September 4, 2008 ascendant said: Yes!! That's it! Thanks so much RobSaunders! Works perfectly. AND doesn't crash AutoIT =) I'd give you a big fat kiss if I were a woman Thanks alot, that totally solved the problem.That's great!!! FinallyThis was like a soap or something...You were provided with solution, both StringRegExp and StringInStr the day before yesterday, you know? ♡♡♡ . eMyvnE
Ascend4nt Posted September 5, 2008 Author Posted September 5, 2008 trancexx said: That's great!!! FinallyThis was like a soap or something...You were provided with solution, both StringRegExp and StringInStr the day before yesterday, you know?'as the RegEx world turns'? hehe. Actually, like I stated before - the StringRegExp()'s provided to me did not return the proper results, and some of them crashed AutoIT. StringInStr() I already knew of, but the topic of this thread wasn't about finding alternatives =) My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
-Ultima- Posted September 5, 2008 Posted September 5, 2008 (edited) Dim $files[5] $files[0] = 'file1.ext' $files[1] = 'file2.ext' $files[2] = 'file3' $files[3] = 'file4.txt' $files[4] = 'file5' For $i = 0 to UBound($files)-1 ConsoleWrite('"' & $files[$i] & '" has no dot: ' & (Not StringRegExp($files[$i], '\.')) & @LF) NextSimple enough >_>All you need to look for is a dot. If it finds a dot, then ignore it. Alternatively, you can do as I did in my modified example and just negate the returned value so that any time it's true (it negated a 0, meaning it did not find a dot), then accept that file.In the end, StringInStr() is indeed the better and faster solution. Why turn to regular expressions for such a simple search? O_o Edited September 5, 2008 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]
trancexx Posted September 5, 2008 Posted September 5, 2008 ascendant said: 'as the RegEx world turns'? hehe. Actually, like I stated before - the StringRegExp()'s provided to me did not return the proper results, and some of them crashed AutoIT. StringInStr() I already knew of, but the topic of this thread wasn't about finding alternatives =) Yes, of course. What is the difference between StringRegExp($files[$i], '^[^.]+$') and StringRegExp($files[$i], '\.') ? To demonstrate, I will make slight modification of 'solution finally found' script: Dim $files[5] $files[0] = 'file1.ext' $files[1] = 'file2.ext' $files[2] = 'file3' $files[3] = 'file4.txt' $files[4] = 'file5' For $i = 0 to UBound($files)-1 ConsoleWrite('Has no dot: ' & StringRegExp($files[$i], '^[^.]+$') & ' Has dot: ' & StringRegExp($files[$i], '\.') & @LF) Next (btw, '^[^.]+$' is impressive) ♡♡♡ . eMyvnE
enaiman Posted September 5, 2008 Posted September 5, 2008 (edited) IMO - the pattern can be simplified - it can work with a simple "(\.)" EDIT: we're all seeing the obvious Edited September 5, 2008 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Ascend4nt Posted September 5, 2008 Author Posted September 5, 2008 (edited) Okay, so I've finished my function. I might as well give everyone the code that was a result of this. It might also answer some questions. I'll also include my 'alternate' entrance to my _FileFolderSearchRegEx() function, which could possibly make some people go 'Ohhh': [edit (again): see new post for now completely DOS-Dir compatible function] Edited September 5, 2008 by ascendant My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
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