myspacee Posted October 20, 2009 Share Posted October 20, 2009 Hello to all, try to understand how AI drag&drop works, but have no luck searching in forum. I try to obtain filename when take a file and leave on my GUI. Find this example, modify but not works: expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> _Singleton("RBC") $WS_EX_ACCEPTFILES = 16 #Region ### START Koda GUI section ### Form=C:\Program Files\Koda 1.7.01\Forms\QuickFTP\FNTConvert.kxf $Form1 = GUICreate("Rockbox FNT Converter", 441, 323, 293, 202, -1, $WS_EX_ACCEPTFILES) $Tab1 = GUICtrlCreateTab(6, 7, 428, 308) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Convert") $Label1 = GUICtrlCreateLabel("Drop the font(s) onto the left (1st) pane,", 71, 50, 189, 17) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Label2 = GUICtrlCreateLabel("then drag the converted font(s) from the right (2nd) pane.", 71, 70, 271, 17) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Owner\My Documents\Autoit Applications\DropBox.jpg", 71, 101, 130, 130) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $Label3 = GUICtrlCreateLabel("Status: Waiting...", 71, 248, 85, 17) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Progress1 = GUICtrlCreateProgress(71, 271, 297, 17) $Pic2 = GUICtrlCreatePic("C:\Documents and Settings\Owner\My Documents\Autoit Applications\DropBox.jpg", 234, 101, 130, 130) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $Label5 = GUICtrlCreateLabel("1.)", 127, 160, 19, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x808080) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Label6 = GUICtrlCreateLabel("2.)", 291, 160, 19, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x808080) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $TabSheet2 = GUICtrlCreateTabItem("About") $Label4 = GUICtrlCreateLabel("Developed by motionman95, 2009, All Rights Reserved.", 15, 286, 274, 17) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $File = @GUI_DragFile msgbox(0,"",$File) ;~ If StringRegExp($file, "^.+\.(?i)((TTF)|(OTF))$") Then ;~ MsgBox(0, "", $file & @CRLF & "Is a font file.") ;~ Else ;~ MsgBox(0, "", $file & @CRLF & "Is an invalid file type.") ;~ EndIf EndSwitch WEnd Anyone can teach me ? Thank you, m. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 20, 2009 Share Posted October 20, 2009 Hello to all, try to understand how AI drag&drop works, but have no luck searching in forum. I try to obtain filename when take a file and leave on my GUI. Find this example, modify but not works: Anyone can teach me ? Thank you, m. Your example has too many extraneous stuff going on. Reduce your scripts down to just what you want to figure out. This demo just accepts drag-n-drop files to an input and also to a picture control. It then responds differently depending on which received the file: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $sPic = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") $sPic &= "\Examples\GUI\logo4.gif" Global $Form1 = GUICreate("Rockbox FNT Converter", 400, 300, Default, Default, Default, $WS_EX_ACCEPTFILES) Global $Label1 = GUICtrlCreateLabel("Drop a file onto the input or pic controls...", 20, 20, 360, 20) Global $Input1 = GUICtrlCreateInput("", 20, 100, 360, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Pic1 = GUICtrlCreatePic($sPic, 20, 140, 360, 100) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $File = @GUI_DragFile Switch @GUI_DropId Case $Input1 MsgBox(64, "Input Control", $File) Case $Pic1 MsgBox(64, "Picture Control", $File) EndSwitch EndSwitch WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Yashied Posted October 20, 2009 Share Posted October 20, 2009 See example for _WinAPI_DragQueryFileEx() function from the WinAPI Extended UDF Library. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
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