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

[AU3基础] 为何正则取不出值(已解决)

[复制链接]
发表于 2012-11-21 16:32:39 | 显示全部楼层 |阅读模式
本帖最后由 CCM 于 2012-11-21 17:32 编辑

请各位大侠过目

#include <GUIConstantsEx.au3>

Local $Button1, $msg

$Form1 = GUICreate("FTP連線工具", 288, 212, 235, 147)

$Label1 = GUICtrlCreateLabel("使用者名稱:", 16, 40, 92, 28)
$Input1 = GUICtrlCreateInput("", 120, 40, 145, 24)

$Label2 = GUICtrlCreateLabel("密碼:", 16, 80, 80, 28)
$Input2 = GUICtrlCreateInput("", 120, 80, 145, 24)

$Label3 = GUICtrlCreateLabel("FTP位置:", 16, 120, 92, 28)
$Input3 = GUICtrlCreateInput("請直接貼上網址", 120, 120, 145, 24)



$Button1 = GUICtrlCreateButton("連線", 168, 168, 65, 25)
GUISetState()

While 1
        $msg = GUIGetMsg()
        $username = GUICtrlRead($Input1) ;取得GUI INPUT 內容
        $password = GUICtrlRead($Input2)
        $address = GUICtrlRead($Input3)
        $ftp = StringRegExp($address, "[^ftp://]+.", 3)
        Select
                Case $msg = $GUI_EVENT_CLOSE
                        ExitLoop
                Case $msg = $Button1
                        ShellExecute("ftp://" & $username & ":" & $password & "@" & $ftp)
        EndSelect
WEnd

ShellExecute("ftp://" & $username & ":" & $password & "@" & $ftp) 这样错误
ShellExecute("ftp://" & $username & ":" & $password & "@" & $address)这样正确
请问我那边出了错?
发表于 2012-11-21 17:15:11 | 显示全部楼层
回复 1# CCM

StringRegExp返回的是数值.
ShellExecute("ftp://" & $username & ":" & $password & "@" & $ftp[0])
 楼主| 发表于 2012-11-21 17:32:19 | 显示全部楼层
刚刚参考之前有用到StringRegExp的程式,也发现这边错了。

谢谢大侠。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-19 06:25 , Processed in 0.086279 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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