Modify

Opened 13 years ago

Closed 11 years ago

#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 Changed 13 years ago by mvg

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 Changed 13 years ago by mvg

#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 Changed 12 years ago by guinness

A 'workaround' is using StringTrimRight and StringLen

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

comment:4 Changed 11 years ago by Jon

  • Resolution set to Rejected
  • Status changed from new to closed

comment:5 Changed 11 years ago by Jpm

  • Resolution Rejected deleted
  • Status changed from closed to reopened

comment:6 Changed 11 years ago by Jon

  • Milestone set to 3.3.9.21
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from reopened to closed

Fixed by revision [8994] in version: 3.3.9.21

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 owner will remain Jon.
Author


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

 
Note: See TracTickets for help on using tickets.