Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » AutoIT (Часть 2)

Модерирует : gyra, Maz

Widok (01-06-2010 13:08): Лимит страниц. Продолжаем здесь.  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

katok888



Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Код:
#region - Alcohol.52.v1.9.8.7530 install script - (Automated with WinExists functions)
 
#include <IE.au3>
Opt('TrayIconDebug', 1)
 
; Installer.
$executable = 'Alcohol52_FE_1.9.8.7530.exe'
; Show progess.
$splash = 0
; Default catagory folder in startmenu.
$group = 'Alcohol 52%'
; New catagory to move the default folder into.
$catagory = ''
; Installation folder in Program Files.
$directory = 'Alcohol Soft\Alcohol 52'
; Allowed time for installation.
$allowed = 60 * 1000
; Components to choose. 1 = Yes, 0 = No.
$SecACID    = 1 ; A.C.I.D Wizard
$langfiles  = 1 ; Multi-Language Files    
$manual     = 0 ; Online manual
$shortcuts  = 1 ; Desktop Shortcut
$startmenu  = 1 ; Startmenu Entries
$starwind   = 0 ; iSCSI Service
 
; ----- Settings Complete (Paste registration on line 83) ------
 
; Set components to install via registry.
$key = 'HKLM\SOFTWARE\Alcohol Soft\Alcohol 52%\AddRemove\Components'
RegWrite($key & '\SecACID',         'Installed', 'Reg_Dword', $SecACID)
RegWrite($key & '\SecLangFiles',    'Installed', 'Reg_Dword', $langfiles)
RegWrite($key & '\SecManual',       'Installed', 'Reg_Dword', $manual)
RegWrite($key & '\SecShortcuts',    'Installed', 'Reg_Dword', $shortcuts)
RegWrite($key & '\SecStartMenu',    'Installed', 'Reg_Dword', $startmenu)
RegWrite($key & '\SecStarWind',     'Installed', 'Reg_Dword', $starwind)
 
; Run the installer.
$pid = _Install()
$time = TimerInit()
$title = 'Alcohol 52%'
 
Do
    Select
            Case WinExists($title, 'Installer Language')
            ControlClick($title, 'Installer Language', 'Button1')
            
        Case WinExists($title, 'Already Installed')
            _Abort()
            
        Case WinExists($title, 'Вас приветствует мастер установки Alcohol 52%')
            WinMove($title, 'Вас приветствует мастер установки Alcohol 52%', @DesktopWidth, 0)
            ControlClick($title, 'Вас приветствует мастер установки Alcohol 52%', 'Button2')
 
        Case WinExists($title, 'License Agreement')
            ControlClick($title, 'License Agreement', 'Button2')
            
        Case WinExists('Alcohol Soft Setup', 'Additional Features and License Agreement')
            WinMove('Alcohol Soft Setup', 'Additional Features and License Agreement', @DesktopWidth, 0)
            Sleep(1000)
            $oIE = _IEAttach ('Alcohol Soft Setup', 'embedded')
            If IsObj($oIE) Then
                $oSubmit = _IEGetObjByName ($oIE, "chk1")
                If IsObj($oSubmit) Then
                    _IEAction ($oSubmit, "click")
                EndIf
                _IELoadWait ($oIE)
                $oIE = 0
            EndIf
            ControlClick('Alcohol Soft Setup', 'Additional Features and License Agreement', 'Button2')
            WinWaitClose('Alcohol Soft Setup', 'Additional Features and License Agreement', 1)
            
        Case WinExists($title, 'Not for Business Use')
            ControlCommand($title, 'Not for Business Use', 'Button4', 'UnCheck'); Toolbar
            ControlCommand($title, 'Not for Business Use', 'Button5', 'UnCheck'); StartPage
            ControlClick($title, 'Not for Business Use', 'Button2')            
 
        Case WinExists($title, 'Choose Components')
            ControlClick($title, 'Choose Components', 'Button2')
 
        Case WinExists($title, 'Choose Install Location')
            ControlClick($title, 'Choose Install Location', 'Button2')
 
        Case WinExists($title, 'Click Finish to close this wizard')
            ControlCommand($title, 'Click Finish to close this wizard', 'Button4', 'UnCheck'); Run
            ;ControlCommand($title, 'Click Finish to close this wizard', 'Button5', 'UnCheck'); Add Drive
            ControlClick($title, 'Click Finish to close this wizard', 'Button2')
 
        Case Else
            Sleep(250)
    EndSelect
    If TimerDiff($time) > $allowed Then _Abort()
Until Not ProcessExists($pid)
 
; *** Paste Registration on the next line ***
 
 
; Exit if $startmenu = 0 from above.
If Not $startmenu Then Exit
 
; Remove shortcuts.
If _MainShortcut('Alcohol 52%.lnk') Then
    FileDelete('Alcohol Command Launcher.lnk')
    FileDelete('Alcohol Manual.lnk')
;~  FileDelete('Uninstall Alcohol 52%.lnk')
;~  _Desktop('Alcohol 52%.lnk')
EndIf
 
#endregion
 
Exit
 
Func _Install($path = Default)
    ; Run the installer in Default Script directory.
    Dim $splash
    If $path = Default Then $path = @ScriptDir
    If StringRight($path, 1) <> '\' Then $path &= '\'
    If StringInStr($executable, '\') Then $path = ''
    If Not FileExists($path & $executable) Then Exit 1
    If $splash Then _Splash('Installing:' & StringTrimRight(StringReplace(@ScriptName, '_', ' '), 4))
    If StringRight($executable, 3) = 'msi' Then
        Return Run('"' & @SystemDir & '\msiexec.exe" /i "' & $path & $executable & '"')
    Else
        Return Run('"' & $path & $executable & '"')
    EndIf
EndFunc
 
Func _Abort()
    ; close process if exists then exit.
    Dim $pid
    If ProcessExists($pid) Then
        ProcessClose($pid)
        Exit 2
    Else
        Exit 3
    EndIf
EndFunc
 
Func _Desktop($shortcut)
    ; Delete a Desktop shortcut.
    If FileExists(@DesktopDir & '\' & $shortcut) Then
        Return FileDelete(@DesktopDir & '\' & $shortcut)
    ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then
        Return FileDelete(@DesktopCommonDir & '\' & $shortcut)
    EndIf
EndFunc
 
Func _MainShortcut($shortcut, $rename = '')
    ; Change working directory to correct StartMenu\Group directory.
    Dim $group, $catagory, $splash
    If $group = '' Then Return 0
    If FileExists(@ProgramsDir & '\' & $group) Then
        FileChangeDir(@ProgramsDir & '\' & $group)
    ElseIf FileExists(@ProgramsCommonDir & '\' & $group) Then
        FileChangeDir(@ProgramsCommonDir & '\' & $group)
    Else
        Return 0
    EndIf
    ; Wait for main shortcut.
    If $splash Then _Splash('Waiting for shortcuts')
    For $i = 1 To 20
        If FileExists($shortcut) Then ExitLoop
        Sleep(500)
    Next
    If $splash Then _Splash('Cleaning up:' & StringTrimRight(StringReplace(@ScriptName, '_', ' '), 4))
    ; If catagory not assigned anything, then return.
    If $catagory = '' Then Return 1
    ; Move the group folder into the catagory folder.
    If FileChangeDir('..') And DirCopy($group, $catagory & '\' & $group, 1) Then
        If DirRemove($group, 1) Then
            ; If optional rename parameter is used, then rename the group folder.
            If $rename <> '' And FileChangeDir($catagory) Then
                If DirCopy($group, $rename, 1) And DirRemove($group, 1) Then
                    Return FileChangeDir($rename)
                EndIf
            Else
                Return FileChangeDir($catagory & '\' & $group)
            EndIf
        EndIf
    EndIf
EndFunc
 
Func _QuickLaunch($shortcut)
    ; Delete a Quicklaunch shortcut.
    Local $subdirs = '\Microsoft\Internet Explorer\Quick Launch'
    If FileExists(@AppDataDir & $subdirs & '\' & $shortcut) Then
        Return FileDelete(@AppDataDir & $subdirs & '\' & $shortcut)
    ElseIf FileExists(@AppDataCommonDir & $subdirs & '\' & $shortcut) Then
        Return FileDelete(@AppDataCommonDir & $subdirs & '\' & $shortcut)
    EndIf
EndFunc
 
Func _Splash($text = '')
    ; Shows a small borderless splash message.
    Dim $splash
    If $splash Then
        If $text Then
            SplashTextOn('', $text, 500, 25, -1, 5, 1, '', 14)
        Else
            SplashOff()
        EndIf
    EndIf
EndFunc
 
Func _WinClose($title, $text = '')
    ; Close a window with further attempts.
    For $i = 1 To 10
        WinClose($title, $text)
        If Not WinExists($title) Then Return 1
        Sleep(500)
    Next
EndFunc
 
Func OnAutoItStart()
    ; A 2nd script instance will exit.
    Local $interpreter
    $interpreter = StringTrimRight(@ScriptName, 4) & ' Script Interpreter'
    If WinExists($interpreter) Then Exit
    AutoItWinSetTitle($interpreter)
EndFunc
 

Всего записей: 26 | Зарегистр. 05-04-2008 | Отправлено: 22:17 07-04-2009 | Исправлено: katok888, 19:47 08-04-2009
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » AutoIT (Часть 2)
Widok (01-06-2010 13:08): Лимит страниц. Продолжаем здесь.


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru