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. teh_hahn

Beiträge von teh_hahn

  • Zähler

    • teh_hahn
    • 30. August 2007 um 09:24

    Hi!

    ja genau. Kannst Du machen wie Du lustig bist. Habe Dir mal ein paar Möglichkeiten aufgeschrieben.

    Spoiler anzeigen
    [autoit]

    Local Const $I_MAX = 5

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

    #region - Example 1
    For $i = 1 To $I_MAX
    Run(@ProgramFilesDir & "\RouterControl\reconnect.bat")
    IniWrite(@ScriptDir & "\Time.ini", "Loop", "Count1", $i)
    Next
    #endregion - Example 1

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

    #region - Example 1
    Local $i = 1
    While $i <= $I_MAX
    Run(@ProgramFilesDir & "\RouterControl\reconnect.bat")
    IniWrite(@ScriptDir & "\Time.ini", "Loop", "Count2", $i)
    $i += 1
    WEnd
    #region - Example 2

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

    #region - Example 3
    Local $i = 1
    Do
    Run(@ProgramFilesDir & "\RouterControl\reconnect.bat")
    IniWrite(@ScriptDir & "\Time.ini", "Loop", "Count3", $i)
    $i += 1
    Until $i > $I_MAX
    #region - Example 3

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

    #region - Example 4 (Endless...)
    Local $i = 1
    While 1
    Run(@ProgramFilesDir & "\RouterControl\reconnect.bat")
    IniWrite(@ScriptDir & "\Time.ini", "Loop", "Count2", $i)
    $i += 1
    Sleep(50) ;~ CPU
    WEnd
    #region - Example 4

    [/autoit]


    Am performantesten ist aber wohl die FOR-Schleife, daher würde ich die verwenden!

  • Firefox - XPIs automatisch installieren

    • teh_hahn
    • 29. August 2007 um 23:37

    Hi!

    Hatte vor längerer Zeit mal ein Batchskript dafür geschrieben:

    Mozilla_Firefox_XPI_Installer.cmd:

    Spoiler anzeigen
    Code
    :: -----------------------------------------------------------------------------
    :: Script Function...: Installs XPI extensions into Mozilla Firefox.
    :: Script Version....: 1.0
    :: Change Date.......: 2006-08-01
    ::
    :: Author(s).........: teh_hahn <sPiTsHiT@gmx.de>
    :: Company...........: none
    :: URL...............: none
    ::
    :: Script File(s)....: Mozilla_Firefox_XPI_Installer.cmd - This script
    :: OS Version(s).....: Windows 2000 / Server 2003 / XP
    :: Note(s)...........: Requires: "taskkill.exe"
    :: -----------------------------------------------------------------------------
    @echo off
    
    
    set FIREFOXPATH=%PROGRAMFILES%\Mozilla Firefox\firefox.exe
    set SCRIPTNAME=Mozilla Firefox XPI Installer
    
    
    title %SCRIPTNAME%
    
    
    tasklist /fi "IMAGENAME eq firefox.exe"|findstr /i firefox.exe > nul
    cls
    echo *** Welcome to %SCRIPTNAME% Script ***
    echo.
    if %ERRORLEVEL% neq 0 (goto Proceed) else goto Choice
    
    
    :Choice
    set /p SURE="firefox.exe is running. Should I kill the process and continue? (Y/N) "
    echo.
    if /i "%SURE%" equ "Y" goto ProcessKill
    if /i "%SURE%" equ "N" goto ExitScript
    
    
    echo *** Input Error! ^(Usage^: "Y" or "N"^) ***
    echo.
    goto Choice
    
    
    :ProcessKill
    taskkill /f /im firefox.exe > nul
    ping -n 1 1.2.3.4 > nul
    
    
    :Proceed
    echo *** Please wait until Mozilla Firefox extensions are installed ***
    echo.
    for %%f in ("*.xpi") do "FIREFOXPATH" -install-global-extension "%%f"
    if %ERRORLEVEL% neq 0 (echo *** An unknown error occured! ***) else echo *** %SCRIPTNAME% was sucessfull! ***
    echo.
    echo *** Press any key to exit %SCRIPTNAME% ***
    pause > nul
    exit
    
    
    :ExitScript
    echo *** %SCRIPTNAME% exit! ^(No chances were made^) ***
    pause > nul
    exit
    Alles anzeigen


    So wie ich das sehe, kannst Du da per Drag&Drop alle XPI-Files auf die Datei ziehen und er installiert die dann automatisch! Oben kannst den Pfad anpassen.

  • IP-Scanner Algorithmus

    • teh_hahn
    • 29. August 2007 um 23:07

    So, ich meld mich auch mal wieder zu Wort:

    GtaSpider : Macht ja nichts. Hätte ich in meinem ersten Post ja auch schon erwähnen können, war bloß schreibfaul! :P
    Dein Code macht leider nicht das richtige, da ja nur jedes Oktett "von"-"bis" verglichen wird und dann nur soweit gezählt wird.
    Bei Start: 192.168.0.1 und Ende: 192.168.0.254 wird z.B. gar nichts gemacht, da das letzte Start-Oktett niedriger als das letzte Ende-Oktett ist und er in dem Fall Probleme in der letzten FOR-Schleife bekommt.

    BugFix : Geile Sache!!! Genau das ist es, was ich gesucht habe. Deine UDF scheint aber einen Fehler zu haben (habe jetzt nicht weiter nachgeschaut). Hab Deine UDF jetzt aus dem ersten Code erstellt und noch dem Array-Index0 die Anzahl der generierten IPs hinzugefügt, plus eine etwas erweiterte Überprüfung der IPs hinzugefügt. Zudem habe ich die Funktion in _IpGenerateRange umbenannt, da alle meine IP-Funktionen mit _Ip... beginnen.

    _IpRangeToAddresses: und mehr... :D (Vielen Dank, an alle die etwas dazu beigetragen haben!!!)

    Spoiler anzeigen
    [autoit]

    #include-once

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IpGenerateRange
    UDF Version.......: 1.1
    Change Date.......: 2007-08-29
    UDF Description...: Generate all possible IPv4 addresses between two IP addresses.

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

    Author(s).........: BugFix <[email='bugfix@autoit.de'][/email]>
    Modified by teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $S_SIP - String containing an IPv4 address to begin with.
    $S_EIP - String containing an IPv4 address to end with.
    Return Value......: Success: Returns an one-dimensional array:
    $a_ips[0] = Contains the count of generated IP addresses.
    $a_ips[1...n] = Contains the IP addresses.
    Failure: Returns 0 and sets @error = 1 if IP address(es) are invalid.

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

    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _IpGenerateRange(Const $S_SIP, Const $S_EIP)
    If Not _IsIPv4($S_SIP) Or Not _IsIPv4($S_EIP) Then Return (SetError(1, 0, 0))

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

    Local Const $A_SIPS = StringSplit($S_SIP, ".")
    Local $i_s2 = $A_SIPS[2], $i_s3 = $A_SIPS[3], $i_s4 = $A_SIPS[4]
    Local Const $A_EIPS = StringSplit($S_EIP, ".")
    Local $i_e2 = 0, $i_e3 = 0, $i_e4 = 0
    Local $a_ips[1] = [0]

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

    For $1 = $A_SIPS[1] To $A_EIPS[1]
    If $1 <> $A_EIPS[1] Then
    $i_e2 = 255
    If $1 <> $A_SIPS[1] Then $i_s2 = 0
    Else
    $i_e2 = $A_EIPS[2]
    EndIf
    For $2 = $i_s2 To $i_e2
    If $2 <> $A_EIPS[2] Or $1 <> $A_EIPS[1] Then
    $i_e3 = 255
    If $2 <> $A_SIPS[2] Then $i_s3 = 0
    Else
    $i_e3 = $A_EIPS[3]
    EndIf
    For $3 = $i_s3 To $i_e3
    If $3 <> $A_EIPS[3] Or $2 <> $A_EIPS[2] Or $1 <> $A_EIPS[1] Then
    $i_e4 = 255
    If $3 <> $A_SIPS[3] Then $i_s4 = 0
    Else
    $i_e4 = $A_EIPS[4]
    EndIf
    For $4 = $i_s4 To $i_e4
    $i_ips = UBound($a_ips)
    ReDim $a_ips[$i_ips + 1]
    $a_ips[$i_ips] = $1 & "." & $2 & "." & $3 & "." & $4
    Next
    Next
    Next
    Next

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

    $a_ips[0] = $i_ips
    Return ($a_ips)
    EndFunc ;==>_IpGenerateRange

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IpToMac
    UDF Version.......: 1.1
    Change Date.......: 2007-08-28
    UDF Description...: Converts an IP address to MAC address.

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

    Author(s).........: gtaspider <[email='gtaspider@autoit.de'][/email]>
    Modified by teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.gtaspider.de/

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

    Parameter(s)......: $S_IP - String containing an IPv4 address.
    Return Value......: Success: Returns string containing MAC address corresponding to the IPv4 address.
    Failure: Returns 00:00:00:00:00:00 if IPv4 address could not be converted.

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

    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _IpToMac(Const $S_IP)
    Local $struct_macstr = DllStructCreate("byte[6]")
    Local $struct_macsize = DllStructCreate("int")
    DllStructSetData($struct_macsize, 1, 6)

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

    Local $a_return = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $S_IP)
    $a_return = DllCall("iphlpapi.dll", "int", "SendARP", "int", $a_return[0], "int", 0, "ptr", DllStructGetPtr($struct_macstr), "ptr", DllStructGetPtr($struct_macsize))

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

    Local $s_macaddress = ""
    For $i = 0 To 5
    If $i Then $s_macaddress &= ":"
    $s_macaddress &= Hex(DllStructGetData($struct_macstr, 1, $i + 1), 2)
    Next

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

    $struct_macstr = 0
    $struct_macsize = 0
    Return ($s_macaddress)
    EndFunc ;==>_IpToMac

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IpToName
    UDF Version.......: 1.1
    Change Date.......: 2007-08-28
    UDF Description...: Converts an IPv4 address to Hostname.

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

    Author(s).........: gtaspider <[email='gtaspider@autoit.de'][/email]>
    Modified by teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.gtaspider.de/

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

    Parameter(s)......: $S_IP - String containing an IPv4 address.
    $I_PING - Integer specifying whether to ping the IPv4 address before or not.
    0 = (default) Do not ping the IPv4 address before.
    1 = Ping the IPv4 address before.
    Return Value......: Success: Returns string containing Hostname corresponding to the IPv4 address.
    Failure: Returns 0
    When the function fails @error contains extended information:
    1 = The host with the specified IP address is currently offline.
    2 = Could not convert the IPv4 address.
    3 = Could not run "nbtstat.exe".

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

    AutoIt Version....: 3.2.6.0
    Note(s)...........: Requires: "nbtstat.exe"
    #ce ----------------------------------------------------------------------------
    Func _IpToName(Const $S_IP, Const $I_PING = 0)
    If $I_PING Then
    If Not Ping($S_IP, 50) Then Return (SetError(1, 0, 0))
    EndIf

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

    Local Const $I_PID = Run(@ComSpec & " /c nbtstat.exe -a " & $S_IP, @SystemDir, @SW_HIDE, 2)
    If @error Then Return (SetError(3, 0, 0))

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

    Local $s_outread = ""
    While 1
    $s_outread &= StdoutRead($I_PID)
    If @error Then ExitLoop
    WEnd

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

    Local Const $A_OUTREAD = StringSplit($s_outread, @CRLF)
    For $i = 1 To $A_OUTREAD[0]
    If StringInStr($A_OUTREAD[$i], "---------------------------------------------") Then
    $s_outread = StringTrimLeft($A_OUTREAD[$i + 3], 4)
    Return (StringLeft($s_outread, StringInStr($s_outread, " ") - 1))
    EndIf
    Next

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

    Return (SetError(2, 0, 0))
    EndFunc ;==>_IpToName

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IpRangeToAddresses
    UDF Version.......: 1.0
    Change Date.......: 2007-08-29
    UDF Description...: Pings a host-range and returns the IPv4 address and the roundtrip-time
    (optional plus Hostnames and MAC address).

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

    Author(s).........: teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $I_IPS - Array containing an IPv4 address-range.
    Return Value......: Success: Returns an one-dimensional array:
    $a_ret[0][0] = Contains the IPv4 address-range count.
    $a_ret[1...n][1] = Contains the roundtrip-times.
    $a_ret[1...n][2] = Contains the Hostnames.
    $a_ret[1...n][3] = Contains the MAC addresses.
    Failure: Returns 0 if $I_IPS is not an array (@error = 1).

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

    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _IpRangeToAddresses(ByRef Const $i_ips, Const $_TIMEOUT = 4000, Const $I_NAME = 0, Const $I_MAC = 0)
    If Not IsArray($i_ips) Then Return (SetError(1, 0, 0))

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

    Local $a_ret[$i_ips[0] + 1][4]
    For $i = 1 To $i_ips[0]
    $a_ret[$i][0] = $i_ips[$i]
    $a_ret[$i][1] = Ping($a_ret[$i][0], $_TIMEOUT)
    If Not @error Then
    If $I_NAME Then $a_ret[$i][2] = _IpToName($a_ret[$i][0])
    If $I_MAC Then $a_ret[$i][3] = _IpToMac($a_ret[$i][0])
    EndIf
    Next

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

    $a_ret[0][0] = $i - 1
    Return ($a_ret)
    EndFunc ;==>_IpRangeToAddresses

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IsIPv4
    UDF Version.......: 1.1
    Change Date.......: 2007-08-28
    UDF Description...: Checks for a valid IPv4 address.

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

    Author(s).........: Thorsten Willert <[email='thorsten.willert@gmx.de'][/email]>
    Company...........: none
    URL...............: http://thorsten-willert.de/

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

    Parameter(s)......: $S_IP - String containing an IPv4 address.
    Return Value......: Success: Returns 1
    Failure: Returns 0 and sets @error = 1 if IP address is invalid.

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

    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _IsIPv4(Const $S_IP)
    If StringRegExp($S_IP, "\A(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\z") Then Return (1)
    Return (SetError(1, 0, 0))
    EndFunc ;==>_IsIPv4

    [/autoit]


    Example:

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #include <Array.au3>

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

    Local $s_startip = "192.168.0.1"
    Local $s_endip = "192.168.0.11"
    Local $a_iprange = _IpGenerateRange($s_startip, $s_endip)
    _ArrayDisplay(_IpRangeToAddresses($a_iprange, 25, 1, 1), "_IpRangeToAddresses from: " & $s_startip & " to: " & $s_endip)

    [/autoit]

    @Agent00: Das was Du schreibst stimmt vom Grundsatz her. Mir ging es aber wirklich in erster Linie um den Algorithmus. Abfragen, ob das Scannen gewisser Ranges Sinn ergibt oder nicht, ließen sich ja auch noch außerhalb der Funktion integrieren! Deine Angaben zu den IP-Adressklassen stimmen leider nicht ganz:

    Klasse-C Adressen haben eine Standardsubnetzmaske von 255.255.255.0 (Hier sind die ersten drei Oktette der Netzanteil und das Vierte der Hostanteil). Dadurch, dass die ersten drei Bits fix sind, beginnt die Klasse-C IP-Range bei 192.0.0.0 und endet bei 223.255.255.255 (einfach alle Netzanteil-Bits auf 1 setzen).
    Das private IPs (d.h. IPs die nicht vom Router geroutet werden von 192.168.0.0/24 bis 192.168.255.255 gehen stimmt (bei einer Standardsubnetzmaske). Allerdings würde schon das Scannen von 192.168.0.0 (der Netzadresse) und 192.168.255.255 (der Broadcastadresse) keinen Sinn machen (es sei denn, es gelingt einem die Broadcastanwtort, die ja von jedem Host kommt, der den Broadcast empfängt, abzufangen [wüsste jetzt nicht, wie man das mit AutoIt bewerkstelligen könnte...] Das wäre doch noch mal eine Aufgabenstellung...)
    Ansonsten aber schöne Erklärung zur Thematik!

    Naja, auf jedenfall oben erst einmal die Funktionen, die soweit einwandfrei funktionieren. Wenn wir das Ganze noch performanter bekommen könnten, wräre das der Hammer!

    EDIT: Änderung an _IpRangeToAddresses: Abfragen für Hostname und MAC fehlten.

  • IP-Scanner Algorithmus

    • teh_hahn
    • 29. August 2007 um 13:43

    lol, danke, aber das habe ich mir bereits angeschaut. Soweit das Ganze zu machen ist ja (relativ) leicht. Mit Deinem Skript kann man ja nur das letzte Oktett scannen. Ich möchte einen Algorithmus, der mich von 0.0.0.0 bis 255.255.255.255 scannen lässt.

    Würde daraus dann ganz gerne eine UDF bauen.

  • IP-Scanner Algorithmus

    • teh_hahn
    • 29. August 2007 um 11:01

    Hallo zusammen!

    Habe grade voll den logischen Denkfehler. ich will mir einen Algorithmus programmieren, mit dem ich IP-Ranges (z.B.: von 192.0.0.1 - 192.168.0.0) scannen kann.
    Folgenden Code habe ich bisher geschrieben:

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    _ArrayDisplay(_PingAll("192.0.0.1", "192.168.0.1", 25, 0, 0))

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

    Func _PingAll(Const $S_IPSTART, Const $S_IPEND, Const $_TIMEOUT = 4000, Const $I_GETNAME = 0, Const $I_GETMAC = 0)
    Local $a_ret[20480][4]
    Local $i = 1
    $a_startip = StringSplit($S_IPSTART, ".", 1)
    $a_endip = StringSplit($S_IPEND, ".", 1)
    For $i_first = $a_startip[1] To 255
    If $i_first > $a_endip[1] Then ExitLoop
    For $i_second = $a_startip[2] To 255
    If $i_second > $a_endip[2] Then ExitLoop
    For $i_third = $a_startip[3] To 255
    If $i_third > $a_endip[3] Then ExitLoop
    For $i_fourth = $a_startip[4] To 255
    $a_ret[$i][0] = $i_first & "." & $i_second & "." & $i_third & "." & $i_fourth
    ;~ MsgBox(0, "", "Fourth: " & $i_fourth & @CR & "End: " & $a_endip[4] & @CR & $a_ret[$i][0])
    If $i_fourth > $a_endip[4] Then
    ;~ Hier fehlt die entscheidende Überprüfung!
    ExitLoop
    EndIf
    ;~ $a_ret[$i][1] = Ping($a_ret[$i][0], $_TIMEOUT)
    ;~ If Not @error Then
    ;~ $a_ret[$i][2] = _TCPIpToName($a_ret[$i][0])
    ;~ $a_ret[$i][3] = _IpToMac($a_ret[$i][0])
    ;~ EndIf
    $i += 1
    Next
    Next
    Next
    Next

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

    $a_ret[0][0] = $i - 1
    ReDim $a_ret[$i][4]

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

    Return ($a_ret)
    EndFunc ;==>_PingAll

    [/autoit]

    Das Problem ist die Zusammensetzung der Schleifen, da er ja in Abhängigkeit des jeweiligen Oktetts fortfahren muss oder nicht. Vielleicht kann mir ja jemand weiterhelfen!

  • verschiedene Probleme mit gui und Dosbox

    • teh_hahn
    • 29. August 2007 um 08:48

    Hi!

    Vielleicht hilft dir folgendes Beispiel weiter:

    Spoiler anzeigen
    [autoit]

    Local Const $S_COMMAND = "ftp.exe"
    Local Const $I_PID = Run(@ComSpec & ' /c "' & $S_COMMAND & '"', @WorkingDir, @SW_HIDE, 7)
    StdinWrite($I_PID, "HELP")
    StdinWrite($I_PID)

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

    Local $s_stdout = ""
    While 1
    $s_stdout &= StdoutRead($I_PID)
    If @error Then ExitLoop
    WEnd

    MsgBox(0, "Debug", $s_stdout)

    [/autoit]


    Dein Aufruf von StdinWrite() war schon falsch, da da der erste Parameter die ProzessID des Run-Befehls sein muss. StdinWrite("PID") beendet den Stream.

  • gleicher Ausdruck - oder nicht? ("nicht ungleich" <> "gleich" ?)

    • teh_hahn
    • 29. August 2007 um 08:41

    Hi!

    Ähh, das klappt doch alles wunderbar. Folgende drei Anweisungen machen exakt das Gleiche, wobei Case 1 wohl die schnellste Überprüfung ist:

    Spoiler anzeigen
    [autoit]

    Local Const $I_VAR = 23

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

    Select
    Case $I_VAR = 23
    MsgBox(64, "Test", "Case 1")
    ContinueCase
    Case $I_VAR == 23
    MsgBox(64, "Test", "Case 2")
    ContinueCase
    Case Not $I_VAR <> 23
    MsgBox(64, "Test", "Case 3")
    ContinueCase
    EndSelect

    [/autoit]

    Dein Fehler muss irgendwo anders liegen!

  • _IsIPv4

    • teh_hahn
    • 28. August 2007 um 11:04

    Muss nicht. Da sich der Wert von $S_IP innerhalb der Funktion aber nicht ändert, habe ich das verwendet. Mache ich eigentlich immer so.

  • _IsIPv4

    • teh_hahn
    • 28. August 2007 um 09:06

    Hi,

    brauchte für eins meiner Skripte eine Funktion um eine IPv4-Adresse auf ihre Korrektheit zu überprüfen (Kein ping!) Dazu habe ich mir folgende Funktion geschrieben:
    _IsIPv4_bak:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IsIPv4_bak
    UDF Version.......: 1.0
    Change Date.......: 2007-08-28
    UDF Description...: Checks if a variable is an IPv4 address.

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

    Author(s).........: teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $S_IP - Specifies the IPv4 address.
    Return Value......: Success: Returns 1
    Failure: Returns 0
    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _IsIPv4_bak(Const $S_IP)
    If StringRegExp($S_IP, "[12]?[0-9]{1,2}\.[12]?[0-9]{1,2}\.[12]?[0-9]{1,2}\.[12]?[0-9]{1,2}") Then
    Local Const $A_IPSPLIT = StringSplit($S_IP, ".")
    For $i = 1 To $A_IPSPLIT[0]
    If Int($A_IPSPLIT[$i]) > 255 Then Return (SetError(1, 0, 0))
    Next

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

    Return (1)
    EndIf

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

    Return (SetError(2, 0, 0))
    EndFunc ;==>_IsIPv4_bak

    [/autoit]


    Ich denke mal, die kann der Ein oder Andere bestimmt auch mal gebrauchen!

    EDIT1: OK, ich gebe mich geschlagen, Deine Funktion ist eindeutig performanter! Hier nochmal:
    _IsIPv4:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _IsIPv4
    UDF Version.......: 1.0
    Change Date.......: 2007-08-19
    UDF Description...: Checks if a variable is an IPv4 address.

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

    Author(s).........: Thorsten Willert <[email='thorsten.willert@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $S_IP - Specifies the IPv4 address.
    Return Value......: Success: Returns 1
    Failure: Returns 0
    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _IsIPv4(Const $S_IP)
    If StringRegExp($S_IP, "\A(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\z") Then Return (1)
    Return (0)
    EndFunc ;==>_IsIPv4

    [/autoit]


    EDIT2: @huggy. Hast natürlich Recht. Schon gefixed. Wollte es bloß einheitlich zur Übersicht haben!

  • Datei an Hashwert erkennen

    • teh_hahn
    • 28. August 2007 um 08:56

    Hi!

    Auch das englische Forum bemühen hilft einem manchmal weiter!
    http://www.autoitscript.com/forum/index.php?showtopic=10590

    Hier noch eine kleine Hilfe dazu:
    http://www.dailycupoftech.com/?page_id=135

  • Editbox transparent?

    • teh_hahn
    • 28. August 2007 um 08:28

    Hi!

    Dann machst Du einfach folgendes:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    $guio = GUICreate("", 320, 240)
    GUICtrlCreatePic("MyPic.jpg", 0, 0, 300, 120)
    GUICtrlCreateButton("Button", 250, 210, 60)
    GUISetState()

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

    $guic = GUICreate("", 300, 120, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $guio)
    WinSetTrans($guic, "", 200)
    GUICtrlCreateEdit("", 0, 0, 300, 120)
    GUISetState()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • WinWaitActive kennt meinen Text nicht

    • teh_hahn
    • 28. August 2007 um 08:21

    Hi!

    Entweder mit der IE.au3 machen oder aber die neue FF.au3 von Stilgar benutzen: FF.au3 Beta (Programm und Dokumentation)

    Damit sollte es auf jeden Fall möglich sein!

  • Hilfe mit Button

    • teh_hahn
    • 28. August 2007 um 08:19

    Bitte Source-Code anständig posten!

    Das Ganze geht entweder mit Run oder mit ShellExecute:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    $Form1_1 = GUICreate("New Box", 512, 391, -1, -1)
    GUISetIcon("D:\006.ico")
    $GroupBox1 = GUICtrlCreateGroup("Info", 8, 0, 497, 377, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetBkColor(-1, 0xF1EFE2)
    $Label2 = GUICtrlCreateLabel("Version : 1.1", 16, 24, 75, 17, $WS_GROUP)
    GUICtrlSetBkColor(-1, 0xF1EFE2)
    $Label1 = GUICtrlCreateLabel("http://www.geheim.de", 328, 358, 172, 17)
    GUICtrlSetBkColor(-1, 0xF1EFE2)
    $Group1 = GUICtrlCreateGroup("Start info", 16, 48, 129, 65)
    GUICtrlSetBkColor(-1, 0xF1EFE2)
    $Button1 = GUICtrlCreateButton("Start", 32, 72, 89, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

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

    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    ShellExecute("C:/Programme/New/?!.exe")
    EndSwitch
    WEnd

    [/autoit]
  • An-/Abmelden

    • teh_hahn
    • 27. August 2007 um 15:11

    Ja. Und was ist jetzt genau die Frage. Willst Du Skripte beim An- bzw. Abmelden starten? Dazu legst du einfach in den Ordnern %SYSTEMROOT%\System32\GroupPolicy\Maschine\Scripts\Startup bzw. %SYSTEMROOT%\System32\GroupPolicy\Maschine\Scripts\Shutdown ein BAT- bzw. CMD-Skript an, mit dem auszuführenden Inhalt. Das Hinzufügen der Skripte geschieht dann über Ausführen => gpedit.msc, dann Windows-Einstellungen und dann Skripte.

    Fertig.

  • _RunWait

    • teh_hahn
    • 27. August 2007 um 14:52

    Hi,

    mir fiel auf, dass die Funktion _RunWait im Falle eines Timeouts, keinen Standard-Stream zurück gibt, was wohl daran liegt, dass der Prozess geschlossen wird bevor überhaupt ein StdRead ausgeführt wird. Daher mal hier, die von mir gefixede Variante:
    _RunWait.au3:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _RunWait
    UDF Version.......: 1.0
    Change Date.......: 2008-07-27
    UDF Description...: Runs an external program and pauses script execution until the program finishes.

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

    Author(s).........: gtaspider <[email='gtaspider@autoit.de'][/email]>
    teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $s_filename - The name of the executable (EXE, BAT, COM, or PIF) to run.
    $s_workingdir - [optional] The working directory.
    $s_flag - [optional] The "show" flag of the executed program:
    @SW_HIDE = Hidden window
    @SW_MINIMIZE = Minimized window
    @SW_MAXIMIZE = Maximized window
    $_stdioflag - [optional] Provide a meaningful handle to one or more STD I/O streams of the child process.
    1 ($STDIN_CHILD) = Provide a handle to the child's STDIN stream
    2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream
    4 ($STDERR_CHILD) = Provide a handle to the child's STDERR stream
    $i_timeout - [optional] Specifies the timeout of the process in milliseconds.
    Return Value......: Success: Returns the STDOUT output
    Failure: Returns the STDOUT / STDERR output depending on @error
    When the function fails @error contains extended information:
    1 = The return value contains the STDERR output.
    2 = The application has a timeout and the return value contains the STDOUT output.
    3 = The application has a timeout and the return value contains the STDERR output.
    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _RunWait(Const $S_FILENAME, Const $S_WORKINGDIR = "", Const $S_FLAG = "", Const $_STDIOFLAG = "", Const $I_TIMEOUT = 0)
    Local Const $I_PID = Run($S_FILENAME, $S_WORKINGDIR, $S_FLAG, $_STDIOFLAG)

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

    If $I_TIMEOUT Then Local $d_timerinit = TimerInit()

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

    While ProcessExists($I_PID)
    If $I_TIMEOUT Then
    If TimerDiff($d_timerinit) >= $I_TIMEOUT Then ExitLoop
    EndIf
    WEnd

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

    If ProcessExists($I_PID) Then
    ProcessClose($I_PID)
    Local $s_stderr = StderrRead($I_PID)
    If $s_stderr Then Return (SetError(2, 0, $s_stderr))

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

    Return (SetError(3, 0, StdoutRead($I_PID)))
    EndIf

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

    Local $s_stderr = StderrRead($I_PID)
    If $s_stderr Then Return (SetError(1, 0, $s_stderr))

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

    Return (StdoutRead($I_PID))
    EndFunc ;==>_RunWait

    [/autoit]


    Example.au3:

    Spoiler anzeigen
    [autoit]

    #include "RunWait.au3"

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

    Local Const $i_pid = _RunWait(@ComSpec & " /c cd.exe BlaBlub12345", "", @SW_HIDE, 6, 0)
    If @error = 1 Then Exit(MsgBox(16, "Error 1", "Das Programm hat einen Error ausgegeben (StdErr):" & @CRLF & @CRLF & $i_pid))
    If @error = 2 Then Exit(MsgBox(16, "Error 2", "Das Programm hat ein Timeout mit Error Ausgabe (StdErr):" & @CRLF & @CRLF & $i_pid))
    If @error = 3 Then Exit(MsgBox(48, "Error 3", "Das Programm hat ein Timeout mit Standard Ausgabe (StdOut:)" & @CRLF & @CRLF & $i_pid))
    Exit(MsgBox(64, "Erfolg", $i_pid))

    [/autoit]
  • Dos Box

    • teh_hahn
    • 27. August 2007 um 13:03

    Hi,

    habe mir Eure DOS Box mal angeschaut und so erweitert, dass sie nun ziemlich vollwertig ist. Schaut Euch das Ding mal an und gebt Feedback!

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------
    Script Name.......: DOS Box
    Script Version....: 1.0
    Change Date.......: 2007-08-27

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

    Author(s).........: Daniel Wahlmann <[email='danielwahlmann@web.de'][/email]>
    ytwinky (autoit.de)
    teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: n/a
    URL...............: http://www.autoit.de/

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

    Script File(s)....: DOSBox.au3 - This script.
    AutoIt Version....: 3.2.6.0
    Note(s)...........: n/a
    #ce ----------------------------------------------------------------------------

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

    #NoTrayIcon

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

    #region - Including external files.
    #include <Constants.au3>
    #include <GUIConstants.au3>
    #endregion - Including external files.

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

    #region - Changing the operation of AutoIt functions/parameters.
    Opt("GUICloseOnESC", 0)
    Opt("MustDeclareVars", 1)
    Opt("RunErrorsFatal", 0)
    #endregion - Changing the operation of AutoIt functions/parameters.

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

    main()

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

    Func main()
    #region - Declaring local constants/variables.
    Local Const $S_APPTITLE = "DOS Box"
    Local Const $S_APPVERSION = "1.0"
    Local Const $HEX_BKCOLOR = 0x000000
    Local Const $HEX_COLOR = 0xC0C0C0

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

    Local $s_osversion = "", $s_cmd = "", $s_directory = "", $s_stdout = ""
    Local $h_maingui = -1, $h_outputedit = -1, $h_cmdcombo = -1, $h_cmdbt = -1
    Local $i_suppresswarn = 0, $i_pid = 0
    #endregion - Declaring local constants/variables.

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

    #region - Determining the current operating system.
    Switch @OSVersion
    Case "WIN_VISTA"
    $s_osversion = "Vista"
    Case "WIN_2003"
    $s_osversion = "Server 2003"
    Case "WIN_XP"
    $s_osversion = "XP"
    Case "WIN_2000"
    $s_osversion = "2000"
    Case "WIN_NT4"
    $s_osversion = "NT"
    Case "WIN_ME"
    $s_osversion = "Millenium"
    Case "WIN_98"
    $s_osversion = "98"
    Case "WIN_95"
    $s_osversion = "95"
    EndSwitch
    #endregion - Determining the current operating system.

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

    #region - Creating the GUI.
    $h_maingui = GUICreate($S_APPTITLE & " v" & $S_APPVERSION, 656, 300, -1, -1)
    $h_outputedit = GUICtrlCreateEdit("Microsoft Windows " & $s_osversion & " [Version " & @OSBuild & "]" & @CRLF & _
    "(C) Copyright Microsoft Corp." & @CRLF & @CRLF & @ScriptDir & ">", 0, 0, 656, 282, $ES_AUTOVSCROLL + $ES_OEMCONVERT + $ES_MULTILINE + $ES_READONLY + $WS_VSCROLL + $WS_DISABLED)
    GUICtrlSetBkColor(-1, $HEX_BKCOLOR)
    GUICtrlSetColor(-1, $HEX_COLOR)
    GUICtrlSetFont(-1, 9, 400, 0, "Lucida Console")
    $h_cmdcombo = GUICtrlCreateCombo("", 0, 282, 601, 18, $CBS_AUTOHSCROLL + $CBS_OEMCONVERT)
    GUICtrlSetFont(-1, 9, 400, 0, "Lucida Console")
    $h_cmdbt = GUICtrlCreateButton("&Send", 606, 282, 50, 18, $BS_CENTER + $BS_DEFPUSHBUTTON + $BS_FLAT)

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

    GUICtrlSetState($h_cmdcombo, $GUI_FOCUS)
    GUISetState(@SW_SHOW, $h_maingui)
    #endregion - Creating the GUI.

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

    #region - GUI SelectLoop.
    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    GUIDelete($h_maingui)
    Exit (0)
    Case $h_cmdbt
    GUICtrlSetData($h_outputedit, @CRLF, GUICtrlRead($h_outputedit))
    GUICtrlSetState($h_cmdbt, $GUI_DISABLE)
    GUICtrlSetState($h_cmdcombo, $GUI_DISABLE)

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

    $s_cmd = GUICtrlRead($h_cmdcombo)
    GUICtrlSetData($h_cmdcombo, $s_cmd & "|")

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

    If StringLeft($s_cmd, 2) = "cd" Then
    $s_directory = StringTrimLeft($s_cmd, StringInStr($s_cmd, " "))
    If FileExists($s_directory) Then
    If FileChangeDir($s_directory) == 1 Then
    $i_suppresswarn = 1
    EndIf
    EndIf
    ElseIf StringLeft($s_cmd, 3) = "cls" Then
    $i_suppresswarn = 1
    GUICtrlSetData($h_outputedit, "")
    EndIf

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

    If $i_suppresswarn = 0 Then
    $i_pid = Run(@ComSpec & " /c " & $s_cmd, @WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    While 1
    $s_stdout = StdoutRead($i_pid)
    If @error Then
    ExitLoop
    EndIf
    GUICtrlSetData($h_outputedit, _StringReplaceDOSChars($s_stdout), GUICtrlRead($h_outputedit))
    WEnd

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

    While 1
    $s_stdout = StderrRead($i_pid)
    If @error Then
    ExitLoop
    EndIf
    GUICtrlSetData($h_outputedit, _StringReplaceDOSChars($s_stdout), GUICtrlRead($h_outputedit))
    WEnd
    EndIf

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

    $i_suppresswarn = 0
    GUICtrlSetData($h_outputedit, @CRLF & @WorkingDir & ">", GUICtrlRead($h_outputedit))
    GUICtrlSetState($h_cmdbt, $GUI_ENABLE)
    GUICtrlSetState($h_cmdcombo, $GUI_ENABLE)
    GUICtrlSetState($h_cmdcombo, $GUI_FOCUS)
    EndSwitch
    WEnd
    #endregion - GUI SelectLoop.
    EndFunc ;==>main

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _StringReplaceDOSChars
    UDF Version.......: 1.0
    Change Date.......: 2007-08-27
    UDF Description...: Replaces special characters for DOS-applications.

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

    Author(s).........: ytwinky (autoit.de)
    Alina (autoit.de)
    teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $s_string - Specifies the string to replace.
    Return Value......: Returns the cleaned up string.

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

    AutoIt Version....: 3.2.6.0
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _StringReplaceDOSChars($s_string)
    $s_string = StringReplace($s_string, Chr(154), "Ü")
    $s_string = StringReplace($s_string, Chr(129), "ü")
    $s_string = StringReplace($s_string, Chr(142), "Ä")
    $s_string = StringReplace($s_string, Chr(132), "ä")
    $s_string = StringReplace($s_string, Chr(153), "Ö")
    $s_string = StringReplace($s_string, Chr(148), "ö")
    $s_string = StringReplace($s_string, Chr(225), "ß")

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

    Return ($s_string)
    EndFunc ;==>_StringReplaceDOSChars

    [/autoit]


    ChangeLog:
    - Design an die XP-Eingabeaufforderung angepasst.
    - Sonderfälle wie "cd" und "cls" werden berücksichtigt.
    - Ausgabe zur Laufzeit.
    - Sperrung der GUI-Controls zur Laufzeit.
    - History der eingegebenen Commands.

    To-Do:
    Output muss noch disabled werden, sonst wird die Ausgabe zerschossen.

  • Crazy GUI

    • teh_hahn
    • 24. August 2007 um 16:16

    Hi, fand die Idee ganz witzig und habe die Funktionen mal etwas "überarbeitet", damit man sie auch wirklich als UDF verwenden kann!

    GUICrazy.au3

    Spoiler anzeigen
    [autoit]

    #include-once

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _GUISetCrazyBk
    UDF Version.......: 1.0
    Change Date.......: 2007-08-24
    UDF Description...: Changes the background color of a GUI in disco mode.

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

    Author(s).........: Waluev (autoit.de)
    teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $I_COUNT - Specifies the number of times to change the background color of the GUI.
    $S_WINTITLE - [optional] Specifies the title of the GUI.
    $S_WINTEXT - [optional] Specifies the text of the GUI.
    $I_INTERVAL - [optional] Specifies the time between the change of the background color of the GUI (default = 250).
    $I_SETORG - [optional] Specifies whether to set the background color of the GUI to its original or not.
    0 = Do not change the background color of the GUI to its original.
    1 = (default) Change the background color of the GUI to its original.
    Return Value......: Success: Returns 1
    Failure: Returns 0 if the GUI does not exist.

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

    AutoIt Version....: 3.2.4.9
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _GUISetCrazyBk(Const $I_COUNT, Const $S_WINTITLE = "", Const $S_WINTEXT = "", Const $I_INTERVAL = 250, Const $I_SETORG = 1)
    Local Const $H_WINHANDLE = WinGetHandle($S_WINTITLE, $S_WINTEXT)
    If $H_WINHANDLE == "" Then
    Return (0)
    EndIf

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

    For $i = 1 To $I_COUNT Step 1
    GUISetBkColor(Random(0, 16777215, 1), $H_WINHANDLE)
    Sleep($I_INTERVAL)
    Next

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

    If $I_SETORG == 1 Then
    GUISetBkColor(0xD4D0C8, $H_WINHANDLE)
    EndIf

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

    Return (1)
    EndFunc ;==>_GUISetCrazyBk

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _GUISetCrazyPos
    UDF Version.......: 1.0
    Change Date.......: 2007-08-24
    UDF Description...: Changes the position of a GUI in disco mode.

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

    Author(s).........: Waluev (autoit.de)
    teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $I_COUNT - Specifies the number of times to change the position of the GUI.
    $S_WINTITLE - [optional] Specifies the title of the GUI.
    $S_WINTEXT - [optional] Specifies the text of the GUI.
    $I_INTERVAL - [optional] Specifies the time between the change of the position of the GUI (default = 250).
    $I_SETORG - [optional] Specifies whether to set the position of the GUI to its original or not.
    0 = Do not change the position of the GUI to its original.
    1 = (default) Change the position of the GUI to its original.
    Return Value......: Success: Returns 1
    Failure: Returns 0 if the GUI does not exist.

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

    AutoIt Version....: 3.2.4.9
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _GUISetCrazyPos(Const $I_COUNT, Const $S_WINTITLE = "", Const $S_WINTEXT = "", Const $I_INTERVAL = 250, Const $I_SETORG = 1)
    Local Const $H_WINHANDLE = WinGetHandle($S_WINTITLE, $S_WINTEXT)
    If $H_WINHANDLE == "" Then
    Return (0)
    EndIf

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

    Local Const $A_ORGWINPOS = WinGetPos($S_WINTITLE, $S_WINTEXT)
    Local $a_winpos = -1

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

    For $i = 1 To $I_COUNT Step 1
    $a_winpos = WinGetPos($S_WINTITLE, $S_WINTEXT)
    WinMove($S_WINTITLE, $S_WINTEXT, Random(0, @DesktopWidth - $a_winpos[2], 1), Random(0, @DesktopHeight - $a_winpos[3], 1))
    Sleep($I_INTERVAL)
    Next

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

    If $I_SETORG == 1 Then
    WinMove($S_WINTITLE, $S_WINTEXT, $A_ORGWINPOS[0], $A_ORGWINPOS[1], $A_ORGWINPOS[2], $A_ORGWINPOS[3])
    EndIf

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

    Return (1)
    EndFunc ;==>_GUISetCrazyPos

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _GUICtrlSetCrazyBk
    UDF Version.......: 1.0
    Change Date.......: 2007-08-24
    UDF Description...: Changes the background color of GUI-controls in disco mode.

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

    Author(s).........: Waluev (autoit.de)
    teh_hahn <[email='sPiTsHiT@gmx.de'][/email]>
    Company...........: none
    URL...............: http://www.autoit.de/

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

    Parameter(s)......: $I_COUNT - Specifies the number of times to change the background color of the GUI-control(s).
    $CONTROLID - Specifies the GUI-control(s) to change the background color.
    If $CONTROLID is a variable only one GUI-control will be changed.
    If $CONTROLID is an array every GUI-control from $CONTROLID[0...n] will be changed.
    $I_INTERVAL - [optional] Specifies the time between the change of the background color of the GUI-control(s) (default = 250).
    $I_SETORG - [optional] Specifies whether to set the GUI-control(s) to their original color or not.
    0 = Do not change the GUI-control(s) to their original color.
    1 = (default) Change the GUI-control(s) to their original color.
    Return Value......: Success: Returns 1
    Failure: Returns 0 if $CONTROLID is not an array or the GUI-control does not exist.

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

    AutoIt Version....: 3.2.4.9
    Note(s)...........: none
    #ce ----------------------------------------------------------------------------
    Func _GUICtrlSetCrazyBk(Const $I_COUNT, Const $CONTROLID, Const $I_INTERVAL = 250, Const $I_SETORG = 1)
    If IsArray($CONTROLID) == 1 Then
    For $i = 1 To $I_COUNT Step 1
    For $p = 0 To UBound($CONTROLID) - 1 Step 1
    GUICtrlSetBkColor($CONTROLID[$p], Random(0, 16777215, 1))
    Next
    Sleep($I_INTERVAL)
    Next

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

    If $I_SETORG == 1 Then
    For $p = 0 To UBound($CONTROLID) - 1 Step 1
    GUICtrlSetBkColor($CONTROLID[$p], 0xD4D0C8)
    Next
    EndIf

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

    Return (1)
    ElseIf GUICtrlGetHandle($CONTROLID) <> 0 Then
    For $i = 1 To $I_COUNT Step 1
    GUICtrlSetBkColor($CONTROLID, Random(0, 16777215, 1))
    Sleep($I_INTERVAL)
    Next

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

    If $I_SETORG == 1 Then
    GUICtrlSetBkColor($CONTROLID, 0xD4D0C8)
    EndIf

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

    Return (1)
    EndIf

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

    Return (0)
    EndFunc ;==>_GUICtrlSetCrazyBk

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

    Func _GUISetCrazy(Const $I_COUNT, Const $S_WINTITLE = "", Const $S_WINTEXT = "", Const $A_CONTROLIDS = -1, Const $I_INTERVAL = 250, Const $I_SETORG = 1)
    Local Const $H_WINHANDLE = WinGetHandle($S_WINTITLE, $S_WINTEXT)
    If $H_WINHANDLE == "" Then
    Return (0)
    EndIf

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

    Local Const $A_ORGWINPOS = WinGetPos($S_WINTITLE, $S_WINTEXT)
    Local $a_winpos = -1

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

    For $i = 1 To $I_COUNT Step 1
    $a_winpos = WinGetPos($S_WINTITLE, $S_WINTEXT)
    WinMove($S_WINTITLE, $S_WINTEXT, Random(0, @DesktopWidth - $a_winpos[2], 1), Random(0, @DesktopHeight - $a_winpos[3], 1))
    GUISetBkColor(Random(0, 16777215, 1), $H_WINHANDLE)
    For $p = 0 To UBound($A_CONTROLIDS) - 1 Step 1
    GUICtrlSetBkColor($A_CONTROLIDS[$p], Random(0, 16777215, 1))
    Next
    Sleep($I_INTERVAL)
    Next

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

    If $I_SETORG == 1 Then
    WinMove($S_WINTITLE, $S_WINTEXT, $A_ORGWINPOS[0], $A_ORGWINPOS[1], $A_ORGWINPOS[2], $A_ORGWINPOS[3])
    GUISetBkColor(0xD4D0C8, $H_WINHANDLE)
    For $p = 0 To UBound($A_CONTROLIDS) - 1 Step 1
    GUICtrlSetBkColor($A_CONTROLIDS[$p], 0xD4D0C8)
    Next
    EndIf

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

    Return (1)
    EndFunc ;==>_GUISetCrazy

    [/autoit]

    GUICrazy_Example.au3

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #include <GUIConstants.au3>
    #include "GUICrazy.au3"

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

    Local Const $I_COUNT = 10
    Local Const $I_INTERVAL = 250
    Local Const $I_RETURNTOORG = 1

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

    Local Const $S_WINTITLE = "Crazy Windows"
    Local $a_controls[30]
    Local $h_maingui = -1
    Local $msg = -1
    $h_maingui = GUICreate($S_WINTITLE, 370, 340)
    $a_controls[0] = GUICtrlCreateButton("", 10, 10, 50, 50)
    $a_controls[1] = GUICtrlCreateButton("", 70, 10, 50, 50)
    $a_controls[2] = GUICtrlCreateButton("", 130, 10, 50, 50)
    $a_controls[3] = GUICtrlCreateButton("", 190, 10, 50, 50)
    $a_controls[4] = GUICtrlCreateButton("", 250, 10, 50, 50)
    $a_controls[5] = GUICtrlCreateButton("", 310, 10, 50, 50)
    $a_controls[6] = GUICtrlCreateButton("", 10, 70, 50, 50)
    $a_controls[7] = GUICtrlCreateButton("", 70, 70, 50, 50)
    $a_controls[8] = GUICtrlCreateButton("", 130, 70, 50, 50)
    $a_controls[9] = GUICtrlCreateButton("", 190, 70, 50, 50)
    $a_controls[10] = GUICtrlCreateButton("", 250, 70, 50, 50)
    $a_controls[11] = GUICtrlCreateButton("", 310, 70, 50, 50)
    $a_controls[12] = GUICtrlCreateButton("", 10, 140, 50, 50)
    $a_controls[13] = GUICtrlCreateButton("", 70, 140, 50, 50)
    $a_controls[14] = GUICtrlCreateButton("", 130, 140, 50, 50)
    $a_controls[15] = GUICtrlCreateButton("", 190, 140, 50, 50)
    $a_controls[16] = GUICtrlCreateButton("", 250, 140, 50, 50)
    $a_controls[17] = GUICtrlCreateButton("", 310, 140, 50, 50)
    $a_controls[18] = GUICtrlCreateButton("", 10, 210, 50, 50)
    $a_controls[19] = GUICtrlCreateButton("", 70, 210, 50, 50)
    $a_controls[20] = GUICtrlCreateButton("", 130, 210, 50, 50)
    $a_controls[21] = GUICtrlCreateButton("", 190, 210, 50, 50)
    $a_controls[22] = GUICtrlCreateButton("", 250, 210, 50, 50)
    $a_controls[23] = GUICtrlCreateButton("", 310, 210, 50, 50)
    $a_controls[24] = GUICtrlCreateButton("", 10, 280, 50, 50)
    $a_controls[25] = GUICtrlCreateButton("", 70, 280, 50, 50)
    $a_controls[26] = GUICtrlCreateButton("", 130, 280, 50, 50)
    $a_controls[27] = GUICtrlCreateButton("", 190, 280, 50, 50)
    $a_controls[28] = GUICtrlCreateButton("", 250, 280, 50, 50)
    $a_controls[29] = GUICtrlCreateButton("", 310, 280, 50, 50)
    GUISetState(@SW_SHOW, $h_maingui)

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

    MsgBox(64, $S_WINTITLE, "_GUICtrlSetCrazyBk" & @CR & "Count: " & $I_COUNT & @CR & "Interval: " & $I_INTERVAL & @CR & "Return to OrigCol: " & $I_RETURNTOORG)
    _GUICtrlSetCrazyBk ($I_COUNT, $a_controls, $I_INTERVAL, $I_RETURNTOORG)
    MsgBox(64, $S_WINTITLE, "_GUISetCrazyBk" & @CR & "Count: " & $I_COUNT & @CR & "Interval: " & $I_INTERVAL & @CR & "Return to OrigCol: " & $I_RETURNTOORG)
    _GUISetCrazyBk ($I_COUNT, $S_WINTITLE, "", $I_INTERVAL, $I_RETURNTOORG)
    MsgBox(64, $S_WINTITLE, "_GUISetCrazyPos" & @CR & "Count: " & $I_COUNT & @CR & "Interval: " & $I_INTERVAL & @CR & "Return to OrigPos: " & $I_RETURNTOORG)
    _GUISetCrazyPos ($I_COUNT, $S_WINTITLE, "", $I_INTERVAL, $I_RETURNTOORG)
    MsgBox(64, $S_WINTITLE, "_GUISetCrazy" & @CR & "Count: " & $I_COUNT & @CR & "Interval: " & $I_INTERVAL & @CR & "Return to OrigPos: " & $I_RETURNTOORG)
    _GUISetCrazy ($I_COUNT, $S_WINTITLE, "", $a_controls, $I_INTERVAL, $I_RETURNTOORG)

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg == $GUI_EVENT_CLOSE
    ExitLoop 1
    EndSelect
    WEnd
    Exit (0)

    [/autoit]

    Bei der Funktion _GUISetCrazy bin ich mir noch nicht ganz sicher. Vielleicht wäre es hier besser noch einen Parameter $I_MODE einzubauen, der je nachdem die Unterschiedlichen Aktionen ausführt und nicht standardmäßig alle.
    Für Verbesserungsvorschläge (Code, Geschwindigkeit, aber auch weitere Ideen etc.) wäre ich dankbar!

  • include

    • teh_hahn
    • 13. August 2007 um 13:06

    Mhh, gute Frage. Das einzige was mir auffällt, ist der "." für das aktuelle Verzeichnis. Lass den mal weg und schreib mal:

    [autoit]

    #include "admin\xxx\kunden.au3"

    [/autoit]
  • Bug im Board

    • teh_hahn
    • 3. August 2007 um 09:08

    ROFL. Edit geht gar nicht mehr. Irgendwas ist hier total zerschossen.
    Hier mein Edit:

    Zitat


    EDIT: Immer noch der Fall. Hier die Fehlermeldung:

    Code
    SQL-DATABASE ERROR
    
    
    Database error in WoltLab Burning Board (2.3.4): Invalid SQL: REPLACE INTO bb1_wordmatch (wordid,postid,intopic) VALUES (10147,24333,0),(11159,24333,0),(10418,24333,0),(10773,24333,0),(11155,24333,0),(11151,24333,0),(11152,24333,0),(10249,24333,0),(10994,24333,1)
    mysql error: Table 'autoit-german.bb1_wordmatch' doesn't exist
    mysql error number: 1146
    mysql version: 5.0.26
    php version: 5.2.0
    Date: 03.08.2007 @ 09:03
    Script: /newthread.php
    Referer: http://www.autoit.de/newthread.php
    Alles anzeigen

    Wurde das Board schon wieder gehackt, oder was? oder war jemand unvorsichtig und hat die table gedroppt. Die Anzahl meiner Posts wird übrigens auch nicht mehr hochgezähl und wer weiß was noch...

  • Bug im Board

    • teh_hahn
    • 3. August 2007 um 09:03

    Hi,

    was ist denn gestern passiert? Wurde irgendwie an der Datenbank des Forums herumgefummelt? Nachdem die Seite down war, ist mir aufgefallen, dass die Anzahl der Antworten zu einem Thread nicht mehr in der Übersicht angezeigt wird. Ferner hatte ich gestern das Problem, dass beim Hinzufügen eines Eintrags ein MySQL-Error geschmissen wurde.

    Werde ja gleich sehen, ob das zweite immer noch der Fall ist! :D

    EDIT: Immer noch der Fall. Hier die Fehlermeldung:

    Code
    SQL-DATABASE ERROR
    
    
    Database error in WoltLab Burning Board (2.3.4): Invalid SQL: REPLACE INTO bb1_wordmatch (wordid,postid,intopic) VALUES (10147,24333,0),(11159,24333,0),(10418,24333,0),(10773,24333,0),(11155,24333,0),(11151,24333,0),(11152,24333,0),(10249,24333,0),(10994,24333,1)
    mysql error: Table 'autoit-german.bb1_wordmatch' doesn't exist
    mysql error number: 1146
    mysql version: 5.0.26
    php version: 5.2.0
    Date: 03.08.2007 @ 09:03
    Script: /newthread.php
    Referer: http://www.autoit.de/newthread.php
    Alles anzeigen

    Wurde das Board schon wieder gehackt, oder was? oder war jemand unvorsichtig und hat die table gedroppt. Die Anzahl meiner Posts wird übrigens auch nicht mehr hochgezähl und wer weiß was noch...

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™