Sieht auch cool aus: 904181+150+2025+159
Gruß,
UEZ
Sieht auch cool aus: 904181+150+2025+159
Gruß,
UEZ
Sieht klasse aus! ![]()
Gruß,
UEZ
Die anderen? Du meinst Dick & Doof...
Gruß,
UEZ
Guckst du hier: http://www.autoitscript.com/forum/topic/14…440__hl__%2Buez
Gruß,
UEZ
Bevor ich dein Skript teste, eine kleine Anmerkung zu 2.: die Ressource wird in ein Base64 umgewandelt, aber vorher, wenn erwünscht, mit dem Built-In Kerner32 Funktion komprimiert, so dass je nach Datentyp die Ressource noch kleiner wird.Aber du hast recht, dass nach der Komprimierung und Umwandlung in B64 die Zeichenfolgen noch verkleinerbar ist. Ok, das ist nicht dein Ansatz.
Werde mal File to Base216 String Code Generator basteln und es mit
File to Base64 String Code Generator vergleichen.
Gruß,
UEZ
Klar kannst du den Code bearbeiten, modifizieren und daraus eine Exe machen. Ansonsten hätte ich den Source Code nicht gepostet. ![]()
Ich meine mit ControlSend kannst du auch arbeiten, ohne dass die GUI aktiv sein muss (arbeite kaum mit Automatisierungen mit den Send Befehlen).
Gruß,
UEZ
Hallo UEZ,
hab ich gemacht, alle Fehler sind weg.
DankeMal ne Frage zu dem Programm und ein paar Problemchen...
- Darf man das Programm so mitgeben?
- Kann man z.B. mit Controlsend die Befehle im Hintergrund ausführen ohne daß man die Oberfläche sieht.
- Kann man den Text zentrieren? Hab nichts gefunden.
- Alt Tastaturabkürzungen für das Menü gehen nicht(z.B. Alt T für Text)
Grüße Ilse
Wem willst du das Programm mitgeben? Es ist eigentlich ein Bestandteil von dem Screenshooter und so eigentlich nicht vollständig separat zu laufen. Eigentlich sollte es nur dir nützlich sein.
Keine Ahnung, ob man mit Controlsend das Ding "kontrollieren" kann; einfach ausprobieren.
Zentrieren ist nicht implementiert, kann es aber hinzufügen.
Bezgl. der Tastenabkürzungen muss ich auch mal schauen.
Gruß,
UEZ
Aktualisiere deine Version auf die Neuste, dann sollte es auch funzen.
Gruß,
UEZ
Welche AutoIt Version benutzt du?
Gruß,
UEZ
Hi Ilse,
leider hatte ich keine Zeit was zu basteln. ![]()
Ich habe mal den Basic Image Editor aus dem Windows Screenshooter extrahiert. Dort kannst du u.a. auch Texte auf das Bild zeichnen und rotieren (linke Maustaste gedrückt halten und Maus bewegen).
Vielleicht hilft die das Ding weiter. Ich weiß, dass es für deine Zwecke überdimensioniert ist, aber was soll's...
Gruß,
UEZ
Ok, vielleicht habe ich " Autoit zu c++ konverter" falsch verstanden.
Was ist genau mit " Autoit zu c++ konverter" gemeint?
Gruß,
UEZ
Na ja, Off-Topic ist eher für Themen, die sonst nichts mit Coding zu tun haben. Egal wie "klein" dein Beispiel Skript ist, sollte aber in Skripte liegen. ![]()
Gruß,
UEZ
...
Die Idee habe ich von einer alten Demo (sowas wie die 64k Demos usw).
Hier ein Beispiel dazu: http://www.stpe.se/javascript/rasterbar.php
...
Ich hatte ein bissl Zeit und habe mal das JavaScript portiert:
;coded by UEZ 2012 build 2012-08-03
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UPX_Parameters=--best --lzma
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
#include <Array.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
Opt('GUIOnEventMode', 1)
Opt("MustDeclareVars", 1)
_GDIPlus_Startup()
Global Const $iW = 640, $iH = 480
Global $sGUIText = "Rotating Raster Bars (C64 Style) by UEZ 2012 / FPS: "
Global Const $hGUI = GUICreate($sGUIText, 640, 480)
GUISetState()
#region init GDI+
Global Const $hBitmap = _WinAPI_CreateDIB($iW, $iH)
Global Const $hDC = _WinAPI_GetDC($hGUI)
Global Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC)
Global Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap)
Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
Global Const $hBrush = _GDIPlus_BrushCreateSolid(0x40000000)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
#endregion
Global Const $fPI = ACos(-1)
Global Const $f2PI = 2 * ACos(-1)
Global Const $fRad = ACos(-1) / 180
Global Const $fYPos = $iH / 2
Global Const $fSpeed = 0.3
Global Const $fRadius = 150
Global Const $fZSize = 20
Global Const $iSize = 100, $iS2 = $iSize / 2
Global $aBitmaps[3][4], $e, $r, $j, $k, $l , $z = 0, $iFPS = 0
Global $iUb = UBound($aBitmaps) - 1
For $e = 0 To $iUb
$r = Random(3, 12, 1)
$aBitmaps[$e][0] = CreateBar($r, $iW, $iSize, "0xFF" & Hex(Random(0x0, 0xFFFFFF, 1), 6))
$aBitmaps[$e][1] = $fYPos
$aBitmaps[$e][2] = Sin($e * $fRad) * 360 / ($iUb + 1)
Next
GUISetOnEvent($GUI_EVENT_CLOSE , "_Exit")
AdlibRegister("FPS", 1000)
While Sleep(10)
DllCall($ghGDIPDll, "int", "GdipFillRectangleI", "handle", $hGraphic, "handle", $hBrush, "int", 0, "int", 0, "int", $iW, "int", $iH) ;_GDIPlus_GraphicsFillRect()
For $j = 0 To $iUb
$k = Sin($fRad * $z + $aBitmaps[$j][2]) * $fRadius
$aBitmaps[$j][3] = Cos(-270 + $fRad * $z + $aBitmaps[$j][2])
$aBitmaps[$j][1] = $fYPos + $k - $iS2
DllCall($ghGDIPDll, "int", "GdipDrawImageRect", "handle", $hGraphic, "handle", $aBitmaps[$j][0], "float", 0, "float", $aBitmaps[$j][1], "float", $iW, "float", $iSize + $aBitmaps[$j][3] * $fZSize)
$z += $fSpeed
Next
_ArraySort($aBitmaps, 0, 0, 0, 3)
DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hDC, "int", 0, "int", 0, "int", $iW, "int", $iH, "handle", $hDC_backbuffer, "int", 0, "int", 0, "dword", $SRCCOPY) ;_WinAPI_BitBlt()
$iFPS += 1
WEnd
Func CreateBar($iStep, $iW, $iH, $iColor, $iBoost = 3)
Local Const $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
Local Const $hBitmap = $aResult[6]
Local Const $hCtx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Local Const $hBrush = _GDIPlus_BrushCreateSolid(0x00000000)
Local $i, $y = 0
For $x = 0 To $iH / 2 Step $iStep
_GDIPlus_BrushSetSolidColor($hBrush, CalcColor($iColor, $iBoost * $x))
_GDIPlus_GraphicsFillRect($hCtx, 0, $y, $iW, $iStep, $hBrush)
$y += $iStep
Next
For $x = $iH / 2 - $iStep To 0 Step -$iStep
_GDIPlus_BrushSetSolidColor($hBrush, CalcColor($iColor, $iBoost * $x))
_GDIPlus_GraphicsFillRect($hCtx, 0, $y, $iW, $iStep, $hBrush)
$y += $iStep
Next
_GDIPlus_GraphicsDispose($hCtx)
_GDIPlus_BrushDispose($hBrush)
Return $hBitmap
EndFunc
Func CalcColor($iColor, $iStep)
Local Const $iA = Hex(BitAND(0xFF, BitShift($iColor, 24)), 2)
Local Const $iR = Hex(Min(BitAND(0xFF, BitShift($iColor, 16)) + Int($iStep), 0xFF), 2)
Local Const $iG = Hex(Min(BitAND(0xFF, BitShift($iColor, 8)) + Int($iStep), 0xFF), 2)
Local Const $iB = Hex(Min(BitAND(0xFF, $iColor) + Int($iStep), 0xFF), 2)
Return "0x" & $iA & $iR & $iG & $iB
EndFunc
Func FPS()
WinSetTitle("", "", $sGUIText & $iFPS)
$iFPS = 0
EndFunc
Func Min($a, $b)
If $a < $b Then Return $a
Return $b
EndFunc
Func _Exit()
AdlibUnRegister("FPS")
Local $c
For $c = 0 To UBound($aBitmaps) - 1
_GDIPlus_BitmapDispose($aBitmaps[$c][0])
Next
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_WinAPI_SelectObject($hDC, $DC_obj)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_ReleaseDC($hGUI, $hDC)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc
Func _WinAPI_CreateDIB($iWidth, $iHeight, $iBitsPerPel = 32) ;taken from WinAPIEx.au3 by Yashied
Local $tBIHDR, $hBitmap, $pBits
Local Const $BI_RGB = 0, $DIB_RGB_COLORS = 0
Local Const $tagBITMAPINFOHEADER = 'dword biSize;long biWidth;long biHeight;ushort biPlanes;ushort biBitCount;dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant'
$tBIHDR = DllStructCreate($tagBITMAPINFOHEADER)
DllStructSetData($tBIHDR, 'biSize', DllStructGetSize($tBIHDR))
DllStructSetData($tBIHDR, 'biWidth', $iWidth)
DllStructSetData($tBIHDR, 'biHeight', $iHeight)
DllStructSetData($tBIHDR, 'biPlanes', 1)
DllStructSetData($tBIHDR, 'biBitCount', $iBitsPerPel)
DllStructSetData($tBIHDR, 'biCompression', $BI_RGB)
$hBitmap = _WinAPI_CreateDIBSection(0, $tBIHDR, $DIB_RGB_COLORS, $pBits)
If @error Then Return SetError(1, 0, 0)
Return $hBitmap
EndFunc ;==>_WinAPI_CreateDIB
Func _WinAPI_CreateDIBSection($hDC, ByRef $tBITMAPINFO, $iUsage, ByRef $pBits, $hSection = 0, $iOffset = 0) ;taken from WinAPIEx.au3 by Yashied
$pBits = 0
Local $Ret = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', $hDC, 'ptr', DllStructGetPtr($tBITMAPINFO), 'uint', $iUsage, 'ptr*', 0, 'ptr', $hSection, 'dword', $iOffset)
If @error Or (Not $Ret[0]) Then Return SetError(1, 0, 0)
$pBits = $Ret[4]
Return $Ret[0]
EndFunc ;==>_WinAPI_CreateDIBSection
Warum hast du dein GDI+ Beispiel in Off-Topic gepostet?
Gruß,
UEZ
Ich finde den Ansatz von Ward sehr interessant, C Code Inline zu benutzen, um die von Andy dargestellten Geschwindigkeitsprobleme zu lösen.
D.h. z.B. ich muss eine Bitmap mit Pixeln füllen, tue dies aber mit Inline C oder von mir auch mit C++. Im Prinzip was Andy / Ward mit dem Inline ASM gebastelt hat.
Zurück zu moritz1243: was ist der Sinn mit AutoIt C++ Code zu erstellen? (nicht negativ gemeint!)
Gruß,
UEZ
Du willst aus vorgefertigten Texten (Menu) aussuchen können und diese dann im Bild positionieren?
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <gdiplus.au3>
#include <misc.au3>
Global $afont[8]
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(FileOpenDialog("Bild auswählen", @ScriptDir, "Bilder (*.jpg)"))
If Not $hImage Then Exit _GDIPlus_Shutdown()
$iW = _GDIPlus_ImageGetWidth($hImage)
$iH = _GDIPlus_ImageGetHeight($hImage)
$hCtxt_bg = _GDIPlus_ImageGetGraphicsContext($hImage)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt_bg, 2)
DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hCtxt_bg, "int", 4)
$x = 140
$y = 110
$Form1 = GUICreate("Form1", $iW, $iH)
$MenuItem1 = GUICtrlCreateMenu("Texte und Schriften")
$mnText1 = GUICtrlCreateMenuItem("Hunde", $MenuItem1)
$mnText2 = GUICtrlCreateMenuItem("Katzen", $MenuItem1)
GUISetState()
Global $Text[4]
[/autoit] [autoit][/autoit] [autoit]$Text[0] = "Welpen"
$Text[1] = "Hunde"
$Text[2] = "Katzen"
$Text[3] = "Vögel"
;_ArrayDisplay($Text)
[/autoit] [autoit][/autoit] [autoit]Global $aFont, $hBrush, $hFamily, $hFont, $hFormat, $tLayout, $aInfo
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1)
;$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
$hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
_GDIPlus_GraphicsDrawImage($hCtxt, $hImage, 0, 0)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Global $hDLL = DllOpen("user32.dll")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Ilse.jpg")
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hCtxt_bg)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_Shutdown()
DllClose($hDLL)
GUIDelete()
Exit
Case $mnText1
$sText = $Text[1]
_Schrift()
Case $mnText2
$sText = $Text[2]
_Schrift()
EndSwitch
If _IsPressed("25") Then
$x -= 1
DllStructSetData($tLayout, "X", $x)
Update()
ElseIf _IsPressed("27") Then
$x += 1
DllStructSetData($tLayout, "X", $x)
Update()
ElseIf _IsPressed("26") Then
$y -= 1
DllStructSetData($tLayout, "Y", $y)
Update()
ElseIf _IsPressed("28") Then
$y += 1
DllStructSetData($tLayout, "Y", $y)
Update()
ElseIf _IsPressed("0D") Then
While _IsPressed("0D")
WEnd
_GDIPlus_GraphicsDrawStringEx($hCtxt_bg, $sText, $hFont, $tLayout, $hFormat, $hBrush)
ConsoleWrite("Text auf das Hintergrundbild kopiert!" & @LF)
EndIf
WEnd
Func Update()
;MsgBox(0,"",$x&"-"&$y)
_GDIPlus_GraphicsDrawImage($hCtxt, $hImage, 0, 0)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush)
;_GDIPlus_GraphicsDrawStringEx($hCtxt, $Text2, $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Return 1
EndFunc ;==>Update
Func _Schrift()
$tLayout = 0
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
$afont = _ChooseFont()
If @error Then Return
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $afont[7])
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate($afont[2])
$hFont = _GDIPlus_FontCreate($hFamily, $afont[3], $afont[1])
$tLayout = _GDIPlus_RectFCreate($x, $y, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString($hCtxt, $sText, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $aInfo[0], $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
EndFunc ;==>_Schrift
So was?
Gruß,
UEZ
Du musst die Schrift auch auf das Hintergrundbild übertragen:
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <gdiplus.au3>
#include <misc.au3>
Global $afont[8]
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(FileOpenDialog("Bild auswählen", @ScriptDir, "Bilder (*.jpg)"))
If Not $hImage Then Exit _GDIPlus_Shutdown()
$iW = _GDIPlus_ImageGetWidth($hImage)
$iH = _GDIPlus_ImageGetHeight($hImage)
$hCtxt_bg = _GDIPlus_ImageGetGraphicsContext($hImage)
$x = 140
$y = 110
$Form1 = GUICreate("Form1", $iW, $iH)
$MenuItem1 = GUICtrlCreateMenu("Texte und Schriften")
$mnText1 = GUICtrlCreateMenuItem("Hunde", $MenuItem1)
$mnText2 = GUICtrlCreateMenuItem("Katzen", $MenuItem1)
GUISetState()
Global $Text[4]
[/autoit] [autoit][/autoit] [autoit]$Text[0] = "Welpen"
$Text[1] = "Hunde"
$Text[2] = "Katzen"
$Text[3] = "Vögel"
;_ArrayDisplay($Text)
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1)
;$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
$hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hCtxt, "int", 4)
_GDIPlus_GraphicsDrawImage($hCtxt, $hImage, 0, 0)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
;$aFont = _ChooseFont()
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $afont[7])
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate($afont[2])
$hFont = _GDIPlus_FontCreate($hFamily, $afont[3], $afont[1])
$tLayout = _GDIPlus_RectFCreate($x, $y, 1000, 1000)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $Text[1], $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Global $hDLL = DllOpen("user32.dll")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Ilse.jpg")
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hCtxt_bg)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_Shutdown()
DllClose($hDLL)
GUIDelete()
Exit
Case $mnText1
_Schrift1()
Case $mnText2
_Schrift2()
EndSwitch
If _IsPressed("25") Then
$x -= 1
DllStructSetData($tLayout, "X", $x)
Update()
ElseIf _IsPressed("27") Then
$x += 1
DllStructSetData($tLayout, "X", $x)
Update()
ElseIf _IsPressed("26") Then
$y -= 1
DllStructSetData($tLayout, "Y", $y)
Update()
ElseIf _IsPressed("28") Then
$y += 1
DllStructSetData($tLayout, "Y", $y)
Update()
ElseIf _IsPressed("0D") Then
_GDIPlus_GraphicsDrawStringEx($hCtxt_bg, $Text[1], $hFont, $tLayout, $hFormat, $hBrush)
EndIf
WEnd
Func Update()
;MsgBox(0,"",$x&"-"&$y)
_GDIPlus_GraphicsDrawImage($hCtxt, $hImage, 0, 0)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $Text[1], $hFont, $tLayout, $hFormat, $hBrush)
;_GDIPlus_GraphicsDrawStringEx($hCtxt, $Text2, $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Return 1
EndFunc ;==>Update
Func _Schrift1()
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
$afont = _ChooseFont()
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $afont[7])
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate($afont[2])
$hFont = _GDIPlus_FontCreate($hFamily, $afont[3], $afont[1])
$tLayout = _GDIPlus_RectFCreate($x, $y, 1000, 1000)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $Text[1], $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Global $hDLL = DllOpen("user32.dll")
EndFunc ;==>_Schrift1
Func _Schrift2()
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
$afont = _ChooseFont()
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $afont[7])
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate($afont[2])
$hFont = _GDIPlus_FontCreate($hFamily, $afont[3], $afont[1])
$tLayout = _GDIPlus_RectFCreate($x, $y, 1000, 1000)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $Text[2], $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Global $hDLL = DllOpen("user32.dll")
EndFunc ;==>_Schrift2
Wenn du die Enter Taste drückst, wird der Text auf das Hintergrundbild kopiert.
Gruß,
UEZ
autoBert: stimmt, denn die Funktion trennt strikt nach Komma und ein Token "Victoria,Dr" wird auch getrennt. Wenn ich den Delimiter ersetze, damit die Trennung eindeutig ist, funzt die Funktion.
#include <Array.au3>
$gs_dummydata = _
'"Nachname"|"Vorname"|"Straße"|"Hausnummer"|"PLZ"|"Ort"|"Anzahl"|"Verbrauch"|"Musterartikel"|"Musterart"' & @CRLF & _
'"Musterman"|"Fritz"|"Feierstr."|5"|"23333"|""Hamelhausen""|"5"|"3050"|""1"|"3"' & @CRLF & _
'"Musterfrau"|"Victoria,Dr."|"Abendrotstr.""|"7"|"23455"|""Aschendorf""|"3"|""|""1"|"3"' & @CRLF & _
'"Müller"|"Heinz,Dr."|"Feldstr.""|"1"|"23455"|""Aschendorf""|""|"7700"|""1"|"3"'
Global $aS = StringSplitW($gs_dummydata, "|")
_ArrayDisplay($aS)
; #FUNCTION# ======================================================================================
; Name ................: StringSplitW()
; Version .............: v0.90 build 2012-05-30 beta
; Description .......: Splits a string into columns instead of rows as it is done by SplitString(), like a csv file to a 2d array ![]()
; Syntax ..............: StringSplitW($string, $delimiter, $max_width)
; Parameters ........: $string - string to split
; $delimiter - the delimter how to split the string
; Return values ....: Success - 2d array
; Failure 1 - either $string or $delimter is not set
; Failure 2 - array width exceeded
; Failure 3 - 2D array memory exceeded -> width + height > 0x5EFA
; Author ..............: UEZ
; Modified ............:
; Remarks ............:
; Related ..............: StringSplit()
; =================================================================================================
Func StringSplitW($string, $delimiter)
If $string = "" Or $delimiter = "" Then Return SetError(1, 0, 0)
Local $chk, $width, $i, $j, $k, $len, $max = 1, $max_width
Local $aPos[1], $l = 0
Local $aSplit = StringSplit($string, @LF)
$max_width = 0x5EFA - $aSplit[0]
If $max_width < 1 Then Return SetError(3, 0, 0)
Local $aVertical[$aSplit[0]][$max_width]
For $k = 1 To $aSplit[0]
$len = StringLen($aSplit[$k])
If $len > 1 Then
$chk = StringReplace($aSplit[$k], $delimiter, $delimiter)
$width = @extended
If $width > $max_width Then Return SetError(2, 0, 0)
If $width >= $max Then $max = $width + 1
Switch $width
Case 0
$aVertical[$l][0] = $aSplit[$k]
Case Else
Dim $aPos[$width * 2 + 2]
$j = 1
$aPos[0] = 1
For $i = 0 To $width - 1
$aPos[$j] = StringInStr($aSplit[$k], $delimiter, 0, $i + 1) - 1
$aPos[$j + 1] = $aPos[$j] + 2
$j += 2
Next
$aPos[UBound($aPos) - 1] = StringLen($aSplit[$k])
$j = 0
For $i = 0 To UBound($aPos) - 1 Step 2
$aVertical[$l][$j] = StringMid($aSplit[$k], $aPos[$i], $aPos[$i + 1] - $aPos[$i] + 1)
$j += 1
Next
EndSwitch
$l += 1
EndIf
Next
ReDim $aVertical[$l][$max]
Return $aVertical
EndFunc
Gruß,
UEZ
Probiere es mal damit -> [ gelöst ] CSV-Datei in ein Array einlesen
Gruß,
UEZ
Auch von mir ein Happy Birthday und alles Gute.
Gruß,
UEZ
Läuft sauber, kein Ruckeln zu sehen.
Gruß,
UEZ