Am besten du zeigt uns dein Skript und wir können dann nach einer Lösung suchen.
Gruß,
UEZ
Am besten du zeigt uns dein Skript und wir können dann nach einer Lösung suchen.
Gruß,
UEZ
Probiere es mal damit:
;coded by UEZ 2013
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Opt("MustDeclareVars", 1)
Global $sInputText = "Bitte Passwort eingeben"
Global Const $hGUI = GUICreate("Password", 369, 46)
Global Const $idInputPWD = GUICtrlCreateInput($sInputText, 68, 12, 151, 21)
GUICtrlSetColor(-1, 0xA0A0A0)
Global Const $hInputPWD = GUICtrlGetHandle($idInputPWD)
Global Const $idLabelPWD = GUICtrlCreateLabel("Passwort:", 18, 14, 44, 19)
Global Const $idButtonGO = GUICtrlCreateButton("GO", 286, 10, 75, 25)
ControlFocus($hGUI, "", $idLabelPWD)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
[/autoit] [autoit][/autoit] [autoit]While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idButtonGO
GUIRegisterMsg($WM_COMMAND, "")
Exit
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $iIDFrom = _WinAPI_LoWord($iwParam)
Local $iCode = _WinAPI_HiWord($iwParam)
Switch $ilParam
Case $hInputPWD
Switch $iCode
Case $EN_KILLFOCUS
If GUICtrlRead($iIDFrom) = "" Then
GUICtrlSendMsg($iIDFrom, $EM_SETPASSWORDCHAR, 0, 0)
GUICtrlSetData($iIDFrom, $sInputText)
GUICtrlSetColor($iIDFrom, 0xA0A0A0)
EndIf
Case $EN_SETFOCUS
GUICtrlSetColor($iIDFrom, 0)
GUICtrlSetData($iIDFrom, "")
GUICtrlSendMsg($iIDFrom, $EM_SETPASSWORDCHAR, 9679, 0)
EndSwitch
EndSwitch
Return "GUI_RUNDEFMSG"
EndFunc ;==>WM_COMMAND
Gruß,
UEZ
Herzlichen Glückwunsch und alles Gute!
@GDI+ Meister: lange nicht mehr aktiv!?!?!?
Gruß,
UEZ
Schaue mal hier nach: http://www.autoitscript.com/forum/topic/14…20#entry1045221
Füllt eine Farbe in einem Bild iterativ. Kannst es ja entsprechend umbauen.
Gruß,
UEZ
Ich bin völlig bei dir, wenn es darum geht, den Reiz am Coden zu erhalten! Aber in diesem Fall fand ich die Idee GDI+ zum Komprimieren zu benutzen, einfach genial. Erst mal auf diese Idee zu kommen, denn mir war die Idee noch "fremd".
Ich würde diese Art (GDI+) zum komprimieren nicht benutzen, doch die Möglichkeit zu haben ist einfach faszinierend.
Gruß,
UEZ
Ich finde die Idee einfach cool, wobei die Idee vielleicht nicht neu ist, aber die Implementierung ist sehr ansehnlich.
Die Idee ist einfach, dass man nicht den "lahmen" AutoIt Interpreter nimmt, sondern Built-In Funktionen.
Oben von mir das Beispiel mit der ntdll.dll und von trancexx die gdiplus.dll als Alternativen.
Natürlich ist der Königsweg zum Komprimieren der von die genannte Weg, aber manchmal sind die alternativ Wege einfach nur genial...
Gruß,
UEZ
Ein interessanter Ansatz ist hier zu sehen (von trancexx): http://www.autoitscript.com/forum/topic/14…ata-compression
Und zwar wird die PNG Komprimierung benutzt, um Daten zu komprimieren. Clever!
Gruß,
UEZ
was ist eigentlich der genaue Unterschied zwischen
[autoit]_GDIPlus_BitmapCreateFromFile
[/autoit]
_GDIPlus_ImageLoadFromFile
?
Bei meinen bisherigen Projekten funktioniert beides
Schaue mal hier nach: http://www.autoitscript.com/forum/topic/14…e/#entry1032804
Gruß,
UEZ
Wer Lust hat, kann ja mal hier rein schauen (siehe Anhang) - ist vom 7-Zip Entwickler.
Zitat
UEZ komprimiert in seinem Script übrigens bei LZNT in der höchsten Stufe, und das ist kompressionstechnisch kein Stück besser als das AutoIt-Pendant!!!
Ist eben "nur" Built-In.
Gruß,
UEZ
Happy Birthday und alles Gute.
Gruß,
Ünal
Haben die Städte was mit Politik zu tun?
Gruß,
UEZ
Schaue mal in der WinAPIEx.au3 nach diesen Funktionen,
_WinAPI_EnumProcessWindows
_WinAPI_EnumChildWindows
ob sie dir helfen.
Gruß,
UEZ
Hier meine Variante von 2011:
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filters
#include <Array.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
Local $width = 800, $height = 600
; Create GUI
$hGUI = GUICreate("GDI+ Vertical Scroller by UEZ", $width, $height)
If @OSBuild < 7600 Then WinSetTrans($hGui,"", 0xFF)
GUISetState()
; Draw a string
_GDIPlus_Startup ()
Local $hGfx = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
Local $hBmp_About = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGfx)
Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp_About)
_GDIPlus_GraphicsClear($hCtxt, 0xFFFFFFFF)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
;~ Local $tRectF = _GDIPlus_RectFCreate(0, 0, $width / 5, $height / 5)
Local $hFormat = _GDIPlus_StringFormatCreate()
Local $ver = "v0.98 Build 2010-12-09 Beta"
Local $aText[26][9] = [ _
["AUTOIT", 0, 0, "Arial Black", 40], _
["Windows Screenshooter", 0, 0, "Comic Sans MS", 48], _
[$ver, 0, 0, "Comic Sans MS", 24], _
[" ", 0, 0, "Arial", 50], _
["Main Code", 0, 0, "Verdana", 30], _
["by", 0, 0, "Times New Roman", 40], _
["UEZ", 0, 0, "Arial Black", 150], _
[" ", 0, 0, "Arial", 20], _
["Additional Code by:", 0, 0, "Georgia", 24], _
["(Alphabetical Order)", 0, 0, "Tahoma", 14], _
[" ", 0, 0, "Arial", 20], _
["Authenticity", 0, 0, "Arial", 32], _
["eukalyptus", 0, 0, "Arial", 32], _
["Montfrooij", 0, 0, "Arial", 32], _
["taietel", 0, 0, "Arial", 32], _
["Ward", 0, 0, "Arial", 32], _
["Yashied", 0, 0, "Arial", 32], _
[" ", 0, 0, "Arial", 100], _
["Thanks to:", 0, 0, "Tunga", 40], _
[" ", 0, 0, "Arial", 20], _
["Firelight Technologies for fmod.dll", 0, 0, "Palatino Linotype", 32], _
[" ", 0, 0, "Arial", 32], _
["Anne Haessig for the chip tune:", 0, 0, "MV Boli", 32], _
["DaZzLed", 0, 0, "Impact", 32], _
[" ", 0, 0, "Arial", 120], _
["Press ESC to quit", 0, 0, "Latha", 30]]
Local $tLayout = _GDIPlus_RectFCreate (0, 0, 0, 0), $aInfo
Local $y = $height, $dy = 0, $sy = 0
For $z = 0 To UBound($aText) - 1
$aText[$z][1] = _GDIPlus_FontFamilyCreate($aText[$z][3]) ;$hFamily
$aText[$z][2] = _GDIPlus_FontCreate($aText[$z][1], $aText[$z][4]) ;$hFont
$aInfo = _GDIPlus_GraphicsMeasureString($hGfx, $aText[$z][0], $aText[$z][2], $tLayout, $hFormat)
$aText[$z][5] = Floor(DllStructGetData($aInfo[0], "Width"))
$aText[$z][6] = Floor(DllStructGetData($aInfo[0], "Height"))
$aText[$z][7] = Floor($width / 2 - ($aText[$z][5] / 2))
$aText[$z][8] = Floor($y + $dy + $sy)
$sy += $aText[$z][6]
Next
;~ _ArrayDisplay($aText)
Local $speed = 1
Local $dll = DllOpen("user32.dll")
While Not _IsPressed("1B", $dll) * Sleep(10)
_GDIPlus_GraphicsClear($hCtxt, 0xFFFFFFFF)
For $z = 0 To UBound($aText) - 1
If $aText[$z][8] < $height And $aText[$z][8] > -$aText[$z][6] Then
$tLayout = _GDIPlus_RectFCreate ($aText[$z][7], $aText[$z][8], 0, 0)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $aText[$z][0], $aText[$z][2], $tLayout, $hFormat, $hBrush)
EndIf
$aText[$z][8] -= $speed
Next
_GDIPlus_GraphicsDrawImageRect($hGfx, $hBmp_About, 0, 0, $width, $height)
If $aText[UBound($aText) - 1][8] < -$aText[UBound($aText) - 1][6] * 2.5 Then ExitLoop
WEnd
DllClose($dll)
For $z = 0 To UBound($aText) - 1
_GDIPlus_FontDispose($aText[$z][2])
_GDIPlus_FontFamilyDispose($aText[$z][1])
Next
$tLayout = ""
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_BitmapDispose($hBmp_About)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_GraphicsDispose($hGfx)
GUIDelete($hGUI)
Exit
Gruß,
UEZ
Man kann auch die Funktionen aus der ntdll.dll benutzen, um String zu komprimieren/entpacken.
Beispiel:
$sTest = '67B[6:6]B76[0:19]56B[6:8]B65[0:17]56B[6:10]765[0:16]667[6:10]766[0:15]5[6:16]5[0:14][6:18][0:13]5[6:18]5[0:12]5[6:14]76665[0:12]56677676767676767665[0:12]566B[7:12]B665[0:12]566B7B[7:9]BB665[0:13]66BBB7B7B7BB7BBD65[0:14]56BD[B:10]D765[0:15]56BDDDBDBDBDDD66[0:16]366BE[D:6]EB655[0:17]5567BDEEDB7655[0:20]55[6:6]55[0:24][5:6][0:13][F:11]E7[F:6]81[F:6]00[F:6]00[F:6]00[F:6]00[F:6]00[F:5]E007FFFFE007FFFFE007FFFFC003FFFFC003FFFFC003FFFFC003FFFF8001FFFF0000FFFF0000FFFE00007FFE00007FFC00003FFC00003FFC00003FFC00003FFC00003FFE00007FFE00007FFF0000FFFF0000FFFF8001FFFFE007[F:5]81FFF[0:8]F26A0451[0:13]1[0:10]800300009053040030010000B004[0:12]28[0:6]2[0:7]4[0:8]10001[0:13]1[0:44][F:6]00[F:44]C1[F:5]C3C7FFFC3FC1FF83FFC07FBFFFC1FFBFFFC7FFBFFFDFFFBFFFDFFFBFFFDFFFBFFFDFFFBFFFDFFFBFFFDFFFBFFFDFFFBFFFDFFFBFFC1FFFBFC3DFFFBC3C1FFF83C3FFFFBC3[F:5]83[F:6]B[F:98]C1[F:5]C007FFFC0001FF8[0:5]7F800001FF800007FF80001FFF80001FFF80001FFF80001FFF80001FFF80001FFF80001FFF80001FFF80001FFF80001FFF80001FFF8003FFFF803[F:5]83[F:6]B[F:54][0:8]F26A0451[0:13]1[0:10]D8040000E8540400E8020000B004[0:12]28[0:6]2[0:7]4[0:8]10004[0:10]8002[0:44]'
$bCompressed = Compress(Binary($sTest))
ConsoleWrite("Binary Length: " & BinaryLen(Binary($sTest)) & " bytes" & @LF)
ConsoleWrite("Binary Length Compressed: " & BinaryLen($bCompressed) & " bytes" & @LF)
ConsoleWrite("Effiency: " & StringFormat("%.2f%s", 100 * BinaryLen($bCompressed) / BinaryLen(Binary($sTest)), "% from original size") & @LF & @LF & @LF)
ConsoleWrite("Decompressed String: " & DeCompress($bCompressed) & @LF)
Exit
Func DeCompress($binString)
Local $tSource = DllStructCreate('byte[' & BinaryLen($binString) & ']')
DllStructSetData($tSource, 1, $binString)
Local $tDecompress
_WinAPI_LZNTDecompress($tSource, $tDecompress)
$tSource = 0
Return BinaryToString(Binary(DllStructGetData($tDecompress, 1)))
EndFunc ;==>DeCompress
Func Compress($binString)
Local $tCompressed
Local $tSource = DllStructCreate('byte[' & BinaryLen($binString) & ']')
DllStructSetData($tSource, 1, $binString)
_WinAPI_LZNTCompress($tSource, $tCompressed, True)
Local $binCompressed = DllStructGetData($tCompressed, 1)
$tSource = 0
Return Binary($binCompressed)
EndFunc ;==>Compress
Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize = 0x800000)
Local $tBuffer, $Ret
$tOutput = 0
$tBuffer = DllStructCreate('byte[' & $iBufferSize & ']')
If @error Then Return SetError(1, 0, 0)
$Ret = DllCall('ntdll.dll', 'uint', 'RtlDecompressBuffer', 'ushort', 0x0002, 'ptr', DllStructGetPtr($tBuffer), 'ulong', $iBufferSize, 'ptr', DllStructGetPtr($tInput), 'ulong', DllStructGetSize($tInput), 'ulong*', 0)
If @error Then Return SetError(2, 0, 0)
If $Ret[0] Then Return SetError(3, $Ret[0], 0)
$tOutput = DllStructCreate('byte[' & $Ret[6] & ']')
If Not _WinAPI_MoveMemory(DllStructGetPtr($tOutput), DllStructGetPtr($tBuffer), $Ret[6]) Then
$tOutput = 0
Return SetError(4, 0, 0)
EndIf
Return $Ret[6]
EndFunc ;==>_WinAPI_LZNTDecompress
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_LZNTCompress
; Description....: Compresses an input data.
; Syntax.........: _WinAPI_LZNTCompress ( $tInput, ByRef $tOutput [, $fMaximum] )
; Parameters.....: $tInput - "byte[n]" or any other structure that contains the data to be compressed.
; $tOutput - "byte[n]" structure that is created by this function, and contain the compressed data.
; $fMaximum - Specifies whether use a maximum data compression, valid values:
; |TRUE - Uses an algorithm which provides maximum data compression but with relatively slower performance.
; |FALSE - Uses an algorithm which provides a balance between data compression and performance. (Default)
; Return values..: Success - The size of the compressed data, in bytes.
; Failure - 0 and sets the @error flag to non-zero, @extended flag may contain the NTSTATUS code.
; Author.........: trancexx
; Modified.......: Yashied, UEZ
; Remarks........: The input and output buffers must be different, otherwise, the function fails.
; Related........:
; Link...........: @@MsdnLink@@ RtlCompressBuffer
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_LZNTCompress(ByRef $tInput, ByRef $tOutput, $fMaximum = True)
Local $tBuffer, $tWorkSpace, $Ret
Local $COMPRESSION_FORMAT_LZNT1 = 0x0002, $COMPRESSION_ENGINE_MAXIMUM = 0x0100
If $fMaximum Then $COMPRESSION_FORMAT_LZNT1 = BitOR($COMPRESSION_FORMAT_LZNT1, $COMPRESSION_ENGINE_MAXIMUM)
$tOutput = 0
$Ret = DllCall('ntdll.dll', 'uint', 'RtlGetCompressionWorkSpaceSize', 'ushort', $COMPRESSION_FORMAT_LZNT1, 'ulong*', 0, 'ulong*', 0)
If @error Then Return SetError(1, 0, 0)
If $Ret[0] Then Return SetError(2, $Ret[0], 0)
$tWorkSpace = DllStructCreate('byte[' & $Ret[2] & ']')
$tBuffer = DllStructCreate('byte[' & (2 * DllStructGetSize($tInput)) & ']')
$Ret = DllCall('ntdll.dll', 'uint', 'RtlCompressBuffer', 'ushort', $COMPRESSION_FORMAT_LZNT1, 'ptr', DllStructGetPtr($tInput), 'ulong', DllStructGetSize($tInput), 'ptr', DllStructGetPtr($tBuffer), 'ulong', DllStructGetSize($tBuffer), 'ulong', 4096, 'ulong*', 0, 'ptr', DllStructGetPtr($tWorkSpace))
If @error Then Return SetError(3, 0, 0)
If $Ret[0] Then Return SetError(4, $Ret[0], 0)
$tOutput = DllStructCreate('byte[' & $Ret[7] & ']')
If Not _WinAPI_MoveMemory(DllStructGetPtr($tOutput), DllStructGetPtr($tBuffer), $Ret[7]) Then
$tOutput = 0
Return SetError(5, 0, 0)
EndIf
Return $Ret[7]
EndFunc ;==>_WinAPI_LZNTCompress
Func _WinAPI_MoveMemory($pDestination, $pSource, $iLenght)
DllCall('ntdll.dll', 'none', 'RtlMoveMemory', 'ptr', $pDestination, 'ptr', $pSource, 'ulong_ptr', $iLenght)
If @error Then Return SetError(1, 0, 0)
Return 1
EndFunc ;==>_WinAPI_MoveMemory
Mit $fMaximum kann man den Grad der Komprimierung wählen -> True = max, False = normal.
Für große Dateien ist Komprimierung relativ langsam, wenn man max. auswählt.
Gruß,
UEZ
Cool: Spring'13 ist draußen... ![]()
Jetzt fehlt mir nur noch die Zeit... Für mich brechen leider harte Zeiten für die nächsten Monate an...
Gruß,
UEZ
jNizM: danke für den Link - sehr praktisch, da ich sehr viele JS Source Codes habe, die total unübersichtlich sind! ![]()
Gruß,
UEZ
Macht's auch nicht übersichtlicher. ![]()
Gruß,
UEZ
Wer Lust und Zeit hat, kann diesen JS Code auseinander frimmeln und ihn nach AutoIt portieren:
silk.js
(function(){var J={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var e in b)J.call(b,e)&&(a[e]=b[e]);c.prototype=b.prototype;a.prototype=new c;a.__super__=b.prototype;return a},G=function(a,b){return function(){return a.apply(b,arguments)}},y=[].slice;this.SilkDomain="http://new.weavesilk.com";this.rand=Math.random;this.max=Math.max;this.min=Math.min;this.abs=Math.abs;this.round=Math.round;this.floor=Math.floor;this.ceil=Math.ceil;this.log=Math.log;this.pow=Math.pow;this.sin=
Math.sin;this.cos=Math.cos;this.sqrt=Math.sqrt;this.atan2=Math.atan2;this.Pi=Math.PI;this.TwoPi=2*Pi;this.HalfPi=Pi/2;this.QuarterPi=Pi/4;this.EighthPi=Pi/8;this.E=Math.E;this.Epsilon=1E-4;this.Paused=!1;this.hexToRGB=function(a){var b,c,e;b=/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(a).slice(1);e=[];for(a=c=0;2>=c;a=++c)e.push(parseInt(b[a],16));return e};this.brightenRGB=function(a,b,c,e){return[floor(min(255,a+255*e)),floor(min(255,b+255*e)),floor(min(255,c+255*e))]};this.constrain=function(a,
b,c){return a>c?c:a<b?b:a};this.randrange=function(a,b){return a+rand()*(b-a)};var H;H=0;this.autoinc=function(){return H++};this.d=function(){return"undefined"!==typeof console&&null!==console?console.log.apply(console,Array.prototype.slice.call(arguments)):void 0};this.requestAnimFrame=this.requestAnimationFrame||this.webkitRequestAnimationFrame||this.mozRequestAnimationFrame||this.oRequestAnimationFrame||this.msRequestAnimationFrame||function(a){return this.setTimeout(a,1E3/60)};this.cancelAnimFrame=
this.cancelAnimationFrame||this.webkitCancelAnimationFrame||this.mozCancelAnimationFrame||this.oCancelAnimationFrame||this.msCancelAnimationFrame||this.clearTimeout;var m=function(a){this.maxParticles=null!=a?a:500;this.start=this.end=0;this.all=Array(this.maxParticles)};m.prototype["new"]=function(){return{age:0,alive:!0}};m.prototype.shouldNotExist=function(){return this.start===this.end};m.prototype.exist=function(a){for(;!(this.start===this.end||this.all[this.start].alive);)this.all[this.start]=
null,this.start=this.inc(this.start);if(!this.shouldNotExist())return this.foreach(function(a){a.px=a.x;a.py=a.y;a.age+=1;return this.update(a)}),this.drawAll(a)};m.prototype.drawAll=function(a){var b,c,e,f,j;if(!this.shouldNotExist()&&("function"===typeof this.drawStart&&this.drawStart(a),this.foreach(function(b){if(b.alive)return this.draw(b,a)}),"function"===typeof this.drawEnd&&this.drawEnd(a),this.symmetries)){f=this.symmetries;j=[];c=0;for(e=f.length;c<e;c++)b=f[code=c],this.foreach(b.trans),"function"===
typeof this.drawStart&&this.drawStart(a),this.foreach(function(b){if(b.alive)return this.draw(b,a)}),"function"===typeof this.drawEnd&&this.drawEnd(a),j.push(this.foreach(b.inv));return j}};m.prototype.foreach=function(a){var b;for(b=this.start;b!==this.end;)a.call(this,this.all[b]),b=this.inc(b)};m.prototype.add=function(a,b){var c,e;c=this.inc(this.end);this.start===c&&(this.start=this.inc(this.start));e=this["new"]();e.x=a;e.y=b;this.all[this.end]=e;this.end=c;return e};m.prototype.inc=function(a){return(a+
1)%this.maxParticles};m.prototype.dec=function(a){return(a-1)%this.maxParticles};this.Particles=m;var l=function(){l.__super__.constructor.apply(this,arguments)};h(l,Particles);l.prototype["new"]=function(){return $.extend(l.__super__["new"].call(this),{r:255,g:255,b:255,maxA:1,radius:0.75,vx:randrange(-1,1),vy:randrange(-1,0),dieAt:25,fadeIn:!1})};l.prototype.update=function(a){var b;a.x+=a.vx;a.y+=a.vy;b=1-a.age/a.dieAt;a.a=a.fadeIn?a.maxA*sin(Pi*b):b;a.color="rgba("+a.r+", "+a.g+", "+a.b+", "+
a.a+")";return a.alive&&(a.alive=a.age<a.dieAt)};l.prototype.draw=function(a,b){if(a.alive)return b.beginPath(),b.fillStyle=a.color,b.arc(a.x,a.y,a.radius,0,TwoPi,!1),b.fill(),b.closePath()};l.prototype.addFromSilk=function(a){var b=this;a.foreach(function(c){var e;if(0.03>rand())return c=b.add(c.x,c.y),e=a.sparkRGB,c.r=e[0],c.g=e[1],c.b=e[2],e})};l.prototype.addClear=function(a,b,c){var e,f,j,B,k,g;null==b&&(b=100);null==c&&(c=1);f=a.width/2;j=a.height/2;for(g=1;1<=b?g<=b:g>=b;1<=b?++g:--g)B=randrange(0,
a.width),k=randrange(0,a.height),e=atan2(k-j,B-f),e+=randrange(-QuarterPi,QuarterPi),k=this.add(B,k),B=0.25*c,k.vx=B*cos(e),k.vy=B*sin(e),k.dieAt=randrange(25,85)};this.Sparks=l;var g=function(a,b,c,e){this.canvas=a;this.width=b;this.height=c;this.seed=e;g.__super__.constructor.call(this);this.offx=(this.width-window.innerWidth)/2;this.offy=(this.height-window.innerHeight)/2;this.age=0;this.alive=!0;this.completed=!1;this.setParams(g.defaultParams);this.perlin=new PerlinNoise(0);this.color={r:255,
g:255,b:255,a:0.07};this.sparkRGB=[255,255,255];this.num=0};h(g,Particles);g.prototype.setSymmetryTypes=function(a){var b,c,e,f,j=this;f=[];c=0;for(e=a.length;c<e;c++)switch(b=a[code=c],b){case "vertical":f.push({trans:function(a){return a.x=j.canvas.width-a.x}});break;case "horizontal":f.push({trans:function(a){return a.y=j.canvas.height-a.y}});break;case "diagonal":f.push({trans:function(a){a.x=j.canvas.width-a.x;return a.y=j.canvas.height-a.y}});break;default:f.push(void 0)}e=this.symmetries=f;b=0;
for(c=e.length;b<c;b++)a=e[b],null==a.inv&&(a.inv=a.trans)};g.prototype["new"]=function(){return $.extend(g.__super__["new"].call(this),{accx:0,accy:0,friction:this.friction,mass:1,springLength:this.springLength,rigidity:this.rigidity,death:250})};g.prototype.add=function(a,b,c,e){var f;f=this.start===this.end;a=g.__super__.add.call(this,a-this.offx,b-this.offy);f||(this.prevParticle.next=a);f=this.mouseDamp;this.reverseMouseVelocity&&(f*=-1);a.vmx=c*f;a.vmy=e*f;a.num=this.num++;return this.prevParticle=
a};g.prototype.shouldNotExist=function(){return g.__super__.shouldNotExist.call(this)||!this.alive};g.prototype.exist=function(){g.__super__.exist.apply(this,arguments);if(this.completed&&(this.color.a-=5E-4,this.color.a<Epsilon))return this.die()};g.prototype.update=function(a){var b,c;noiseDetail(this.noiseOctaves,this.noiseFallout);c=2*TwoPi*noise((a.x+this.offx)*this.noiseScale,(a.y+this.offy)*this.noiseScale,this.seed+0.008*this.age,this.perlin);c*=2;b=Pi/2;(0!==a.vmx||0!==a.vmy)&&atan2(a.vmx,
a.vmy);this.addAngleForce(a,c+b,1);this.addForce(a,a.vmx,a.vmy);a.vmx*=0.99;a.vmy*=0.99;a.rigidity*=0.999;this.wind&&this.addAngleForce(a,this.windAngle,this.windForce);null!=a.next&&(this.move(a),this.constrain(a));return a.alive&&(a.alive=a.age<a.death)};g.prototype.move=function(a){a.x+=(a.x-a.px)*a.friction+a.accx;a.y+=(a.y-a.py)*a.friction+a.accy;return a.accx=a.accy=0};g.prototype.addForce=function(a,b,c){a.accx+=b/a.mass;return a.accy+=c/a.mass};g.prototype.addAngleForce=function(a,b,c){c/=
a.mass;a.accx+=c*cos(b);return a.accy+=c*sin(b)};g.prototype.addPosition=function(a,b,c){a.x+=b;return a.y+=c};g.prototype.constrain=function(a){var b,c,e;c=a.next.x-a.x;e=a.next.y-a.y;b=Math.sqrt(c*c+e*e);if(0!==b&&(b=1-a.springLength/b,c=a.rigidity*c*b,e=a.rigidity*e*b,this.addPosition(a,c,e),null!=a.next.next))return this.addPosition(a.next,-c,-e)};g.prototype.drawStart=function(a){var b;a.beginPath();b=this.all[this.start];return 1===this.drawScale?a.moveTo(b.x*this.drawScale,b.y*this.drawScale):
a.moveTo((b.x-window.innerWidth/2)*this.drawScale+window.innerWidth/2,(b.y-window.innerHeight/2)*this.drawScale+window.innerHeight/2)};g.prototype.draw=function(a,b){var c,e,f,j;f=a.next;if(null!=(null!=f?f.next:void 0)){if(1===this.drawScale)return b.quadraticCurveTo(a.x*this.drawScale,a.y*this.drawScale,(a.x*this.drawScale+f.x*this.drawScale)/2,(a.y*this.drawScale+f.y*this.drawScale)/2);c=(a.x-window.innerWidth/2)*this.drawScale+window.innerWidth/2;e=(a.y-window.innerHeight/2)*this.drawScale+window.innerHeight/
2;j=(f.x-window.innerWidth/2)*this.drawScale+window.innerWidth/2;f=(f.y-window.innerHeight/2)*this.drawScale+window.innerHeight/2;return b.quadraticCurveTo(c,e,(c+j)/2,(e+f)/2)}};g.prototype.drawEnd=function(a){a.lineWidth=this.drawScale;a.strokeStyle="rgba("+this.color.r+", "+this.color.g+", "+this.color.b+", "+this.color.a+")";a.stroke();return a.closePath()};g.prototype.setParams=function(a){return $.extend(this,a)};g.prototype.setRGB=function(a,b,c){this.color.r=a;this.color.g=b;this.color.b=
c;return this.sparkRGB=brightenRGB(a,b,c,0.3)};g.prototype.tick=function(){return this.age+=1};g.prototype.complete=function(){return this.completed=!0};g.prototype.die=function(){return this.alive=!1};g.originalParams={noiseOctaves:8,noiseFallout:0.65,noiseScale:0.01,wind:!1,windAngle:-Pi,windForce:0.75,friction:0.975,springLength:0,rigidity:0.3,reverseMouseVelocity:!1,mouseDamp:0.2};g.randomParams=function(){return{noiseOctaves:randrange(2,9),noiseFallout:randrange(0.25,1),noiseScale:randrange(0.001,
0.1),wind:0.5>rand(),windAngle:randrange(0,TwoPi),windForce:randrange(0.5,1),friction:randrange(0,1),springLength:randrange(0,20),rigidity:randrange(0,1),reverseMouseVelocity:0.5>rand(),mouseDamp:randrange(0,1)}};g.defaultParams=g.originalParams;g.setDefaultParams=function(a){this.defaultParams=a};g.resetDefaultParams=function(){return this.setDefaultParams(this.originalParams)};this.Silk=g;h=function(a,b,c){this.getPictureURL=G(this.getPictureURL,this);this.toBlob=G(this.toBlob,this);var e=this;
this.silkOne=$(a)[0];this.silkTwo=$(b)[0];this.silkCanvas=this.silkOne;this.bufferCanvas=this.silkTwo;this.sparksCanvas=$(c)[0];this.silks={};this.time=0;this.pristine=ko.observable(!0);this.dirty=ko.observable(!1);this.undoState=ko.observable(null);this.canUndo=ko.computed(function(){return null!=e.undoState()&&!e.dirty()});this.tape=new Tape(this);this.replay=new Tape(this);this.sparks=new Sparks;this.replayUrl=ko.observable("");this.saving=ko.observable(!1);this.setRGB("dd4876");this.setSymmetryTypes("vertical");
this.drawScale=1};h.prototype.load=function(a){var b=this;$.ajax({type:"GET",url:"/v1/load",data:{id:a},success:function(a){a=JSON.parse(a);b.replay=new Tape(b);return b.replay.load(a)}});return this.replayUrl("/?"+a)};h.prototype.save=function(){var a,b=this;a=JSON.stringify(this.tape.get());$.ajax({type:"POST",url:"/v1/save",data:{contents:a},success:function(a){b.replayUrl("/?"+a);return b.saving(!1)}});return this.saving(!0)};h.prototype.toBlob=function(){return this.silkCanvas.toBlob(function(a){return saveAs(a,
"silk.png")})};h.prototype.getPictureURL=function(){var a,b,c,e,f,j;a=this.silkCanvas;c=a.getContext("2d");j=a.width;f=a.height;e=c.getImageData(0,0,j,f);b=c.globalCompositeOperation;c.globalCompositeOperation="destination-over";c.fillStyle="#000";c.fillRect(0,0,j,f);a=a.toDataURL("image/png");c.clearRect(0,0,j,f);c.putImageData(e,0,0);c.globalCompositeOperation=b;return a};h.prototype.swapSilkCanvii=function(){this.silkCanvas===this.silkOne?(this.bufferCanvas=this.silkOne,this.silkCanvas=this.silkTwo):
(this.silkCanvas=this.silkOne,this.bufferCanvas=this.silkTwo);$(this.silkCanvas).insertBefore($(this.bufferCanvas));$(this.silkCanvas).addClass("active");return $(this.bufferCanvas).removeClass("active")};h.prototype.add=function(a,b,c,e,f,j){var g;null==a&&(a=(new Date).getTime());null==b&&(b=this.rgb);null==c&&(c=this.symmetryTypes);null==e&&(e=this.silkCanvas.width);null==f&&(f=this.silkCanvas.height);null==j&&(j=randrange(0,1E6)|0);this.tape.recStart();this.tape.rec("add",a,b,c,e,f,j);this.silks[a]=
new Silk(this.silkCanvas,e,f,j);this.silks[a].drawScale=this.drawScale;(g=this.silks[a]).setRGB.apply(g,b);this.silks[a].setSymmetryTypes(c);this.dirty(!0);this.pristine(!1);return a};h.prototype.addPoint=function(a,b,c,e,f){var j;this.tape.rec("addPoint",a,b,c,e,f);return null!=(j=this.silks[a])?j.add(b,c,e,f):void 0};h.prototype.complete=function(a){var b,c,e;if(null!=this.silks[a]&&!this.silks[a].completed){this.tape.rec("complete",a);this.silks[a].complete();b=!0;e=this.silks;for(a in e)if(c=
e[a],!c.completed){b=!1;break}if(b&&(this.tape.recStop(),10<this.tape.time-this.tape.startedTime))return this.tape.advance(15)}};h.prototype.clear=function(){var a,b;if(this.dirty()){b=this.tape.eject();this.replay.eject();this.undoState({time:this.time,tapeContents:b,replayUrl:this.replayUrl()});this.replayUrl("");b=this.silks;for(a in b)this.complete(a);this.silks={};this.dirty(!1);this.time=0;a=this.bufferCanvas.getContext("2d");a.clearRect(0,0,this.bufferCanvas.width,this.bufferCanvas.height);
$(this.silkCanvas).addClass("hidden");$(this.bufferCanvas).removeClass("hidden");this.swapSilkCanvii()}return this.sparks.addClear(this.sparksCanvas,100)};h.prototype.undoClear=function(){var a;if(this.canUndo())return a=this.undoState(),this.time=a.time,this.tape.load(a.tapeContents),this.replayUrl(a.replayUrl),this.undoState(null),this.dirty(!0),$(this.bufferCanvas).removeClass("hidden"),this.swapSilkCanvii(),this.sparks.addClear(this.sparksCanvas,100,-1)};h.prototype.exist=function(){var a,b,c,
e,f,j;c=this.silkCanvas.getContext("2d");e=this.sparksCanvas.getContext("2d");c.globalCompositeOperation="lighter";j=this.silks;for(a in j)if(b=j[a],b.alive){this.sparks.addFromSilk(b);for(f=1;6>=f;++f)b.exist(c);b.tick()}else delete this.silks[a];e.clearRect(0,0,this.sparksCanvas.width,this.sparksCanvas.height);this.sparks.exist(e);this.replay.play();this.tape.recording&&this.tape.tick();this.replay.tick();return this.tick()};h.prototype.tick=function(){return this.time+=1};h.prototype.setRandomParams=
function(a){null==a&&(a=Silk.randomParams());return Silk.setDefaultParams(a)};h.prototype.unsetRandomParams=function(){return Silk.resetDefaultParams()};h.prototype.setSymmetryTypes=function(){return this.symmetryTypes=1<=arguments.length?y.call(arguments,0):[]};h.prototype.setRGB=function(a){return this.rgb=hexToRGB(a)};this.Silks=h;ZeroClipboard.setMoviePath(SilkDomain+"/js/ZeroClipboard.swf");this.initControls=function(a,b){var c,e,f,j,g,k,h,C,m,n,t,l,p,r,D,w,x,E,u,z,q,s,v,F;C=a.silkOne;E=a.silkTwo;
u=a.sparksCanvas;initResizeHandler(C,E,u);l=n=u.width/2;p=t=u.height/2;z=q=s=0;m=!1;r=null;C=!1;try{(h=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))&&(C=!0)}catch(K){null!=navigator.mimeTypes["application/x-shockwave-flash"]&&(C=!0)}D=function(){b.start();m=!0;r=a.add();b.playDrawSound();k.ui.replayUrl("");return!1};c=$(u);w=function(a){var b,e;b=c.offset();e=b.left;b=b.top;n=a.pageX-e;return t=a.pageY-b};x=function(){m=!1;a.complete(r);return b.stopDrawSound()};$(document).mouseup(function(a){if(1===
a.which)return x()});$(u).mousedown(function(a){if(1===a.which)return k.ui.showAbout(!1),D()}).mousemove(function(a){return w(a)}).mouseup(function(a){if(1===a.which)return x()}).bind("touchstart",function(a){w(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0]);l=n;p=t;D();return!1}).bind("touchmove",function(a){w(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0]);return!1}).bind("touchend",function(){x();return!1});k={exist:function(){var b;m?(a.addPoint(r,n,t,n-l,t-p),q=
l-n,s=p-t,b=q*q+s*s,z=0<b?sqrt(b):0):q=s=z=0;l=n;return p=t},vmouse:function(){return z},ui:{pristine:a.pristine,dirty:a.dirty,canUndo:a.canUndo,replayUrl:a.replayUrl,saving:a.saving,canClip:C,clipText:ko.observable("Copy link"),showSaveOverlay:ko.observable(!1),showAbout:ko.observable(!1),emailUrl:ko.computed(function(){return"mailto:?subject=Silk&body="+(SilkDomain+a.replayUrl())}),fbUrl:ko.computed(function(){var b;b=SilkDomain+a.replayUrl();return["https://www.facebook.com/dialog/feed?&app_id=408271179236250",
"link="+b,"picture="+SilkDomain+"/img/fb_share_thumb.jpg","name=Silk&caption=&description=Create beautiful art with Silk, an interactive generative artwork.","redirect_uri="+b].join("&")}),twitterUrl:ko.computed(function(){return"https://twitter.com/share?url="+SilkDomain+a.replayUrl()}),muteMusic:b.muteMusic,muteSound:b.muteSound,symmetry:ko.observable(""),color:ko.observable(""),savePicture:function(){return a.toBlob()},setColor:function(a){k.ui.color(a);return b.blip()},setSymmetry:function(a){return k.ui.symmetry(a)},
share:function(){return a.save()},clear:function(){a.clear();r=null;b.playClearSound();return refreshCarbonAd()},undo:function(){b.blip(1.25);return a.undoClear()},randomize:function(){return a.setRandomParams()},unrandomize:function(){return a.unsetRandomParams()},toggleAbout:function(){return k.ui.showAbout(!k.ui.showAbout())},toggleMusic:function(){return b.muteMusic()?b.setMuteMusic(!1):b.setMuteMusic(!0)},toggleSound:function(){if(b.muteSound())return b.setMuteMusic(!1),b.setMuteEffects(!1);
b.setMuteMusic(!0);return b.setMuteEffects(!0)},bloop:function(){return b.bloop()}}};e=new ZeroClipboard.Client;e.glue("copy-to-clipboard","copy-to-clipboard-wrap");a.replayUrl.subscribe(function(a){return e.setText(SilkDomain+a)});e.addEventListener("onMouseOver",function(){return k.ui.clipText("Copy link")});e.addEventListener("onComplete",function(){return k.ui.clipText("Copied.")});g={blue:"#3d95cc",green:"#53BD39",yellow:"#E3BF30",orange:"#EB5126",pink:"#dd4876",grey:"#555555"};j=ko.computed(function(){return g[k.ui.color()]});
k.ui.color.subscribe(function(b){sessionStorage.colorName=b;j=g[b];a.setRGB(j);return $("#colors").css("background-color",j)});for(f in g)h=g[f],$("#colors ."+f).css("background",h);k.ui.symmetry.subscribe(function(b){sessionStorage.symmetryKind=b;switch(b){case "none":return a.setSymmetryTypes();case "vertical":return a.setSymmetryTypes("vertical");case "both":return a.setSymmetryTypes("horizontal","vertical","diagonal")}});k.ui.color(null!=(v=sessionStorage.colorName)?v:"blue");k.ui.symmetry(null!=
(F=sessionStorage.symmetryKind)?F:"vertical");key("x, space",function(){return k.ui.clear()});key("u",function(){return k.ui.undo()});return k};this.initResizeHandler=function(){var a,b;a=1<=arguments.length?y.call(arguments,0):[];b=function(){var b,e,f,j,g,k,h;h=[];g=0;for(k=a.length;g<k;g++)e=a[g],b=e.getContext("2d"),j=e.width,f=e.height,f=b.getImageData(0,0,j-1,f-1),b=$(window),e.width=b.width(),e.height=b.height(),b=e.getContext("2d"),h.push(b.putImageData(f,0,0));return h};b();return $(window).resize(b)};
h=function(a){this.source=a;this.load({})};h.prototype.recStart=function(){this.recording=!0;return this.startedTime=this.time};h.prototype.rec=function(){var a,b,c;a=1<=arguments.length?y.call(arguments,0):[];if(this.recording){if(null==(b=this.tape)[c=this.time])b[code=c]=[];return this.tape[this.time].push(a)}return d("Error: Not recording.",a)};h.prototype.recStop=function(){return this.recording=!1};h.prototype.advance=function(a){return this.time+=a};h.prototype.play=function(){var a,b,c,e,f,g;if(this.time in
this.tape){f=this.tape[this.time];c=0;for(e=f.length;c<e;c++)a=f[code=c],b=a[0],a=2<=a.length?y.call(a,1):[],(g=this.source)[b].apply(g,a)}};h.prototype.tick=function(){return this.time+=1};h.prototype.load=function(a){this.tape=a;return this.time=0};h.prototype.get=function(){return this.tape};h.prototype.eject=function(){var a;a=this.tape;this.load({});return a};this.Tape=h;this.initAudio=function(){var a,b,c,e,f,g,h,k,l,m,y,n,t,A,p,r,D,w,x,E,u,z;this.audioContext=this.audioContext||this.webkitAudioContext;
var q=function(a,b){this.buffer=a;this.ctx=b;this.setLoop(!1);this.setVolume(1)};q.prototype.setLoop=function(a){this.loop=a};q.prototype.setVolume=function(a){this.gain=a};q.prototype.createSource=function(){this.source=this.ctx.createBufferSource();this.source.buffer=this.buffer;this.source.loop=this.loop;this.source.gain.value=this.gain;return this.source.connect(this.ctx.destination)};q.prototype.play=function(){var a;return null!=(a=this.source)?a.noteOn(0):void 0};q.prototype.fadeTo=function(a,
b){var c;this.gain=a;c=this.ctx.currentTime;this.source.gain.cancelScheduledValues(c);this.source.gain.setValueAtTime(this.source.gain.value,c);return this.source.gain.linearRampToValueAtTime(this.gain,c+b)};q.prototype.trigger=function(a){var b,c;null==a&&(a=1);b=this.triggerSource;this.triggerSource=this.triggerSourceBk;this.triggerSourceBk=b;null!=(c=this.triggerSource)&&c.noteOff(0);this.triggerSource=this.ctx.createBufferSource();this.triggerSource.buffer=this.buffer;this.triggerSource.loop=
this.loop;this.triggerSource.gain.value=this.gain*a;this.triggerSource.connect(this.ctx.destination);return this.triggerSource.noteOn(0)};z=function(a){return"http://yurivish.com/Silk%20Static/srv.php?file=audio/"+escape(a)};t=function(a,b,c,e){var f;f=new XMLHttpRequest;f.open("GET",a,!0);f.responseType="arraybuffer";f.onload=function(){return b.decodeAudioData(f.response,function(a){return"function"===typeof c?c(a):void 0},function(){return"function"===typeof e?e(req,a):void 0})};return f.send()};
if(null!=this.audioContext){g=new this.audioContext;n=function(a,b){var c;c=z(a);return t(c,g,function(a){a=new q(a,g);return b(a)})};var s,v,F;s=[];F=function(a){a.setVolume(0.27);s.push(a);return 4===s.length};n("Clear 1 16-44.m4a",F);v=1;w=function(){var a;0<v&&(a=floor(randrange(0,s.length)),s[a].trigger());if(4>v)return n("Clear "+(v+1)+" 16-44.m4a",F),v+=1};k=null;n("Sparks 16-44 -looped.m4a",function(a){k=a;k.setVolume(0);k.setLoop(!0);k.createSource();return k.play()});l=null;n("Draw B2 2048 loop.m4a",
function(a){l=a;l.setVolume(0);l.setLoop(!0);l.createSource();return l.play()});m=!1;x=function(){m=!0;null!=k&&k.fadeTo(0.02,0.5);return null!=l?l.fadeTo(0.15,0.5):void 0};u=function(){m=!1;null!=k&&k.fadeTo(0,1);return null!=l?l.fadeTo(0,1):void 0};A=function(a){if(m)return a=log(log(a*(1/30)+1)),a=constrain(a,0.15,0.6),null!=l?l.fadeTo(a,0.2):void 0};e=null;n("Palette A5.m4a",function(a){e=a;return e.setVolume(0.4)});f=null;n("Palette A4.m4a",function(a){f=a;return f.setVolume(0.3)})}r=ko.observable(null!=
localStorage.getItem("muteMusic"));p=ko.observable(null!=localStorage.getItem("muteEffects"));D=ko.computed(function(){return r()&&p()});E=!1;a=$("#bg-music")[0];b=$("#bg-music-intro")[0];c=!1;y=function(){a.volume=0;a.play();return setTimeout(function(){var b;return b=setInterval(function(){a.volume+=0.5/150;a.volume=min(a.volume,0.5)+0.01;if(0.5<=a.volume)return clearInterval(b)},100)},500)};return h={muteMusic:r,muteSound:D,setMuteMusic:function(c){r(c);c?localStorage.setItem("muteMusic",!0):(localStorage.removeItem("muteMusic"),
h.setMuteEffects(!1),h.start());b.muted=c;return a.muted=c},setMuteEffects:function(a){p(a);return a?localStorage.setItem("muteEffects",!0):localStorage.removeItem("muteEffects")},start:function(){var e;if(!E&&!r())return E=!0,e=setInterval(function(){var f;f=0<a.buffered.length&&10<a.buffered.end(0);0<b.buffered.length&&2<b.buffered.end(0)&&!c&&(b.volume=0.55,b.play(),c=!0);if(f)return clearInterval(e),y()},100)},playClearSound:function(){if(!p())return"function"===typeof w?w():void 0},playDrawSound:function(){if(!p())return"function"===
typeof x?x():void 0},stopDrawSound:function(){if(!p())return"function"===typeof u?u():void 0},modulateDrawSound:function(a){return"function"===typeof A?A(a):void 0},blip:function(a){if(!p())return null!=e?e.trigger(a):void 0},bloop:function(a){if(!p())return null!=f?f.trigger(a):void 0}}};var A,I;I=function(){return(new Date).getTime()/1E3};A=0;this.refreshCarbonAd=function(){var a;a=I();30<a-A&&(A=a)};$(function(){var a,b,c,e,f,g,h;h=new Silks("#silk-1","#silk-2","#sparks");a=initAudio();b=initControls(h,
a);f=document.location.href.indexOf("?");-1<f?(g=document.location.href.indexOf("&"),e=document.location.href.substring(f+1),-1<g&&(e=e.substring(0,g-f-1)),d("Loading silk",e),h.load(e)):refreshCarbonAd();c=function(){b.exist();h.exist();a.modulateDrawSound(b.vmouse());return requestAnimFrame(c)};c();return ko.applyBindings(b.ui,$("#body")[0])})}).call(this);
Alles anzeigen
Stammt von http://new.weavesilk.com/ ![]()
Gruß,
UEZ
Sieht jetzt gut aus. ![]()
Gruß,
UEZ
Schaue mal, ob das hier passt:
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Icons\Stop.ico
#AutoIt3Wrapper_Outfile=Stoppuhr.exe
#AutoIt3Wrapper_Res_Description=Stoppuhr
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Oscar (http://www.autoit.de)
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UPX_Parameters=--best --lzma
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <StaticConstants.au3>
#include <Timers.au3>
#include <WindowsConstants.au3>
Opt('GuiOnEventMode', 1)
Opt('MustDeclareVars', 1)
Global $sProgName = 'Stoppuhr'
Global $sProgVersion = '1.1.0.0'
Global $sProgDate = '07.02.2013'
_GDIPlus_Startup()
Global Const $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0
Global $hHBmp_Info = _GDIPlus_BMPFromMemory(_Infopng(), True)
Global $hHBmp_Pause = _GDIPlus_BMPFromMemory(_Pausepng(), True)
Global $hHBmp_Start = _GDIPlus_BMPFromMemory(_Startpng(), True)
Global $hHBmp_Stop = _GDIPlus_BMPFromMemory(_Stoppng(), True)
Global $hBmp_Stop = _GDIPlus_BMPFromMemory(_Stoppng())
Global $aWeekday = StringSplit('Sonntag|Montag|Dienstag|Mittwoch|Donnerstag|Freitag|Samstag', '|', 1)
Global $iStopTime, $iClock, $sLastDate, $hHelpGui, $hIcon_HelpGUI, $idAuthor1, $idAuthor2, $sLink1, $sLink2
Global $iLaptime = 0, $iLastticks = 0, $iPauseTimer = 0, $aPauseTimer[1], $iPauseCount = 0, $fTimerStop = False
Global $hGui = GUICreate(StringFormat('%s v%3.3s', $sProgName, $sProgVersion), 620, 380)
GUISetOnEvent($GUI_EVENT_CLOSE, '_CloseGui')
GUISetBkColor(0xDDDDDD)
;~ GUISetIcon($sIconDir & '\Stop.ico', 0)
Global $hIcon_GUI = _WinAPI_SetWindowTitleIcon($hBmp_Stop, $hGui)
;~ Global $ID_Icon = GUICtrlCreateIcon($sIconDir & '\Stop.ico', 0, 15, 4, 32, 32)
Global $ID_Icon = GUICtrlCreatePic('', 15, 4, 32, 32)
_hBmpToPicControl($ID_Icon, $hHBmp_Stop)
Global $ID_Date = GUICtrlCreateLabel('', 60, 10, 290, 22, $SS_Left)
GUICtrlSetFont(-1, 14, 800, 0, 'Courier New', 4)
Global $ID_Clock = GUICtrlCreateLabel('', 310, 10, 250, 22, $SS_RIGHT)
GUICtrlSetFont(-1, 14, 800, 0, 'Courier New', 4)
;~ Global $ID_Info = GUICtrlCreateIcon($sIconDir & '\Info.ico', 0, 578, 4, 32, 32)
Global $ID_Info = GUICtrlCreatePic('', 578, 4, 32, 32)
_hBmpToPicControl($ID_Info, $hHBmp_Info)
GUICtrlSetTip(-1, 'Informationen über das Programm')
GUICtrlSetOnEvent(-1, '_ShowHelp')
Global $ID_Label = GUICtrlCreateInput('0', 10, 40, 600, 64, BitOR($ES_CENTER, $ES_READONLY), $WS_EX_STATICEDGE)
GUICtrlSetFont(-1, 42, 800, 0, 'Courier New', 4)
GUICtrlSetBkColor(-1, 0xFFFFAA)
Global $ID_Laptime = GUICtrlCreateListView('Nr.|Gesamtzeit|Rundenzeit|Uhrzeit', 10, 110, 600, 220, $BS_DEFPUSHBUTTON)
GUICtrlSetFont(-1, 14, 800, 0, 'Courier New', 4)
Global $ID_Context = GUICtrlCreateContextMenu($ID_Laptime)
GUICtrlCreateMenuItem('Rundenzeiten in die Zwischenablage kopieren...', $ID_Context)
GUICtrlSetOnEvent(-1, '_CopyLaptimeToClip')
Global $hLaptime = GUICtrlGetHandle($ID_Laptime)
_GUICtrlListView_JustifyColumn($hLaptime, 0, 1)
_GUICtrlListView_JustifyColumn($hLaptime, 1, 1)
_GUICtrlListView_JustifyColumn($hLaptime, 2, 1)
_GUICtrlListView_JustifyColumn($hLaptime, 3, 1)
_GUICtrlListView_SetColumnWidth($hLaptime, 0, 80)
_GUICtrlListView_SetColumnWidth($hLaptime, 1, 180)
_GUICtrlListView_SetColumnWidth($hLaptime, 2, 180)
_GUICtrlListView_SetColumnWidth($hLaptime, 3, 120)
Global $ID_Start = GUICtrlCreateButton('Start', 10, 340, 140, 32)
GUICtrlSetFont(-1, 11, 400, 0, 'Arial')
GUICtrlSetOnEvent(-1, '_StartTimer')
Global $ID_Pause = GUICtrlCreateButton('Pause', 170, 340, 140, 32)
GUICtrlSetFont(-1, 11, 400, 0, 'Arial')
GUICtrlSetOnEvent(-1, '_PauseTimer')
Global $ID_Lap = GUICtrlCreateButton('Rundenzeit', 320, 340, 140, 32)
GUICtrlSetFont(-1, 11, 400, 0, 'Arial')
GUICtrlSetOnEvent(-1, '_Laptime')
Global $ID_Stop = GUICtrlCreateButton('Stop', 470, 340, 140, 32)
GUICtrlSetFont(-1, 11, 400, 0, 'Arial')
GUICtrlSetOnEvent(-1, '_StopTimer')
GUICtrlSetState($ID_Pause, $GUI_DISABLE)
GUICtrlSetState($ID_Stop, $GUI_DISABLE)
GUICtrlSetState($ID_Lap, $GUI_DISABLE)
_ShowClock(0, 0, 0, 0)
$iClock = _Timer_SetTimer($hGui, 250, '_ShowClock')
GUISetState(@SW_SHOW, $hGui)
Global $iTimer = TimerInit()
For $i = 1 To 10
_ShowTimer(0, 0, 0, 0)
Next
Global $iElapse = Int(TimerDiff($iTimer))
_CreateHelp()
GUICtrlSetData($ID_Label, _TicksToTimeFormat(0, '%hh:%mm:%ss.%ms'))
GUICtrlSetState($ID_Start, $GUI_FOCUS)
WinWaitClose($hGui)
_Timer_KillAllTimers($hGui)
Exit
Func _CloseGui()
_WinAPI_DeleteObject($hHBmp_Info)
_WinAPI_DeleteObject($hHBmp_Pause)
_WinAPI_DeleteObject($hHBmp_Start)
_WinAPI_DeleteObject($hHBmp_Stop)
_GDIPlus_BitmapDispose($hBmp_Stop)
_WinAPI_DestroyIcon($hIcon_GUI)
_GDIPlus_Shutdown()
GUIDelete($hGui)
EndFunc ;==>_CloseGui
Func _ShowClock($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
Local $sDate = @MDAY & @MON & @YEAR
GUICtrlSetData($ID_Clock, StringFormat('%02d:%02d:%02d', @HOUR, @MIN, @SEC))
If $sDate <> $sLastDate Then
$sLastDate = $sDate
GUICtrlSetData($ID_Date, StringFormat('%s, %02d.%02d.%04d', $aWeekday[@WDAY], @MDAY, @MON, @YEAR))
EndIf
EndFunc ;==>_ShowClock
Func _ShowTimer($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
If $fTimerStop Then Return
Local $iTicks = TimerDiff($iTimer)
For $i = 0 To $iPauseCount - 1
$iTicks -= $aPauseTimer[$i]
Next
GUICtrlSetData($ID_Label, _TicksToTimeFormat($iTicks, '%hh:%mm:%ss.%ms'))
EndFunc ;==>_ShowTimer
Func _CopyLaptimeToClip()
Local $sClipboard = ''
For $i = 0 To $iLaptime - 1
$sClipboard &= _GUICtrlListView_GetItemTextString($hLaptime, $i) & @CRLF
Next
ClipPut(StringReplace($sClipboard, '|', ' --- '))
EndFunc ;==>_CopyLaptimeToClip
Func _StartTimer()
;~ GUICtrlSetImage($ID_Icon, $sIconDir & '\Start.ico')
;~ GUISetIcon($sIconDir & '\Start.ico', 0, $hGui)
_hBmpToPicControl($ID_Icon, 0)
_hBmpToPicControl($ID_Icon, $hHBmp_Start)
Global $iLaptime = 0, $iLastticks = 0, $iPauseTimer = 0, $aPauseTimer[1], $iPauseCount = 0
GUICtrlSetData($ID_Stop, 'Stop')
GUICtrlSetOnEvent($ID_Stop, '_StopTimer')
GUICtrlSetState($ID_Start, $GUI_DISABLE)
GUICtrlSetState($ID_Stop, $GUI_ENABLE)
GUICtrlSetState($ID_Lap, $GUI_ENABLE)
GUICtrlSetState($ID_Pause, $GUI_ENABLE)
GUICtrlSetState($ID_Lap, $GUI_FOCUS)
_GUICtrlListView_DeleteAllItems($hLaptime)
$iTimer = TimerInit()
$fTimerStop = False
$iStopTime = _Timer_SetTimer($hGui, $iElapse, '_ShowTimer')
EndFunc ;==>_StartTimer
Func _DelResult()
Global $iLaptime = 0, $iLastticks = 0, $iPauseTimer = 0, $aPauseTimer[1], $iPauseCount = 0
GUICtrlSetData($ID_Label, _TicksToTimeFormat($iLastticks, '%hh:%mm:%ss.%ms'))
GUICtrlSetData($ID_Stop, 'Stop')
GUICtrlSetOnEvent($ID_Stop, '_StopTimer')
GUICtrlSetState($ID_Start, $GUI_ENABLE)
GUICtrlSetState($ID_Stop, $GUI_DISABLE)
GUICtrlSetState($ID_Lap, $GUI_DISABLE)
GUICtrlSetState($ID_Pause, $GUI_DISABLE)
_GUICtrlListView_DeleteAllItems($hLaptime)
GUICtrlSetState($ID_Start, $GUI_FOCUS)
EndFunc ;==>_DelResult
Func _PauseTimer()
;~ GUISetIcon($sIconDir & '\Pause.ico', 0, $hGui)
;~ GUICtrlSetImage($ID_Icon, $sIconDir & '\Pause.ico')
_hBmpToPicControl($ID_Icon, 0)
_hBmpToPicControl($ID_Icon, $hHBmp_Pause)
$fTimerStop = True
_Timer_KillTimer($hGui, $iStopTime)
$iPauseTimer = TimerInit()
GUICtrlSetState($ID_Lap, $GUI_DISABLE)
GUICtrlSetData($ID_Pause, 'Weiter')
GUICtrlSetOnEvent($ID_Pause, '_ContinueTimer')
EndFunc ;==>_PauseTimer
Func _ContinueTimer()
;~ GUISetIcon($sIconDir & '\Start.ico', 0, $hGui)
;~ GUICtrlSetImage($ID_Icon, $sIconDir & '\Start.ico')
_hBmpToPicControl($ID_Icon, 0)
_hBmpToPicControl($ID_Icon, $hHBmp_Start)
$aPauseTimer[$iPauseCount] = TimerDiff($iPauseTimer)
$iPauseCount += 1
ReDim $aPauseTimer[$iPauseCount + 1]
GUICtrlSetState($ID_Lap, $GUI_ENABLE)
GUICtrlSetData($ID_Pause, 'Pause')
GUICtrlSetOnEvent($ID_Pause, '_PauseTimer')
$fTimerStop = False
$iStopTime = _Timer_SetTimer($hGui, $iElapse, '_ShowTimer')
EndFunc ;==>_ContinueTimer
Func _Laptime()
Local $iTicks = TimerDiff($iTimer), $iLasttime
For $i = 0 To $iPauseCount - 1
$iTicks -= $aPauseTimer[$i]
Next
$iLasttime = _TicksToTimeFormat($iTicks - $iLastticks, '%hh:%mm:%ss.%ms')
$iLastticks = $iTicks
$iLaptime += 1
GUICtrlCreateListViewItem($iLaptime & '.|' & _TicksToTimeFormat($iTicks, '%hh:%mm:%ss.%ms') & '|' & $iLasttime & '|' & StringFormat('%02d:%02d:%02d', @HOUR, @MIN, @SEC), $ID_Laptime)
_GUICtrlListView_EnsureVisible($hLaptime, $iLaptime - 1)
Return $iTicks
EndFunc ;==>_Laptime
Func _StopTimer()
;~ GUISetIcon($sIconDir & '\Stop.ico', 0, $hGui)
;~ GUICtrlSetImage($ID_Icon, $sIconDir & '\Stop.ico')
_hBmpToPicControl($ID_Icon, 0)
_hBmpToPicControl($ID_Icon, $hHBmp_Stop)
$fTimerStop = True
_Timer_KillTimer($hGui, $iStopTime)
Local $iTicks = _Laptime()
GUICtrlSetData($ID_Label, _TicksToTimeFormat($iTicks, '%hh:%mm:%ss.%ms'))
GUICtrlSetState($ID_Lap, $GUI_DISABLE)
GUICtrlSetState($ID_Pause, $GUI_DISABLE)
GUICtrlSetState($ID_Start, $GUI_ENABLE)
GUICtrlSetData($ID_Pause, 'Pause')
GUICtrlSetOnEvent($ID_Pause, '_PauseTimer')
GUICtrlSetData($ID_Stop, 'Löschen')
GUICtrlSetOnEvent($ID_Stop, '_DelResult')
GUICtrlSetState($ID_Start, $GUI_FOCUS)
EndFunc ;==>_StopTimer
Func _ShowHelp()
GUISetState(@SW_SHOW, $hHelpGui)
EndFunc
Func _CloseHelp()
GUISetState(@SW_HIDE, $hHelpGui)
EndFunc
Func _CreateHelp()
Local $sMsg, $iWidth = 590
$hHelpGui = GUICreate($sProgName & ' - Hilfe', $iWidth + 20, 280, -1, -1, BitOR($WS_POPUPWINDOW, $WS_CAPTION), Default, $hGui)
GUISetOnEvent($GUI_EVENT_CLOSE, '_CloseHelp', $hHelpGui)
;~ GUISetIcon($sIconDir & '\Info.ico')
GUISetBkColor(0xFFFFDD)
$sMsg = 'Version: %s\t Anzeigetimer: %sms\nDatum: %s'
GUICtrlCreateLabel(StringFormat($sMsg, $sProgVersion, $iElapse, $sProgDate), 80, 15, $iWidth, 40)
GUICtrlSetFont(-1, 12, 600, 0, 'Verdana')
;~ GUICtrlCreateIcon($sIconDir & '\Start.ico', 0, 10, 15, 32, 32)
Local $ID_IconHelp = GUICtrlCreatePic('', 10, 15, 32, 32)
_hBmpToPicControl($ID_IconHelp, $hHBmp_Start)
$sMsg = 'Autor "Stoppuhr": \tThomas Stephan'
GUICtrlCreateLabel(StringFormat($sMsg), 10, 70, 320, 20)
GUICtrlSetFont(-1, 10, 400, 0, 'Verdana')
$sLink1 = 'mailto:oscar@elektronik-kurs.de'
$idAuthor1 = GUICtrlCreateLabel($sLink1, 330, 70, 260, 20)
GUICtrlSetOnEvent(-1, '_ShowLink')
GUICtrlSetFont(-1, 10, 400, 4, 'Verdana')
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$sMsg = 'Autor der Icons: \tFatCow'
GUICtrlCreateLabel(StringFormat($sMsg), 10, 100, 300, 20)
GUICtrlSetFont(-1, 10, 400, 0, 'Verdana')
$sLink2 = 'http://www.fatcow.com/'
$idAuthor2 = GUICtrlCreateLabel($sLink2, 330, 100, 260, 20)
GUICtrlSetOnEvent(-1, '_ShowLink')
GUICtrlSetFont(-1, 10, 400, 4, 'Verdana')
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
$sMsg = 'Rechtliches:'
GUICtrlCreateLabel(StringFormat($sMsg), 10, 150, $iWidth, 20)
GUICtrlSetFont(-1, 11, 800, 4, 'Verdana')
$sMsg = '- Dieses Programm darf, zeitlich unbegrenzt, kostenlos genutzt werden!\n'
$sMsg &= '- Eine evtl. Weitergabe muss kostenlos, vollständig und unverändert erfolgen!\n'
$sMsg &= '- Änderungen am Programm dürfen nur durch den Autor vorgenommen werden!\n\n'
GUICtrlCreateLabel(StringFormat($sMsg), 10, 170, $iWidth, 60)
GUICtrlSetFont(-1, 11, 400, 2, 'Verdana')
GUICtrlCreateButton('Ok', Int($iWidth / 2) - 40, 240, 80, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, '_CloseHelp')
GUICtrlSetFont(-1, 10, 400, 0, 'Arial')
EndFunc
Func _ShowLink()
Switch @GUI_CtrlId
Case $idAuthor1
ShellExecute($sLink1)
Case $idAuthor2
ShellExecute($sLink2)
EndSwitch
EndFunc
;===============================================================================
; Function Name: _TicksToTimeFormat($iTicks, $sFormat = '%hh:%mm:%ss')
; Description:: Diese Funktion wandelt Millisekunden in ein anzugebenes Zeitformat um
; Parameter(s): $iTicks = Zeit in Millisekunden
; $sFormat:
; %ww für Wochen
; %dd für Tage
; %hh für Stunden
; %mm für Minuten
; %ss für Sekunden
; %ms für Millisekunden
; sonstige Zeichen, die dazwischen stehen, werden übernommen
; Requirement(s): -
; Return Value(s): Zeit im ausgewählten Format (String)
; Author(s): Oscar (http://www.autoit.de)
;===============================================================================
Func _TicksToTimeFormat($iTicks, $sFormat = '%hh:%mm:%ss')
Local $aTime[6], $sOut, $aTimeFormat[6] = ['ww', 'dd', 'hh', 'mm', 'ss', 'ms'], $aFormat
$aTime[4] = Int($iTicks / 1000)
$aTime[5] = $iTicks - $aTime[4] * 1000
$aTime[0] = Int($aTime[4] / 604800)
$aTime[4] = Mod($aTime[4], 604800)
$aTime[1] = Int($aTime[4] / 86400)
$aTime[4] = Mod($aTime[4], 86400)
$aTime[2] = Int($aTime[4] / 3600)
$aTime[4] = Mod($aTime[4], 3600)
$aTime[3] = Int($aTime[4] / 60)
$aTime[4] = Mod($aTime[4], 60)
$aFormat = StringRegExp($sFormat, '%([^%]+)', 3)
If Not IsArray($aFormat) Then Return SetError(1, 0, $iTicks)
For $i = 0 To UBound($aFormat) - 1
For $j = 0 To UBound($aTimeFormat) - 1
If StringLeft($aFormat[$i], 2) = $aTimeFormat[$j] Then $sOut &= StringFormat('%0' & 2 + ($j = 5) & 'i', $aTime[$j]) & StringMid($aFormat[$i], 3)
Next
Next
Return $sOut
EndFunc ;==>_TicksToTimeFormat
Func _hBmpToPicControl($iCID, $hBmp, $iFlag = 0)
Local $hOldBmp
$hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
If $iFlag Then _WinAPI_DeleteObject($hBmp)
EndFunc ;==>_hBmpToPicControl
;======================================================================================
; Function Name: _GDIPlus_BMPFromMemory
; Description: Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap
;
; Parameters: $bImage: the binary string which contains any valid image which is supported by GDI+
; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created
;
; Remark: hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format
; Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown()
;
; Requirement(s): GDIPlus.au3, Memory.au3 and _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
; Return Value(s): Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format),
; Error: 0
; Error codes: 1: $bImage is not a binary string
; 2: unable to create stream on HGlobal
; 3: unable to create bitmap from stream
;
; Author(s): UEZ
; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines and
; Yashied for _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
; Version: v0.98 Build 2012-08-29 Beta
;=======================================================================================
Func _GDIPlus_BMPFromMemory($bImage, $hHBITMAP = False)
If Not IsBinary($bImage) Then Return SetError(1, 0, 0)
Local $aResult
Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary
Local Const $len = BinaryLen($memBitmap) ;get length of image
Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002)
Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
_MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE
$aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
If @error Then Return SetError(2, 0, 0)
Local Const $hStream = $aResult[3]
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface
If @error Then Return SetError(3, 0, 0)
Local Const $hBitmap = $aResult[2]
Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
"dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak
$tMem = 0
$tVARIANT = 0
If $hHBITMAP Then
Local Const $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap)
_GDIPlus_BitmapDispose($hBitmap)
Return $hHBmp
EndIf
Return $hBitmap
EndFunc ;==>_GDIPlus_BMPFromMemory
Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported)
Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0
$aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0)
If (@error) Or ($aRet[0]) Then Return 0
$tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
$pBits = DllStructGetData($tData, 'Scan0')
If Not $pBits Then Return 0
$tBIHDR = DllStructCreate( 'dword bV5Size;long bV5Width;long bV5Height;word bV5Planes;word bV5BitCount;dword bV5Compression;' & _ ;http://msdn.microsoft.com/en-us/library/…1(v=vs.85).aspx
'dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;' & _
'dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;' & _
'int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;' & _
'dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved')
DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR))
DllStructSetData($tBIHDR, 'bV5Width', $aRet[2])
DllStructSetData($tBIHDR, 'bV5Height', $aRet[3])
DllStructSetData($tBIHDR, 'bV5Planes', 1)
DllStructSetData($tBIHDR, 'bV5BitCount', 32)
DllStructSetData($tBIHDR, 'bV5Compression', 0) ; $BI_BITFIELDS = 3, $BI_RGB = 0, $BI_RLE8 = 1, $BI_RLE4 = 2, $RGBA = 0x41424752
DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride'))
DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000)
DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000)
DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00)
DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF)
DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2
DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA
$hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0)
If (Not @error) And ($hResult[0]) Then
DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0'))
$hResult = $hResult[0]
Else
$hResult = 0
EndIf
_GDIPlus_BitmapUnlockBits($hBitmap, $tData)
$tData = 0
$tBIHDR = 0
Return $hResult
EndFunc ;==>_WinAPI_BitmapCreateDIBFromBitmap
;======================================================================================
; Function Name: _WinAPI_SetWindowTitleIcon
; Description: Loads an image, scales it to desired width or height and creates and icon handle
;
; Parameters: $sFile: image file to be loaded or bitmap handle
; $hWnd: GUI handle where the new icon should be displayed
; $iW: new image (icon) width. Default values is 32
; $iH: new image (icon) height. Default values is 32
;
; Requirement(s): GDIPlus.au3, _WinAPI_GetClassLongEx() and _WinAPI_SetClassLongEx()
; Return Value(s): Success: HICON handle, Error: 0 (see below)
; Error codes: 1: Code is running as x64 - not supported yet
; 2: $sFile value is empty
; 3: $hWnd is not a windows handle
; 4: filename doesn't exist or $sFile is not a valid bitmap handle
; 5: unable to create image from file
; 6: unable to create thumbnail from image handle
; 7: unable to create HICON from bitmap handle
; 8: unable to set ClassLongEx from GUI handle
;
; Limitation: only x86 compatible currently
;
; Author(s): UEZ, Yashied for _WinAPI_GetClassLongEx() and _WinAPI_SetClassLongEx()
; Version: v0.97 Build 2012-06-03 Beta
;
; Remarks: When finished release icon with _WinAPI_DestroyIcon()
;=======================================================================================
Func _WinAPI_SetWindowTitleIcon($sFile, $hWnd, $iW = 32, $iH = 32)
If @AutoItX64 Then Return SetError(1, 0, 0)
If $sFile = "" Then Return SetError(2, 0, 0)
If Not IsHWnd($hWnd) Then Return SetError(3, 0, 0)
Local Const $GCL_HICON = -14, $GCL_HICONSM = -34
Local $hImage
If Not FileExists($sFile) Then
If _GDIPlus_ImageGetType($sFile) = -1 Then Return SetError(4, @error, 0)
$hImage = $sFile ;interpret $sFile as a bitmap handle
Else
$hImage = _GDIPlus_ImageLoadFromFile($sFile)
If @error Then Return SetError(5, @error, 0)
EndIf
Local $aRes = DllCall($ghGDIPDll, "uint", "GdipGetImageThumbnail", "handle", $hImage, "uint", $iW, "uint", $iH, "int*", 0, "ptr", 0, "ptr", 0)
If @error Then Return SetError(6, @error, 0)
Local $hImageScaled = $aRes[4]
$aRes = DllCall($ghGDIPDll, "uint", "GdipCreateHICONFromBitmap", "handle", $hImageScaled, "int*", 0)
If @error Then
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hImageScaled)
Return SetError(7, @error, 0)
EndIf
Local $hIconNew = $aRes[2]
_WinAPI_SetClassLongEx($hWnd, $GCL_HICONSM, $hIconNew)
If @error Then
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hImageScaled)
Return SetError(8, @error, 0)
EndIf
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hImageScaled)
Return $hIconNew
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_SetClassLongEx
; Description....: Replaces the specified value into the specified window belongs.
; Syntax.........: _WinAPI_SetClassLongEx ( $hWnd, $iIndex, $iNewLong )
; Parameters.....: $hWnd - Handle to the window.
; $iIndex - The value to be replaced. This parameter can be one of the following values.
;
; $GCL_CBCLSEXTRA
; $GCL_CBWNDEXTRA
; $GCL_HBRBACKGROUND
; $GCL_HCURSOR
; $GCL_HICON
; $GCL_HICONSM
; $GCL_HMODULE
; $GCL_MENUNAME
; $GCL_STYLE
; $GCL_WNDPROC
;
; $iNewLong - The replacement value.
; Return values..: Success - The previous value.
; Failure - 0 and sets the @error flag to non-zero.
; Author.........: Yashied
; Modified.......:
; Remarks........: None
; Related........:
; Link...........: @@MsdnLink@@ SetClassLong
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_SetClassLongEx($hWnd, $iIndex, $iNewLong)
Local $Ret
If @AutoItX64 Then
$Ret = DllCall('user32.dll', 'ulong_ptr', 'SetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex, 'long_ptr', $iNewLong)
Else
$Ret = DllCall('user32.dll', 'ulong', 'SetClassLongW', 'hwnd', $hWnd, 'int', $iIndex, 'long', $iNewLong)
EndIf
If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0)
Return $Ret[0]
EndFunc ;==>_WinAPI_SetClassLongEx
;Code below was generated by: 'File to Base64 String' Code Generator v1.11 Build 2012-10-13
[/autoit] [autoit][/autoit] [autoit]Func _Infopng($bSaveBinary = False)
Local $Infopng
$Infopng &= 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACvlBMVEXw8PD////s7Ozq6urc3NyEpcXr6+tai7ZVhbJuocrl7/fa6PN/osN1lrdcjbhdj7pkl8BWh7RklsBYibVLeKPAwMBmmMFkhaVJfava2trj4+Pq8vhjjrY+caOHp8eFpsWFpseKqchOga/x+PxJfa1HeahnkrqNq8pplbxMfq6IqMdOgK5ahrH9/v9hjbVolLvq8/hShbJbj7tYirVQhLH3+/7z+PtsmL+txdpai7eJqchYirZQhLP2+fxAeaxCdaZbjblkj7hUh7VNf638/v/3+/3+//8/c6Ronshqlr1EealWibddjrr7/f9ajblMg7Py+Pzp8vh9q9FroMt6nsHe7PZGfa97q9F5nsHc6/VYjLllmMNVibdTiLfu9fnj7vVPg7HT4/BKf69+ocPt9vvj7vb1+/5jl8FxnsVkl8Jgk72nwdpgkr1Vi7jf6vTg7fR4pcvb29vDw8NkmMOIqMj0+f3p8vlzn8ddkb1ilcBNfqtilb9YjrtHe6rb6fN8oMJ+osN6n8Lm8Pd0oshgk75Mf65RgrBakLzf7PXW5fFnmsS/v7/v9/x1o8lhlMF4nsJ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MKwsb6/NzK4L8nnlVUDw2PuIxRKGMuI8ND1SzPKmpXaWvbFMr2Gm21lulPF4db037+/n7TW4cMjy4CAo+Cg48CA5geXYSE7uyEhjA9urh9q/v4uPsLy6OK81/7+7+3szyq+JH38z9BUZZHQfwfn3sWd+rqF7uX7XMpVMgRAAAAAElFTkSuQmCC'
Local $bString = Binary(_Base64Decode($Infopng))
If $bSaveBinary Then
Local $hFile = FileOpen(@ScriptDir & "\Info.png", 18)
FileWrite($hFile, $bString)
FileClose($hFile)
EndIf
Return $bString
EndFunc ;==>_Infopng
Func _Pausepng($bSaveBinary = False)
Local $Pausepng
$Pausepng &= 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAABnRSTlMA8ADwAPAu69YAAAAHQElEQVR4Xq1We2xUVRq/98y9M3c6M62VttOxtLUtkAJGgbZWJQU0tPG16kI0xN2YLHGDa7KJrC5FQSRmiYY/anEUggvKDhRdtrZIdTQCLatN3FhGSqlKBzulU6UPOu2087zv/d25k9mZ2o0x4cu9J+d+55zf9/h955xLBdNkfHz8iKvlvX8cGxjwTk1NBW+EUOnoB//+bjQWjcfj6IyOjt5IA0B3vn1wOhhsef+DycBU0763fD4f9IFA4MKF3lMdnyCyI0ePH3FpDzr4hBJDmPDLBoDe1Oy8NjZ2GNk5dnx0bLzjY3fPec8XX3ZDce7f3f6RHxVVUdMEn1B2ndMmYNrk5OT/M0B4nncde//hhx5sa2vTFlJqZ1cXstTf/104Ev3dpifsBXmt/2p96qk/rK+/v77hATzo4LP1ROuiitInNz0RjkY/+/xMNBql5hOCAdiIx2KKDHBFVmRZkmdmQzU11TXVq3btfvW11/feUuTYtu2vJ0+27X19Dx508OlY6Nixc9cru1+9s3rVijvucH92BhlWFGWuAby1Nata204GpoI8Lwi8JIjSPXffFQmHd+x4uapqldO5r76+weFwIKxINIoHHXw21Dc4nW9WVVVt3fo8Jq++u/b0mXOxWGxuCCCgv7//7Nmzbrfb5Tp64OAhzze9X3Z/9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WvYmJqsVsgiYuqgZCxOA1tOjrSozSCV6TBlBe8D1vwc04JReyCwd9vsJCOyEEvmuHhM6BDp9wFuUVkxQzZ9SwZBX0Xh64jBZ9XYnRDJJx0oHYpZVLvuj+CiTDnudC7z2rV7MMo40m6CbJEzUpgkybjKze'
$Pausepng &= 'wdDsbIQQNl1Jz6kijuNwjKy4fXmPpxcuQtPj+WZxRQW4wXp9TmdnJxK9dt29sBSXKR0rrmjE+P0oqgr0k0r5ZxuNYRhkqbi4OBaLX/r2MvYBKMIVOj4x4Si0YwjRQGBATxUvYx8knFUI8oYLiCaL0NeVPJSUmmFApzovLw95B05v37fhcDge5y2WLCTNZrNitKDQgXUjPi/sSFQyG6J2IdH28kripcU05dwIUmwjUcgJ4Aa8PwwODlotFlyVOGgZVpsMAyYCD3JF3ERGTYMioikF1yLtldHXlYJqmN8AoEEGZsMAbqXp6emffrqGv8hro6N6sYINlhINhjUSnDCaoJEoYqAUs9lqoGbR15UyZZhL8pxc5ebm4iZBxux2++zsLP5ucO6nzvbT39M0a7ZaWI0PVi9kQKLP6UqK1W7A+Q2kOEcEsAF6wTZAU9ttZmbGeiXQ6T6tKpoGDGexoF1rz7rPpJS5ZloT7ffxVwqWDA8Po9VNAuSmhECTUiLVyAH+VBjq1wsILy0txb9XemnggMnJyUkpYRVKJOC/oirevSyuPyMAAAAASUVORK5CYII='
Local $bString = Binary(_Base64Decode($Pausepng))
If $bSaveBinary Then
Local $hFile = FileOpen(@ScriptDir & "\Pause.png", 18)
FileWrite($hFile, $bString)
FileClose($hFile)
EndIf
Return $bString
EndFunc ;==>_Pausepng
Func _Startpng($bSaveBinary = False)
Local $Startpng
$Startpng &= 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAABnRSTlMA8ADwAPAu69YAAAAHOUlEQVR4Xq1We1BU1xm/9+y9+2Rx2gju+sCgxkGbRGVBqgzGWmHavDR2JmPbmWTiJGP1r1pT0PERYiajwx8EQqpDSaJdX2hWgj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XVlZf/9fDhov0H3993oHB6gMViRUXFuXPncgovHWkNFbUFXzhYV19fjzc8xGM+vB5D+JYaGRnp7u62Wq34JKitra2OIbBYxFZLS8v6Q5eKOsT178VpjzfweMKXIT5SAQkC6okhsFjEFuZvlzb+8oPGWO3xBv4/wosTQaB8o9qfrAGHwwEbQ0NDUe3x9F+H0i8LzzhyEQAAAABJRU5ErkJggg=='
Local $bString = Binary(_Base64Decode($Startpng))
If $bSaveBinary Then
Local $hFile = FileOpen(@ScriptDir & "\Start.png", 18)
FileWrite($hFile, $bString)
FileClose($hFile)
EndIf
Return $bString
EndFunc ;==>_Startpng
Func _Stoppng($bSaveBinary = False)
Local $Stoppng
$Stoppng &= 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAABnRSTlMA8ADwAPAu69YAAAAG0klEQVR4Xq1WeUxUdx5/99wgLQxMERCsxqOpB1A8gtoGaGt3tdGsMW1jUtONrn+Vuiu6rtY02d3GPyg4VWOq1h2PtrsU8BqNB1AlcbM4iojugjIIqBwyXHO+N/Pe28+bGWYYwDQmfvPmze/8fL7n7/eIoTHS29t7zHLy+3+caGlpHRgYGHoZQoxFP/TdUY/X4/P50Oju7n6ZBEA37z80ODR08ocf+x0DpeXf2u12jDscjtu3G8+cPQ/Ljh0/dcyiPGigi0FMYcGvEwC9tMz8tKfnCLxz4lR3T+/Zc9aGm7Zr1+sxUPdLfWfXY0mW5DGCLgZr65QFWNbf3/88AornecuJH37zwcrKykplIyHX1NbCS83N911uz8fr1yUbEyv+VbFhw6cFhe8VFr2PBw10K/5Z8fr0jI/Wr3N5PBcvXfF4PMRkQmECHD6vVxIBLomSKAbE4RFnbm5Obs7C3Xu++vvXe19LNW3b9qfq6sq9X/8VDxromqaadv5l95d7vnorZ+H8efOsF6/Aw5IkjSfALy93YUVltWNgiOcFgQ8I/sCSxYvcLtfOnbuysxeazeWFhUUmkwlmuT0ePGigW1RYZDbvy87OLi7eisVLF+ddvlLn9XrHm4AAND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a2uBvmL5crzH+in08vplvUbF0ZMQCKKEWQxjY5gA6QXdE199BafkVHZqm92ekpIMb0J35ZAI7gvDUyFHyN6ApFFzLI1+VML+ESXMxmQRTjoEdvasmdfqbwwMDILPdrtxydKlLMMos/CV4peYoAoiyeHQwNwEApKSMUuOS1O1Wo1jZP6bcxtsjaFYNdhuzZg+HbEBdGhNTU0NNF6+4m0w+URCxcFD'
$Stoppng &= 'xCQW0IRPnFBoDMPAS2lpaV6v7+69/6EOECJcob19faaUZEzBGggIQq7iRYrjGPQmIZAJXsKMHCWIhDoxMRF+B05j0z2Xy+Xz8TqdFk4zGPSYNaaYsK/L3gqeAIGCYNGdKBISCbzjLIhEG46CTwDX0vqwra1Nr9PhqsRBy7DKYiCqKGiQ4MdNxDFR/FgjBJmenADQCAYuURDgVhocHHzy5Cm+Ip92d4eSFdFgCT9NLwtQcJEKaBNcBCFFZMZ4glhfJSQk4CaBx5KTk0dGRvB1g3M/crZf/i9Jshq9jiXAOlGQQaxyA05KEI05LAAHwotoAzRSbsPDw/oHjhrrZRnOfo6gXNQsGTnsXkywpaOjA+8I5WQ2kFOmTMnIyGCIFxcEHDvx7TVufGK+YOX/AVpHkFZH85wiAAAAAElFTkSuQmCC'
Local $bString = Binary(_Base64Decode($Stoppng))
If $bSaveBinary Then
Local $hFile = FileOpen(@ScriptDir & "\Stop.png", 18)
FileWrite($hFile, $bString)
FileClose($hFile)
EndIf
Return $bString
EndFunc ;==>_Stoppng
Func _Base64Decode($sB64String)
Local $struct = DllStructCreate("int")
Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $sB64String, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
If @error Or Not $a_Call[0] Then Return SetError(1, 0, "")
Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
$a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $sB64String, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
If @error Or Not $a_Call[0] Then Return SetError(2, 0, "")
Return DllStructGetData($a, 1)
EndFunc ;==>_Base64Decode
Gruß,
UEZ