[已解决]参考其他高手写了个程序,两段代码只是路径不同,请问怎么合并?
本帖最后由 6vvvvvv 于 2015-10-30 18:57 编辑#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;画出交互界面并隐藏,等待热键
$Form1_1 = GUICreate("微信二维码拍照程序", 531, 141, 695, 666)
$Input1 = GUICtrlCreateInput("", 64, 56, 425, 21)
$czbutton = GUICtrlCreateButton("充值", 64, 104, 89, 25)
$czbutton2 = GUICtrlCreateButton("拍照", 264, 104, 89, 25)
$Label1 = GUICtrlCreateLabel("请输入微信二维码", 72, 16, 100, 17)
GUISetState(@SW_HIDE)
HotKeySet("^!x", "_Echowin1")
While 1
Sleep(500)
WEnd
;交互界面
FUNC _Echowin1()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $czbutton; 按下[充值]
_Captureimg1()
Case $nMsg = $czbutton2; 按下[拍照]
_Captureimg2()
Case $nmsg = $GUI_EVENT_CLOSE; 关闭程序,隐藏[窗口]
GUISetState(@SW_HIDE)
ExitLoop
EndSelect
WEnd
EndFunc
;[充值]截屏程序1
Func _Captureimg1()
Dim $captureimgname
$captureimgname = "D:\充值\"& GUICtrlRead($Input1)&"_" & @YEAR & "_" & @MON & @MDAY & "_" & @HOUR & @MIN & "_" & @SEC & ".jpg"
Send("{PRINTSCREEN}")
Sleep(1000)
Run("mspaint.exe")
_winwaitactivate("", "")
Send("{CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}fa")
Sleep(1000)
Send($captureimgname)
Send("{ENTER}")
_winwaitactivate("", "")
Send("{ALTDOWN}{ALTUP}fx")
EndFunc
Func _winwaitactivate($title, $text, $timeout = 0)
WinWait($title, $text, $timeout)
If NOT WinActive($title, $text) Then WinActivate($title, $text)
WinWaitActive($title, $text, $timeout)
EndFunc
;[拍照]截屏程序2
Func _Captureimg2()
Dim $captureimgname
$captureimgname = "D:\拍照\" & @YEAR & "_" & @MON & @MDAY & "_" & @HOUR & @MIN & "_" & @SEC & ".jpg"
Send("{PRINTSCREEN}")
Sleep(1000)
Run("mspaint.exe")
_winwaitactivate2("", "")
Send("{CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}fa")
Sleep(1000)
Send($captureimgname)
Send("{ENTER}")
_winwaitactivate2("", "")
Send("{ALTDOWN}{ALTUP}fx")
EndFunc
Func _winwaitactivate2($title, $text, $timeout = 0)
WinWait($title, $text, $timeout)
If NOT WinActive($title, $text) Then WinActivate($title, $text)
WinWaitActive($title, $text, $timeout)
EndFunc 新手慢慢学习中 两段代码只是路径不同,怎么合并? #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate("微信二維碼拍照程序", 531, 141, 695, 666)
$Input1 = GUICtrlCreateInput("", 64, 56, 425, 21)
$czbutton = GUICtrlCreateButton("充值", 64, 104, 89, 25)
$czbutton2 = GUICtrlCreateButton("拍照", 264, 104, 89, 25)
$Label1 = GUICtrlCreateLabel("請輸入微信二維碼", 72, 16, 100, 17)
GUISetState(@SW_HIDE)
HotKeySet("^!x", "_Echowin1")
While 1
Sleep(500)
WEnd
FUNC _Echowin1()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $czbutton
_Captureimg1()
Case $nMsg = $czbutton2
_Captureimg2()
Case $nmsg = $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE)
ExitLoop
EndSelect
WEnd
EndFunc
Func _Captureimg1()
Dim $captureimgname
Dim $captureimgname1
$captureimgname = "D:\充值\"& GUICtrlRead($Input1)&"_" & @YEAR & "_" & @MON & @MDAY & "_" & @HOUR & @MIN & "_" & @SEC & ".jpg"
$captureimgname1 = "D:\拍照\" & @YEAR & "_" & @MON & @MDAY & "_" & @HOUR & @MIN & "_" & @SEC & ".jpg"
Send("{PRINTSCREEN}")
Sleep(1000)
Run("mspaint.exe")
_winwaitactivate("", "")
Send("{CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}fa")
Sleep(1000)
Send($captureimgname)
Send($captureimgname1)
Send("{ENTER}")
_winwaitactivate("", "")
Send("{ALTDOWN}{ALTUP}fx")
EndFunc
Func _winwaitactivate($title, $text, $timeout = 0)
WinWait($title, $text, $timeout)
If NOT WinActive($title, $text) Then WinActivate($title, $text)
WinWaitActive($title, $text, $timeout)
EndFunc
Func _winwaitactivate2($title, $text, $timeout = 0)
WinWait($title, $text, $timeout)
If NOT WinActive($title, $text) Then WinActivate($title, $text)
WinWaitActive($title, $text, $timeout)
EndFunc 回复 4# txen548
谢谢了 是否解決了問題,如已解決,請修改標題。
页:
[1]