autohotkey gui 文件框
时间: 2023-11-04 10:04:39 浏览: 23
AutoHotkey GUI 文件框可以通过Gui Add控件实现,具体步骤如下:
1. 首先创建一个GUI窗口:
```
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
```
2. 在GUI窗口中添加一个按钮,点击该按钮可以打开文件选择窗口:
```
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
```
3. 在窗口上添加一个函数,点击按钮后调用该函数并打开文件选择对话框:
```
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
FileSelectFile, SelectedFile, 3, , 请选择文件,,, (*.txt;*.doc;*.docx)
if SelectedFile <> ""
MsgBox, 已选择的文件为:%SelectedFile%
Return
```
4. 在函数中使用FileSelectFile命令打开文件选择对话框,并在选择文件后弹出消息框显示已选择的文件路径。
完整代码:
```
Gui, Add, Text,, 请选择文件:
Gui, Add, Button, w120 gChooseFile, 浏览...
Gui, Show
Return
ChooseFile:
FileSelectFile, SelectedFile, 3, , 请选择文件,,, (*.txt;*.doc;*.docx)
if SelectedFile <> ""
MsgBox, 已选择的文件为:%SelectedFile%
Return
```
阅读全文