找回密码
 加入
搜索
查看: 4937|回复: 16

[AU3基础] 关于拖放文件在任意控件上不能指定控件输出[已解决]

[复制链接]
发表于 2017-5-26 09:49:45 | 显示全部楼层 |阅读模式
本帖最后由 c8520c 于 2017-6-14 18:10 编辑

各位,这个问题我也自己也觉得让人误会,还是看下面的吧。

我的程序有两个文本框,三个输入框,组合是:文本框2 = 文本框1+输出框1.2.3
目前已经实现了,只要把文件拖放到文本框1控件上,就在文本框1控件上输出文件路径,如此类推
但是,我想实现的是,无论拖放文件到任意控件上,它都只在文本框1输出文件路径(拖放文件到文本框2或输出框1.2.3,但只在文本框1输出)
发表于 2017-5-26 10:24:38 | 显示全部楼层
你是怎么实现  把文件拖放到任意控件上,就在此控件上输出文件路径。
把这边改一下。
发表于 2017-5-26 11:28:33 | 显示全部楼层
回复 1# c8520c

是这个意思?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2017-5-26 12:38:25 | 显示全部楼层
回复 2# 1361739590


    不好意思。刚刚没注意,现在文字改了一些,这样应该比较好述清。
 楼主| 发表于 2017-5-26 12:41:44 | 显示全部楼层
回复 3# chzj589


    界面是一样,但这个效果不是我想要的,我想要的是把文件拖放到前面四个中的任何一个,但这四个中不会有输出,只在最后一个框输出
发表于 2017-5-26 13:03:23 | 显示全部楼层
回复  chzj589


    界面是一样,但这个效果不是我想要的,我想要的是把文件拖放到前面四个中的任何一 ...
c8520c 发表于 2017-5-26 12:41


不管拖进那一个,点击确定



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2017-5-26 13:19:56 | 显示全部楼层
回复 6# chzj589

数学太差

67=42
76=??????
发表于 2017-5-26 13:21:21 | 显示全部楼层
你是怎么实现  把文件拖放到任意控件上,就在此控件上输出文件路径。
发表于 2017-5-26 13:22:56 | 显示全部楼层
回复 4# c8520c


   
把你实现  把文件拖放到任意控件上,就在此控件上输出文件路径。这个功能的代码贴上了。
帮你改一下。
 楼主| 发表于 2017-5-26 20:52:09 | 显示全部楼层
本帖最后由 c8520c 于 2017-5-26 20:58 编辑

回复 9# 1361739590
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include<Array.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("批量生成", 470, 440, 200, 130,-1,0x00000010)

$Label1 = GUICtrlCreateLabel("将 数字 改为 *", 8, 0, 350, 25)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Edit1 = GUICtrlCreateEdit('', 8, 30, 455, 50)
GUICtrlSetState(-1, 8)
$Label2 = GUICtrlCreateLabel("开始数", 8, 90, 60, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Edit2 = GUICtrlCreateInput("", 72, 90, 50, 21)
GUICtrlSetState(-1, 8)
$Label3 = GUICtrlCreateLabel("结束数", 136, 90, 60, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Edit3 = GUICtrlCreateInput("", 200, 90, 50, 21)
GUICtrlSetState(-1, 8)

$Label4 = GUICtrlCreateLabel("位数", 264, 90, 44, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Edit4 = GUICtrlCreateInput("", 307, 90, 50, 21)
GUICtrlSetState(-1, 8)

$Edit5 = GUICtrlCreateEdit("", 8, 152, 454, 278)
GUICtrlSetState(-1, 8)
$Checkbox1 = GUICtrlCreateCheckbox("添加img src", 373, 90, 81, 25)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")

$Button1 = GUICtrlCreateButton("生成", 8, 118, 44, 28)
$Button2 = GUICtrlCreateButton("保存", 56, 118, 44, 28)

GUISetState()
While 1
WEnd
以下代码可以放进while 与wend,但是如果再次拖放文件到第2至第4个控件,此时第2至第4个控件的内容会改变,但我不想改变
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                        
                Case -13 
                        $mouse = GUIGetCursorInfo($Form1)
                        $_str = ControlCommand($Form1, "", $mouse[4], "GetSelected","")
                                                ControlSetText ( $Form1, "", "Edit1",$_str) 
                                                
If  $mouse[4] <> 4 Then
ControlSetText ( $Form1, "", $mouse[4],"") 
EndIf
 楼主| 发表于 2017-5-26 20:57:41 | 显示全部楼层
回复 7# chzj589


    我实现的是自动,而不是手动
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include<Array.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("批量生成", 470, 440, 200, 130,-1,0x00000010)

$Label1 = GUICtrlCreateLabel("将 数字 改为 *", 8, 0, 350, 25)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Edit1 = GUICtrlCreateEdit('', 8, 30, 455, 50)
GUICtrlSetState(-1, 8)
$Label2 = GUICtrlCreateLabel("开始数", 8, 90, 60, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Edit2 = GUICtrlCreateInput("", 72, 90, 50, 21)
GUICtrlSetState(-1, 8)
$Label3 = GUICtrlCreateLabel("结束数", 136, 90, 60, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Edit3 = GUICtrlCreateInput("", 200, 90, 50, 21)
GUICtrlSetState(-1, 8)

$Label4 = GUICtrlCreateLabel("位数", 264, 90, 44, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Edit4 = GUICtrlCreateInput("", 307, 90, 50, 21)
GUICtrlSetState(-1, 8)

$Edit5 = GUICtrlCreateEdit("", 8, 152, 454, 278)
GUICtrlSetState(-1, 8)
$Checkbox1 = GUICtrlCreateCheckbox("添加img src", 373, 90, 81, 25)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")

$Button1 = GUICtrlCreateButton("生成", 8, 118, 44, 28)
$Button2 = GUICtrlCreateButton("保存", 56, 118, 44, 28)

GUISetState()
While 1
WEnd
以下代码可以放进while 与wend,但是如果再次拖放文件到第2至第4个控件,此时第2至第4个控件的内容会改变,但我不想改变
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                        
                Case -13 
                        $mouse = GUIGetCursorInfo($Form1)
                        $_str = ControlCommand($Form1, "", $mouse[4], "GetSelected","")
                                                ControlSetText ( $Form1, "", "Edit1",$_str) 
                                                
If  $mouse[4] <> 4 Then
ControlSetText ( $Form1, "", $mouse[4],"") 
EndIf
发表于 2017-5-26 21:28:04 | 显示全部楼层
自己的程序,改变控件的文本应该用 GuiCtrlSetData
Case -13 
                        $mouse = GUIGetCursorInfo($Form1)
                                                If @error Then ContinueLoop
                        $_str = GUICtrlRead($mouse[4])
                                                GUICtrlSetData($edit5, $_str)
                        If $mouse[4] <> $edit5 Then GUICtrlSetData($mouse[4], '')
 楼主| 发表于 2017-5-27 09:08:39 | 显示全部楼层
回复 12# Alam


    呃,我发现乱了,我这样说吧。
  EDIT5控件拖放文件 -> 输出到EDIT1 -> 生成数据到EDIT5 -> 二次EDIT5控件拖放文件 -> 删除目前EDIT1中的数据,并二次输出到EDIT1,同时清空EDIT5生成数据
我想知道怎么去掉 “同时清空EDIT5生成数据”,不然的话,三次,四次拖放文件都是瞎弄。
同时,谢谢你提供了代码,我下班后试试看。
发表于 2017-5-27 09:14:32 | 显示全部楼层
回复 11# c8520c

怎么看不到你写的代码?
手动能达到,自动就也能达到

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2017-5-27 09:19:00 | 显示全部楼层
回复 14# chzj589


    今晚我把程序上传吧,一个仿迅雷批量下载的东西,只是按自己想要的效果写的。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-28 21:52 , Processed in 0.088239 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表