Modify

Opened 3 years ago

Closed 3 years ago

#3856 closed Bug (No Bug)

FileOpenDialog passing unseen information

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description

The summary is the best I could describe it and is an assumption. See link starting at post 4
https://www.autoitscript.com/forum/topic/207124-regexp-assistance-please/ for a better perspective.

Passing a file list to an array from the fileopendialog function puts something in the array that is messing with regexp functions. If I pass the same exact information from a "manually built array" of information the regexp will work with no issue.

$FileSelect = FileOpenDialog("File Rename", "F:\", "Images (*.jpg)|Videos (*.mp4)", $FD_MULTISELECT, "", $hForm)

$aDirContent_New = StringSplit($FileSelect, "|", 2)

_ArrayDisplay($aDirContent_New)

    For $i = UBound($aDirContent_New) - 1 To 0 Step - 1
        ConsoleWrite($i & " " & $aDirContent_New[$i] & @CRLF)
        If StringRegExp($aDirContent_New[$i], "^\d{4}(-\d{2}){2}_\d{6}_[PV]$") Then
            ConsoleWrite("> " & $i & @CRLF)
            _ArrayDelete($aDirContent_New, $i)
            ContinueLoop
        EndIf
        ;$aDirContent_New[$i] = $aDirContent_New[0] & "\" & $aDirContent_New[$i]
    Next
    
_ArrayDisplay($aDirContent_New)
{{{


As I said, passing an array directly, or the following code works perfectly with regexp which leads me to believe this is a bug.



{{{
#include <File.au3>
#include <WinAPISysWin.au3>
Global $GText
Local $hTimerProc = DllCallbackRegister('_TimerProc', 'none', 'hwnd;uint;uint_ptr;dword')
Global $g_iCount = 0
Local $iTimerID = _WinAPI_SetTimer(0, 0, 1000, DllCallbackGetPtr($hTimerProc))
$title = "File Rename"
$sFileSelect = FileOpenDialog($title, "F:\", "Images (*.jpg)|Videos (*.mp4)", $FD_MULTISELECT, "", 0)
$aDirContent_New = StringSplit($GText, """", 2)
_ArrayDisplay($aDirContent_New)

    For $i = UBound($aDirContent_New) - 1 To 0 Step - 1
        ConsoleWrite($i & " " & $aDirContent_New[$i] & @CRLF)
        If StringRegExp($aDirContent_New[$i], "^\d{4}(-\d{2}){2}_\d{6}_[PV]$") Or $aDirContent_New[$i] = " " Then
            ConsoleWrite("> " & $i & @CRLF)
            _ArrayDelete($aDirContent_New, $i)
            ContinueLoop
        EndIf
        ;$aDirContent_New[$i] = $aDirContent_New[0] & "\" & $aDirContent_New[$i]
    Next

_ArrayDisplay($aDirContent_New)
Func _TimerProc($hWnd, $iMsg, $iTimerID, $iTime)
$GText = ControlGetText($title, "", "Edit1")
EndFunc   ;==>_TimerProc
}}}
}}}

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by Jos

  • Resolution set to No Bug
  • Status changed from new to closed

Closed until there is a real bug determined in that forum thread.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.