找回密码
 加入
搜索
查看: 3366|回复: 7

谁能发一下软件自动安装器的源码?

[复制链接]
发表于 2008-5-4 07:12:35 | 显示全部楼层 |阅读模式
本人近来想自己做个自动安装器来弄个装机软件安装盘并用Atoit做几个安装脚本来实现这一目的。

请各位大侠顶力相助。谢谢。
发表于 2008-5-4 21:21:01 | 显示全部楼层

回复 1# yiren2008 的帖子

这里有个脚本,自动安装,只是不是“ XXXX器 ”

http://www.autoitx.com/forum.php ... &extra=page%3D1
发表于 2008-5-6 09:02:11 | 显示全部楼层
自己学啊。。。
老等别人做
发表于 2008-5-7 08:53:19 | 显示全部楼层
呵呵  我有
源码在此
#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=d:\我的文档\桌面\2008-04-15_100753.ico
#AutoIt3Wrapper_Res_Comment=第一次
#AutoIt3Wrapper_Res_Description=初试牛刀
#AutoIt3Wrapper_Res_Fileversion=HX_S_1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=跨日(宋)
#AutoIt3Wrapper_Res_Field=作者:|跨日(宋)
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

dim $font
$font="Courier New Bold Italic"

;处理事件
Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("软件安装管理",500,300) ; 创建窗口并返回窗口句柄
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; 设置窗口关闭事件
GUICtrlCreateLabel ("作者:跨日-2008-05",  320, 275,200,50)
GUICtrlSetFont (-1,10, 400, 2+4, $font);设置字体
GUICtrlSetColor(-1,0xff0eee);字体颜色
$buttona = GUICtrlCreateButton ("安装全部\所选软件",195,190,110,20)
GUICtrlSetOnEvent(-1, "aPressed")
GUICtrlSetOnEvent(-1, "aPressed2")
$buttonb = GUICtrlCreateButton ("不安装软件",195,215,110,20)
GUICtrlSetOnEvent(-1, "bPressed")

;图片
GUISetBkColor (0xE0FFFF);背景颜色
$n=GUICtrlCreatePic("logo.jpg",0,0,500,90, -1)
$n=GUICtrlCreatePic("夸父追日.bmp",195,100, 110,85,-1)

GUICtrlCreateGroup ("软件组壹", 10, 90, 180, 145)
$radio_1 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 20, 110, 165, 20)
GUICtrlSetState ( $radio_1, $GUI_CHECKED)
$radio_2 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 20, 135, 165, 20)
GUICtrlSetState ( $radio_2, $GUI_CHECKED)
$radio_3 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 20, 160, 165, 20)
GUICtrlSetState ( $radio_3, $GUI_CHECKED)
$radio_4 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 20, 185, 165, 20)
GUICtrlSetState ( $radio_4, $GUI_CHECKED)
$radio_5 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 20, 210, 165, 20)
GUICtrlSetState ( $radio_5, $GUI_CHECKED)


GUICtrlCreateGroup ("软件组贰", 310, 90, 180, 145)
$radio_6 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 320, 110, 165, 20)
GUICtrlSetState ( $radio_6, $GUI_CHECKED)
$radio_7 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 320, 135, 165, 20)
GUICtrlSetState ( $radio_7, $GUI_CHECKED)
$radio_8 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 320, 160, 165, 20)
GUICtrlSetState ( $radio_8, $GUI_CHECKED)
$radio_9 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 320, 185, 165, 20)
GUICtrlSetState ( $radio_9, $GUI_CHECKED)
$radio_0 = GUICtrlCreateCheckbox ("安装XXXXXXXXXXXX", 320, 210, 165, 20)
GUICtrlSetState ( $radio_0, $GUI_CHECKED)


GUISetState(@SW_SHOW)


$progressbar1 = GUICtrlCreateProgress (10,245,480,25)
GUICtrlSetColor(-1,32250); 对 Windows XP 主题无效
GUISetState ()

$wait = 40; 进度条每进一个单位就等_毫秒
$s = 0;用于保存进度条的滑块位置



For $i = $s To 101
GUICtrlSetData ($progressbar1, $i)

Sleep ($wait)
$m = GUIGetMsg ()   
If $m = $buttona Then  ExitLoop
$cut1 = GUICtrlRead ( $radio_1, 0)
$cut2 = GUICtrlRead ( $radio_2, 0)
$cut3 = GUICtrlRead ( $radio_3, 0)
$cut4 = GUICtrlRead ( $radio_4, 0)
$cut5 = GUICtrlRead ( $radio_5, 0)
$cut6 = GUICtrlRead ( $radio_6, 0)
$cut7 = GUICtrlRead ( $radio_7, 0)
$cut8 = GUICtrlRead ( $radio_8, 0)
$cut9 = GUICtrlRead ( $radio_9, 0)
$cut0 = GUICtrlRead ( $radio_0, 0)
$cuta = GUICtrlRead ( $buttona, 0)

Select
    Case $cut1 = $GUI_UNCHECKED
        ExitLoop
    Case $cut2 = $GUI_UNCHECKED
        ExitLoop
    Case $cut3 = $GUI_UNCHECKED
        ExitLoop
    Case $cut4 = $GUI_UNCHECKED
        ExitLoop
    Case $cut5 = $GUI_UNCHECKED
        ExitLoop
    Case $cut6 = $GUI_UNCHECKED
        ExitLoop
    Case $cut7 = $GUI_UNCHECKED
        ExitLoop
    Case $cut8 = $GUI_UNCHECKED
        ExitLoop
    Case $cut9 = $GUI_UNCHECKED
        ExitLoop
    Case $cut0 = $GUI_UNCHECKED
        ExitLoop
Func aPressed()
Select
   Case $cuta = "安装全部\所选软件"
        ExitLoop

EndSelect
EndFunc

Func bPressed()
Run("C:\WINDOWS\system32\kill.exe")
Exit

EndFunc
EndSelect
Next

Func aPressed2()
$cut11 = GUICtrlRead ( $radio_1, 0)
$cut12 = GUICtrlRead ( $radio_2, 0)
$cut13 = GUICtrlRead ( $radio_3, 0)
$cut14 = GUICtrlRead ( $radio_4, 0)
$cut15 = GUICtrlRead ( $radio_5, 0)
$cut16 = GUICtrlRead ( $radio_6, 0)
$cut17 = GUICtrlRead ( $radio_7, 0)
$cut18 = GUICtrlRead ( $radio_8, 0)
$cut19 = GUICtrlRead ( $radio_9, 0)
$cut10 = GUICtrlRead ( $radio_0, 0)

If $cut11 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\1.exe")

If $cut12 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\2.exe")

If $cut13 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\3.exe")

If $cut14 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\4.exe")

If $cut15 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\5.exe")

If $cut16 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\6.exe")

If $cut17 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\7.exe")

If $cut18 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\8.exe")

If $cut19 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\9.exe")

If $cut10 = $GUI_CHECKED Then RunWait("C:\Program Files\soft\0.exe")

Run("C:\WINDOWS\system32\kill.exe")
Exit
EndFunc

If GUICtrlRead($progressbar1) = 100 Then   
Msgbox(0,"提示","开始安装软件", 1)

RunWait("C:\Program Files\soft\1.exe")

RunWait("C:\Program Files\soft\2.exe")

RunWait("C:\Program Files\soft\3.exe")

RunWait("C:\Program Files\soft\4.exe")

RunWait("C:\Program Files\soft\5.exe")

RunWait("C:\Program Files\soft\6.exe")

RunWait("C:\Program Files\soft\7.exe")

RunWait("C:\Program Files\soft\8.exe")

RunWait("C:\Program Files\soft\9.exe")

RunWait("C:\Program Files\soft\0.exe")
Run("C:\WINDOWS\system32\kill.exe")
Exit
else
EndIf


While 1
  Sleep(1000)
WEnd

Func CLOSEClicked()
Run("C:\WINDOWS\system32\kill.exe")
Exit
EndFunc

; 运行脚本直到窗口被关闭
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then Exit
Wend
安装软件后会自动删除自己
退出后也会自动删除自己
点不安装也会自动删除自己
发表于 2009-9-15 00:29:25 | 显示全部楼层
谢谢2楼的链接
发表于 2010-7-2 06:08:43 | 显示全部楼层
楼上的厉害!
发表于 2011-7-11 09:52:03 | 显示全部楼层
2楼得不错。但是会有错误。。
发表于 2012-7-6 21:37:04 | 显示全部楼层
学习了 不错
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-18 21:40 , Processed in 0.078639 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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