Modify

#1870 closed Bug (Fixed)

@GUI_DRAGFILE

Reported by: anonymous Owned by: Jon
Milestone: 3.3.9.21 Component: AutoIt
Version: 3.3.6.1 Severity: None
Keywords: @GUI_DRAGFILE Cc:

Description

The @GUI_DRAGFILE seems to return an extra 2 bytes, assumably a @CRLF, when a file is dropped onto an Edit control, as opposed to the return string when dropped e.g. onto a button.

Attachments (0)

Change History (6)

comment:1 by mvg, on Feb 3, 2011 at 12:04:39 PM

Bug Report Guidelines
You must provide a short test script that reproduces the problem. The script should be no more than the bare minimum code necessary to reproduce the problem.

That would also take care of the 'seems' part.

comment:2 by mvg, on Feb 21, 2011 at 8:17:36 PM

#cs - - -
	>Environment(Language:0409  Keyboard:00000409  OS:WIN_XP/Service Pack 3  CPU:X86 OS:X86)
	>Running:(3.3.6.1):C:\...\autoit3.exe "D:\...\_TEST_.au3"
	@GUI_DragFile = "D:\\...\\_TEST__Obfuscated.au3\r\n"
	GUICtrlRead($cEdit) = "D:\\...\\String_and_NUL\r\nD:\\...\\_FileCountLines.txt\r\nD:\\...\\_TEST__Obfuscated.au3\r\n"
#ce - - -
;~ #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 6 -q
;~ #AutoIt3Wrapper_Add_Constants=n
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
main()
Exit
Func main()
	;; gui setup.
	Local $hGui = GUICreate("My GUI", Default, Default, Default, Default, $GUI_SS_DEFAULT_GUI, $WS_EX_ACCEPTFILES)
	_DebugOut('$hGui', $hGui) ;### Debug DebugOut.
	;
	Local $aWinClientSize = WinGetClientSize($hGui) ;; [0]Width, [1]Height
	;
	GUICtrlCreateLabel("Label", 2, 2)
	Local $cLabel = GUICtrlCreateLabel("", 0, 0, Floor($aWinClientSize[0] / 2), $aWinClientSize[1], BitOR($GUI_SS_DEFAULT_LABEL, $SS_BLACKFRAME))
	GUICtrlSetState($cLabel, $GUI_DROPACCEPTED)
	_DebugOut('$cLabel', $cLabel) ;### Debug DebugOut.
	;
	Local $cEdit = GUICtrlCreateEdit("Edit", Floor($aWinClientSize[0] / 2), 0, Floor($aWinClientSize[1] / 2), $aWinClientSize, $GUI_SS_DEFAULT_EDIT)
	GUICtrlSetState($cEdit, $GUI_DROPACCEPTED)
	_DebugOut('$cEdit', $cEdit) ;### Debug DebugOut.
	;
	GUISetState(@SW_SHOW)
	
	;; gui wait.
	Local $iMsg, $fQuit = False
	Do
		$iMsg = GUIGetMsg()
		If $iMsg Then
			Switch $iMsg
				Case $GUI_EVENT_CLOSE
					_DebugOut('- $GUI_EVENT_CLOSE') ;### Debug DebugOut.
					$fQuit = True
				Case $GUI_EVENT_DROPPED
					_DebugOut('- $GUI_EVENT_DROPPED') ;### Debug DebugOut.
					_DebugOut('@GUI_DRAGID', @GUI_DragId) ;### Debug DebugOut.
					_DebugOut('@GUI_DROPID', @GUI_DropId) ;### Debug DebugOut.
					_DebugOut('@GUI_DragFile', _DebugString(@GUI_DragFile)) ;### Debug DebugOut.
					_DebugOut('GUICtrlRead($cEdit)', _DebugString(GUICtrlRead($cEdit))) ;### Debug DebugOut.
			EndSwitch
		EndIf
	Until $fQuit
	
	;; gui cleanup.
	GUIDelete()

	_DebugOut('!< main()') ;### Debug DebugOut
EndFunc
Func _DebugString($S)
	Return StringReplace(StringReplace(StringReplace(StringReplace($S, '\', '\\'), @CR, '\r'), @LF, '\n'), @TAB, '\t')
EndFunc
Func _DebugOut($1 = '', $2 = '')
	If IsString($2) And $2 Then $2 = '"' & StringReplace($2, "'", "''") & '"'
	If IsArray($2) Then $2 = '[' & VarGetType($2) & ']'
	If Not ($2 == '') Or Not IsString($2) Then $1 &= ' = ' & String($2)
	ConsoleWrite($1 & @CRLF)
EndFunc

comment:3 by guinness, on Dec 13, 2011 at 12:15:12 PM

A 'workaround' is using StringTrimRight and StringLen

$sFilePath = StringTrimRight(@GUI_DragFile, StringLen(@CRLF))

comment:4 by Jon, on Jul 21, 2013 at 11:31:57 PM

Resolution: Rejected
Status: newclosed

comment:5 by Jpm, on Sep 7, 2013 at 10:38:38 AM

Resolution: Rejected
Status: closedreopened

comment:6 by Jon, on Sep 9, 2013 at 1:36:31 PM

Milestone: 3.3.9.21
Owner: set to Jon
Resolution: Fixed
Status: reopenedclosed

Fixed by revision [8994] in version: 3.3.9.21

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.