找回密码
 加入
搜索
查看: 2054|回复: 8

run问题.....

[复制链接]
发表于 2008-11-25 04:59:25 | 显示全部楼层 |阅读模式
本帖最后由 mmsivws 于 2009-7-1 03:38 编辑

我是个初学者,想到一种办法,想写成以下功能的.
INI文件我定义了三个路径(其它我就略)
$soft=d:toolsimg.exe
$dir=h:cgowinxp.img
$disk=o:

在程序里面怎么实现以下的功能,我是没办法.初学....
run("$soft $disk $dir")

请各位给我改一下....万分感激.....
上面那样是运行不了的.....
发表于 2008-11-25 07:10:09 | 显示全部楼层
你是要实现用toolsimg.exe打开cgowinxp.img再写入o:盘吗?如果是这样的话,关键是toolsimg.exe本身可不可以带参数。
还有run的用法不是你这样用的,run只能运行(文件格式为 EXE,BAT,COM 或 PIF),不能直接运行一个变量。
Run ( "文件名" [, "工作目录" [, 显示标志[, 可选标志]]] )
文件名 可执行文件的完整路径(文件格式为 EXE,BAT,COM 或 PIF).

多看帮助文件是很有好处的,可以解决很多问题。
发表于 2008-11-25 09:48:52 | 显示全部楼层
或许是这样:

run($soft & ' ' & $dir & ' ' & $disk)

按楼主写的,在运行时的命令行就是:
$soft$disk$dir
这是明显错误的!

帮助没看的结果...
发表于 2008-11-25 10:12:42 | 显示全部楼层
先定义好INI文件,再读出INI文件的指定内容,做为RUN的参数运行就可以了
 楼主| 发表于 2008-11-25 14:12:05 | 显示全部楼层
我看过帮助......没什么编程语言的基础.....我就是不会怎么写这程式.....

还有MZD_IMG.EXE是可以用命令的方式打开IMG包的....

打开:MZD_IMG.EXE O: d:cgowinxp.exe

关闭:MZD_IMG.EXE o:

打开时盘符要加,关闭时不要加,这是我发现的....

我现在试一下上面兄弟的程式....
 楼主| 发表于 2008-11-25 14:22:05 | 显示全部楼层
原帖由 liongodmien 于 2008-11-25 09:48 发表
或许是这样:

run($soft & ' ' & $dir & ' ' & $disk)

按楼主写的,在运行时的命令行就是:
$soft$disk$dir
这是明显错误的!

帮助没看的结果...


不行呀...谁帮我看看这代码呀....

初学的....


$g_szVersion = "My Script 1.1"
If WinExists($g_szVersion) Then Exit ; 此脚本已经运行了
AutoItWinSetTitle($g_szVersion)
#include <GUIConstants.au3>
fileinstall("ad.jpg",@scriptdir &"\ad.jpg")
$imgsoft = iniread(@scriptdir &"\gutools.ini","IMG软件","imgsoft","")
$imgfile = iniread(@scriptdir &"\gutools.ini","IMG文件","imgfile","")
$upsoft = iniread(@scriptdir &"\gutools.ini","更新软件","upsoft","")
$updisk  = iniread(@scriptdir &"\gutools.ini","更新盘符","updisk","")
$Form1 = GUICreate("GU三层游戏更新-辅助工具", 364, 203, 306, 160)
$Button1 = GUICtrlCreateButton("加载镜像文件", 8, 80, 81, 41, 0)
$Button2 = GUICtrlCreateButton("弹出镜像文件", 96, 80, 81, 41, 0)
$Button3 = GUICtrlCreateButton("开始游戏升级", 184, 80, 81, 41, 0)
$Button4 = GUICtrlCreateButton("停止游戏升级", 272, 80, 81, 41, 0)
$Label2 = GUICtrlCreateLabel("版权所有:广东佛山信宇科技公司", 32, 180, 342, 40)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Button5 = GUICtrlCreateButton("关于本工具", 8, 136, 345, 33, 0)
$Pic1 = GUICtrlCreatePic(@scriptdir &"\ad.JPG", 8, 2, 345, 76, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
case $nmsg = $button1 
if fileexists("o:") Then 
    msgbox("64","温馨提示:","您是否已经加载了镜像文件,请确认后在使用!","3")
    Exit
Else
EndIf
msgbox ("64","温馨提示:","开始加载IMG文件,","1")
run($imgsoft & ' ' & $updisk & ' ' & $imgfile)
msgbox("4096","温馨提示:","镜像文件加载成功,盘符为O盘","3")
case $nmsg = $button2
    if fileexists("o:") Then
     Else
     msgbox("32","温馨提示","你还没有加载IMG镜像,程序退出!","3")
     Exit
    EndIf
    run("img.exe o:", "",@SW_HIDE)
        Sleep(3000)
        run("img.exe p:", "",@SW_HIDE)
Exit
Case $nmsg = $button3
    if fileexists("o:") Then
     Else
     msgbox("64","温馨提示:","你还没有加载IMG镜像请点[加载镜像文件]","3")
     Exit
    EndIf
    run($upsoft)
case $nmsg = $button4
    if processexists("$upsoft") Then
     Else
     MsgBox("32", "温馨提示","你还没有运行游戏自动更新软件","3")
     Exit
    EndIf
    exit
    processclose("$upsoft")
msgbox("64","温馨提示:","游戏更新停止,程序自动退出","2")
case $nmsg = $button5
    msgbox("64","温馨提示:","欢迎使用由梁宇自主开发的[GU三层游戏更新辅助工具] 联系QQ:228541637")
    EndSelect
Switch $nMsg
    Case $GUI_EVENT_CLOSE
     Exit

EndSwitch
WEnd


INI文件内容.....

[IMG软件]
IMGSOFT=d:\gutools\IMG.exe
[IMG文件]
IMGFILE=E:\cgo\磁盘目录\winxp.img
[更新软件]
UPSOFT=d:\gutools\GU.exe
[更新盘符]
updisk=o:
 楼主| 发表于 2008-11-25 18:40:05 | 显示全部楼层
我搞定了....

$g_szVersion = "My Script 1.1"
If WinExists($g_szVersion) Then Exit ; 此脚本已经运行了
AutoItWinSetTitle($g_szVersion)
#include <GUIConstants.au3>
fileinstall("ad.jpg",@scriptdir &"\ad.jpg")
$imgsoft = iniread(@scriptdir &"\gutools.ini","IMG软件","imgsoft","")
$imgfile = iniread(@scriptdir &"\gutools.ini","IMG文件","imgfile","")
$upsoft = iniread(@scriptdir &"\gutools.ini","更新软件","upsoft","")
$updisk  = iniread(@scriptdir &"\gutools.ini","更新盘符","updisk","")
$Form1 = GUICreate("GU三层游戏更新-辅助工具[O盘]V2008.11.25", 364, 203, 306, 160)
$Button1 = GUICtrlCreateButton("加载镜像文件", 8, 80, 81, 41, 0)
$Button2 = GUICtrlCreateButton("弹出镜像文件", 96, 80, 81, 41, 0)
$Button3 = GUICtrlCreateButton("开始游戏升级", 184, 80, 81, 41, 0)
$Button4 = GUICtrlCreateButton("停止游戏升级", 272, 80, 81, 41, 0)
$Label2 = GUICtrlCreateLabel("版权所有:佛山市容桂麒丰网络有限公司  www.266168.com", 22, 180, 342, 40)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Button5 = GUICtrlCreateButton("关闭多余虚拟盘", 8, 130, 168, 41, 0)
$Button6 = GUICtrlCreateButton("关于本工具", 184, 130, 168, 41, 0)
$Pic1 = GUICtrlCreatePic(@scriptdir &"\ad.JPG", 8, 2, 345, 76, BitOR($SS_NOTIFY,$WS_GROUP))
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Select
case $nmsg = $button1 
    if fileexists($updisk) Then 
                Msgbox("64","温馨提示:","您是否已经加载了镜像文件,请确认后在使用!","2")
        Else
                msgbox ("64","温馨提示:","开始加载IMG文件,","2")
                run($imgsoft & ' ' & $updisk & '\ ' & ' '  & $imgfile)
                Sleep(2000)
                msgbox("4096","温馨提示:","镜像文件加载成功,盘符为 O 盘","2")
        EndIf
case $nmsg = $button2
    if fileexists($updisk) Then
                msgbox("32","温馨提示","现在关闭IMG镜像","2")
                run($imgsoft & ' ' & 'o:')
                Sleep(1000)
                run($imgsoft & ' ' & 'p:')
        Else
                msgbox("32","温馨提示","你还没有加载IMG镜像","2")        
         EndIf
Case $nmsg = $button3
    if fileexists($updisk) Then
                run($upsoft)
     Else
            msgbox("64","温馨提示:","你还没有加载IMG镜像,请点[加载镜像文件]","2")
     EndIf    
case $nmsg = $button4
    if processclose($upsoft) Then
                processclose($upsoft)
                Sleep(1000)
                msgbox("64","温馨提示:","游戏更新停止","2")
     Else
        MsgBox("32", "温馨提示","你还没有运行游戏自动更新软件","2")                        
    EndIf
case $nmsg = $Button5
        msgbox("64","温馨提示:","关闭多余的虚拟盘所需要90秒,正在关闭中...请耐心等待!!!","90")
    run($imgsoft & ' ' & 'f:')
        Sleep(1000)
        run($imgsoft & ' ' & 'g:')
        Sleep(1000)
        run($imgsoft & ' ' & 'h:')
        Sleep(1000)
        run($imgsoft & ' ' & 'i:')
        Sleep(1000)
        run($imgsoft & ' ' & 'j:')
        Sleep(1000)
        run($imgsoft & ' ' & 'k:')
        Sleep(1000)
        run($imgsoft & ' ' & 'l:')
        Sleep(1000)
        run($imgsoft & ' ' & 'n:')
        Sleep(1000)
        run($imgsoft & ' ' & 'm:')
        Sleep(1000)
        run($imgsoft & ' ' & 'o:')
        Sleep(1000)
        run($imgsoft & ' ' & 'p:')
        Sleep(1000)
        run($imgsoft & ' ' & 'q:')
        Sleep(1000)
        run($imgsoft & ' ' & 'r:')
        Sleep(1000)
        run($imgsoft & ' ' & 's:')
        Sleep(1000)
        run($imgsoft & ' ' & 't:')
        Sleep(1000)
        run($imgsoft & ' ' & 'u:')
        Sleep(1000)
        run($imgsoft & ' ' & 'v:')
        Sleep(1000)
        run($imgsoft & ' ' & 'w:')
        Sleep(1000)
        run($imgsoft & ' ' & 'x:')
        Sleep(1000)
        run($imgsoft & ' ' & 'y:')
        Sleep(1000)
        run($imgsoft & ' ' & 'z:')
        msgbox("64","温馨提示:","关闭多余的虚拟盘完成","3")
case $nmsg = $button6
    msgbox("64","温馨提示:","程序设计:梁宇  版本号:V2008.11.25  联系QQ:228541637","30")
    EndSelect
Switch $nMsg
    Case $GUI_EVENT_CLOSE
     Exit

EndSwitch
WEnd
 楼主| 发表于 2008-11-25 18:41:00 | 显示全部楼层
原帖由 liongodmien 于 2008-11-25 09:48 发表
或许是这样:

run($soft & ' ' & $dir & ' ' & $disk)

按楼主写的,在运行时的命令行就是:
$soft$disk$dir
这是明显错误的!

帮助没看的结果...



谢谢你.....兄弟.....
发表于 2008-11-26 15:29:00 | 显示全部楼层

run($imgsoft & ' ' & 'x:')
;空格可以和后面的字串一同设置的
run($imgsoft & ' x:')
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-6 03:33 , Processed in 0.072101 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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