找回密码
 加入
搜索
查看: 246|回复: 2

[AU3基础] 如何获取到组合列表框的值?

[复制链接]
发表于 2024-5-22 09:06:20 | 显示全部楼层 |阅读模式
如何获取到组合列表框的值?

谢谢。
现在只能读到到D:\Personal,我想能正常选择其他目录时,也能获取到当前选择的什么值?




#RequireAdmin
; *** Start added by AutoIt3Wrapper ***
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;复制文件显示进度条功能api
#include <APIShellExConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIShellEx.au3>
;包含数据函数文件
#include <File.au3>
#include <Array.au3>

Dim $Input_Personal_TargetDir
Dim $Input_Personal_TargetDir_Read,$TestDir,$Input_Personal_TargetDir_Read2

$Form1_1 = GUICreate("个人文件转移工具 v1.0.20231002", 441, 601, 465, 114)

$Label_Dir = GUICtrlCreateLabel("  目标文件夹:", 36, 471, 73, 20)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")


;$Input_Personal_TargetDir = GUICtrlCreateInput("D:\Personal", 129, 471, 218, 21)  ;要转移到的目录
$Input_Personal_TargetDir = GUICtrlCreateCombo("D:\Personal", 129, 471, 218, 21)  ;要转移到的目录  20240521注释
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")

;GUICtrlSetState(-1, $GUI_DISABLE)
;取磁盘分区盘符并添加到组合框中
Local $aArray_TargetDir = DriveGetDrive($DT_FIXED)
If @error Then
    ; 检索驱动器时出现错误.
    MsgBox($MB_SYSTEMMODAL, "", "检索驱动器时出现错误.")
Else


    For $i = 2 To $aArray_TargetDir[0]  ;i从2开始读取,0是分区数量,1是C盘
        ; 显示找到的所有驱动器, 并将驱动器盘符转换为大写.
        ;MsgBox($MB_SYSTEMMODAL, "", "驱动器 " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i]))
                ;GUICtrlSetData($Input_Personal_TargetDir, StringUpper($aArray_TargetDir[$i])&"\Personal", $aArray_TargetDir[2])
                GUICtrlSetData($Input_Personal_TargetDir, StringUpper($aArray_TargetDir[$i])&"\Personal")
                $Input_Personal_TargetDir_Read=GUICtrlRead($Input_Personal_TargetDir)
                

Next
EndIf
MsgBox(0,"test",String($Input_Personal_TargetDir_Read),2)

;GUICtrlSetData($Input_Personal_TargetDir, $Input_Personal_TargetDir_Read)

;$Input_Personal_TargetDir = GUICtrlCreateCombo($Input_Personal_TargetDir_Read, 129, 471, 218, 21)  ;要转移到的目录

;GUICtrlSetData($Input_Personal_TargetDir, $Input_Personal_TargetDir_Read)
;$Input_Personal_TargetDir = $Input_Personal_TargetDir_Read

$Button3_Test = GUICtrlCreateButton("测试", 64, 550, 83, 31)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")


GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
       
        Case $Button3_Test          ;临时测试
             MsgBox(0+32+64,"Info",$Input_Personal_TargetDir_Read,5)
             ;Exit
        EndSwitch
WEnd




本帖子中包含更多资源

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

×
发表于 2024-5-22 09:10:36 | 显示全部楼层
...
                Case $Button3_Test ;临时测试
                        $Input_Personal_TargetDir_Read = GUICtrlRead($Input_Personal_TargetDir)
                        MsgBox(0 + 32 + 64, "Info", $Input_Personal_TargetDir_Read, 5)
...
 楼主| 发表于 2024-5-22 09:27:54 | 显示全部楼层
afan 发表于 2024-5-22 09:10
...
                Case $Button3_Test ;临时测试
                        $Input_Personal_TargetDir_Read = GUICtrlRead($Input_Personal_T ...

A大,牛B啊,
非常 感谢

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-16 11:01 , Processed in 0.081846 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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