kjason Posted July 31, 2007 Posted July 31, 2007 Hi? I need your help with the issue. I just want to get a file name with fullpath when a file dropped on a "GUICtrlCreatePic " . I know I can use "GUICtrlCreateInput" but I just want to use a "GUICtrlCreatePic " because I can use a picture on it and contexts menu. So, is there any other way to use drag & drop function? In the source I have been making , I want to show the dropped file name with fullpath. ==================================================================================================== === #include <GUIConstants.au3> #include <file.au3> #include <Array.au3> #NoTrayIcon $Drvletter = StringLeft ( @ScriptDir, 2 ) $DrvLabel = DriveGetLabel ( $Drvletter ) GUICreate("DDarea", 76, 71, @DesktopWidth - "160", @DesktopHeight - "300", $WS_POPUP, $WS_EX_TOOLWINDOW ) $GUI = GUICtrlCreatePic (@scriptDir & "\test.jpg", -1, -1, 77, 72, $GUI_SS_DEFAULT_PIC , BitOR($WS_EX_ACCEPTFILES , $GUI_WS_EX_PARENTDRAG )) WinSetOnTop("DDarea", "", 1) WinSetTrans ( "DDarea", "", 100 ) GUICtrlSetState ( $GUI, $GUI_DROPACCEPTED) GUISetState () While 1 $msg = GUIgetMsg () Select case $msg = 0 case $msg = $GUI_EVENT_DROPPED MsgBox (4096, "Files dropped", ?????????????????????????????????? ) Endselect Wend ==================================================================================================== ===
martin Posted July 31, 2007 Posted July 31, 2007 Hi? I need your help with the issue.I just want to get a file name with fullpath when a file dropped on a "GUICtrlCreatePic " . I know I can use "GUICtrlCreateInput" but I just want to use a "GUICtrlCreatePic " because I can use a picture on it and contexts menu.So, is there any other way to use drag & drop function?In the source I have been making , I want to show the dropped file name with fullpath. =======================================================================================================#include <GUIConstants.au3>#include <file.au3>#include <Array.au3>#NoTrayIcon$Drvletter = StringLeft ( @ScriptDir, 2 )$DrvLabel = DriveGetLabel ( $Drvletter )GUICreate("DDarea", 76, 71, @DesktopWidth - "160", @DesktopHeight - "300", $WS_POPUP, $WS_EX_TOOLWINDOW )$GUI = GUICtrlCreatePic (@scriptDir & "\test.jpg", -1, -1, 77, 72, $GUI_SS_DEFAULT_PIC , BitOR($WS_EX_ACCEPTFILES , $GUI_WS_EX_PARENTDRAG ))WinSetOnTop("DDarea", "", 1)WinSetTrans ( "DDarea", "", 100 )GUICtrlSetState ( $GUI, $GUI_DROPACCEPTED)GUISetState ()While 1 $msg = GUIgetMsg () Select case $msg = 0 case $msg = $GUI_EVENT_DROPPED MsgBox (4096, "Files dropped", ?????????????????????????????????? ) Endselect Wend=======================================================================================================have a look at this Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
smashly Posted July 31, 2007 Posted July 31, 2007 (edited) Hi, here's a rough example of your code.. expandcollapse popup#include <GUIConstants.au3> #include <file.au3> #include <Array.au3> #NoTrayIcon $Drvletter = StringLeft ( @ScriptDir, 2 ) $DrvLabel = DriveGetLabel ( $Drvletter ) $GUI = GUICreate("DDarea", 76, 71, @DesktopWidth - "160", @DesktopHeight - "300", $WS_POPUP _ , $WS_EX_ACCEPTFILES _ + $WS_EX_TOPMOST _ + $WS_EX_TOOLWINDOW) $PIC = GUICtrlCreatePic (@scriptDir & "\Water lilies.jpg", -1, -1, 77, 72, $GUI_SS_DEFAULT_PIC _ , $GUI_WS_EX_PARENTDRAG) GUICtrlSetState ($PIC, $GUI_DROPACCEPTED) GUICtrlSetTip($PIC, @scriptDir & "\Water lilies.jpg") WinSetTrans ( "DDarea", "", 100 ) GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIgetMsg() Select case $msg = $GUI_EVENT_CLOSE Exit case $msg = $GUI_EVENT_DROPPED If StringRight(@GUI_DragFile, 4) == _DropFilter(StringRight(@GUI_DragFile, 4)) Then GUICtrlSetImage($PIC, @GUI_DragFile) GUICtrlSetTip($PIC, @GUI_DragFile) Else MsgBox (4096, "File dropped..", "The file that was dropped was not a supported picture format." & _ @LF & "File Dropped: " & @GUI_DragFile) EndIf Endselect Wend Func _DropFilter($dFile) Dim $dFilter = StringSplit(".jpg|.bmp|.gif", "|") For $i = 1 To $dFilter[0] If $dFilter[$i] = $dFile Then Return $dFile Next Return "" EndFunc Cheers Edited July 31, 2007 by smashly
kjason Posted July 31, 2007 Author Posted July 31, 2007 smashly~ Excellent job!! Thanks so~~~ much~ ^^; I really appreciate it.
kjason Posted July 31, 2007 Author Posted July 31, 2007 have a look at thisThanks so much martin.I think I can use some of it. I appreciate it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now