本帖最后由 republican 于 2010-9-9 20:55 编辑
LZ的代码确实混乱...
看的晕呼呼的,只能帮LZ整理代码了....
#include <Process.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
;~ fanhui()
If ProcessExists("elementclient.exe") Then
$mainwindow = GUICreate("完美世界", 200, 110)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("系统检测到你正在运行游戏", 27, 13)
GUICtrlCreateLabel("请退出游戏后,再运行该程序", 25,33)
$okbutton = GUICtrlCreateButton("立即关闭游戏",7,73,90)
GUICtrlSetOnEvent($okbutton, "guanbigame")
$okbutton = GUICtrlCreateButton("手动关闭游戏",105,73,90)
GUICtrlSetOnEvent($okbutton, "CLOSEClicked")
GUISetState(@SW_SHOW)
while 1
Sleep(1000)
WEnd
Else
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("完美穿门程序", 329, 212)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$Button1 = GUICtrlCreateButton("确定(&O)", 64, 176, 75, 25, 0)
GUICtrlSetOnEvent($Button1, "queding")
$Button2 = GUICtrlCreateButton("取消(&C)", 160, 176, 75, 25, 0)
GUICtrlSetOnEvent($Button2,"CLOSEClicked")
$Button3 = GUICtrlCreateButton("浏览(&R)", 256, 144, 67, 25, 0)
GUICtrlSetOnEvent($Button3, "liulang")
$Input1 = GUICtrlCreateInput("", 0, 146, 249, 21)
$Label1 = GUICtrlCreateLabel("欢迎使用“完美穿门程序”", 48, 16, 228, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("游戏安装目录", 16, 112, 100, 24)
$Label5 = GUICtrlCreateLabel("请选择游戏安装目录后按“确定(O)”键继续", 8, 48, 292, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
EndIf
Func liulang()
$ll=FileSelectFolder("浏览","")
If FileExists($ll) Then GUICtrlSetData($Input1,$ll)
EndFunc
Func CLOSEClicked()
Exit
EndFunc
Func qidongyouxi()
$number = GUICtrlRead($Input1)
Run($number & "\launcher\Launcher.exe")
Exit
EndFunc
Func queding()
$number = GUICtrlRead($Input1)
If FileExists($number & "\element") Then
$mainwindow = GUICreate("完美世界", 200, 175)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("完美世界穿门程序", 48, 5)
$okbutton = GUICtrlCreateButton("更改游戏为《穿门模式》",28,83,145)
GUICtrlSetOnEvent($okbutton, "chuanmenmoshi")
$okbutton = GUICtrlCreateButton("更改游戏为《默认模式》",28,113,145)
GUICtrlSetOnEvent($okbutton, "morenmoshi")
GUISetState(@SW_SHOW)
Else
MsgBox(16,"运行时出错","请输入正确的游戏路径或者复制本程序到游戏安装目录后运行")
EndIf
EndFunc
Func Exitgame()
ProcessClose("Launcher.exe")
processclose("elementclient.exe")
Sleep("500")
If ProcessExists("elementclient.exe") Then
$mainwindow = GUICreate("操作失败", 180, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("游戏退出失败", 52, 10)
GUICtrlCreateLabel("请手动退出游戏后,再运行该程序!", 5, 30)
$okbutton = GUICtrlCreateButton("确定",53,50,70)
GUICtrlSetOnEvent($okbutton, "fanhui")
GUISetState(@SW_SHOW)
Else
$mainwindow = GUICreate("操作成功", 170, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("游戏退出成功", 48, 10)
$okbutton = GUICtrlCreateButton("确定",53,50,60)
GUICtrlSetOnEvent($okbutton, "fanhui")
GUISetState(@SW_SHOW)
EndIf
EndFunc
func fanhui();问题出在这句的身上,请高手分析下,那个函数没有声明,非常感谢、
If fileExists("element") Then
$mainwindow = GUICreate("完美世界", 200, 175)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("完美世界穿门程序", 48, 5)
$okbutton = GUICtrlCreateButton("更改游戏为《穿门模式》",28,83,145)
GUICtrlSetOnEvent($okbutton, "chuanmenmoshi")
$okbutton = GUICtrlCreateButton("更改游戏为《默认模式》",28,113,145)
GUICtrlSetOnEvent($okbutton, "morenmoshi")
GUISetState(@SW_SHOW)
Else
$Form1 = GUICreate("完美穿门程序", 329, 212)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$Button1 = GUICtrlCreateButton("确定(&O)", 64, 176, 75, 25, 0)
GUICtrlSetOnEvent($Button1, "queding")
$Button2 = GUICtrlCreateButton("取消(&C)", 160, 176, 75, 25, 0)
GUICtrlSetOnEvent($Button2,"CLOSEClicked")
$Button3 = GUICtrlCreateButton("浏览(&R)", 256, 144, 67, 25, 0)
GUICtrlSetOnEvent($Button3, "liulang")
$Input1 = GUICtrlCreateInput("", 0, 146, 249, 21)
$Label1 = GUICtrlCreateLabel("欢迎使用“完美穿门程序”", 48, 16, 228, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("游戏安装目录", 16, 112, 100, 24)
$Label5 = GUICtrlCreateLabel("请选择游戏安装目录后按“确定(O)”键继续", 8, 48, 292, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
EndIf
EndFunc
Func chuanmenmoshi()
$number = GUICtrlRead($Input1)
If FileExists($number & "\element\grasses.pck.bak") Then
$mainwindow = GUICreate("完美世界", 170, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("《穿门模式》更改成功", 22, 10)
$okbutton = GUICtrlCreateButton("运行游戏", 12, 48, 70)
GUICtrlSetOnEvent($okbutton, "qidongyouxi")
$okbutton = GUICtrlCreateButton("关闭程序", 88, 48, 70)
GUICtrlSetOnEvent($okbutton, "CLOSEClicked")
GUISetState(@SW_SHOW)
Else
FileCopy($number & "\element\grasses.pck", $number & "\element\grasses.pck.bak", 1)
FileCopy($number & "\element\trees.pck", $number & "\element\trees.pck.bak", 1)
FileChangeDir($number)
_RunDOS("ren element\grasses.pck grasses1.pck")
_RunDOS("ren element\trees.pck grasses.pck")
_RunDOS("ren element\grasses1.pck trees.pck")
$mainwindow = GUICreate("完美世界", 170, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("《穿门模式》更改成功", 22, 10)
$okbutton = GUICtrlCreateButton("运行游戏", 12, 48, 70)
GUICtrlSetOnEvent($okbutton, "qidongyouxi")
$okbutton = GUICtrlCreateButton("关闭程序", 88, 48, 70)
GUICtrlSetOnEvent($okbutton, "CLOSEClicked")
GUISetState(@SW_SHOW)
EndIf
EndFunc
Func morenmoshi()
$number = GUICtrlRead($Input1)
if FileExists($number & "\element\grasses.pck.bak") Then
FileDelete($number & "\element\trees.pck")
FileDelete($number & "\element\grasses.pck")
sleep(100)
FileChangeDir($number)
_RunDOS("ren element\grasses.pck.bak grasses.pck")
_RunDOS("ren element\trees.pck.bak trees.pck")
$mainwindow = GUICreate("完美世界", 170, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("《默认模式》更改成功", 22, 10)
$okbutton = GUICtrlCreateButton("运行游戏", 12, 48, 70)
GUICtrlSetOnEvent($okbutton, "qidongyouxi")
$okbutton = GUICtrlCreateButton("关闭程序", 88, 48, 70)
GUICtrlSetOnEvent($okbutton, "CLOSEClicked")
GUISetState(@SW_SHOW)
Else
$mainwindow = GUICreate("完美世界", 170, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("《默认模式》更改成功", 22, 10)
$okbutton = GUICtrlCreateButton("运行游戏", 12, 48, 70)
GUICtrlSetOnEvent($okbutton, "qidongyouxi")
$okbutton = GUICtrlCreateButton("关闭程序", 88, 48, 70)
GUICtrlSetOnEvent($okbutton, "CLOSEClicked")
GUISetState(@SW_SHOW)
EndIf
EndFunc
Func guanbigame()
ProcessClose("Launcher.exe")
processclose("elementclient.exe")
$mainwindow = GUICreate("操作成功", 170, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("游戏退出成功", 48, 10)
$okbutton = GUICtrlCreateButton("确定",53,50,60)
GUICtrlSetOnEvent($okbutton, "fanhui")
GUISetState(@SW_SHOW)
EndFunc
By the way,我这里没问题。 |