Jump to content

Recommended Posts

Posted

both input fileds are configured to accept file drops.

the first works, the second doesn't replace data content but appends to it.

#include <GUIConstantsEx.au3>
#include <file.au3>
#include <array.au3>

$file1 = "test.jpg"
$file2 = "test2.jpg"

$Form1 = GUICreate("Form1", 625, 200, 192, 124, -1, 0x00000018); WS_EX_ACCEPTFILES
$file1GUI = GUICtrlCreateInput($file1, 80, 70, 513, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

$file2GUI = GUICtrlCreateInput($file2, 80, 118, 513, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
WEnd
Posted (edited)

The only difference I see when I start your script is that the content of the first input field is marked and therefore replaced when dropping a file.

The second input field isn't marked and therefore the dropped file is appended.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

ok, i didnt notice that.

so i understand i need to change the focus to the second input filed when i drag.

can you hint to how?

Posted (edited)

To do it manually just tab to the second field.

If you want to do it automatically then you'll have to catch the GUI event of drag&drop (example)

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

thanks, this work

#include <GUIConstantsEx.au3>

$file1 = "test.jpg"
$file2 = "test2.jpg"

$Form1 = GUICreate("Form1", 625, 200, 192, 124, -1, 0x00000018); WS_EX_ACCEPTFILES

$file1GUI = GUICtrlCreateInput($file1, 80, 70, 513, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

$file2GUI = GUICtrlCreateInput($file2, 80, 118, 513, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$msg = 0
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $GUI_EVENT_DROPPED
            If (@GUI_DropId == 3) Then
                GUICtrlSetState($file1GUI, $GUI_FOCUS)
                GUICtrlSetData($file1GUI,@GUI_DRAGFILE)
            ElseIf (@GUI_DropId == 4) Then
                GUICtrlSetState($file2GUI, $GUI_FOCUS)
                GUICtrlSetData($file2GUI,@GUI_DRAGFILE)
            EndIf
    EndSelect
WEnd

btw, whats the easiest way to convert a control id from

@GUI_DropId == 3

@GUI_DropId == $file1GUI

Posted (edited)

It's the same.

@GUI_DropId = Control identifier where the drop occurred = the value (ControlId) returned by GUICtrlCreateInput.

So the line

If (@GUI_DropId == 3) Then
can be written as
If (@GUI_DropId == $file1GUI) Then
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...