Ru-Board.club
← Вернуться в раздел «Программы»

» AutoIT

Автор: Trrrbit
Дата сообщения: 08.07.2010 01:02
KiLL
Спасибо большое. При первой возможности опробую
Автор: AZJIO
Дата сообщения: 10.07.2010 06:00
[more=Секундомер]
Код: #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_OutFile=Stopwatch.exe
#AutoIt3Wrapper_icon=Stopwatch.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=-
#AutoIt3Wrapper_Res_Description=Stopwatch.exe
#AutoIt3Wrapper_Res_Fileversion=0.5.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=n
#AutoIt3Wrapper_Res_LegalCopyright=AZJIO
#AutoIt3Wrapper_Res_Language=1049
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; @AZJIO 2.09.2010 (AutoIt3_v3.2.12.1+)
#NoTrayIcon

; En
$LngTitle='Stopwatch'
$LngStart='Start'
$LngSp='Stop'
$LngPs='Pause'
$LngRe='Reset'
$LngMem='Memory'
$LngSig='Signal'
$LngAbout='About'
$LngVer='Version'
$LngSite='Site'
$LngHK='HotKey'
$LngHKMsg= 'Start - Enter, UP'&@CRLF&'Pause - Down, Pause-Break'&@CRLF&'Reset - Delete, 0, Numpad0'&@CRLF&'Memory - Space'&@CRLF&'Signal - Numpad., Alt+.'
$LngSgTx='Will Enter time, in which'&@CRLF&'must sound signal'
$LngTm='Hour | Minute | Seconds'
$LngSpk='1. Speaker'
$LngMSpk='2. Tune Speaker'
$LngCn='Cancel'
$LngErr='Error'
$LngErrMsg='Time must be not installed in 0,'&@CRLF&'a name of the conservation must be incorporated,'&@CRLF&'in name must not be a symbol "|"'
$LngErrMsg2='Path not exist.'
$LngErrMsg3='Choose other name of the save'
$LngErrMsg4='Time must be not installed in 0'
$LngSl="Select File"
$LngType="Media-File"
$LngNx='Next'
$LngCm='3. Select path'
$LngMP='internal device for mp3'
        


; Ru
; если есть русский в раскладках клавиатуры, то использовать его
For $i = 1 to 5
    $LngN = RegEnumVal("HKCU\Keyboard Layout\Preload", $i)
    If @error <> 0 Then ExitLoop
    If RegRead("HKCU\Keyboard Layout\Preload", $LngN) = 00000419 Then
        $LngTitle='Секундомер'
        $LngStart='Старт'
        $LngSp='Стоп'
        $LngPs='Пауза'
        $LngRe='Сброс'
        $LngMem='Память'
        $LngSig='Сигнал'
        $LngAbout='О программе'
        $LngVer='Версия'
        $LngSite='Сайт'
        $LngHK='Горячие клавиши'
        $LngHKMsg= 'Старт - Enter, UP'&@CRLF&'Пауза - Down, Pause-Break'&@CRLF&'Сброс - Delete, 0, Numpad0'&@CRLF&'Память - Space'&@CRLF&'Сигнал - Numpad., Alt+.'
        $LngSgTx='Введите время, в которое'&@CRLF&'должен прозвучать сигнал'
        $LngTm='Часы | Минуты | Секунды'
        $LngSpk='1. Динамик ПК'
        $LngMSpk='2. Мелодия динамика ПК'
        $LngCn='Отмена'
        $LngErr='Мелкая ошибка'
        $LngErrMsg='Время не должно быть установлено в 0,'&@CRLF&'должно быть введено имя сохранения,'&@CRLF&'в имени не должно быть символа "|"'
        $LngErrMsg2='Путь не существует.'
        $LngErrMsg3='Запись с таким именем уже существует'
        $LngErrMsg4='Время не должно быть установлено в 0'
        $LngSl="Указать файл"
        $LngType="Медиа-файл"
        $LngNx='Далее'
        $LngCm='3. Укажите путь'
        $LngMP='внутренее устройство для mp3'
        ExitLoop
    EndIf
Next

Global $Pause, $iTime, $L=0, $iStart, $s=0, $iTimeSig, $nSig0, $combo=$LngCm, $Bold = 700
Global $Tr1 = 0, $Tr2 = 0, $Tr3 = 0, $n=1, $pid, $sLabel, $trMp=0
Global $IniText, $aIniText, $ini=@ScriptDir&'\Stwh.ini'
If FileExists($ini) Then
    $file = FileOpen($ini, 0)
    $IniText = FileRead($file)
    FileClose($file)
EndIf


; Case 'WIN_2000', 'WIN_XP', 'WIN_2003'
Switch @OSVersion
Case 'WIN_VISTA', 'WIN_7'
$Bold = 400
EndSwitch


$Gui = GUICreate($LngTitle, 230, 185)
If @compiled=0 Then GUISetIcon("Stopwatch.ico",-2)
GUICtrlCreateLabel ("", 3,3,144,34,0x12)

$hLabel1 = GUICtrlCreateLabel(' 00', 5, 5, 35, 30,0xC)
_bk()
GUICtrlCreateLabel(':', 40, 5, 10, 30)
_bk()
$hLabel2 = GUICtrlCreateLabel('00', 50, 5, 28, 30)
_bk()
GUICtrlCreateLabel(':', 78, 5, 10, 30)
_bk()
$hLabel3= GUICtrlCreateLabel('00', 88, 5, 33, 30)
_bk()
GUICtrlCreateLabel('.', 116, 5, 7, 30)
_bk()
$hLabel4= GUICtrlCreateLabel('0', 123, 5, 22, 30)
_bk()

$hM1 = GUICtrlCreateLabel('M1 - 00:00:00.0', 30, 45, 110, 25, 0xC)
GUICtrlSetFont(-1, 10, $Bold)
$hM2 = GUICtrlCreateLabel('M2 - 00:00:00.0', 30, 65, 110, 25, 0xC)
GUICtrlSetFont(-1, 10, $Bold)
$hM3 = GUICtrlCreateLabel('M3 - 00:00:00.0', 30, 85, 110, 25, 0xC)
GUICtrlSetFont(-1, 10, $Bold)
$hM4 = GUICtrlCreateLabel('M4 - 00:00:00.0', 30, 105, 110, 25, 0xC)
GUICtrlSetFont(-1, 10, $Bold)
$hM5 = GUICtrlCreateLabel('M5 - 00:00:00.0', 30, 125, 110, 25, 0xC)
GUICtrlSetFont(-1, 10, $Bold)

$hSg = GUICtrlCreateLabel('', 30, 160, 110, 25)
GUICtrlSetFont(-1, 10, $Bold)
GUICtrlSetColor(-1, 0x3db03a)

$Start = GUICtrlCreateButton($LngStart, 161, 5, 60, 25)
GUICtrlSetTip(-1, 'Enter'&@CRLF&'Up')
$Pause0 = GUICtrlCreateButton($LngPs, 161, 35, 60, 25)
GUICtrlSetState(-1,128)
GUICtrlSetTip(-1, 'Down'&@CRLF&'Pause')
;$Stop = GUICtrlCreateButton("Стоп", 161, 65, 60, 25)
$Reset = GUICtrlCreateButton($LngRe, 161, 65, 60, 25)
GUICtrlSetTip(-1, 'NumPad 0'&@CRLF&'Del'&@CRLF&'0')
$Mem = GUICtrlCreateButton($LngMem, 161, 95, 60, 25)
GUICtrlSetTip(-1, 'Space')
$Signal = GUICtrlCreateButton($LngSig, 161, 125, 60, 25)
GUICtrlSetTip(-1, 'Alt+.'&@CRLF&'NumPad Del')
$About = GUICtrlCreateButton("@", 161, 155, 27, 25)
$HotKey = GUICtrlCreateButton("?", 193, 155, 27, 25)
$nStop1 = GUICtrlCreateButton($LngSp, 235, 160, 32, 23)
$n=1
$sLabel=' 00:00:00.0'
$iHour='00'
$iMin='00'
$iSec='00'
$iMsec='0'

Dim $AccelKeys[10][2]=[["{Enter}", $Start], ["{UP}", $Start], ["{SPACE}", $Mem], ["{DEL}", $Reset], ["0", $Reset], ["{NUMPAD0}", $Reset], ["{DOWN}", $Pause0], ["{PAUSE}", $Pause0], ["!{.}", $Signal], ["{NUMPADDOT}", $Signal]]

GUISetAccelerators($AccelKeys)

GUISetState()

$iHourTmp=''
$iMinTmp=''
$iSecTmp=''
$iMsecTmp=''

While 1
    $msg = GUIGetMsg()
    If $Tr1 = 1 Then
        $iTime = Int(TimerDiff($iStart)/100)/10-$L
        $iHour=Int($iTime/3600)
        $iMin = Int(($iTime-$iHour*3600)/60)
        $iSec = Int($iTime)-$iHour*3600-$iMin*60
        $iMsec = Int(($iTime-Int($iTime))*10)
        If $iHour < 10 Then $iHour='0'&$iHour
        If $iMin < 10 Then $iMin='0'&$iMin
        If $iSec < 10 Then $iSec='0'&$iSec
        ;If $iMsec < 10 Then $iMsec='0'&$iMsec
        If $iHourTmp<>$iHour Then GUICtrlSetData($hLabel1, " " &$iHour)
        If $iMinTmp<>$iMin Then GUICtrlSetData($hLabel2, $iMin)
        If $iSecTmp<>$iSec Then GUICtrlSetData($hLabel3, $iSec)
        If $iMsecTmp<>$iMsec Then GUICtrlSetData($hLabel4, $iMsec)
        $iHourTmp=$iHour
        $iMinTmp=$iMin
        $iSecTmp=$iSec
        $iMsecTmp=$iMsec
        ;Sleep(20)
    EndIf
    If $s = 1 And $iTimeSig<=$iTime Then
        $s = 0
        GUICtrlSetData($hSg,'')
        $nSig=StringLeft($nSig0, 1)
        Switch $nSig
            Case 1
             Beep(500, 1000)
            Case 2
                _melodia()
            Case 3
                ;ShellExecute(StringTrimLeft($nSig0, 3))
                If $trMp=1 And StringInStr(';mp3;wav;wma;',';'&StringRegExpReplace($nSig0, '.*\.(\S+)', '\1')&';')<>0 Then
                    _MP($nSig0)
                Else
                    _StartFile($nSig0)
                EndIf
            Case Else
                _melodia()
        EndSwitch
    EndIf
    
    If $pid<>0 And ProcessExists($pid) Then
        GUICtrlSetPos($nStop1, 5, 160)
    Else
        GUICtrlSetPos($nStop1, 235, 160)
        $pid=0
    EndIf

    Select
        Case $msg = $About
            _About()
        Case $msg = $HotKey
            MsgBox(0, $LngHK, $LngHKMsg)
        Case $msg = $nStop1
            If $pid<>0 And ProcessExists($pid) Then
                ProcessClose($pid)
                $pid=0
            EndIf
        Case $msg = $Start
            _Start()
        Case $msg = $Pause0
            If $Tr3 = 0 Then ContinueLoop
            If $Tr1 = 1 Then
                $Tr1 = 0
                $Tr2 = 1
                GUICtrlSetData($Pause0,$LngNx)
                GUICtrlSetState($Start,128)
            Else
                $L=Int(TimerDiff($iStart)/100)/10-$iTime
                $Tr1 = 1
                $Tr2 = 2
                GUICtrlSetData($Pause0, $LngPs)
                GUICtrlSetState($Start,64)
            EndIf
        Case $msg = $Mem
            If $n = 6 Then
                For $n = 1 to 5
                    GUICtrlSetColor(Eval("hM"&$n), 0x000000)
                Next
                $n = 1
            EndIf
            $sLabel = " " &$iHour & ":" & $iMin & ":" & $iSec & "." &$iMsec
            GUICtrlSetData(Eval("hM"&$n), 'M'&$n&' -'&$sLabel)
            If $sLabel<>' 00:00:00.0' Then
                GUICtrlSetColor(Eval("hM"&$n), 0xc03d3a)
                $n+=1
            EndIf
        Case $msg = $Reset
            _Reset()
        Case $msg = $Signal
            _Signal()
        Case $msg = -3
            Exit
    EndSelect
WEnd


Func _Signal()
    $GuiPos = WinGetPos($Gui)
$Gui1 = GUICreate($LngSig, 243, 200,$GuiPos[0], $GuiPos[1], -1, 0x00000080)
    GUICtrlCreateLabel($LngSgTx, 20, 5, 200, 34)
    
    GUICtrlCreateLabel($LngTm, 15, 38, 170, 17)
    $nHour = GUICtrlCreateInput("0", 10, 55, 50, 22)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1, 24, 0)
    $nMin = GUICtrlCreateInput("0", 65, 55, 50, 22)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1, 60, 0)
    $nSec = GUICtrlCreateInput("0", 120, 55, 50, 22)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1, 60, 0)

    $nSig = GUICtrlCreateCombo ('', 10,83,160,25)
    GUICtrlSetData(-1,$LngSpk&'|'&$LngMSpk&'|'&$combo,$LngSpk)
    $nFolder = GUICtrlCreateButton("...", 172, 83, 32, 23)
    GUICtrlSetFont(-1, 14)
    $nPlay = GUICtrlCreateButton("Play", 205, 83, 32, 23)
    $nStop = GUICtrlCreateButton("Stop", 245, 55, 32, 23)

    $nSection = GUICtrlCreateCombo ('', 10,113,160,25)
    $nSave = GUICtrlCreateButton("Save", 172, 113, 32, 23)
    $nOpen = GUICtrlCreateButton("Open", 248, 113, 32, 23)
    If FileExists($ini) Then GUICtrlSetPos($nOpen, 205, 113)
    _IniText()
    
    If $IniText<>'' Then
        For $i = 1 to UBound($aIniText) - 1
            If $aIniText[$i]<>'' Then
                If StringInStr(StringRegExpReplace ($aIniText[$i],'(.*)(3\. .*)','\2'), '|')=0 Then GUICtrlSetData($nSig,StringRegExpReplace ($aIniText[$i],'(.*)(3\. .*)','\2'),'')
                GUICtrlSetData($nSection,StringRegExpReplace ($aIniText[$i],'(.*?)\|(.*)','\1'),'')
            EndIf
        Next
    EndIf
        
    $nMP = GUICtrlCreateCheckbox($LngMP, 10, 138, 180, 25)
    If $trMp=1 Then GUICtrlSetState(-1,1)
    
    $nOK = GUICtrlCreateButton("OK", 59, 165, 60, 25)
    $nCancel = GUICtrlCreateButton($LngCn, 124, 165, 60, 25)
    $pid=0
    GUISetState(@SW_SHOW, $Gui1)
    GUISetState(@SW_HIDE, $Gui)
$msg = $Gui1
    While 1
     $msg = GUIGetMsg()
        If $pid<>0 And ProcessExists($pid) Then
            GUICtrlSetPos($nStop, 205, 55)
        Else
            GUICtrlSetPos($nStop, 245, 55)
            $pid=0
        EndIf
     Select
        Case $msg = $nMP
            If GUICtrlRead($nMP) = 1 Then
                $trMp=1
            Else
                $trMp=0
            EndIf
        Case $msg = $nStop
            If $pid<>0 And ProcessExists($pid) Then
                ProcessClose($pid)
                $pid=0
            EndIf
        Case $msg = $nOpen
            ShellExecute($ini)
            
        Case $msg = $nPlay
            $nSi0=GUICtrlRead($nSig)
            If StringLeft($nSi0, 1)='3' And Not FileExists(StringTrimLeft($nSi0, 3)) Then
                MsgBox(0,$LngErr, $LngErrMsg2)
                ContinueLoop
            EndIf
            Switch StringLeft($nSi0, 1)
                Case 1
                 Beep(500, 1000)
                Case 2
                    _melodia()
                Case 3
                    If GUICtrlRead($nMP) = 1 And StringInStr(';mp3;wav;wma;',';'&StringRegExpReplace($nSi0, '.*\.(\S+)', '\1')&';')<>0 Then
                        _MP($nSi0)
                    Else
                        _StartFile($nSi0)
                    EndIf
            EndSwitch

        Case $msg = $nSection
            $nSection0=GUICtrlRead($nSection)
            $combotmp=''
            For $i = 1 to UBound($aIniText) - 1
                If StringRegExpReplace ($aIniText[$i],'(.*?)\|(.*)','\1')=$nSection0 Then
                    $combotmp=StringSplit($aIniText[$i], '|')
                    GUICtrlSetData($nHour, $combotmp[2])
                    GUICtrlSetData($nMin, $combotmp[3])
                    GUICtrlSetData($nSec, $combotmp[4])
                    GUICtrlSetData($nSig, $combotmp[5])
                EndIf
            Next
            If StringLeft($combotmp[5], 1)='3' And Not FileExists(StringTrimLeft($combotmp[5], 3)) Then MsgBox(0, $LngErr,$LngErrMsg2)
            
        Case $msg = $nSave
            $nSection0=GUICtrlRead($nSection)
            $nHour0=GUICtrlRead($nHour)
            $nMin0=GUICtrlRead($nMin)
            $nSec0=GUICtrlRead($nSec)
            $nSi0=GUICtrlRead($nSig)
            If $nHour0+$nMin0+$nSec0 = 0 or StringInStr($nSection0,'|')<>0 or $nSection0='' Then
                MsgBox(0, $LngErr, $LngErrMsg)
                ContinueLoop
            EndIf
            If StringLeft($nSi0, 1)='3' And Not FileExists(StringTrimLeft($nSi0, 3)) Then
                MsgBox(0, $LngErr,$LngErrMsg2)
                ContinueLoop
            EndIf
            If StringInStr($IniText, $nSection0&'|')<>0 Then
                MsgBox(0, $LngErr, $LngErrMsg3)
                ContinueLoop
            EndIf
            $ReadTmp=$nSection0&'|'&$nHour0&'|'&$nMin0&'|'&$nSec0&'|'&$nSi0&@CRLF
            ;If StringRegExp($IniText, '(?s)(^.*)\n$', 0)=0 Then $ReadTmp&=@CRLF&$ReadTmp
            $file = FileOpen($ini,1)
            FileWrite($file, $ReadTmp)
            $IniText&=$ReadTmp
            FileClose($file)
            _IniText()
            If StringLeft($nSi0, 1)='3' Then GUICtrlSetData($nSig,$nSi0,$nSi0)
            GUICtrlSetData($nSection,$nSection0,$nSection0)
            GUICtrlSetPos($nOpen, 205, 113)

        Case $msg = $nCancel
            $s=0
            GUICtrlSetData($hSg,'')
            $msg = $Gui
            $GuiPos = WinGetPos($Gui1)
            GUIDelete($Gui1)
            WinMove($Gui, "", $GuiPos[0], $GuiPos[1])
            GUISetState(@SW_SHOW, $Gui)
            ExitLoop
        Case $msg = $nFolder
            $tmp = FileOpenDialog($LngSl, @WorkingDir & "", $LngType&" (*.*)", 1 + 4)
            If @error Then ContinueLoop
            GUICtrlSendMsg($nSig, 0x14B, 0, 0)
            $combo="3. "&$tmp
            GUICtrlSetData($nSig,$LngSpk&'|'&$LngMSpk&'|'&$combo, $combo)

        Case $msg = $nOK
            $s=1
            $nHour0=GUICtrlRead($nHour)
            $nMin0=GUICtrlRead($nMin)
            $nSec0=GUICtrlRead($nSec)
            $nSig0=GUICtrlRead($nSig)
            If $nHour0+$nMin0+$nSec0 = 0 Then
                MsgBox(0, $LngErr, $LngErrMsg4)
                ContinueLoop
            EndIf
            $iTimeSig=$nHour0*3600+$nMin0*60+$nSec0
            If $nHour0 < 10 Then $nHour0='0'&$nHour0
            If $nMin0 < 10 Then $nMin0='0'&$nMin0
            If $nSec0 < 10 Then $nSec0='0'&$nSec0
            GUICtrlSetData($hSg,'Sg - '&$nHour0&':'&$nMin0&':'&$nSec0&'.0')
            _Reset()
            _Start()
            ContinueCase
        Case $msg = -3
            $msg = $Gui
            $GuiPos = WinGetPos($Gui1)
            GUIDelete($Gui1)
            WinMove($Gui, "", $GuiPos[0], $GuiPos[1])
            GUISetState(@SW_SHOW, $Gui)
            ExitLoop
        EndSelect
WEnd
EndFunc

Func _IniText()
    If $IniText<>'' Then
        ;UDF File.au3
        If StringInStr($IniText, @LF) Then
            $aIniText = StringSplit(StringStripCR($IniText), @LF)
        ElseIf StringInStr($IniText, @CR) Then
            $aIniText = StringSplit($IniText, @CR)
        Else
            If StringLen($IniText) Then
                Dim $aIniText[2] = [1, $IniText]
            Else
                MsgBox(0, $LngErr, "Error ini")
                Exit
            EndIf
        EndIf
    EndIf
EndFunc

Func _bk()
GUICtrlSetFont(-1, 20, $Bold, -1, 'Arial')
GUICtrlSetColor(-1, 0xc03d3a)
GUICtrlSetBkColor(-1, 0xffffff)
EndFunc

Func _Start()
    If $Tr2 = 1 Then Return
    If $Tr1 = 0 Then
        $Tr1 = 1
        $Tr3 = 1
        $L=0
        GUICtrlSetData($Start, $LngSp)
        GUICtrlSetState($Pause0,64)
        $iStart = TimerInit()
    Else
        $Tr1 = 0
        $Tr3 = 0
        GUICtrlSetData($Start, $LngStart)
        GUICtrlSetState($Pause0,128)
    EndIf
EndFunc

Func _Reset()
    $sLabel=' 00:00:00.0'
    $Tr1 = 0
    $Tr2 = 0
    $Tr3 = 0
    $iTime=0
    $L=0
    GUICtrlSetData($hLabel1, ' 00')
    GUICtrlSetData($hLabel2, '00')
    GUICtrlSetData($hLabel3, '00')
    GUICtrlSetData($hLabel4, '0')
    For $n = 1 to 5
        GUICtrlSetColor(Eval("hM"&$n), 0x000000)
        GUICtrlSetData(Eval("hM"&$n), 'M'&$n&' - 00:00:00.0')
    Next
    $n = 1
    GUICtrlSetData($Start, $LngStart)
    GUICtrlSetState($Start,64)
    GUICtrlSetData($Pause0, $LngPs)
    GUICtrlSetState($Pause0,128)
EndFunc

Func _MP($nSi2)
$nSi2=StringTrimLeft($nSi2, 3)
$melod= '#NoTrayIcon' & @CRLF & _
'SoundPlay("'&$nSi2&'", 0)' & @CRLF & _
'MsgBox(0, "Message", "Stop?")'
$file = FileOpen(@TempDir&'\Beepfile.au3',2)
FileWrite($file, $melod)
FileClose($file)
$pid=Run(@AutoItExe&' /AutoIt3ExecuteScript "'&@TempDir&'\Beepfile.au3"', '', @SW_HIDE)
EndFunc

Func _StartFile($nSi2)
    $type=StringRegExpReplace($nSi2, '.*\.(\S+)', '\1')
    $astype = RegRead('HKEY_CLASSES_ROOT\.' & $type, "")
    $astype = RegRead('HKEY_CLASSES_ROOT\' & $astype & '\shell\open\command', "")
    $nSi2=StringTrimLeft($nSi2, 3)
    If @error = 1 Then
        ShellExecute($nSi2)
        Return
    EndIf
    $aPathexe=StringRegExpReplace($astype, '(^.*)exe(.*)$', '\1')
    If @error = 1 Then
        ShellExecute($nSi2)
        Return
    EndIf
    $aPathexe = StringReplace($aPathexe, '"', '')
    If FileExists($aPathexe & 'exe') Then
        $filename=StringRegExpReplace($aPathexe & 'exe', '(^.*)\\(.*)$', '\2')
        If ProcessExists($filename) Then
            $aProsname=ProcessList ($filename)
            $pid=$aProsname[1][1]
            Run('"'&$aPathexe&'exe" "'&$nSi2&'"')
        Else
            $pid=Run('"'&$aPathexe&'exe" "'&$nSi2&'"')
        EndIf
    Else
        ShellExecute($nSi2)
        Return
    EndIf
EndFunc

Func _melodia()
$melod= '#NoTrayIcon' & @CRLF & _
'Global $nTempo=0.8'&@CRLF&'Global $iTone=0'&@CRLF&'HotKeySet("{ESC}", "_Quit")'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(7,4,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100,100)' & @CRLF & _
'_Beep(1,5,100,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(7,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100,100)'&@CRLF&'_Beep(12,4,100,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(7,4,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(6,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(6,4,100)'&@CRLF&'_Beep(5,4,100)'&@CRLF&'_Beep(4,4,200,300)'&@CRLF&'_Beep(1,5,100)' & @CRLF & _
'_Beep(12,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(1,5,100,100)' & @CRLF & _
'_Beep(6,5,100,100)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)' & @CRLF & _
'_Beep(8,4,100)'&@CRLF&'_Beep(1,5,100,100)'&@CRLF&'_Beep(4,5,100,100)'&@CRLF&'_Beep(4,5,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(3,4,100)' & @CRLF & _
'_Beep(7,4,100)'&@CRLF&'_Beep(10,4,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(4,5,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(3,5,250,250)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(7,4,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100,100)' & @CRLF & _
'_Beep(1,5,100,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(7,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100,100)'&@CRLF&'_Beep(12,4,100,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(7,4,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(6,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(6,4,100)'&@CRLF&'_Beep(5,4,100)'&@CRLF&'_Beep(4,4,200,300)'&@CRLF&'_Beep(1,5,100)' & @CRLF & _
'_Beep(12,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(1,5,100,100)' & @CRLF & _
'_Beep(6,5,100,100)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)' & @CRLF & _
'_Beep(8,4,100)'&@CRLF&'_Beep(1,5,100,100)'&@CRLF&'_Beep(4,5,100,100)'&@CRLF&'_Beep(4,5,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(12,4,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(8,5,100)'&@CRLF&'_Beep(6,5,100)' & @CRLF & _
'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,300,200)'&@CRLF&'_Beep(3,5,100)' & @CRLF
$melod&= _
'_Beep(1,5,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(4,4,100)' & @CRLF & _
'_Beep(8,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(4,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(11,4,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(1,5,150,150)'&@CRLF&'_Beep(9,4,200,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(11,4,100)' & @CRLF & _
'_Beep(3,4,100)'&@CRLF&'_Beep(6,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(3,4,100)' & @CRLF & _
'_Beep(6,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(1,5,150,150)' & @CRLF & _
'_Beep(8,4,200,100)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(6,5,100)' & @CRLF & _
'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(4,5,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(3,5,150,150)' & @CRLF & _
'_Beep(11,4,300,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(4,5,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(3,5,100)' & @CRLF & _
'_Beep(1,5,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(11,4,400,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(11,4,100)' & @CRLF & _
'_Beep(4,4,100)'&@CRLF&'_Beep(8,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(4,4,100)' & @CRLF & _
'_Beep(8,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(1,5,150,150)' & @CRLF & _
'_Beep(9,4,200,100)'&@CRLF&'_Beep(3,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(12,4,100)' & @CRLF & _
'_Beep(11,4,100)'&@CRLF&'_Beep(3,4,100)'&@CRLF&'_Beep(6,4,100)'&@CRLF&'_Beep(11,4,100)' & @CRLF & _
'_Beep(3,4,100)'&@CRLF&'_Beep(6,4,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(12,4,100)' & @CRLF & _
'_Beep(1,5,150,150)'&@CRLF&'_Beep(8,4,150,150)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)' & @CRLF & _
'_Beep(2,5,100)'&@CRLF&'_Beep(1,5,100)'&@CRLF&'_Beep(12,4,100)'&@CRLF&'_Beep(1,5,100)' & @CRLF & _
'_Beep(3,5,100)'&@CRLF&'_Beep(6,5,100)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)' & @CRLF & _
'_Beep(1,5,100)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(4,5,100)' & @CRLF & _
'_Beep(8,5,100)'&@CRLF&'_Beep(11,5,100)'&@CRLF&'_Beep(10,5,100)'&@CRLF&'_Beep(9,5,100)' & @CRLF & _
'_Beep(8,5,100)'&@CRLF&'_Beep(6,5,100)'&@CRLF&'_Beep(4,5,100)'&@CRLF&'_Beep(3,5,100)' & @CRLF & _
'_Beep(1,5,100)'&@CRLF&'_Beep(11,4,100)'&@CRLF&'_Beep(9,4,100)'&@CRLF&'_Beep(8,4,100)' & @CRLF & _
'_Beep(6,4,100)'&@CRLF&'_Beep(4,4,200)' & @CRLF & _
'Func _Beep($iNote,$iOctave=4,$iDuration=200,$iPause=0)' & @CRLF & _
'    $iFrequency=440*2^(($iNote+$iTone)/12+$iOctave+1/6-4)' & @CRLF & _
'    Beep($iFrequency, $iDuration/$nTempo)' & @CRLF & _
'    If $iPause<>0 Then Sleep($iPause/$nTempo)' & @CRLF & _
'EndFunc' & @CRLF & _
'Func _Quit()' & @CRLF & _
' Exit' & @CRLF & _
'EndFunc'
$file = FileOpen(@TempDir&'\Beepfile.au3',2)
FileWrite($file, $melod)
FileClose($file)
$pid=Run(@AutoItExe&' /AutoIt3ExecuteScript "'&@TempDir&'\Beepfile.au3"', '', @SW_HIDE)
EndFunc

Func _About()
$GuiPos = WinGetPos($Gui)
GUISetState(@SW_HIDE, $Gui)
$font="Arial"
$Gui1 = GUICreate($LngAbout, 270, 180,$GuiPos[0], $GuiPos[1], -1, 0x00000080)
    GUISetBkColor (0xf8c848)
    GUICtrlCreateLabel($LngTitle, 0, 20, 270, 33, 0x01)
    GUICtrlSetFont (-1,15, 600, -1, $font)
    GUICtrlSetColor(-1,0xa21a10)
    GUISetFont (9, 600, -1, $font)
    GUICtrlCreateLabel($LngVer&' 0.5 2.09.2010', 55, 100, 210, 17)
    GUICtrlCreateLabel($LngSite&':', 55, 115, 40, 17)
    $url=GUICtrlCreateLabel('http://azjio.ucoz.ru', 92, 115, 170, 17)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x0000ff)
    GUICtrlCreateLabel('WebMoney: R939163939152', 55, 130, 210, 17)
    GUICtrlCreateLabel('Copyright AZJIO © 2010', 55, 145, 210, 17)
    GUISetState(@SW_SHOW, $Gui1)
$msg = $Gui1
    While 1
     $msg = GUIGetMsg()
     Select
        Case $msg = $url
            ShellExecute ('http://azjio.ucoz.ru')
        Case $msg = -3
            $msg = $Gui
            GUIDelete($Gui1)
            GUISetState(@SW_SHOW, $Gui)
            ExitLoop
        EndSelect
WEnd
EndFunc
Автор: guardberc
Дата сообщения: 11.07.2010 00:22
Подскажите, как отправить письмо с вложением средствами autoit?

PS поиск юзал. если пропустил что-то, то ткните носом.
Пробую этот пример http://www.autoitscript.com/forum/index.php?showtopic=23860&st=320

Код: #Include <file.au3>
;##################################
; INI
;##################################
$var1 = IniRead("H:\Bureaublad\config.ini", "config", "SMTP", "")
$var2 = IniRead("H:\Bureaublad\config.ini", "opmaak", "NAAM", "")
$var3 = IniRead("H:\Bureaublad\config.ini", "config", "VAN-EMAIL", "")
$var4 = IniRead("H:\Bureaublad\config.ini", "opmaak", "NAAR-EMAIL", "")
$var5 = IniRead("H:\Bureaublad\config.ini", "opmaak", "ONDERWERP", "")
$var6 = IniRead("H:\Bureaublad\config.ini", "opmaak", "BODY", "")
$var7 = IniRead("H:\Bureaublad\config.ini", "opmaak", "ATTACHMENT", "")
$var8 = IniRead("H:\Bureaublad\config.ini", "opmaak", "CC", "")
$var9 = IniRead("H:\Bureaublad\config.ini", "opmaak", "BCC", "")
$var10 = IniRead("H:\Bureaublad\config.ini", "config", "PRIORITY", "Normal")
$var11 = IniRead("H:\Bureaublad\config.ini", "config", "USERNAME", "")
$var12 = IniRead("H:\Bureaublad\config.ini", "config", "PASSWORD", "")
$var13 = IniRead("H:\Bureaublad\config.ini", "config", "IPPORT", "25")

;##################################
; Variables
;##################################
$SmtpServer = $var1 ; address for the smtp-server to use - REQUIRED
$FromName = $var2 ; name from who the email was sent
$FromAddress = $var3 ; address from where the mail should come
$ToAddress = $var4 ; destination address of the email - REQUIRED
$Subject = $var5 ; subject from the email - can be anything you want it to be
$Body = $var6 ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = $var7 ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = $var8 ; address for cc - leave blank if not needed
$BccAddress = $var9 ; address for bcc - leave blank if not needed
$Importance = $var10 ; Send message priority: "High", "Normal", "Low"
$Username = $var11 ; username for the account used from where the mail gets sent - REQUIRED
$Password = $var12 ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = $var13 ; port used for sending the mail
$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS

;##################################
; Script
;##################################
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
EndIf
;
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
If FileExists ($S_Files2Attach[$x]) Then
ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
.AddAttachment($S_Files2Attach[$x])
Else
ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
If Number($IPPort) = 0 then $IPPort = 25
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Set Email Importance
Switch $s_Importance
Case "High"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
Case "Normal"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
Case "Low"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
EndSwitch
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
$objEmail=""
EndFunc ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFunc
Автор: Orion_76
Дата сообщения: 11.07.2010 18:32
guardberc

Цитата:
но при отправке выскакивает сообщение

скрипт один в один похож на этот с оф.форума
http://www.autoitscript.com/forum/index.php?showtopic=116815&st=0&p=814757&hl=mail&fromsearch=1&#entry814757

Там же решается похожая с вашей проблема(как раз c gmail.com)
Пост №3...
Автор: AZJIO
Дата сообщения: 12.07.2010 15:36
[more=Пятнашки]
Код: #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_OutFile=Fifteen.exe
#AutoIt3Wrapper_icon=Fifteen.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=-
#AutoIt3Wrapper_Res_Description=Fifteen.exe
#AutoIt3Wrapper_Res_Fileversion=0.2.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=n
#AutoIt3Wrapper_Res_LegalCopyright=AZJIO
#AutoIt3Wrapper_Res_Language=1049
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; @AZJIO 2010.07.12
; Resizing, displacement on 2-3 buttons.
#NoTrayIcon

; En
$LngTitle='Fifteen'
$LngAbout='About'
$LngSite='Site'
$LngA='Author'
$LngRe='Disturb'
$LngMsgT= 'Message'
$LngMsg= 'Excellently'

; Ru
; если есть русский в раскладках клавиатуры, то использовать его
For $i = 1 to 5
    $LngN = RegEnumVal("HKCU\Keyboard Layout\Preload", $i)
    If @error <> 0 Then ExitLoop
    If RegRead("HKCU\Keyboard Layout\Preload", $LngN) = 00000419 Then
        $LngTitle='Пятнашки'
        $LngAbout='О программе'
        $LngSite='Сайт'
        $LngA='Автор'
        $LngRe='Перемешать'
        $LngMsgT= 'Сообщение'
        $LngMsg= 'Молодец!'
        ExitLoop
    EndIf
Next

$h=58
$w=8
Global $aXY[17][4], $s
$Gui=GUICreate($LngTitle, 188, 238, -1, -1, 0x00040000)
$GuiPos = WinGetPos($Gui)
$s=Int(($GuiPos[2]-$w)/4)
WinMove($Gui, "", $GuiPos[0], $GuiPos[1], $s*4+$w, $s*4+$h)

$restart = GUICtrlCreateButton ($LngA,0,$s*4+1,$s*2, 20)
GUICtrlSetResizing(-1, 512 + 64)
$refresh = GUICtrlCreateButton ($LngRe,$s*2,$s*4+1,$s*2, 20)
GUICtrlSetResizing(-1, 512 + 64)

$y=0
$x=0
For $i = 1 to 16
    $aXY[$i][0]=$i
Switch $i
    Case 1 To 4
     $y=0
     $x=1
    Case 5 To 8
     $y=1
     $x=5
    Case 9 To 12
     $y=2
     $x=9
    Case 13 To 16
     $y=3
     $x=13
EndSwitch
    $aXY[$i][2]=($i-$x)*$s
    $aXY[$i][3]=$y*$s
    If $i < 16 Then
        GUISetFont (15, 700)
        $aXY[$i][1]=GUICtrlCreateButton ($i, $aXY[$i][2],$aXY[$i][3],$s,$s)
        GUICtrlSetResizing(-1, 1)
     EndIf
Next
$r=0
GUISetState ()
_refresh()

While 1
    $msg = GUIGetMsg()

    If $aXY[16][2]=$s*3 and $aXY[16][3]=$s*3 And $aXY[15][2]=$s*2 and $aXY[15][3]=$s*3 And $aXY[14][2]=$s and $aXY[14][3]=$s*3 And $aXY[13][2]=0 and $aXY[13][3]=$s*3 And $aXY[12][2]=$s*3 and $aXY[12][3]=$s*2 And $aXY[11][2]=$s*2 and $aXY[11][3]=$s*2 And $aXY[10][2]=$s and $aXY[10][3]=$s*2 And $aXY[9][2]=0 and $aXY[9][3]=$s*2 And $aXY[8][2]=$s*3 and $aXY[8][3]=$s And $aXY[7][2]=$s*2 and $aXY[7][3]=$s And $aXY[6][2]=$s and $aXY[6][3]=$s And $aXY[5][2]=0 and $aXY[5][3]=$s And $aXY[4][2]=$s*3 and $aXY[4][3]=0 And $aXY[3][2]=$s*2 and $aXY[3][3]=0 And $aXY[2][2]=$s and $aXY[2][3]=0 And $aXY[1][2]=0 and $aXY[1][3]=0 Then
        Sleep(500)
        MsgBox(0, $LngMsgT, $LngMsg)
        _refresh()
    EndIf
#Region ;Resizing, change the sizes window
    $r += 1
    If $r = 200 Then ; each 0,2 seconds checking the change window
        $r = 0
        $GuiPos = WinGetPos($Gui)
        If ($GuiPos[2]-$w)/4<>$s or ($GuiPos[3]-$h)/4<>$s Then
            $t=$s
            If $GuiPos[2]-$w>$GuiPos[3]-$h Then
                $s=Int(($GuiPos[2]-$w)/4)
            Else
                $s=Int(($GuiPos[3]-$h)/4)
            EndIf
            If $s < 31 Then $s = 31
            WinMove($Gui, "", $GuiPos[0], $GuiPos[1], $s*4+$w, $s*4+$h)
            For $i = 1 to 16
                $aXY[$i][2]=$aXY[$i][2]/$t*$s
                $aXY[$i][3]=$aXY[$i][3]/$t*$s
                GUICtrlSetPos($aXY[$i][1], $aXY[$i][2],$aXY[$i][3],$s,$s)
                GUICtrlSetFont ($aXY[$i][1],Int($s/2.7), 700, 2)
            Next
                GUICtrlSetPos($restart, 0,$s*4,$s*2, 20)
                GUICtrlSetPos($refresh, $s*2,$s*4,$s*2, 20)
        EndIf
    EndIf
#EndRegion

    For $i = 1 to 15
        If $msg = $aXY[$i][1] Then
            If ($aXY[$i][2]=$aXY[16][2] And ($aXY[$i][3]=$aXY[16][3]+$s Or $aXY[$i][3]=$aXY[16][3]-$s)) Or ($aXY[$i][3]=$aXY[16][3] And ($aXY[$i][2]=$aXY[16][2]+$s Or $aXY[$i][2]=$aXY[16][2]-$s)) Then _reButton($i)
            
; displacement on 2-3 buttons.

            ;from below upwards
            If $aXY[$i][2]=$aXY[16][2] And $aXY[$i][3]=$aXY[16][3]+$s*2 Then
                _reArr(0,1)
                _reArr(0,1)
                ExitLoop
            EndIf
            
            If $aXY[$i][2]=$aXY[16][2] And $aXY[$i][3]=$aXY[16][3]+$s*3 Then
                _reArr(0,1)
                _reArr(0,1)
                _reArr(0,1)
                ExitLoop
            EndIf
            
            ;from top to bottom
            If $aXY[$i][2]=$aXY[16][2] And $aXY[$i][3]=$aXY[16][3]-$s*2 Then
                _reArr(0,-1)
                _reArr(0,-1)
                ExitLoop
            EndIf
            
            If $aXY[$i][2]=$aXY[16][2] And $aXY[$i][3]=$aXY[16][3]-$s*3 Then
                _reArr(0,-1)
                _reArr(0,-1)
                _reArr(0,-1)
                ExitLoop
            EndIf
            
            ; right to left
            If $aXY[$i][2]=$aXY[16][2]+$s*2 And $aXY[$i][3]=$aXY[16][3] Then
                _reArr(1,0)
                _reArr(1,0)
                ExitLoop
            EndIf
            
            If $aXY[$i][2]=$aXY[16][2]+$s*3 And $aXY[$i][3]=$aXY[16][3] Then
                _reArr(1,0)
                _reArr(1,0)
                _reArr(1,0)
                ExitLoop
            EndIf
            
            ; left to right
            If $aXY[$i][2]=$aXY[16][2]-$s*2 And $aXY[$i][3]=$aXY[16][3] Then
                _reArr(-1,0)
                _reArr(-1,0)
                ExitLoop
            EndIf
            
            If $aXY[$i][2]=$aXY[16][2]-$s*3 And $aXY[$i][3]=$aXY[16][3] Then
                _reArr(-1,0)
                _reArr(-1,0)
                _reArr(-1,0)
                ExitLoop
            EndIf

        EndIf
    Next
    
    
    Select
        Case $msg = $refresh
            _refresh()
        Case $msg = $restart
            _About()
        Case $msg = -3
            ExitLoop
    EndSelect
WEnd

; we change places a button with paleholder by rand in 4-h directions
Func _refresh()
    For $u = 1 to 500
    ;Sleep(100)
Switch Random(1,4,1)
    Case 1
        For $i = 1 to 16
            If $aXY[$i][2]=$aXY[16][2]+$s And $aXY[$i][3]=$aXY[16][3] Then _reButton($i)
        Next
    Case 2
        For $i = 1 to 16
            If $aXY[$i][2]=$aXY[16][2]-$s And $aXY[$i][3]=$aXY[16][3] Then _reButton($i)
        Next
    Case 3
        For $i = 1 to 16
            If $aXY[$i][2]=$aXY[16][2] And $aXY[$i][3]=$aXY[16][3]+$s Then _reButton($i)
        Next
    Case 4
        For $i = 1 to 16
            If $aXY[$i][2]=$aXY[16][2] And $aXY[$i][3]=$aXY[16][3]-$s Then _reButton($i)
        Next
EndSwitch
Next
EndFunc

; displacement on 2-3 buttons.
Func _reArr($o,$u)
    For $i = 1 to 16
        If $aXY[$i][2]=$aXY[16][2]+$s*$o And $aXY[$i][3]=$aXY[16][3]+$s*$u Then
            _reButton($i)
            Return
        EndIf
    Next
EndFunc

; we change places a button with paleholder
Func _reButton($i)
    GUICtrlSetPos($aXY[$i][1], $aXY[16][2],$aXY[16][3])
    $tmp2=$aXY[$i][2]
    $tmp3=$aXY[$i][3]
    $aXY[$i][2]=$aXY[16][2]
    $aXY[$i][3]=$aXY[16][3]
    $aXY[16][2]=$tmp2
    $aXY[16][3]=$tmp3
EndFunc

Func _About()
$GuiPos = WinGetPos($Gui)
GUISetState(@SW_HIDE, $Gui)
$font="Arial"
$Gui1 = GUICreate($LngAbout, 210, 180,$GuiPos[0], $GuiPos[1], -1, 0x00000080)
    GUISetBkColor (0xf8c848)
    GUICtrlCreateLabel($LngTitle, 0, 20, 210, 23, 0x01)
    GUICtrlSetFont (-1,15, 600, -1, $font)
    GUICtrlSetColor(-1,0xa21a10)
    GUISetFont (9, 600, -1, $font)
    GUICtrlCreateLabel('12.07.2010', 0, 59, 210, 46, 0x01)
    GUICtrlCreateLabel($LngSite&':', 15, 115, 40, 17)
    $url=GUICtrlCreateLabel('http://azjio.ucoz.ru', 52, 115, 170, 17)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x0000ff)
    GUICtrlCreateLabel('WebMoney: R939163939152', 15, 130, 195, 17)
    GUICtrlCreateLabel('Copyright AZJIO © 2010', 15, 145, 195, 17)
    GUISetState(@SW_SHOW, $Gui1)
$msg = $Gui1
    While 1
     $msg = GUIGetMsg()
     Select
        Case $msg = $url
            ShellExecute ('http://azjio.ucoz.ru')
        Case $msg = -3
            $msg = $Gui
            GUIDelete($Gui1)
            GUISetState(@SW_SHOW, $Gui)
            ExitLoop
        EndSelect
WEnd
EndFunc
Автор: KiLL
Дата сообщения: 12.07.2010 22:42
Друзья, подскажите, а реально ли такое на AutoIt написать вообще?

Есть объект InternetExplorer или WebBrowser, у него есть событие FileDownload, которое срабатывает в случае скачивания какого-либо файла (появляется окно).

Проблем скачать файл нету, когда известен линк. А когда линка нету? Например как при скачивании аттачей на gmail, вроде имя файла в аттаче одно. А при клике на Scan and Download выпадает совсем другое.

Именно в этом случае хотелось бы отработать FileDownload, отменить само окно (событие позволяет), перехватить ссылку и скачать файл. Примерно так работают плагины менеджеров закачек. Участие пользователя или клики по контролам для меня не подходят, я делаю полную автоматизацию.

На VB это выглядит примерно так:

Global IE As InternetExplorer
'---------------------------------
Sub Download()
...
IE.Navigate(...)
...
End Sub
'---------------------------------
Sub FileDownloadEvent() Handles IE.FileDownload
...
End Sub

Попытки сделать что-то вроде IE.Silent ни к чему не приводят.

Итого встал вопрос, а реально ли написать такую обработку события на AutoIt?

Параллельно здесь.
Автор: Trrrbit
Дата сообщения: 13.07.2010 02:45

Цитата:
Программа просто закрывает эти окошки, ведет подсчет закрытых окошек мастера. Когда количество закрытых окон мастера сходится с количество неизвестных устройств в диспетчере задач


Проверял один раз но наткнулся на следующее:
Когда появляется мастер установки нового оборудования, то просит нажать ДАЛЕЕ для автоматического поиска драйвера. С этим скрипт справляется без проблем. (ЗА ЭТО СПАСИБО), но:
когда система сама находит, скажем, CMOS и часы она предлагает нажать ГОТОВО, а не ДАЛЕЕЕ. Вот тут я и получил из динамика системного блока ругательства, типа запала какая-нить клавиша. Благо клавиатура таки работала.... Завершил скрипт.
Это баг? или единичный случай? Или может скрипт реагирует только на активное окно и начал ругаться из-за нажатого сочетания Alt+Tab? Можно ли его заставить нажимать еще и кнопку ГОТОВО, когода это нужно?
Автор: KiLL
Дата сообщения: 13.07.2010 09:54
Trrrbit, странно....

У меня система тоже находит и CMOS и часы, и описанной ситуации не происходит. Но я не использую сборки (Zver, WPI, Xtreme и т.п.). Для установки драйверов без шума и пыли они должны быть подписаны (сертификатами). Для пущей стабильности у меня в системе нету сторонних драйверов вообще. Только Windows XP SP3. А у вам похоже что-то где-то изменено.

По теме ветки. Я делаю полную автоматизацию, направленную на максимально быстрое развертывание. Т.е. тестирование написанного проходит за чашкой кофе и втыкание в монитор, никакого внешнего воздействия не оказываю.
Автор: madmasles
Дата сообщения: 13.07.2010 11:16
KiLL
Попробуйте так:
Код: #include <IE.au3>

$sUrlDownload = ''
$sFileName = ''
$iByte = 0
$oIE = _IECreate('http://rghost.ru/2059767/private/457a05107272aea8e6ed3025e3f57ea3', 0, 0)
$oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
If StringInStr($oLink.title, 'Скачать') <> 0 Then
$sUrlDownload = $oLink.href
$sFileName = StringStripWS(StringReplace($oLink.title, 'Скачать', ''), 8)
_IEQuit($oIE)
ExitLoop
EndIf
Next
$iByte = InetGetSize($sUrlDownload)
MsgBox(0, '', $sUrlDownload & @CRLF & $sFileName & @CRLF & $iByte & ' b.')
$timeout = TimerInit()
ProgressOn('Progress Download', 'Download: ' & $sFileName, '0 b.')
$hDownload = InetGet($sUrlDownload, @ScriptDir & "\" & $sFileName, 1, 1)
Do
Sleep(20)
$aData = InetGetInfo($hDownload, -1)
If $aData[1] > 0 Then
ProgressSet($aData[0] / $aData[1] * 100, $aData[0] & ' b.')
EndIf
Until InetGetInfo($hDownload, 2)
If $aData[0] = $aData[1] And $aData[1] = $iByte Then
ProgressSet(100, 'Success!')
Sleep(3000)
ProgressOff()
Else
ProgressSet(100, 'Error!')
Sleep(3000)
ProgressOff()
EndIf
Автор: KiLL
Дата сообщения: 13.07.2010 12:26
madmasles, пробовал InetGet - не получается, отдает html-страницу.

Вообще у меня пишется попытка получить прайс из личного кабинета одной конторы. И если в вашем примере под кнопкой есть ссылка, которую можно скачать, то у меня есть ссылка, которая через InetGet отдает html. Я попробовал обработку событий в IE. Но как-то пока не получается, всеравно окошко выскакивает. Чего-то я не понимаю.

;here goes download IE event handling
$oEvents = ObjEvent($oIE,"IEEvent_","DWebBrowserEvents2")
_IENavigate($oIE,$sURL,0)

Sleep(20000)

Exit

Func IEEvent_FileDownload ($ActiveDocument ,$Cancel)
$Cancel = True
InetGet($sPriceURL,"D:\1.zip",0,1)
EndFunc

Func IEEvent_BeforeNavigate($pDisp,$NavigateURL,$Flags,$TargetFrameName,$PostData,$Headers,$Cancel)
$Cancel = True
$sPriceURL = $NavigateURL
EndFunc
Автор: madmasles
Дата сообщения: 13.07.2010 12:33
KiLL
Вы бы тогда пример страницы привели. Не личный кабинет конторы, а что-нибудь похожее в открытом доступе.

Попробуйте открыть Вашу страницу в IE и посмотреть все ссылки так:
Код: #include <IE.au3>

$i = 0
$oIE = _IEAttach('[Class:IEFrame]', 'embedded')
$oLinks = _IELinkGetCollection($oIE)
$iNumLinks = @extended
MsgBox(0, 'Link Info', $iNumLinks & ' links found')
For $oLink In $oLinks
$i += 1
MsgBox(0, 'Link № ' & $i, $oLink.title & @CRLF & $oLink.innertext & @CRLF & $oLink.href)
Next
Автор: KiLL
Дата сообщения: 13.07.2010 15:49
madmasles, думаю с Gmail будет что-то подобное. Вечером проверю.
Автор: DiaBlo90
Дата сообщения: 13.07.2010 18:46
Ребят, подскажите в чем косяк, почему при нажатии esc скрипт закрывается? И как от этого можно избавиться

Хот кеи на esc не ставил.
Автор: AZJIO
Дата сообщения: 13.07.2010 20:51
Обновил справку UDFs3.chm (2Мб), ещё 36 страниц, всего 70. Всё теже функции _GUICtrlListView_. Или только переведённые страницы (30кб)
Автор: ViSiToR
Дата сообщения: 13.07.2010 21:29
DiaBlo90 19:46 13-07-2010
Цитата:
почему при нажатии esc скрипт закрывается?

Это задаётся опцией «GUICloseOnESC».


Код: [no]Opt("GUICloseOnESC", 0)[/no]
Автор: AZJIO
Дата сообщения: 15.07.2010 00:28
[more=Калькулятор]
Код: #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_OutFile=Calculator.exe
#AutoIt3Wrapper_icon=Calculator.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=-
#AutoIt3Wrapper_Res_Description=Calculator.exe
#AutoIt3Wrapper_Res_Fileversion=0.6.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=n
#AutoIt3Wrapper_Res_LegalCopyright=AZJIO
#AutoIt3Wrapper_Res_Language=1049
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; @AZJIO 29.07.2010 (AutoIt3_v3.2.12.1+)
#NoTrayIcon
#include <BigNum.au3>
Opt("GUIResizeMode", 0x0322)
Global $aN[10], $MG='', $Oper='', $MS0='', $trOper=0, $RES='', $trRavno=0, $aM[10][3], $aCalcini, $Mtmp, $LngFile='', $BaseFile='', $MGST=''
Global $Ini=@ScriptDir&'\Calc.ini'
$tablo0=''
$s0=''
$HoldCh=0

; En
$LngTitle='CalculatorMR'
$LngRet='Return'
$LngErr='Error'
$LngAbout='About'
$LngVer='Version'
$LngSite='Site'
$LngHK='HotKey'
$LngHKMsg= 'Number = Number'&@CRLF&@CRLF&'"=" - Space, Enter'&@CRLF&'"/" - Shift+(, \'&@CRLF&'"5 function" - Shift+1...Shift+5'&@CRLF&'"Add in extended memory" - Ctrl+1...Ctrl+9'&@CRLF&'"Return from extended memory" - Alt+1...Alt+9'&@CRLF&'"Unfold/roll up panel" - End'&@CRLF&'"MS" - Up'&@CRLF&'"MR" - Down'&@CRLF&'"M+" - PageUp'&@CRLF&'"+/-" - PageDown'&@CRLF&'"CE" - Ctrl+Delete'&@CRLF&'"BS" - Ctrl+Backspace'&@CRLF&'"RE" - Pause'
$LngL='Read memory'
$LngRest='"Restart CalculatorMR"'
$LngMS='Add in memory'&@CRLF&'"Up"'
$LngMR='Return from memory'&@CRLF&'"Down"'
$LngMP='Add to memories'&@CRLF&'PageUp'
$LngCE='Clean'&@CRLF&'Ctrl+Delete'
$LngBS='Take away numeral on the right'&@CRLF&'Ctrl+BackSpace'
$LngRE='Return the previous number'&@CRLF&'Pause Break'
$LngEX='Extended memory'&@CRLF&'End'
$LngDelit='Divide'&@CRLF&'Shift+('
$LngYmno='Multiply'
$LngMinus='Subtract'
$LngPlus='Add'
$LngRavno='Calculate'&@CRLF&'Enter, Space'
$LngPT='Point'
$LngPM='Change sign'&@CRLF&'PageDown'
$LngAMEx='Add in cell'
$LngRMEx='Return from cell'
$LngSave= 'Save cells. When Exit'&@CRLF&'is saved automatically'
$LngDX='Reciprocal'&@CRLF&'Shift+1'
$LngX2='in square'&@CRLF&'Shift+2'
$LngXY='Exponentiate'&@CRLF&'Shift+3'
$LngKoren='Square root'&@CRLF&'Shift+4'
$LngPI='pi - 3,14'&@CRLF&'Shift+5'
$LngSl='Choose file'
$LngType='To choose a language file'
$LngNum='File of numbers'
$LngOpConf='Open file a cell to memories'
$LngCl='Clean all cells'
$LngInvF='Invalid format of the file'
$LngCrIni='Create'
$LngHold='Hold'


If FileExists($Ini) Then
    $file = FileOpen($Ini, 0)
    $Calcini = FileRead($file)
    FileClose($file)
    ;==============================
    ;UDF File.au3
    If StringInStr($Calcini, @LF) Then
        $aCalcini = StringSplit(StringStripCR($Calcini), @LF)
    ElseIf StringInStr($Calcini, @CR) Then
        $aCalcini = StringSplit($Calcini, @CR)
    Else
        If StringLen($Calcini) Then
            Dim $aCalcini[2] = [1, $Calcini]
        Else
            MsgBox(0, $LngErr, "Error Calc.ini")
        EndIf
    EndIf
Else
    Dim $aCalcini[11]=['','position*-1*-1*0**','','','','','','','','','']
EndIf

$aPos=StringSplit($aCalcini[1], '*')
If $aPos[4] = 1 Then
    $PosW=275+235
    $Chr='0x25C4'
Else
    $PosW=275
    $Chr='0x25BA'
EndIf

$Gui = GUICreate($LngTitle, $PosW, 208, $aPos[2], $aPos[3])

$About = GUICtrlCreateButton("@", 217, 2, 18, 20)
GUICtrlSetTip(-1, $LngAbout)

$HotKey = GUICtrlCreateButton("?", 237, 2, 18, 20)
GUICtrlSetTip(-1, $LngHK)

$restart = GUICtrlCreateButton("R", 257, 2, 18, 20)
GUICtrlSetTip(-1, $LngRest)

$LRE = GUICtrlCreateLabel('', 15, 6, 203, 12,0xC)
GUICtrlSetColor (-1, 0x999999)
$MT = GUICtrlCreateLabel('', 17, 21, 203, 12,0xC)
GUICtrlSetColor (-1, 0x999999)
$Err = GUICtrlCreateLabel('', 220, 21, 35, 12,0xC)
GUICtrlSetColor (-1, 0xff0000)
GUICtrlSetFont (-1,8.5, 700)
$FileN= GUICtrlCreateLabel('Calc', 325, 3, 175, 15,0xC)
$tablo = GUICtrlCreateInput("", 13, 34, 245, 25,0x0002)
GUICtrlSetFont (-1,15, 400)
$LOper = GUICtrlCreateLabel('', 260, 34, 16, 25)
GUICtrlSetFont (-1,15, 400)

GUISetFont (15, 400)
$aN[0] = GUICtrlCreateButton("0", 70, 171, 30, 29)
;_bc()
$l=0
$v =0
For $i = 1 to 9
If $l > 60 Then
$l = 0
$v -= 29
EndIf
    $aN[$i] = GUICtrlCreateButton($i, 70+$l, 142+$v, 30, 29)
$l += 30
    ;_bc()
Next

$PM = GUICtrlCreateButton("+/-", 101, 171, 30, 29)
GUICtrlSetBkColor (-1, 0 )
GUICtrlSetColor (-1, 0xffffff)
GUICtrlSetFont (-1,12, 400)
GUICtrlSetTip(-1, $LngPM)
$PT = GUICtrlCreateButton(".", 131, 171, 30, 29)
GUICtrlSetTip(-1, $LngPT)
_bc()

$Divide = GUICtrlCreateButton("/", 165, 85, 25, 25)
GUICtrlSetTip(-1, $LngDelit)
_bc2()
$Multiply = GUICtrlCreateButton("*", 165, 115, 25, 25)
GUICtrlSetTip(-1,$LngYmno)
_bc2()
$minus = GUICtrlCreateButton("-", 165, 145, 25, 25)
GUICtrlSetTip(-1, $LngMinus)
_bc2()
$plus = GUICtrlCreateButton("+", 165, 175, 25, 25)
GUICtrlSetTip(-1, $LngPlus)
_bc2()
$ravno = GUICtrlCreateButton("=", 195, 175, 25, 25)
GUICtrlSetTip(-1, $LngRavno)
_bc2()

GUISetFont (9, 700)
$MS = GUICtrlCreateButton("MS", 195, 85, 25, 25)
GUICtrlSetTip(-1, $LngMS)
GUICtrlSetBkColor (-1, 0xffffff )
GUICtrlSetColor (-1, 0xff0000)
$MR = GUICtrlCreateButton("MR", 195, 115, 25, 25)
GUICtrlSetTip(-1, $LngMR)
GUICtrlSetBkColor (-1, 0xffffff )
GUICtrlSetColor (-1, 0xff0000)
$MP = GUICtrlCreateButton("M+", 195, 145, 25, 25)
GUICtrlSetTip(-1, $LngMP)
GUICtrlSetBkColor (-1, 0xffffff )
GUICtrlSetColor (-1, 0xff0000)
$CE = GUICtrlCreateButton("CE", 225, 85, 25, 25)
GUICtrlSetTip(-1, $LngCE)
GUICtrlSetBkColor (-1, 0x00aa00)
GUICtrlSetColor (-1, 0xffffff)
$BS = GUICtrlCreateButton("BS", 225, 115, 25, 25)
GUICtrlSetTip(-1, $LngBS)
GUICtrlSetBkColor (-1, 0x00aa00)
GUICtrlSetColor (-1, 0xffffff)
$RE = GUICtrlCreateButton("RE", 225, 145, 25, 25)
GUICtrlSetTip(-1,$LngRE)
GUICtrlSetBkColor (-1, 0x00aa00)
GUICtrlSetColor (-1, 0xffffff)
$EX = GUICtrlCreateButton(ChrW($Chr) , 225, 175, 25, 25)
GUICtrlSetTip(-1, $LngEX)
GUICtrlSetFont (-1,-1, -1, -1, 'Arial')

GUISetFont (8.5, 400)
$OpenConf = GUICtrlCreateButton('Open', 470, 20, 34, 18)
GUICtrlSetTip(-1, $LngOpConf)
$Save = GUICtrlCreateButton('Save', 470, 40, 34, 18)
GUICtrlSetTip(-1, $LngSave)
$Hold = GUICtrlCreateButton('Hold', 470, 60, 34, 18)
GUICtrlSetTip(-1, $LngHold)
$OpenLng = GUICtrlCreateButton(' Lang', 470, 160, 34, 18)
GUICtrlSetTip(-1, $LngType)
$Clear = GUICtrlCreateButton(' Clear', 470, 180, 34, 18)
GUICtrlSetTip(-1, $LngCl)

$v =0
For $i = 1 to 9
    GUICtrlCreateLabel($i, 314, 23+$v, 17, 20)
    GUICtrlSetFont (-1,9, 700)
    $aM[$i][0] = GUICtrlCreateButton('>', 292, 20+$v, 17, 20)
    GUICtrlSetTip(-1, $LngAMEx&' '&$i&@CRLF&'Ctrl+'&$i)
GUICtrlSetBkColor (-1, 0xf01700)
GUICtrlSetColor (-1, 0xffffff)
GUICtrlSetFont (-1,11, 700)
    $aM[$i][1] = GUICtrlCreateButton('<', 275, 20+$v, 17, 20)
GUICtrlSetBkColor (-1, 0x00b300)
GUICtrlSetColor (-1, 0xffffff)
GUICtrlSetFont (-1,11, 700)
    GUICtrlSetTip(-1, $LngRMEx&' '&$i&@CRLF&'Alt+'&$i)
    $aM[$i][2] = GUICtrlCreateInput('', 325, 20+$v, 140, 21)
    If Mod($i,2) = 0 Then GUICtrlSetBkColor(-1,0xf3f3f3)
    GUICtrlSetData($aM[$i][2],$aCalcini[$i+1])
$v += 20
Next

GUISetFont (8.5, 700)
$dx = GUICtrlCreateButton("1/x", 10, 85, 28, 20)
GUICtrlSetTip(-1, $LngDX)
$x2 = GUICtrlCreateButton("x^2", 10, 105, 28, 20)
GUICtrlSetTip(-1, $LngX2)
$xy = GUICtrlCreateButton("x^y", 10, 125, 28, 20)
GUICtrlSetTip(-1, $LngXY)
$koren = GUICtrlCreateButton("V"&ChrW ('0x203E'), 10, 145, 28, 20)
GUICtrlSetFont (-1,-1, -1, -1, 'Arial')
GUICtrlSetTip(-1, $LngKoren)

; GUICtrlCreateGroup ("", 13, 53, 56, 25)
; $pi = GUICtrlCreateLabel("pi", 17, 61, 12, 14)
; GUICtrlSetTip(-1, $LngPI)
; $rad = GUICtrlCreateLabel("rad", 33, 61, 17, 14)
; $e= GUICtrlCreateLabel("e", 56, 61, 9, 14)
$pi = GUICtrlCreateButton("pi", 10, 165, 28, 20)
GUICtrlSetTip(-1, $LngPI)

If $aPos[6]<>'' And FileExists($aPos[6]) Then _OpenLng($aPos[6])
If $aPos[5]<>'' And FileExists($aPos[5]) Then _OpenConf($aPos[5])

Dim $AccelKeys[65][2]=[["1", $aN[1]], ["2", $aN[2]], ["3", $aN[3]], ["4", $aN[4]], ["5", $aN[5]], ["6", $aN[6]], ["7", $aN[7]], ["8", $aN[8]], ["9", $aN[9]], ["0", $aN[0]], ["{NUMPAD1}", $aN[1]], _
["{NUMPAD2}", $aN[2]], ["{NUMPAD3}", $aN[3]], ["{NUMPAD4}", $aN[4]], ["{NUMPAD5}", $aN[5]], ["{NUMPAD6}", $aN[6]], ["{NUMPAD7}", $aN[7]], ["{NUMPAD8}", $aN[8]], ["{NUMPAD9}", $aN[9]], ["{NUMPAD0}", $aN[0]], ["{NUMPADDIV}", _
$Divide], ["+{(}", $Divide], ["{\}", $Divide], ["{NUMPADMULT}", $Multiply], ["+{8}", $Multiply], ["{NUMPADSUB}", $minus], ["{-}", $minus], ["{NUMPADADD}", $plus], ["+{=}", $plus], ["{SPACE}", $ravno], ["{=}", $ravno], ["{Enter}", $ravno], _
["{UP}", $MS], ["{DOWN}", $MR], ["^{DEL}", $CE], ["{NUMPADDOT}", $PT], ["{.}", $PT], ["{PGDN}", $PM], ["{PGUP}", $MP], ["^{BS}", $BS], ["{PAUSE}", $RE], ["{END}", $EX], _
["+{1}", $dx], ["+{2}", $x2], ["+{3}", $xy], ["+{4}", $koren], ["+{5}", $pi], _
["^{1}", $aM[1][0]], ["^{2}", $aM[2][0]], ["^{3}", $aM[3][0]], ["^{4}", $aM[4][0]], ["^{5}", $aM[5][0]], ["^{6}", $aM[6][0]], ["^{7}", $aM[7][0]], ["^{8}", $aM[8][0]], ["^{9}", $aM[9][0]], _
["!{1}", $aM[1][1]], ["!{2}", $aM[2][1]], ["!{3}", $aM[3][1]], ["!{4}", $aM[4][1]], ["!{5}", $aM[5][1]], ["!{6}", $aM[6][1]], ["!{7}", $aM[7][1]], ["!{8}", $aM[8][1]], ["!{9}", $aM[9][1]]]

Dim $AccelKeys1[65][2]=[["+{1}", $dx], ["+{2}", $x2], ["+{3}", $xy], ["+{4}", $koren], ["+{5}", $pi]] ; для кнопки Hold

GUISetAccelerators($AccelKeys)
If $aPos[2]= '-1' Then _Save()
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    For $i = 1 to 9
        If $msg = $aM[$i][0] Then
            If $HoldCh=1 Then ContinueLoop
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0<>'' Then
                GUICtrlSetColor ($Mtmp, 0x000000)
                GUICtrlSetData($aM[$i][2],$tablo0)
                GUICtrlSetColor ($aM[$i][2], 0xee0000)
                $Mtmp=$aM[$i][2]
            EndIf
        EndIf
    Next
    For $i = 1 to 9
        If $msg = $aM[$i][1] Then
            $tablo0=GUICtrlRead ($aM[$i][2])
            If $tablo0<>'' Then GUICtrlSetData($tablo,$tablo0)
        EndIf
    Next
    
    For $i = 0 to 9
        If $msg = $aN[$i] Then
        GUICtrlSetData($Err,'')
        $tablo0=GUICtrlRead ($tablo)
        If $i = 0 And ($tablo0='' Or $trOper=1 Or $trRavno=1) Then
            $s0='.'
        Else
            $s0=''
        EndIf
            If $trRavno=1 or $trOper=1 Then
                GUICtrlSetData($tablo,$i&$s0)
                $trRavno=0
                $trOper=0
                If GUICtrlRead ($LOper)='=' Then GUICtrlSetData($LOper,'')
            Else
                GUICtrlSetData($tablo,$tablo0&$i&$s0)
            EndIf
        EndIf
    Next
    Select
        Case $msg = $About
            _About()
        Case $msg = $HotKey
            MsgBox(0, $LngHK, $LngHKMsg)
        Case $msg = $Save
            _Save()
        Case $msg = $OpenLng
            $tmp = FileOpenDialog($LngSl, @WorkingDir, $LngType&" (*.lng)", 1, "", $Gui)
            If @error Then ContinueLoop
            _OpenLng($tmp)
        Case $msg = $OpenConf
            $tmp = FileOpenDialog($LngSl, @WorkingDir, $LngNum&" (*.ini)", "", "", $Gui)
            If @error Then ContinueLoop
            If StringRight($tmp, 4)<>'.ini' Then $tmp&='.ini'
            _OpenConf($tmp)
        Case $msg = $Clear
            If $HoldCh=1 Then ContinueLoop
            For $i = 1 to 9
                GUICtrlSetData($aM[$i][2],'')
            Next
        Case $msg = $Divide
            If GUICtrlRead ($LOper)='/' And Not($trRavno=1 or $trOper=1) Then _ravno()
            If GUICtrlRead ($tablo)<>'' Then
                GUICtrlSetData($LOper,'/')
                _Oper()
                $Oper=1
            EndIf
        Case $msg = $Multiply
            If GUICtrlRead ($LOper)='*' And Not($trRavno=1 or $trOper=1) Then _ravno()
            If GUICtrlRead ($tablo)<>'' Then
                GUICtrlSetData($LOper,'*')
                _Oper()
                $Oper=2
            EndIf
        Case $msg = $minus
            If GUICtrlRead ($LOper)='-' And Not($trRavno=1 or $trOper=1) Then _ravno()
            If GUICtrlRead ($tablo)<>'' Then
                GUICtrlSetData($LOper,'-')
                _Oper()
                $Oper=3
            EndIf
        Case $msg = $plus
            If GUICtrlRead ($LOper)='+' And Not($trRavno=1 or $trOper=1) Then _ravno()
            If GUICtrlRead ($tablo)<>'' Then
                GUICtrlSetData($LOper,'+')
                _Oper()
                $Oper=4
            EndIf
        Case $msg = $Hold
            If $HoldCh = 0 Then
                $HoldCh=1
                For $i = 1 to 9
                    GUICtrlSetState($aM[$i][0],128)
                    GUICtrlSetBkColor ($aM[$i][0], 0xbbbbbb)
                    GUICtrlSetStyle ($aM[$i][2],0x0800)
                    If Mod($i,2) = 0 Then
                        GUICtrlSetBkColor($aM[$i][2],0xfffbd7)
                    Else
                        GUICtrlSetBkColor($aM[$i][2],0xffffee)
                    EndIf
                Next
                GUISetAccelerators($AccelKeys1)
            Else
                $HoldCh=0
                For $i = 1 to 9
                    GUICtrlSetState($aM[$i][0],64)
                    GUICtrlSetBkColor ($aM[$i][0], 0xf01700)
                    GUICtrlSetStyle ($aM[$i][2],0)
                    If Mod($i,2) = 0 Then
                        GUICtrlSetBkColor($aM[$i][2],0xf3f3f3)
                    Else
                        GUICtrlSetBkColor($aM[$i][2],0xffffff)
                    EndIf
                Next
                GUISetAccelerators($AccelKeys)
            EndIf
        Case $msg = $ravno
            _ravno()
        Case $msg = $MS
            $MS0T=GUICtrlRead ($tablo)
            If $MS0T <>'' Then
                $MS0=$MS0T
                GUICtrlSetTip($MR, $LngL&' ' &$MS0)
                ;GUICtrlSetBkColor ($MS, 0xddffdd )
                GUICtrlSetData($MT,'M='&$MS0)
                _mig(0xffaaaa)
            EndIf
        Case $msg = $MR
            If $MS0 <>'' Then
                GUICtrlSetData($tablo,$MS0)
                _mig(0xaaffaa)
            EndIf
        Case $msg = $MP
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0 <>'' Then
                $MS0+=$tablo0
                GUICtrlSetTip($MR, $LngL&' ' &$MS0)
                GUICtrlSetData($MT,'M='&$MS0)
                _mig(0xaaaaff)
            EndIf
        Case $msg = $CE
            GUICtrlSetData($Err,'')
            GUICtrlSetData($tablo,'')
            GUICtrlSetData($LOper,'')
            $trRavno=1
        Case $msg = $BS
            $tablo0=GUICtrlRead ($tablo)
            GUICtrlSetData($tablo,StringTrimRight ($tablo0, 1 ))
        Case $msg = $RE
            GUICtrlSetData($tablo,$RES)
        Case $msg = $EX
            $GuiPos = WinGetPos($Gui)
            If $GuiPos[2] > 250 And $GuiPos[2] < 300 Then
                WinMove($Gui, "", $GuiPos[0], $GuiPos[1], $GuiPos[2]+235, $GuiPos[3])
                GUICtrlSetData($EX,ChrW ('0x25C4'))
            Else
                WinMove($Gui, "", $GuiPos[0], $GuiPos[1], $GuiPos[2]-235, $GuiPos[3])
                GUICtrlSetData($EX,ChrW ('0x25BA'))
            EndIf

        Case $msg = $PM
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0='' Then ContinueLoop
            If StringLeft($tablo0, 1 )='-' Then
                $tablo0=StringTrimLeft($tablo0, 1 )
            Else
                $tablo0='-'&$tablo0
            EndIf
            GUICtrlSetData($tablo,$tablo0)
        Case $msg = $PT
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0<>'' Then
                If $trRavno=1 Or $trOper=1 Then
                    GUICtrlSetData($tablo,'0.')
                    $trOper=0
                    $trRavno=0
                Else
                    If StringInStr($tablo0, '.')>0 Then ContinueLoop
                    GUICtrlSetData($tablo,$tablo0&'.')
                EndIf
            Else
                GUICtrlSetData($tablo,'0.')
                $trRavno=0
            EndIf
        Case $msg = $dx
            GUICtrlSetData($Err,'')
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0='' Then ContinueLoop
            If $tablo0=0 Then
                _err()
                ContinueLoop
            EndIf
            GUICtrlSetData($tablo,1/$tablo0)
            $trRavno=1
            _re($tablo0)
        Case $msg = $x2
            GUICtrlSetData($Err,'')
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0='' Then ContinueLoop
            GUICtrlSetData($tablo,Execute($tablo0)^2)
            $trRavno=1
            _re($tablo0)
        Case $msg = $xy
            GUICtrlSetData($Err,'')
            If GUICtrlRead ($tablo)='' Then ContinueLoop
                GUICtrlSetData($LOper,'^')
                _Oper()
                $Oper=5
        Case $msg = $koren
            GUICtrlSetData($Err,'')
            $tablo0=GUICtrlRead ($tablo)
            If $tablo0='' Then ContinueLoop
            If $tablo0<0 Then
                _err()
                ContinueLoop
            EndIf
            GUICtrlSetData($tablo,Sqrt($tablo0))
            $trRavno=1
            _re($tablo0)
        Case $msg = $pi
            GUICtrlSetData($Err,'')
            GUICtrlSetData($tablo,'3.141592653589793')
            $trRavno=1
            If GUICtrlRead ($tablo0)<>'' Then _re($tablo0)
        Case $msg = $restart
            _restart()
        Case $msg = -3
            _Save()
            Exit
    EndSelect
WEnd

Func _OpenLng($Path)
    $aLng = IniReadSection($Path, 'lng')
    If @error Then
        $LngFile=''
        Return
    Else
        For $i = 1 To $aLng[0][0]
            If StringInStr($aLng[$i][1], '\r\n') <>0 Then $aLng[$i][1]=StringReplace($aLng[$i][1],'\r\n',@CRLF)
            Assign($aLng[$i][0],$aLng[$i][1])
        Next
        $LngFile=$Path
        GUICtrlSetTip($About, $LngAbout)
        GUICtrlSetTip($HotKey, $LngHK)
        GUICtrlSetTip($restart, $LngRest)
        GUICtrlSetTip($Divide, $LngDelit)
        GUICtrlSetTip($Multiply,$LngYmno)
        GUICtrlSetTip($minus, $LngMinus)
        GUICtrlSetTip($plus, $LngPlus)
        GUICtrlSetTip($ravno, $LngRavno)
        GUICtrlSetTip($MS, $LngMS)
        GUICtrlSetTip($MR, $LngMR)
        GUICtrlSetTip($MP, $LngMP)
        GUICtrlSetTip($CE, $LngCE)
        GUICtrlSetTip($BS, $LngBS)
        GUICtrlSetTip($RE,$LngRE)
        GUICtrlSetTip($EX, $LngEX)
        GUICtrlSetTip($Save, $LngSave)
        GUICtrlSetTip($dx, $LngDX)
        GUICtrlSetTip($x2, $LngX2)
        GUICtrlSetTip($xy, $LngXY)
        GUICtrlSetTip($koren, $LngKoren)
        GUICtrlSetTip($pi, $LngPI)
        GUICtrlSetTip($OpenLng, $LngType)
        GUICtrlSetTip($Hold, $LngHold)
        GUICtrlSetTip($Clear , $LngCl)
        GUICtrlSetTip($OpenConf , $LngOpConf)
        For $i = 1 to 9
            GUICtrlSetTip($aM[$i][0], $LngAMEx&' '&$i&@CRLF&'Ctrl+'&$i)
            GUICtrlSetTip($aM[$i][1] , $LngRMEx&' '&$i&@CRLF&'Alt+'&$i)
        Next
    EndIf
EndFunc

Func _ravno()
    $tablo0=GUICtrlRead ($tablo)
    $tablo0Tmp=$tablo0
    If $tablo0<>'' Then
        If StringInStr($tablo0, ',') Then $tablo0=StringReplace($tablo0, ',' , '.')
        If StringInStr($MG, ',') Then $MG=StringReplace($MG, ',' , '.')
        
        If StringInStr($tablo0, 'e+') Then $tablo0=_ConvNumP($tablo0)
        If StringInStr($MG, 'e+') Then $MG=_ConvNumP($MG)

        If StringInStr($tablo0, 'e-') Then $tablo0=_ConvNumM($tablo0)
        If StringInStr($MG, 'e-') Then $MG=_ConvNumM($MG)
        $rech=''
        Switch $Oper
            Case 1
                If GUICtrlRead ($LOper)<>'=' Then
                    $rech = _BigNum_Div($MG, $tablo0,'200')
                    $MGST=$tablo0
                Else
                    $rech = _BigNum_Div($tablo0, $MGST,'200')
                EndIf
            Case 2
             $rech = _BigNum_Mul($MG, $tablo0)
             If GUICtrlRead ($LOper)<>'=' Then $MG=$tablo0
            Case 3
                If GUICtrlRead ($LOper)<>'=' Then
                    $rech = _BigNum_Sub($MG, $tablo0)
                    $MGST=$tablo0
                Else
                    $rech = _BigNum_Sub($tablo0, $MGST)
                EndIf
             If GUICtrlRead ($LOper)<>'=' Then $MG=$tablo0
            Case 4
             $rech = _BigNum_Add($MG, $tablo0)
             If GUICtrlRead ($LOper)<>'=' Then $MG=$tablo0
            Case 5
                If GUICtrlRead ($LOper)<>'=' Then
                    $rech = $MG^$tablo0
                    $MGST=$tablo0
                Else
                    $rech = $tablo0^$MGST
                EndIf
            Case Else
             Return
        EndSwitch
        If StringInStr($rech, "1.#IN") Then
            _err()
            Return
        EndIf
; 1200 > 1.2e+003
        If StringLen($rech)>20 And Not(StringInStr($rech, 'e+') Or StringInStr($rech, 'e-')) Then
            If StringLen(Int($rech))>20 Then
                $exp=StringLen(Int($rech))-1
                If StringLen($exp)<3 Then $exp='0'&$exp
                If StringLen($exp)<3 Then $exp='0'&$exp
                $rech=StringMid($rech, 1, 1)&'.'&StringTrimLeft(StringTrimRight(Int($rech),5),1)&'e+'$exp
            Else
                If StringMid($rech, 1, 1)<>0 Then
                    $Npt = StringInStr($rech, '.')
                    $rech= Round($rech, 20-$Npt)
                Else
                    $aRech1=StringRegExp($rech, '(0\.)(0*)(\d+)',3)
                    $exp=StringLen($aRech1[1])+1
                    If StringLen($exp)<3 Then $exp='0'&$exp
                    If StringLen($exp)<3 Then $exp='0'&$exp
                    $rech=StringMid($aRech1[2], 1, 1)&'.'&StringTrimLeft($aRech1[2],1)
                    $rech= Round($rech, 15)&'e-'&$exp
                EndIf
            EndIf
        EndIf
; End 1200 > 1.2e+003
        If StringInStr($rech, "1.#IN") Then
            _err()
            Return
        EndIf
        GUICtrlSetData($tablo,$rech)
        GUICtrlSetData($LOper,'=')
        _re($tablo0Tmp)
    EndIf
    $trRavno=1
EndFunc

; 1.2e+003 > 1200
Func _ConvNumP($num)
    $exp='1'
        $aRech1=StringSplit($num, '+')
        For $i = 1 to Execute($aRech1[2])
            $exp&='0'
        Next
        $num = _BigNum_Mul(StringTrimRight($aRech1[1],1), $exp)
    Return $num
EndFunc

; 1.2e-003 > 0.0012
Func _ConvNumM($num)
    $exp='1'
        $aRech1=StringSplit($num, '-')
        For $i = 1 to $aRech1[2]
            $exp&='0'
        Next
        $num = _BigNum_Div(StringTrimRight($aRech1[1],1), $exp,'200')
    Return $num
EndFunc

Func _err()
    GUICtrlSetData($Err,' Error ')
    $trOper=1
    For $i = 1 to 4
        GUICtrlSetBkColor ($Err, 0xff0000 )
        GUICtrlSetColor ($Err, 0xffffff)
        Sleep(40)
        GUICtrlSetBkColor ($Err, -1 )
        GUICtrlSetColor ($Err, 0xff0000)
        Sleep(40)
    Next
EndFunc

Func _Save()
    $GuiPos = WinGetPos($Gui)
    If $GuiPos[2] > 250 And $GuiPos[2] < 300 Then
        $W=0
    Else
        $W=1
    EndIf
    $Save0=''
    $Save11=''
    $Save1=''
    If $BaseFile = $Ini Then $BaseFile =''
    If $GuiPos[0] < 0 Or $GuiPos[1]< 0 Then
        $GuiPos[0]=$aPos[2]
        $GuiPos[1]=$aPos[3]
    EndIf
    $Save0&='position*'&$GuiPos[0]&'*'&$GuiPos[1]&'*'&$W&'*'&$BaseFile&'*'&$LngFile&@CRLF
    For $i = 1 to 9
        $Save1&=GUICtrlRead ($aM[$i][2])&@CRLF
    Next
    If $BaseFile<>'' And FileExists($BaseFile) Then
        $file = FileOpen($BaseFile,2)
        FileWrite($file, $Save0&$Save1)
        FileClose($file)
    $file = FileOpen($Ini, 0)
    $Save11 = FileRead($file)
    FileClose($file)
    $Save11=StringRegExpReplace($Save11, '(?s)(.*?\r\n)(.*)', '\2')
        $file = FileOpen($Ini,2)
        FileWrite($file, $Save0&$Save11)
        FileClose($file)
    Else
        $file = FileOpen($Ini,2)
        FileWrite($file, $Save0&$Save1)
        FileClose($file)
    EndIf
EndFunc

Func _OpenConf($Path)
    $file = FileOpen($Path, 0)
    $Calcini = FileRead($file)
    FileClose($file)
    If Not(StringLeft($Calcini, 8)='position' or $Calcini='') Then
        MsgBox(0, $LngErr, $LngInvF)
        Return
    EndIf
    $aCalcini=''
    $filename=StringRegExpReplace($Path, '(^.*)\\(.*)\.(.*)$', '\2')
    ;==============================
    ;UDF File.au3
    If StringInStr($Calcini, @LF) Then
        $aCalcini = StringSplit(StringStripCR($Calcini), @LF)
    ElseIf StringInStr($Calcini, @CR) Then
        $aCalcini = StringSplit($Calcini, @CR)
    Else
        If StringLen($Calcini) Then
            Dim $aCalcini[2] = [1, $Calcini]
        Else
            If MsgBox(4, $LngErr, $LngCrIni&' '&$filename&'?')=6 Then
                $file = FileOpen($Path, 2+8)
                FileClose($file)
                $BaseFile=$Path
                _Save()
                _OpenConf($Path)
            EndIf
            Return
        EndIf
    EndIf
    GUICtrlSetColor ($Mtmp, 0x000000)
    For $i = 1 to 9
        GUICtrlSetData($aM[$i][2],$aCalcini[$i+1])
    Next
    $BaseFile=$Path
    GUICtrlSetData($FileN,$filename)
    GUICtrlSetTip($OpenConf, 'Current' &@CRLF&$filename&'.ini')
EndFunc

Func _mig($t)
    GUICtrlSetBkColor ($tablo, $t)
    Sleep(40)
    GUICtrlSetBkColor ($tablo, 0xffffff )
EndFunc

Func _re($t)
    $RES=$t
    GUICtrlSetTip($RE, $LngRet&' '&$RES)
    GUICtrlSetData($LRE,'RE='&$RES)
EndFunc

Func _bc()
    GUICtrlSetBkColor (-1, 0 )
    GUICtrlSetColor (-1, 0xffffff)
EndFunc

Func _bc2()
    GUICtrlSetBkColor (-1, 0x003C74)
    GUICtrlSetColor (-1, 0xffffff)
EndFunc

Func _Oper()
    $MG=GUICtrlRead ($tablo)
    _re($MG)
    $trOper=1
    ;GUICtrlSetData($tablo,'')
EndFunc

Func _restart()
    _Save()
    Local $sAutoIt_File = @TempDir & "\~Au3_ScriptRestart_TempFile.au3"
    Local $sRunLine, $sScript_Content, $hFile

    $sRunLine = @ScriptFullPath
    If Not @Compiled Then $sRunLine = @AutoItExe & ' /AutoIt3ExecuteScript ""' & $sRunLine & '""'
    If $CmdLine[0] > 0 Then $sRunLine &= ' ' & $CmdLineRaw

    $sScript_Content &= '#NoTrayIcon' & @CRLF & _
            'While ProcessExists(' & @AutoItPID & ')' & @CRLF & _
            ' Sleep(10)' & @CRLF & _
            'WEnd' & @CRLF & _
            'Run("' & $sRunLine & '")' & @CRLF & _
            'FileDelete(@ScriptFullPath)' & @CRLF

    $hFile = FileOpen($sAutoIt_File, 2)
    FileWrite($hFile, $sScript_Content)
    FileClose($hFile)

    Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $sAutoIt_File & '"', @ScriptDir, @SW_HIDE)
    Sleep(1000)
    Exit
EndFunc ;==>_restart

Func _About()
$GuiPos = WinGetPos($Gui)
GUISetState(@SW_HIDE, $Gui)
$font="Arial"
$Gui1 = GUICreate($LngAbout, 270, 180,$GuiPos[0], $GuiPos[1], -1, 0x00000080)
    GUISetBkColor (0xf8c848)
    GUICtrlCreateLabel($LngTitle, 0, 20, 270, 23, 0x01)
    GUICtrlSetFont (-1,15, 600, -1, $font)
    GUICtrlSetColor(-1,0xa21a10)
    GUISetFont (9, 600, -1, $font)
    GUICtrlCreateLabel($LngVer&' 0.6 29.07.2010', 55, 100, 210, 17)
    GUICtrlCreateLabel($LngSite&':', 55, 115, 40, 17)
    $url=GUICtrlCreateLabel('http://azjio.ucoz.ru', 92, 115, 170, 17)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x0000ff)
    GUICtrlCreateLabel('WebMoney: R939163939152', 55, 130, 210, 17)
    GUICtrlCreateLabel('Copyright AZJIO © 2010', 55, 145, 210, 17)
    GUISetState(@SW_SHOW, $Gui1)
$msg = $Gui1
    While 1
     $msg = GUIGetMsg()
     Select
        Case $msg = $url
            ShellExecute ('http://azjio.ucoz.ru')
        Case $msg = -3
            $msg = $Gui
            GUIDelete($Gui1)
            GUISetState(@SW_SHOW, $Gui)
            ExitLoop
        EndSelect
WEnd
EndFunc
Автор: emauzzo
Дата сообщения: 15.07.2010 06:11
Помогите пожалуйста наваять простенький скрипт. Что нужно:
мне часто приходится копипастить из word в autocad, но чтобы не сохранялось форматирование word. Раньше я делал это через стандартный блокнот, но это немного напрягает - много лишних движений. Вот и хотелось бы чтобы скопировал текст по ctrl+с нажал скрипт и он уже "очищен" от форматирования. Можно hotkey конечно сделать.
Сам я новичок вообще в программировании.


Код: Run ("notepad.exe")
WinWaitActive ("Безымянный - Блокнот")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","Вст&авить    Ctrl+V")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","Выделить в&се    Ctrl+A")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","&Копировать    Ctrl+C")
WinClose("Безымянный - Блокнот")
ControlClick("Блокнот","Текст в файле Безымянный был и","Button2")
Автор: ynbIpb
Дата сообщения: 15.07.2010 10:09
emauzzo, что-то типа этого?

Код: HotKeySet ( "{HOME}", "_text"); горячая клавиша HOME

While 1 ; бесконечный цикл
sleep(100)
WEnd

Func
_text() ; функция, выполняется при нажатии на кнопку HOME
$wordtext = ClipGet ( ) ; читаем текст из буфера обмена
If $wordtext = "" Then Return ; если в буфере пусто, то возвращаемся из функции
$wordtext = String ($wordtext) ; переобразовываем в строку
ClipPut ($wordtext); вставляем в буфер обмена
EndFunc
Автор: AZJIO
Дата сообщения: 15.07.2010 13:23
Обнаружил, что в скрипте "Калькулятор" использование стиля для кнопок цифр тормозит реакцию на событие нажатия. Другими словами двойной клик не вводит две цифры. Если отключить стили, то реакция увеличивается и двойной клик успевает ввести две цифры.
Автор: ViSiToR
Дата сообщения: 15.07.2010 14:01
AZJIO 14:23 15-07-2010
Цитата:
в скрипте "Калькулятор" использование стиля для кнопок цифр тормозит реакцию на событие нажатия

Какой конкретно стиль?
Автор: AZJIO
Дата сообщения: 15.07.2010 14:13
ViSiToR
GUICtrlSetBkColor (-1, 0 )
GUICtrlSetColor (-1, 0xffffff)

чёрная кнопка с белым текстом.
Автор: ViSiToR
Дата сообщения: 15.07.2010 14:25
AZJIO 15:13 15-07-2010
Цитата:
чёрная кнопка с белым текстом

Это известная проблема, в этом случае кнопка обрабатывается почти как Label (у него таже проблема), и двойной клик организовать не так просто.
Автор: NIKZZZZ
Дата сообщения: 19.07.2010 01:21
Написал UDF'ку, аналог FileFindFirstFile() и FileFindNextFile() с поиском по подкаталогам.
[more]; #Example# *********************************************************************************************************************
$search = _FileFindFirstFile("c:\Program Files\Internet Explorer\*.*",1)
If $search = -1 Then
    ConsoleWrite("No files/directories matched the search pattern" & @CRLF)
    Exit
EndIf
While 1
    $file = _FileFindNextFile($search)
    If @error Then ExitLoop
    ConsoleWrite("Find file - " & $file & @CRLF)
WEnd
_FileFindClose($search)
;********************************************************************************************************************************

; #INDEX# =======================================================================================================================
; Title .........: FileFind
; AutoIt Version : 3.2.3++
; Language ......: Русский
; Description ...: Поиск файлов, включая подкаталоги, синтаксис и возвращаемое значение совпадают с FileFindFirstFile()
; FileFindNextFile(), в FileFindFirstFile("filename" [,flag]) добавлен необязатенльный параметр flag
; flag=1 - поиск файлов
; flag=2 - поиск каталогов , по умолчанию flag=3
; Author(s) .....: Nikzzzz
; ===============================================================================================================================

Func _FileFindFirstFile($sFile,$iMode=3)
    Local $avStack[5]
    $avStack[0] = 0
    $avStack[1] = StringMid($sFile, StringInStr($sFile, "\", 0, -1) + 1)
    $avStack[1] = StringRegExpReplace($avStack[1], "[\\\(\)\{\}\+\$\.]", "\\\0")
    $avStack[1] = StringReplace($avStack[1], "*", ".*")
    $avStack[1] = StringReplace($avStack[1], "?", ".")
    $avStack[2] = $iMode
    $avStack[3] = StringLeft($sFile, StringInStr($sFile, "\", 0, -1) - 1)
    $avStack[4] = FileFindFirstFile($avStack[3] & "\*.*")
    If $avStack[4] = -1 Then
        SetError(1)
        Return -1
    EndIf
    Return $avStack
EndFunc ;==>_FileFindFirstFile

Func _FileFindNextFile(ByRef $avStack)
    Local $sFindFile
    While 1
        $sFindFile = FileFindNextFile($avStack[$avStack[0] + 4])
        If Not @error Then
            If StringInStr(FileGetAttrib($avStack[$avStack[0] + 3] & "\" & $sFindFile), "D") > 0 Then
                $avStack[0] += 2
                ReDim $avStack[$avStack[0] + 5]
                $avStack[$avStack[0] + 3] = $avStack[$avStack[0]+1] & "\" & $sFindFile
                $avStack[$avStack[0] + 4] = FileFindFirstFile($avStack[$avStack[0] + 3] & "\*.*")
                If BitAND($avStack[2],2) Then Return StringMid($avStack[$avStack[0] + 3], StringLen($avStack[3]) + 2)
                ContinueLoop
            Else
                If StringRegExpReplace($sFindFile, $avStack[1], "") = "" Then
                    SetError(0)
                    If BitAND($avStack[2],1) Then Return StringMid($avStack[$avStack[0] + 3] & "\" & $sFindFile, StringLen($avStack[3]) + 2)
                Else
                    ContinueLoop
                EndIf
            EndIf
        Else
            If $avStack[0] = 0 Then
                SetError(-1)
                Return ""
            Else
                FileClose($avStack[$avStack[0] + 4])
                $avStack[0] -= 2
                ReDim $avStack[$avStack[0] + 5]
            EndIf
        EndIf
    WEnd
EndFunc ;==>_FileFindNextFile

Func _FileFindClose(ByRef $avStack)
    Local $iRetVaue
    While $avStack[0] >= 0
        $iRetVaue=FileClose($avStack[$avStack[0] + 4])
        $avStack[0] -= 2
    WEnd
    ReDim $avStack[1]
    Return $iRetVaue
EndFunc ;==>_FileFindClose
[/more]
Автор: AZJIO
Дата сообщения: 19.07.2010 16:18
NIKZZZZ
А может добавить параметры для функции.
Я к предыдущей версии этой функции прикрутил поиск типов файлов, поиск каталогов, глубину вложенности поиска.
[more]
Код: Global $Stack[50], $Stack1[50]

$Text = ""
FileFindNextFirst("C:\WINDOWS")
While 1
    $tempname = FileFindNext('exe;dll',1,1)
    If $tempname = "" Then ExitLoop
    $Text &= $tempname & @CRLF
WEnd

MsgBox(4096, '', $Text)

Func FileFindNextFirst($FindCat)
    $Stack[0] = 1
    $Stack1[1] = $FindCat
    $Stack[1] = FileFindFirstFile($FindCat & "\*.*")
    Return $Stack[1]
EndFunc ;==>FileFindNextFirst

;$mode=0 - файлы
;$mode=1 - типы файлов
;$mode=2 - каталоги
;$Level= от 1 до 49
;$type = может иметь перечисление расширений, например exe;dll;com точнее $tempname = FileFindNext('exe;dll;com',1,1)
Func FileFindNext($type = 'log', $mode = 0, $Level = 49)
    While 1
        $file = FileFindNextFile($Stack[$Stack[0]])
        If @error Then
            FileClose($Stack[$Stack[0]])
            If $Stack[0] = 1 Then
                Return ""
            Else
                $Stack[0] -= 1
                ContinueLoop
            EndIf
        Else
            If StringInStr(FileGetAttrib($Stack1[$Stack[0]] & "\" & $file), "D") > 0 Then
                If $Stack[0] = $Level Then ContinueLoop
                $Stack[0] += 1
                $Stack1[$Stack[0]] = $Stack1[$Stack[0] - 1] & "\" & $file
                $Stack[$Stack[0]] = FileFindFirstFile($Stack1[$Stack[0]] & "\*.*")
                If $mode = 2 Then
                    Return $Stack1[$Stack[0]]
                Else
                    ContinueLoop
                EndIf
            Else
                If $mode = 2 Then ContinueLoop
                If $mode = 1 Then
                    ;If StringInStr (';'&$type&';', ';'&StringRight($Stack1[$Stack[0]] & "\" & $file, 3)&';')=0 Then
                    If StringInStr (';'&$type&';', ';'&StringRegExpReplace($Stack1[$Stack[0]] & "\" & $file, '.*\.(\S+)', '\1')&';')=0 Then
                        ContinueLoop
                    Else
                        Return $Stack1[$Stack[0]] & "\" & $file
                    EndIf
                Else
                    Return $Stack1[$Stack[0]] & "\" & $file
                EndIf
            EndIf
        EndIf
    WEnd
EndFunc ;==>FileFindNext
Автор: NIKZZZZ
Дата сообщения: 19.07.2010 20:08
AZJIO
Ну, все прикручивать излишне, а вот отдельный поиск файлов и каталогов я добавил, предыдущий пост исправил.
Автор: Dmitri_Andreev
Дата сообщения: 21.07.2010 16:25
Привет всем.
Может кто-нибудь знает более удобный способ получения списка сетевых подключений, кроме как анализировать текст ipconfig?
Автор: Orion_76
Дата сообщения: 21.07.2010 21:44
Dmitri_Andreev

Код: ; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & "Computer: " & $strComputer & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
For $objItem In $colItems
$Output = $Output & "ArpAlwaysSourceRoute: " & $objItem.ArpAlwaysSourceRoute & @CRLF
$Output = $Output & "ArpUseEtherSNAP: " & $objItem.ArpUseEtherSNAP & @CRLF
$Output = $Output & "Caption: " & $objItem.Caption & @CRLF
$Output = $Output & "DatabasePath: " & $objItem.DatabasePath & @CRLF
$Output = $Output & "DeadGWDetectEnabled: " & $objItem.DeadGWDetectEnabled & @CRLF
$strDefaultIPGateway = $objItem.DefaultIPGateway(0)
$Output = $Output & "DefaultIPGateway: " & $strDefaultIPGateway & @CRLF
$Output = $Output & "DefaultTOS: " & $objItem.DefaultTOS & @CRLF
$Output = $Output & "DefaultTTL: " & $objItem.DefaultTTL & @CRLF
$Output = $Output & "Description: " & $objItem.Description & @CRLF
$Output = $Output & "DHCPEnabled: " & $objItem.DHCPEnabled & @CRLF
$Output = $Output & "DHCPLeaseExpires: " & WMIDateStringToDate($objItem.DHCPLeaseExpires) & @CRLF
$Output = $Output & "DHCPLeaseObtained: " & WMIDateStringToDate($objItem.DHCPLeaseObtained) & @CRLF
$Output = $Output & "DHCPServer: " & $objItem.DHCPServer & @CRLF
$Output = $Output & "DNSDomain: " & $objItem.DNSDomain & @CRLF
$strDNSDomainSuffixSearchOrder = $objItem.DNSDomainSuffixSearchOrder(0)
$Output = $Output & "DNSDomainSuffixSearchOrder: " & $strDNSDomainSuffixSearchOrder & @CRLF
$Output = $Output & "DNSEnabledForWINSResolution: " & $objItem.DNSEnabledForWINSResolution & @CRLF
$Output = $Output & "DNSHostName: " & $objItem.DNSHostName & @CRLF
$strDNSServerSearchOrder = $objItem.DNSServerSearchOrder(0)
$Output = $Output & "DNSServerSearchOrder: " & $strDNSServerSearchOrder & @CRLF
$Output = $Output & "DomainDNSRegistrationEnabled: " & $objItem.DomainDNSRegistrationEnabled & @CRLF
$Output = $Output & "ForwardBufferMemory: " & $objItem.ForwardBufferMemory & @CRLF
$Output = $Output & "FullDNSRegistrationEnabled: " & $objItem.FullDNSRegistrationEnabled & @CRLF
$strGatewayCostMetric = $objItem.GatewayCostMetric(0)
$Output = $Output & "GatewayCostMetric: " & $strGatewayCostMetric & @CRLF
$Output = $Output & "IGMPLevel: " & $objItem.IGMPLevel & @CRLF
$Output = $Output & "Index: " & $objItem.Index & @CRLF
$strIPAddress = $objItem.IPAddress(0)
$Output = $Output & "IPAddress: " & $strIPAddress & @CRLF
$Output = $Output & "IPConnectionMetric: " & $objItem.IPConnectionMetric & @CRLF
$Output = $Output & "IPEnabled: " & $objItem.IPEnabled & @CRLF
$Output = $Output & "IPFilterSecurityEnabled: " & $objItem.IPFilterSecurityEnabled & @CRLF
$Output = $Output & "IPPortSecurityEnabled: " & $objItem.IPPortSecurityEnabled & @CRLF
$strIPSecPermitIPProtocols = $objItem.IPSecPermitIPProtocols(0)
$Output = $Output & "IPSecPermitIPProtocols: " & $strIPSecPermitIPProtocols & @CRLF
$strIPSecPermitTCPPorts = $objItem.IPSecPermitTCPPorts(0)
$Output = $Output & "IPSecPermitTCPPorts: " & $strIPSecPermitTCPPorts & @CRLF
$strIPSecPermitUDPPorts = $objItem.IPSecPermitUDPPorts(0)
$Output = $Output & "IPSecPermitUDPPorts: " & $strIPSecPermitUDPPorts & @CRLF
$strIPSubnet = $objItem.IPSubnet(0)
$Output = $Output & "IPSubnet: " & $strIPSubnet & @CRLF
$Output = $Output & "IPUseZeroBroadcast: " & $objItem.IPUseZeroBroadcast & @CRLF
$Output = $Output & "IPXAddress: " & $objItem.IPXAddress & @CRLF
$Output = $Output & "IPXEnabled: " & $objItem.IPXEnabled & @CRLF
$strIPXFrameType = $objItem.IPXFrameType(0)
$Output = $Output & "IPXFrameType: " & $strIPXFrameType & @CRLF
$Output = $Output & "IPXMediaType: " & $objItem.IPXMediaType & @CRLF
$strIPXNetworkNumber = $objItem.IPXNetworkNumber(0)
$Output = $Output & "IPXNetworkNumber: " & $strIPXNetworkNumber & @CRLF
$Output = $Output & "IPXVirtualNetNumber: " & $objItem.IPXVirtualNetNumber & @CRLF
$Output = $Output & "KeepAliveInterval: " & $objItem.KeepAliveInterval & @CRLF
$Output = $Output & "KeepAliveTime: " & $objItem.KeepAliveTime & @CRLF
$Output = $Output & "MACAddress: " & $objItem.MACAddress & @CRLF
$Output = $Output & "MTU: " & $objItem.MTU & @CRLF
$Output = $Output & "NumForwardPackets: " & $objItem.NumForwardPackets & @CRLF
$Output = $Output & "PMTUBHDetectEnabled: " & $objItem.PMTUBHDetectEnabled & @CRLF
$Output = $Output & "PMTUDiscoveryEnabled: " & $objItem.PMTUDiscoveryEnabled & @CRLF
$Output = $Output & "ServiceName: " & $objItem.ServiceName & @CRLF
$Output = $Output & "SettingID: " & $objItem.SettingID & @CRLF
$Output = $Output & "TcpipNetbiosOptions: " & $objItem.TcpipNetbiosOptions & @CRLF
$Output = $Output & "TcpMaxConnectRetransmissions: " & $objItem.TcpMaxConnectRetransmissions & @CRLF
$Output = $Output & "TcpMaxDataRetransmissions: " & $objItem.TcpMaxDataRetransmissions & @CRLF
$Output = $Output & "TcpNumConnections: " & $objItem.TcpNumConnections & @CRLF
$Output = $Output & "TcpUseRFC1122UrgentPointer: " & $objItem.TcpUseRFC1122UrgentPointer & @CRLF
$Output = $Output & "TcpWindowSize: " & $objItem.TcpWindowSize & @CRLF
$Output = $Output & "WINSEnableLMHostsLookup: " & $objItem.WINSEnableLMHostsLookup & @CRLF
$Output = $Output & "WINSHostLookupFile: " & $objItem.WINSHostLookupFile & @CRLF
$Output = $Output & "WINSPrimaryServer: " & $objItem.WINSPrimaryServer & @CRLF
$Output = $Output & "WINSScopeID: " & $objItem.WINSScopeID & @CRLF
$Output = $Output & "WINSSecondaryServer: " & $objItem.WINSSecondaryServer & @CRLF
if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
$Output=""
Next
Else
Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkAdapterConfiguration" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc
Автор: Dmitri_Andreev
Дата сообщения: 22.07.2010 13:20
Orion_76
Огромное спасибо за ответ, этот пример мне пригодится в будущим, но я имел ввиду немного другое, наверно неудачно мысль изложил. Нужно получить имена сетевых подключений (Подключение по локальной сети, Подключение по локальной сети 2, имена PPP, PPPoE, VPN соединений).
Автор: Senza
Дата сообщения: 22.07.2010 13:23
Привет
Автор: Orion_76
Дата сообщения: 22.07.2010 18:04
Dmitri_Andreev

Цитата:
Подключение по локальной сети, Подключение по локальной сети 2, имена PPP, PPPoE, VPN соединений

т.е. Имена ярлыков папки Сетевые подключения?

Страницы: 12345678910111213

Предыдущая тема: Проблемы с VMware Workstation (часть 4)


Форум Ru-Board.club — поднят 15-09-2016 числа. Цель - сохранить наследие старого Ru-Board, истории становления российского интернета. Сделано для людей.