Jump to content

Drag and Drop - the other way around


Recommended Posts

Hi All,

I know this thread has gone on for a while and you are doing something quite interesting.

You thought about embedding an Explorer window into the GUI earlier.

Something like:

#include <GUIConstantsEX.au3>
#include <Misc.au3>

_Singleton("RBC")
$WS_EX_ACCEPTFILES = 16
$TempDir = CreateRandomTempDir()
$oIE = ObjCreate("Shell.Explorer.1")


#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 ###
$GUIActiveX = GUICtrlCreateObj( $oIE, 180, 101, 230, 80)

GUISetState ()





While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_DROPPED
            $File = @GUI_DragFile
            If StringRegExp($file, "^.+\.(?i)((TTF)|(OTF))$") Then
                MsgBox(0, "", $file & @CRLF & "Is a font file.")
                $TempDir = CreateRandomTempDir()
                ConvertFile($file)
                $oIE.navigate($TempDir)
                $oIE.navigate($TempDir)
    ;$oIE.style('1')

            Else
                MsgBox(0, "", $file & @CRLF & "Is an invalid file type.")
            EndIf
    EndSwitch
WEnd



Func ConvertFile($file)
    $FileSplit = StringSplit($File,'\')
    $dest = $TempDir & $FileSplit[$FileSplit[0]]
    ConsoleWrite(@cr&$dest)
    FileCopy($file,$dest,8)
EndFunc


Func CreateRandomTempDir()
    While 1
        Local $RAND = Random(100000,999999,1)
        Local $ctrTempDir = @TempDir&'\'&$RAND&'\'
        if not FileExists($ctrTempDir) then ExitLoop
    WEnd
        ConsoleWrite($ctrTempDir)
        DirCreate($ctrTempDir)
        Return $ctrTempDir
EndFunc

The code is very dirty, and generates a random folder in %temp% each time you 'process' a file it so shows only 1 icon in the panel 2.

Cheers

Neil

edit:spelling and paragraph1

Edited by NBJ
Link to post
Share on other sites
  • Replies 94
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

@NBJ How do you suggest using that to drag files from the application which is the problem we have been struggling with? Dropping files onto the gui isn't a problem.

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.
Link to post
Share on other sites

@Martin,

Hi, Sorry to intrude into the conversation.

I was looking through the thread and it is my understanding that motionman95 was looking to do the following;

- Have the user drop a font file onto the gui

- Have the Gui recognize this and perform his conversion (yet to be programmed)

- Once the Conversion is complete an Icon of the converted file show in the GUI so the user can then drag the converted file to their preferred destination.

motionman95 figured out the drop onto gui, no problems. What I was proposing that was by using an embedded explorer window showing the actual converted file, the end user would then be ale to drag that out on to their desktop.

At least that is whats happening on my machine (XP) when I run the script I uploaded and dragged a ttf onto area 1.

In my scrappy version of the script, in stead of converting the file, I just copies the original to a unique temp folder, in order to have the Gui display 1 icon in Area 2. This icon is then available to drag to another folder.

- I have to agree that the work you guys are doing is far more advanced and ultimately will be more useful to the community it will enable a far greater number of possibilities in future.

Thanks for all the input I learn a great deal from these forums.

NBJ

Link to post
Share on other sites

I'm trying to implement the DoDragDrop and the needed COM-Interfaces in AutoIt. When i have a working example, i will post it :P

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to post
Share on other sites

I'm trying to implement the DoDragDrop and the needed COM-Interfaces in AutoIt. When i have a working example, i will post it :P

Great!

I'll be very interested to see how you do it because I've already studied the msdn information your link leads to but I was soon confused, mainly because I don't know anything about OLE and COM interfacing.

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.
Link to post
Share on other sites

I think, i have the interfaces, but it just doesn't want to drop the data :P

And COM/OLE-interfaces in AutoIt... That is a pain. You have to use DLLCallbackRegister for each funtion in the object, use a modified memorydllcall, since DLLCall doesn't support pointers ...

//Edit:It works :unsure: Now i have to clean up the code. I think i will post it the in the next days.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to post
Share on other sites
  • 1 year later...
  • 6 years later...
  • Moderators

VikramGanapathi,

As this is a forum for AutoIt, why would you expect anyone to have converted the code to Java? Perhaps asking the original question on a Java forum would be more appropriate.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

@M23,

  Thank you for the inputs, but I am implementing AutoIT in Selenium java, so thought there would be any sample code that would work for Java. But I realize that its an exe that I have to execute as part of Selenium that is not language dependent. Lemme try to implement the same in my and will keep you posted.

Vikram

Link to post
Share on other sites

you are attempting to automate your automation with some automation....something something Java?

 

is that about right?

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...