» AutoIT
DiaBlo90 19:46 13-07-2010
Цитата:
Это задаётся опцией «GUICloseOnESC».
Код: [no]Opt("GUICloseOnESC", 0)[/no]
Цитата:
почему при нажатии esc скрипт закрывается?
Это задаётся опцией «GUICloseOnESC».
Код: [no]Opt("GUICloseOnESC", 0)[/no]
[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
Код: #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
Помогите пожалуйста наваять простенький скрипт. Что нужно:
мне часто приходится копипастить из word в autocad, но чтобы не сохранялось форматирование word. Раньше я делал это через стандартный блокнот, но это немного напрягает - много лишних движений. Вот и хотелось бы чтобы скопировал текст по ctrl+с нажал скрипт и он уже "очищен" от форматирования. Можно hotkey конечно сделать.
Сам я новичок вообще в программировании.
Код: Run ("notepad.exe")
WinWaitActive ("Безымянный - Блокнот")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","Вст&авить Ctrl+V")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","Выделить в&се Ctrl+A")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","&Копировать Ctrl+C")
WinClose("Безымянный - Блокнот")
ControlClick("Блокнот","Текст в файле Безымянный был и","Button2")
мне часто приходится копипастить из word в autocad, но чтобы не сохранялось форматирование word. Раньше я делал это через стандартный блокнот, но это немного напрягает - много лишних движений. Вот и хотелось бы чтобы скопировал текст по ctrl+с нажал скрипт и он уже "очищен" от форматирования. Можно hotkey конечно сделать.
Сам я новичок вообще в программировании.
Код: Run ("notepad.exe")
WinWaitActive ("Безымянный - Блокнот")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","Вст&авить Ctrl+V")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","Выделить в&се Ctrl+A")
WinMenuSelectItem("Безымянный - Блокнот","","&Правка","&Копировать Ctrl+C")
WinClose("Безымянный - Блокнот")
ControlClick("Блокнот","Текст в файле Безымянный был и","Button2")
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
Код: 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 14:23 15-07-2010
Цитата:
Какой конкретно стиль?
Цитата:
в скрипте "Калькулятор" использование стиля для кнопок цифр тормозит реакцию на событие нажатия
Какой конкретно стиль?
ViSiToR
GUICtrlSetBkColor (-1, 0 )
GUICtrlSetColor (-1, 0xffffff)
чёрная кнопка с белым текстом.
GUICtrlSetBkColor (-1, 0 )
GUICtrlSetColor (-1, 0xffffff)
чёрная кнопка с белым текстом.
AZJIO 15:13 15-07-2010
Цитата:
Это известная проблема, в этом случае кнопка обрабатывается почти как Label (у него таже проблема), и двойной клик организовать не так просто.
Цитата:
чёрная кнопка с белым текстом
Это известная проблема, в этом случае кнопка обрабатывается почти как Label (у него таже проблема), и двойной клик организовать не так просто.
Написал 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]
[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]
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
А может добавить параметры для функции.
Я к предыдущей версии этой функции прикрутил поиск типов файлов, поиск каталогов, глубину вложенности поиска.
[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
AZJIO
Ну, все прикручивать излишне, а вот отдельный поиск файлов и каталогов я добавил, предыдущий пост исправил.
Ну, все прикручивать излишне, а вот отдельный поиск файлов и каталогов я добавил, предыдущий пост исправил.
Привет всем.
Может кто-нибудь знает более удобный способ получения списка сетевых подключений, кроме как анализировать текст ipconfig?
Может кто-нибудь знает более удобный способ получения списка сетевых подключений, кроме как анализировать текст ipconfig?
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
Код: ; 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
Orion_76
Огромное спасибо за ответ, этот пример мне пригодится в будущим, но я имел ввиду немного другое, наверно неудачно мысль изложил. Нужно получить имена сетевых подключений (Подключение по локальной сети, Подключение по локальной сети 2, имена PPP, PPPoE, VPN соединений).
Огромное спасибо за ответ, этот пример мне пригодится в будущим, но я имел ввиду немного другое, наверно неудачно мысль изложил. Нужно получить имена сетевых подключений (Подключение по локальной сети, Подключение по локальной сети 2, имена PPP, PPPoE, VPN соединений).
Привет
Dmitri_Andreev
Цитата:
т.е. Имена ярлыков папки Сетевые подключения?
Цитата:
Подключение по локальной сети, Подключение по локальной сети 2, имена PPP, PPPoE, VPN соединений
т.е. Имена ярлыков папки Сетевые подключения?
удалить...
Обновил калькулятор (третий пост сверху), добавлена расширенная память (9 ячеек) и автосохранение памяти и позиции окна. Все операции доступны с клавиатуры. Добавил алгоритм повтора последней операции, т.е. если вы делите на 2, то повторное нажатие "Вычислить" опять делит число на 2.
Dmitri_Andreev,
Так у меня показывает все ярлыки папки "Сетевые подключения" (Windows XP SP3):
Код: #include <GuiListView.au3>
#include <Array.au3>
Opt("WinWaitDelay", 0)
Local $sTitle = "Сетевые подключения", $hListView, $iNumber, $sName
Run("control ncpa.cpl")
;ShellExecute("::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")
WinWait($sTitle)
If Not WinActive($sTitle) Then WinActivate($sTitle)
WinWaitActive($sTitle)
WinSetState($sTitle, "", @SW_MINIMIZE)
$hListView = ControlGetHandle($sTitle, "", "[CLASS:SysListView32; INSTANCE:1]")
$iNumber = _GUICtrlListView_GetItemCount($hListView)
Dim $aNetwork[$iNumber + 1]
For $i = 0 To $iNumber - 1
$sName = _GUICtrlListView_GetItemText($hListView, $i)
$aNetwork[$i + 1] = $sName
Next
$aNetwork[0] = UBound($aNetwork) - 1
WinClose($sTitle)
_ArrayDisplay($aNetwork)
Так у меня показывает все ярлыки папки "Сетевые подключения" (Windows XP SP3):
Код: #include <GuiListView.au3>
#include <Array.au3>
Opt("WinWaitDelay", 0)
Local $sTitle = "Сетевые подключения", $hListView, $iNumber, $sName
Run("control ncpa.cpl")
;ShellExecute("::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")
WinWait($sTitle)
If Not WinActive($sTitle) Then WinActivate($sTitle)
WinWaitActive($sTitle)
WinSetState($sTitle, "", @SW_MINIMIZE)
$hListView = ControlGetHandle($sTitle, "", "[CLASS:SysListView32; INSTANCE:1]")
$iNumber = _GUICtrlListView_GetItemCount($hListView)
Dim $aNetwork[$iNumber + 1]
For $i = 0 To $iNumber - 1
$sName = _GUICtrlListView_GetItemText($hListView, $i)
$aNetwork[$i + 1] = $sName
Next
$aNetwork[0] = UBound($aNetwork) - 1
WinClose($sTitle)
_ArrayDisplay($aNetwork)
Dmitri_Andreev
Цитата:
на офф.форуме нашел только через ipconfig...
хотя что-то мне подсказывает, можно и из реестра выдернуть...
Цитата:
Подключение по локальной сети, Подключение по локальной сети 2, имена PPP, PPPoE, VPN соединений
на офф.форуме нашел только через ipconfig...
хотя что-то мне подсказывает, можно и из реестра выдернуть...
Обновил генератор мелодий в двух вариантах, особенно для MIDI.
Возможно ли решить такую задачу:
1) сделать копию ветки реестра со всеми значениями
2) через некоторое время сделать повторную копию этой ветки
3) сравнить их на предмет изменения записей (добавление, удаление, изменение)
1) сделать копию ветки реестра со всеми значениями
2) через некоторое время сделать повторную копию этой ветки
3) сравнить их на предмет изменения записей (добавление, удаление, изменение)
$s= 'text = "text1(text2)";'
Как вырезать в этом примере то, что находиться в кавычках, т.е. text1(text2) ?
Как вырезать в этом примере то, что находиться в кавычках, т.е. text1(text2) ?
Zloy_Gelud
$s = StringSplit('text = "text1(text2)";', '"')
MsgBox(0, 'Сообщение', $s[2])
$s = StringSplit('text = "text1(text2)";', '"')
MsgBox(0, 'Сообщение', $s[2])
Zloy_Gelud
Можно еще так попробовать:
Код: $sString = 'text = "text1(text2)";'
; 1-ый вариант:
$sResult = StringRegExpReplace($sString, '(?s).*?\Q"\E(.*?)\Q"\E.*', '\1')
MsgBox(0, '1-Найдено:', $sResult)
; 2-ой вариант:
$aResult = StringRegExp($sString, '"(.*?)"', 3)
If IsArray($aResult) Then
MsgBox(0, '2-Найдено:', $aResult[0])
Else
MsgBox(0, 'NO', 'NO')
EndIf
; 3-ий вариант:
$sRes = StringMid($sString, StringInStr($sString, '"', 0, 1) + 1, StringInStr($sString, '"', 0, 2) - _
StringInStr($sString, '"', 0, 1) - 1)
MsgBox(0, '3-Найдено:', $sRes)
Можно еще так попробовать:
Код: $sString = 'text = "text1(text2)";'
; 1-ый вариант:
$sResult = StringRegExpReplace($sString, '(?s).*?\Q"\E(.*?)\Q"\E.*', '\1')
MsgBox(0, '1-Найдено:', $sResult)
; 2-ой вариант:
$aResult = StringRegExp($sString, '"(.*?)"', 3)
If IsArray($aResult) Then
MsgBox(0, '2-Найдено:', $aResult[0])
Else
MsgBox(0, 'NO', 'NO')
EndIf
; 3-ий вариант:
$sRes = StringMid($sString, StringInStr($sString, '"', 0, 1) + 1, StringInStr($sString, '"', 0, 2) - _
StringInStr($sString, '"', 0, 1) - 1)
MsgBox(0, '3-Найдено:', $sRes)
A не подскажите еще как заменить определенные слова в строке на другие?
Zloy_Gelud
Код: $sString = 'text = "text1(text2)";'
$sWordOld = 'text'
$sWordNew = 'click'
$sResult = StringReplace($sString, $sWordOld, $sWordNew)
MsgBox(0, '', 'Old: ' & $sString & @CRLF & 'New: ' & $sResult)
Код: $sString = 'text = "text1(text2)";'
$sWordOld = 'text'
$sWordNew = 'click'
$sResult = StringReplace($sString, $sWordOld, $sWordNew)
MsgBox(0, '', 'Old: ' & $sString & @CRLF & 'New: ' & $sResult)
Zloy_Gelud
Цитата:
Слишком объёмный вопрос, решить можно, а можно взять готовую бесплатную программу regshot (с исходниками).
Цитата:
Возможно ли решить такую задачу:
Слишком объёмный вопрос, решить можно, а можно взять готовую бесплатную программу regshot (с исходниками).
Предыдущая тема: Проблемы с VMware Workstation (часть 4)
Форум Ru-Board.club — поднят 15-09-2016 числа. Цель - сохранить наследие старого Ru-Board, истории становления российского интернета. Сделано для людей.