Jump to content



Photo

Error with GUI_DRAGFILE


  • Please log in to reply
7 replies to this topic

#1 Unc3nZureD

Unc3nZureD

    Polymath

  • Active Members
  • PipPipPipPip
  • 205 posts

Posted 09 August 2012 - 02:00 PM

Hi guys, as the title says somewhy I can't use the @GUI_DRAGFILE. Here my code is:

$Form2 = GUICreate(" FTProject [UPLOAD]", 211, 122, 403, 231, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUICtrlSetState (-1, $GUI_DROPACCEPTED) $Label1 = GUICtrlCreateLabel("Drag a file here to start uploading!", 8, 8, 199, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(6, 96, 198, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _FTP_Close($Open) Exit EndSwitch msgbox(0,"",@GUI_DRAGFILE) WEnd


Unknown macro.

What did I fail?

----------------

Edit:
Theoritacally I found the problem, but not sure yet. GUISetonEvent?

Edited by Unc3nZureD, 09 August 2012 - 02:06 PM.








#2 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 09 August 2012 - 02:08 PM

Unless there is a file dropped onto the GUI, that macro doesn't work, there's a similar issue with using @GUI_CtrlID, if no control has been actioned, you get an error when using it. It's working as intended because you're trying to access something that doesn't apply.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#3 Unc3nZureD

Unc3nZureD

    Polymath

  • Active Members
  • PipPipPipPip
  • 205 posts

Posted 09 August 2012 - 02:19 PM

GUIDelete($Form1) $Form2 = GUICreate(" FTProject [UPLOAD]", 211, 122, 403, 231, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUICtrlSetState($Form2, $GUI_DROPACCEPTED) $Label1 = GUICtrlCreateLabel("Drag a file here to start uploading!", 8, 8, 199, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(6, 96, 198, 17) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_DROPPED, _UploadFile(), $Form2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _FTP_Close($Open) Exit EndSwitch WEnd EndFunc Func _UploadFile() msgbox(0,"", @GUI_DRAGFILE)


I thought it'll be working. But it instantly gets activated. Still can't get it working :S

#4 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 09 August 2012 - 02:24 PM

One thing I see is that you're mixing OnEvent mode and MessageLoop mode, that won't work.

If you could post a script that reproduces the error, that someone can run, it will make it easier to see exactly what it is you're attempting and why it's not working.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#5 Unc3nZureD

Unc3nZureD

    Polymath

  • Active Members
  • PipPipPipPip
  • 205 posts

Posted 09 August 2012 - 02:27 PM

AutoIt         
#include <FTPEx.au3> #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> $Form2 = GUICreate(" FTProject [UPLOAD]", 211, 122, 403, 231, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUICtrlSetState (-1, $GUI_DROPACCEPTED) $Label1 = GUICtrlCreateLabel("Drag a file here to start uploading!", 8, 8, 199, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(6, 96, 198, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd


So that thing that it should do is:
If somebody drags a file into the Form, it will upload the file to a given FTP.

Edited by Unc3nZureD, 09 August 2012 - 02:29 PM.


#6 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 09 August 2012 - 02:37 PM

Try this demo, run it from SciTE and it will display the name of the file dropped on the label in the lower panel.

AutoIt         
#include <FTPEx.au3> #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> $Form2 = GUICreate(" FTProject [UPLOAD]", 211, 122, 403, 231, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) $Label1 = GUICtrlCreateLabel("Drag a file here to start uploading!", 8, 8, 199, 40) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xffffff) ; set the background color so you can see where the label is. $Progress1 = GUICtrlCreateProgress(6, 96, 198, 17) GUISetState(@SW_SHOW) While 1      $nMsg = GUIGetMsg()      Switch $nMsg           Case $GUI_EVENT_CLOSE                Exit           Case $GUI_EVENT_DROPPED ; actioned when a file is dropped on the label, because that is the only control set w/$GUI_DROPACCEPTED                ConsoleWrite(@GUI_DragFile & @CRLF)           Case $Label1 ; click the label and it will display what file was dropped on it.                ConsoleWrite(@GUI_DragFile & @CRLF)      EndSwitch WEnd

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#7 Unc3nZureD

Unc3nZureD

    Polymath

  • Active Members
  • PipPipPipPip
  • 205 posts

Posted 09 August 2012 - 02:47 PM

So as I can see I can't make it with the GUI itself. Okay, I did a little trick :) Used your source and I gave the label bigger area so it's like they dragged to the GUI, but it's handled by the label :)

Thanks!

#8 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 09 August 2012 - 02:55 PM

You're welcome.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users