Jump to content

Recommended Posts

Posted

  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 Then
That 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 UDFsProcess 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)

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

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 :)

Posted

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

  • Moderators
Posted (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 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.

Posted (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 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 UDFsProcess 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
Posted (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.

Ascend4nt

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.

Edited 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.

Posted

  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 UDFsProcess 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
Posted

  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.

Posted

I ran this directly from Scite.

Dim $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.

Posted

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.

Posted

  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 UDFsProcess 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)

Posted

  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 UDFsProcess 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)

Posted

  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!!! Finally

This was like a soap or something...

You were provided with solution, both StringRegExp and StringInStr the day before yesterday, you know?

♡♡♡

.

eMyvnE

Posted

  trancexx said:

That's great!!! Finally

This 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 UDFsProcess 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)

Posted (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)
Next

Simple 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 by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Posted

  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

Posted (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 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 UDFsProcess 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)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...