1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • arrays 'verschmelzen'

    • UEZ
    • 6. Oktober 2009 um 15:16

    Hier eine von vielen Möglichkeiten:

    [autoit]


    #include <Array.au3>

    [/autoit][autoit][/autoit][autoit]

    Dim $array1[20][2]
    Dim $array2[20]
    Dim $array3[20][3]

    [/autoit][autoit][/autoit][autoit]

    ;fülle Array1 & Array2
    For $x = 0 To 19
    $array1[$x][0] = "x" & $x
    $array1[$x][1] = "y" & $x
    Next
    For $x = 0 To 19
    $array2[$x] = "z" & $x
    Next

    [/autoit][autoit][/autoit][autoit]

    ;Kopiere Array1 und Array2 nach Array3
    For $x = 0 To 19
    $array3[$x][0] = $array1[$x][0]
    $array3[$x][1] = $array1[$x][1]
    $array3[$x][2] = $array2[$x]
    Next

    [/autoit][autoit][/autoit][autoit]

    _ArrayDisplay($array3)

    [/autoit][autoit][/autoit][autoit][/autoit]

    UEZ

  • Taschenrechner

    • UEZ
    • 6. Oktober 2009 um 13:27
    Zitat von peethebee

    UEZ, enttäusch mich nicht :D.

    0 : x ist natürlich 0 :D.


    Johannes

    Natürlich hast du recht...

    Manchmal bin ich geistig nicht da... :whistling: (voll blamiert Alter! :cursing: )

    UEZ

  • Taschenrechner

    • UEZ
    • 6. Oktober 2009 um 09:42

    Interessant wären noch andere Standard Befehle, wie Sin, Cos, Tan, Wurzel, x^n, log, ln, n!, ...

    Wenn es denn nicht den Rahmen sprengt ;)


    0/1 = 0 (hhhmmm, das stimmt wohl nicht!)

    1/0 = 1.#INF (das geht auch nicht)


    Gruß.
    UEZ

  • Alle Unterschlüssel eines Registry Pfades herausbekommen

    • UEZ
    • 6. Oktober 2009 um 00:46

    Hier ein Code Ausschnitt von SIC2, um die installierte Software (für alle Benutzer) von System per Registry auszulesen (in der unbeliebten Commandline Version :D ), ohne "Updates anzeigen"!

    Spoiler anzeigen
    [autoit]


    ;Coded by UEZ 2009
    #AutoIt3Wrapper_Change2CUI=y
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseX64=n
    #include <array.au3>
    Global $server = "localhost"
    If $CmdLine[0] > 0 Then $server = $CmdLine[1]

    [/autoit] [autoit][/autoit] [autoit]

    $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $server & "\root\cimv2")

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite(@CRLF & "Installed software on " & $server & @CRLF & @CRLF)
    Software($server)

    [/autoit] [autoit][/autoit] [autoit]

    Func Software($srv) ; registry read version 2
    Local $function_name = "Software"
    Local $objReg, $HKLM, $BaseKey, $BaseKey64, $server, $arrSubKeys, $SubKey, $Value, $objRegService, $chk_nr, $chk_url, $chk_sc
    Local $software, $Key, $key_value, $SW_DisplayName, $SW_DisplayVersion, $SW_Publisher, $SW_InstallDate, $line, $TimeStamp
    Local $filename_sw = $function_name & "_" & $srv
    Local $filename_error_current = $function_name & "_" & $srv & "_error.log"
    $HKLM = 0x80000002
    $BaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
    $BaseKey64 = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
    If @OSArch = "X64" And ($srv = @ComputerName Or _
    $srv = "localhost" Or _
    $srv = @IPAddress1 Or _
    $srv = @IPAddress2 Or _
    $srv = @IPAddress3 Or _
    $srv = @IPAddress4) Then
    $i = 1
    While 1
    $key = RegEnumKey("HKEY_LOCAL_MACHINE\" & $BaseKey, $i)
    If @error <> 0 Then ExitLoop
    $key_value = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "DisplayName")
    $chk_sc = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "SystemComponent")
    $chk_url = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "MoreInfoURL")
    $chk_nr = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "NoRemove")
    If $key_value <> "" And _
    StringIsASCII($key_value) <> 0 And _
    $key_value <> "Security Update for" And _
    $key_value <> "Hotfix for" And _
    $key_value <> "Update for Office" And _
    $key_value <> "Windows 2000 Hotfix" And _
    StringInStr(StringLower($key), StringLower("InstallShield_")) = 0 And _
    StringInStr(StringLower($chk_url), StringLower("http://support.microsoft.com/kb/")) = 0 And _
    $chk_nr <> 1 And $chk_sc <> 1 Then
    $SW_DisplayName = StringStripWS($key_value, 7)
    $SW_Publisher = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "Publisher")
    $SW_InstallDate = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "InstallDate")
    $SW_DisplayVersion = RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey & "\" & $key, "DisplayVersion")
    $software &= $srv & ";" & $SW_DisplayName & ";" & $SW_DisplayVersion & ";" & $SW_Publisher & ";" & $SW_InstallDate & ";" & @CRLF
    EndIf
    $i += 1
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    $i = 1
    While 1
    $key = RegEnumKey("HKEY_LOCAL_MACHINE64\" & $BaseKey, $i)
    If @error <> 0 Then ExitLoop
    $key_value = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "DisplayName")
    $chk_sc = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "SystemComponent")
    $chk_url = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "MoreInfoURL")
    $chk_nr = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "NoRemove")
    If $key_value <> "" And _
    StringIsASCII($key_value) <> 0 And _
    $key_value <> "Security Update for" And _
    $key_value <> "Hotfix for" And _
    $key_value <> "Update for Office" And _
    $key_value <> "Windows 2000 Hotfix" And _
    StringInStr(StringLower($key), StringLower("InstallShield_")) = 0 And _
    StringInStr(StringLower($chk_url), StringLower("http://support.microsoft.com/kb/")) = 0 And _
    $chk_nr <> 1 And $chk_sc <> 1 Then
    $SW_DisplayName = StringStripWS($key_value, 7)
    $SW_Publisher = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "Publisher")
    $SW_InstallDate = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "InstallDate")
    $SW_DisplayVersion = RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey & "\" & $key, "DisplayVersion")
    $software &= $srv & ";" & $SW_DisplayName & ";" & $SW_DisplayVersion & ";" & $SW_Publisher & ";" & $SW_InstallDate & ";" & @CRLF
    EndIf
    $i += 1
    WEnd
    Else
    If StringLower(@OSVersion) <> StringLower("WIN_2000") Then
    $objWMILocator = ObjCreate("WbemScripting.SWbemLocator")
    $objRegService = $objWMILocator.ConnectServer($srv, "\root\default", "", "", "", "", 0x80)
    $objReg = $objRegService.Get("StdRegProv")
    Else
    $objReg = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $srv & "\root\default:StdRegProv")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If IsObj($objReg) Then
    $objReg.EnumKey($HKLM, $BaseKey, $arrSubKeys)
    For $SubKey In $arrSubKeys
    $SW_DisplayName = ""
    $SW_DisplayVersion = ""
    $SW_Publisher = ""
    $SW_InstallDate = ""
    $Key = $objReg.GetStringValue($HKLM, $BaseKey & $SubKey, "DisplayName", $Value)
    $objReg.GetDWORDValue($HKLM, $BaseKey & $SubKey, "NoRemove", $chk_nr)
    $objReg.GetDWORDValue($HKLM, $BaseKey & $SubKey, "SystemComponent", $chk_sc)
    $objReg.GetStringValue($HKLM, $BaseKey & $SubKey, "MoreInfoURL", $chk_url)
    If $Key <> 0 Or StringLeft($SubKey, 2) = "KB" Or StringLeft($SubKey, 1) = "Q" Then
    $Key = $objReg.GetStringValue($HKLM, $BaseKey & $SubKey, "QuietDisplayName", $Value)
    EndIf
    If $Value <> "" And StringIsASCII($Value) <> 0 _
    And $Key = 0 And StringInStr(StringLower($Value), StringLower("Security Update for")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Update for Windows")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Hotfix for")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Update for Office")) = 0 _
    And StringInStr(StringLower($SubKey), StringLower("InstallShield_")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Windows 2000 Hotfix")) = 0 _
    And StringInStr(StringLower($chk_url), StringLower("http://support.microsoft.com/kb/")) = 0 _
    And $chk_nr <> 1 _
    And $chk_sc <> 1 Then
    $SW_DisplayName = $Value

    [/autoit] [autoit][/autoit] [autoit]

    $Key = $objReg.GetStringValue($HKLM, $BaseKey & $SubKey, "DisplayVersion", $Value)
    If $Value <> "" And StringIsASCII($Value) <> 0 Then
    $SW_DisplayVersion = StringStripWS($Value, 7)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $Key = $objReg.GetStringValue($HKLM, $BaseKey & $SubKey, "Publisher", $Value)
    If $Value <> "" And StringIsASCII($Value) <> 0 Then
    $SW_Publisher = StringStripWS($Value, 7)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $Key = $objReg.GetStringValue($HKLM, $BaseKey & $SubKey, "InstallDate", $Value)
    If $Value <> "" And StringIsASCII($Value) <> 0 Then $SW_InstallDate = $Value
    $line = $srv & ";" & $SW_DisplayName & ";" & $SW_DisplayVersion & ";" & $SW_Publisher & ";" & $SW_InstallDate & ";" & @CRLF
    $software &= $line
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Dim $arrSubKeys
    $objReg.EnumKey($HKLM, $BaseKey64, $arrSubKeys)
    If UBound($arrSubKeys) > 0 Then
    For $SubKey In $arrSubKeys
    $SW_DisplayName = ""
    $SW_DisplayVersion = ""
    $SW_Publisher = ""
    $SW_InstallDate = ""
    $Key = $objReg.GetStringValue($HKLM, $BaseKey64 & $SubKey, "DisplayName", $Value)
    $objReg.GetDWORDValue($HKLM, $BaseKey64 & $SubKey, "NoRemove", $chk_nr)
    $objReg.GetDWORDValue($HKLM, $BaseKey64 & $SubKey, "SystemComponent", $chk_sc)
    $objReg.GetStringValue($HKLM, $BaseKey64 & $SubKey, "MoreInfoURL", $chk_url)
    If $Key <> 0 Or StringLeft($SubKey, 2) = "KB" Or StringLeft($SubKey, 1) = "Q" Then
    $Key = $objReg.GetStringValue($HKLM, $BaseKey64 & $SubKey, "QuietDisplayName", $Value)
    EndIf
    If $Value <> "" And StringIsASCII($Value) <> 0 _
    And $Key = 0 And StringInStr(StringLower($Value), StringLower("Security Update for")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Update for Windows")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Hotfix for")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Update for Office")) = 0 _
    And StringInStr(StringLower($SubKey), StringLower("InstallShield_")) = 0 _
    And StringInStr(StringLower($Value), StringLower("Windows 2000 Hotfix")) = 0 _
    And StringInStr(StringLower($chk_url), StringLower("http://support.microsoft.com/kb/")) = 0 _
    And $chk_nr <> 1 _
    And $chk_nr <> 1 Then
    $SW_DisplayName = $Value

    [/autoit] [autoit][/autoit] [autoit]

    $Key = $objReg.GetStringValue($HKLM, $BaseKey64 & $SubKey, "DisplayVersion", $Value)
    If $Value <> "" And StringIsASCII($Value) <> 0 Then
    $SW_DisplayVersion = StringStripWS($Value, 7)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $Key = $objReg.GetStringValue($HKLM, $BaseKey64 & $SubKey, "Publisher", $Value)
    If $Value <> "" And StringIsASCII($Value) <> 0 Then
    $SW_Publisher = StringStripWS($Value, 7)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $Key = $objReg.GetStringValue($HKLM, $BaseKey64 & $SubKey, "InstallDate", $Value)
    If $Value <> "" And StringIsASCII($Value) <> 0 Then $SW_InstallDate = $Value
    $line = $srv & ";" & $SW_DisplayName & ";" & $SW_DisplayVersion & ";" & $SW_Publisher & ";" & $SW_InstallDate & ";" & @CRLF
    $software &= $line
    EndIf
    Next
    EndIf
    EndIf
    EndIf
    ConsoleWrite($software & @CRLF)
    EndFunc ;==>Software

    [/autoit]

    Für Remote Systeme muss der eigene Account berechtigt und die Ports für die WMI Abfrage müssen offen sein (keine Errorhandling in dem Beispiel)!

    Vielleicht ist es auch für jemanden nützlich!

    UEZ

    Dateien

    Installed Software.au3 9,18 kB – 415 Downloads
  • Vor dem Schließen abfrage

    • UEZ
    • 5. Oktober 2009 um 16:35

    Ich glaube, dass du das meinst oder?

    [autoit]

    $Form1 = GUICreate("Form1", 640, 480)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit]

    Do
    If GUIGetMsg() = -3 Then
    $x = MsgBox(4 + 32 + 256, "Test", "Soll das Programm geschlossen werden?")
    If $x = 6 Then ExitLoop
    EndIf
    Until Not Sleep(10)

    [/autoit][autoit][/autoit][autoit]

    Exit

    [/autoit]

    Gruß,
    UEZ

  • SIC2 (System Information Collector 2 - sammelt Information auch von Remote Systemen)

    • UEZ
    • 25. September 2009 um 11:17

    Es haben ja schon einige Leute SIC2 heruntergeladen.

    Ich wollte wissen, ob ihr mit dem CMD Tool zurecht gekommen seid:

    a) ist das Tool intuitiv benutzbar?
    b) ist die Syntax verständlich?
    c) gab es Probleme mit der Ausführung?
    d) wurde das Tools in einer größeren Umgebung mit Multiprozessing eingesetzt? Wie war die Geschwindigkeit?
    e) sonstiges

    Danke,
    UEZ

    PS: ich bin hart im Nehmen!

  • SIC2 (System Information Collector 2 - sammelt Information auch von Remote Systemen)

    • UEZ
    • 24. September 2009 um 10:23
    Zitat von kleiner27

    Guten morgen!

    Beim start ist schon schluß bei mir, Ich habe XP PRO Service3 32 Bit und bei mir kommt der fehler!

    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    woran liegt das?

    LG Kleiner

    Sorry, habe es nicht klar erwähnt: dies ist ein CMD Tool, d.h. nur in der "DOS-BOX" ausführbar!

    Also, du musst die CMD.exe starten und dort kannst du SIC2.exe aufrufen!

    Hier eine Übersicht der Befehle:

    Spoiler anzeigen


    SIC2 v2.0 build 2009-11-11 beta by UEZ.

    Usage: SIC2 <-i (system list filename)>
    [-master] for multi processing mode
    [-slaves <n>] can only be used with -master parameter.
    Default is 20.
    [-prio <0-3>] for process prio - standard is 0 (idle)
    [-silent] no output to CMD
    [-no_folder] doesn't create the output folder.
    [-zip] move Run_YYYY-MM-DD_HHMMSS folder to ZIP archive
    [-shuffle] shuffels system list
    <options> see below!
    [-ver] for version number
    [-? | /? | -help | /help]] for this page

    Options can be (at least one option below must be set):

    -all activate all options below
    -di get only information about domain
    -dp get only information about disk partitions
    -el get only information about eventlog
    -ee [d] [id] get only information about eventlog system errors-> slow
    -hd get only information about harddisk
    -hw get only information about hardware
    -ls get only information about local shares
    -lu get only information about local user accounts
    -ms get only information about membership of local administrators group
    -nw get only information about network settings
    -od get only information about optical drive
    -os get only information about operating system
    -pc get only information about patches
    -pf get only information about pagefile
    -ph get only information about PnP hardware problem
    -pt get only information about printer
    -rl get only information about role of system
    -rt get only information about persistent IP4 routing table
    -sv get only information about services
    -sw get only information about installed software
    -tz get only information about timezone
    -vc get only information about video controller

    If you set only -ee then all errors of last 7 days will be enumerated!
    Otherwise set parameter [d] for days and [id] for event id.

    If argument [-master -slaves <n>] is not given then sequential
    mode will be used automatically!

    Each slave process takes around 6 MB of memory!

    System list file for parameter -i may contain only one name or ip address
    in each line of the appropriate system.

    Output will be written to folder Output where SIC2.exe was started and to a
    separate folder named Run_YYYY-MM-DD_HHMMSS.

    Output format is a semicolon separeted text file (*.csv) in Ouput's subfolder.


    Prio parameter can be from 0-3: Idle, Below Normal, Normal and Above Normal


    Examples:

    Parallel run:
    SIC2.exe -i list.txt -all -zip -master -slaves 25
    SIC2.exe -i list.txt -os -nw -hw -master -slaves 15
    SIC2.exe -i list.txt -ee 5 7000 -di -sw -od -master -prio 1

    Sequential run:
    SIC2.exe -i list.txt -all
    SIC2.exe -i list.txt -el -pc -tz -ms -od -rt -zip
    SIC2.exe -i list.txt -ee 7 -sw -prio 2

    Eine passende GUI (nicht in SIC2.exe, sondern extern) wollte ich auch mal erstellen, nur fehlt mir momentan die Zeit. Also wer Lust hat, kann ja mal eine GUI dazu basteln!

    Gruß,
    UEZ

  • SIC2 (System Information Collector 2 - sammelt Information auch von Remote Systemen)

    • UEZ
    • 24. September 2009 um 01:14

    Hier ein Commandline (CMD) Programm (kein GDI+ ;-)), welches ich im Herbst 2008 programmiert habe, um schnell Informationen von Remote Systemen zu sammeln.

    Eine detaillierte Beschreibung von SIC2 findet ihr hier! Ich hatte mit einem Kollegen überlegt, wie man ein Script beschleunigen kann.
    Heraus kam SIC2. Ist eine, aber sicherlich nicht die beste Möglichkeit (ich habe Anfang 2008 mit AutoIt zu coden angefangen)!

    Vielleicht nützt es ja einigen System Admins, um "schnell" Informationen von seinen Systemen zu sammeln :D

    Nicht getestet auf x64 Systemen. Ein Kollege sagte mir, dass die Software Liste auf x64 nicht vollständig ausgelesen wird... Sollte jetzt funzen!

    Source Code + compilierte Exe + SIC2GUI im Dateianhang unten (Build 2012-02-24 Beta)!

    Ich habe unter WinXP, Windows 2000 und Windows2003 keine Möglichkeit herausgefunden, um die installierten CPUs auszulesen! :(

    Jetzt mit zusätzlicher GUI als extra Skript für Mausschubser ;)

    Gruß,
    UEZ

    PS: Für ein Feedback bitte mein Post#4 unten checken!

    Dateien

    SIC2.7z 1,02 MB – 596 Downloads SIC2_GUI.7z 59,92 kB – 600 Downloads
  • Mein Jump n' Run Spiel mit der Irrlich Engine - Neue Version!

    • UEZ
    • 20. September 2009 um 21:33

    Saubere Arbeit :thumbup: Einige Konstanten kommen mir bekannt vor... ;)

    Ich habe mich noch nie mit Irrlicht befasst. Sieht so aus, als ob man tolle 3D Sachen darstellen kann...

    Gruß,
    UEZ

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 19. September 2009 um 15:17

    War doch nicht so schwer oder? :thumbup:

    Du solltest auf die Pfade achten, wenn du deinen Code postest -> $ball = GUICtrlCreateIcon("C:\Users\Tim\Desktop\Block Breaker\circle.ico", 0, $ballleft, $balltop, 16, 16)...

    Apropos Kollision: kannst ja mal hier schauen: #10 Simple Ball Collision Simulation. Mein Versuch mit Kollisionen zwischen Kugeln...

    UEZ ;)

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 18. September 2009 um 23:57
    Zitat von Techmix

    Da ist er ja, unser GDI+ Gott!
    Neee im ernst, ich glaub nicht das sich jemand hier besser mit GDI auskennt als UEZ!!

    Wenn er meint das du vx mit xy Multiplizieren solltest, damit xyz rauskommt; dann ist das so :rock: :rock:


    Will ja nicht Schleimen oder so :rolleyes:

    Das hat eigentlicht nichts mit GDI+ zu tun, sondern mit Mathe :D GDI+ ist nur ein Darstellungsmedium für die Mathematik/Physik.

    Meine GDI+ Codes finde ich persönlich nicht Gott-Like, sondern nur OK! Ich interessiere mich eben mehr für die grafische Darstellung...

    UEZ

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 18. September 2009 um 23:49

    Ob das jetzt mit GDI+ oder guictrlsetpos() machst, ist erstmal egal.

    Das Objekt bewegt sich mit vx und vy in eine Richtung. Wenn es jetzt zu einer Kollision kommt (vernachlässigen wir mal Drall und andere Faktoren), dann sollte das Objekt sich in eine andere Richtung bewegen.

    Stell dir mal vor, dass eine Kugel sich nur waagerecht bewegt (<-->) und sich an der linken bzw. rechten Bande abstößt. Das heißt, der x Wert ist z.B. aufsteigend, bis die rechte Bande erreicht ist, danach verkleinert sich der x wieder, bis er wieder an die linke Bande stößt. Analog mit der y Achse.

    In meinem Beispiel siehst du unter Func Calculate_New_Position(), wie die neue Position berechnet wird. Je nach Variante wird der Wert einfach mit -1 multipliziert.

    $coordinates[$k][3] bzw. $coordinates[$k][4] sind die Bewegungsvektoren für die x/y Bewegung.

    Ist schwierig zu erklären, aber vielleicht nimmt ihr ja mal Vektoren in Mathe durch... Ich hatte das in der Oberstufe...

    UEZ

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 18. September 2009 um 23:12

    Du muss einfach das entsprechende Vorzeichen ändern.

    In deinem Beispiel fliegt die Kugel mit 2 Vektoren, sagen wir mal vx und vy. Beim Aufprall unten multipliziert du einfach den Vektor vy mit -1. Dadurch bekommst du den neuen Winkel (Vektor v) und musst im Prinzip nur die Kollision berechnen!

    Hier ein Beispiel in GDI+

    Spoiler anzeigen

    ;coded by UEZ 2009
    #include <GUIConstantsEx.au3>
    #include <GDIplus.au3>
    #include <WindowsConstants.au3>

    Global Const $width = @DesktopWidth / 2
    Global Const $height = @DesktopHeight / 2

    Opt("GUIOnEventMode", 1)
    Global $hwnd = GUICreate("Border Collision!", $width, $height, -1, -1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")
    GUISetState()

    _GDIPlus_Startup()
    Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)
    Global $brush_color
    Global $brush = _GDIPlus_BrushCreateSolid()
    _GDIPlus_BrushSetSolidColor($brush, $brush_color)
    Global $max_dots = 1
    Global $max_speed = 5
    Global $iWidth = 60
    Global $iHeight = 60
    Dim $coordinates[$max_dots][5], $angle
    Dim $brush[$max_dots]
    Initialize()

    Do
    _GDIPlus_GraphicsClear($backbuffer, 0xFF000000)
    Draw_Dots()
    Calculate_New_Position()
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    Sleep(5)
    Until False

    Func Initialize()
    For $k = 0 To $max_dots - 1
    $r = Random(64, 255, 1)
    $g = Random(64, 255, 1)
    $b = Random(64, 255, 1)
    $brush_color = "0xAF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
    $brush[$k] = _GDIPlus_BrushCreateSolid($brush_color)
    New_Coordinates($k)
    Next
    EndFunc ;==>Initialize

    Func Draw_Dots()
    Local $i, $temp_x, $temp_y
    For $i = 0 To $max_dots - 1
    _GDIPlus_GraphicsFillEllipse($backbuffer, $coordinates[$i][0], $coordinates[$i][1], $iWidth, $iHeight, $brush[$i])
    Next
    EndFunc ;==>Draw_Dots

    Func New_Coordinates($k)
    $coordinates[$k][0] = $width / 2 ;Random($width / 20, $width - $width / 20, 1);start x position
    $coordinates[$k][1] = $height / 2 ;Random($height / 20, $height - $height / 20, 1) ;start y position
    $coordinates[$k][2] = Random(1, $max_speed, 1) ;speed of pixel
    $angle = Random(0, 359, 1)
    ConsoleWrite("Angle: " & $angle & "°" & @CRLF)
    $coordinates[$k][3] = $coordinates[$k][2] * Cos($angle * 3.141592653 / 180)
    $coordinates[$k][4] = $coordinates[$k][2] * Sin($angle * 3.141592653 / 180)
    EndFunc ;==>New_Coordinates

    Func Calculate_New_Position()
    Local $k
    For $k = 0 To $max_dots - 1
    $coordinates[$k][0] += $coordinates[$k][3] ;increase x coordinate with appropriate slope
    $coordinates[$k][1] += $coordinates[$k][4] ;increase y coordinate with appropriate slope
    If $coordinates[$k][0] <= 0 Then ;border collision x left
    $coordinates[$k][0] = 1
    $coordinates[$k][3] *= -1
    ElseIf $coordinates[$k][0] >= $width - $iWidth Then ;border collision x right
    $coordinates[$k][0] = $width - ($iWidth + 1)
    $coordinates[$k][3] *= -1
    EndIf
    If $coordinates[$k][1] <= 0 Then ;border collision y top
    $coordinates[$k][1] = 1
    $coordinates[$k][4] *= -1
    ElseIf $coordinates[$k][1] >= $height - $iHeight Then ;border collision y bottom
    $coordinates[$k][1] = $height - ($iHeight + 1)
    $coordinates[$k][4] *= -1
    EndIf
    Next
    EndFunc ;==>Calculate_New_Position


    Func close()
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>close

    Func _GDIPlus_BrushSetSolidColor($hBrush, $iARGB = 0xFF000000)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetSolidFillColor", "hwnd", $hBrush, "int", $iARGB)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_BrushSetSolidColor

    Ich hoffe, dass das dir das hilft :)

    UEZ

  • Screensaver layout?

    • UEZ
    • 16. September 2009 um 11:18

    Und? Ist der Code verständlich? Konntest du das Layout erstellen?

    Gruß,
    UEZ

  • Screensaver layout?

    • UEZ
    • 14. September 2009 um 10:59

    Hallo tobi_girst,

    leider kann ich dir nicht via AutoIt.de antworten, da deine Mail nur zu meiner Email Adresse geschickt wurden, aber in Auto.de nicht verfügbar ist.

    Schaue dir doch mal den beigefügten Code genauer an. Falls du Hilfe benötigst, dann melde dich einfach!

    Gruß,
    UEZ

  • Screensaver layout?

    • UEZ
    • 13. September 2009 um 17:50

    Vielleicht hilft dir ja dieser Beitrag weiter GDI+ Screensaver (Magic Lines Screensaver) ;)

    Punkte 1-3 sind u.a. implementiert, wobei Punkt 2 nur eine Messagebox ist (ich war zu faul für ein Settings Menue :whistling: )

    Gruß,
    UEZ

  • SuperMario Gameplay und Download

    • UEZ
    • 12. September 2009 um 22:32

    Sau geile Implementierung! :thumbup:

    Respekt!


    UEZ

  • GDI+ CloneArea Problem

    • UEZ
    • 3. September 2009 um 22:25

    Kannst du bitte mir nochmals erklären, was du genau machen willst!

    Ich dachte, dass du ein Bild laden und es anschließend auf irgendeine Seite clonen willst! ?(

    UEZ

  • GDI+ CloneArea Problem

    • UEZ
    • 3. September 2009 um 20:53

    Hilft dir dieser Thread vielleicht -> [ gelöst ] Gdi+ Clone/Save

    Gruß,
    UEZ

  • Die Länge einer Linie anhand 2 Koordinaten herausfinden

    • UEZ
    • 3. September 2009 um 19:40
    [autoit]

    Func Pixel_Distance($x1, $y1, $x2, $y2) ;Pythagoras theorem
    Local $a, $b, $c
    If $x2 = $x1 And $y2 = $y1 Then
    Return 0
    Else
    $a = $y2 - $y1
    $b = $x2 - $x1
    $c = Sqrt($a * $a + $b * $b)
    Return $c
    EndIf
    EndFunc ;==>Pixel_Distance

    [/autoit]

    Gruß,
    UEZ

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™