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

Beiträge von TheLuBu

  • pdfsam-win.exe automatisieren

    • TheLuBu
    • 28. August 2012 um 13:50

    Habe gerade leider nur Win 7 32 Bit, kann heute abend aber auf 64Bit testen

  • GUI Hilfe

    • TheLuBu
    • 28. August 2012 um 12:02

    wie denn? ^^

  • GUI Hilfe

    • TheLuBu
    • 28. August 2012 um 11:47
    Spoiler anzeigen
    [autoit]

    ;########INCLUDES GEHÖREN NACH OBEN##########
    #include <GUIConstants.au3>
    #include <misc.au3>

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

    Global $pause = False
    HotKeySet("{ESC}", "PAUSE")
    Global $iCount = 0

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

    GUICreate("Test", 200, 200, 50, 100)
    $label1 = GUICtrlCreateLabel("A", 80, 10, 150, 50)
    $Input1 = GUICtrlCreateInput("", 10, 10, 60, 20)
    $label2 = GUICtrlCreateLabel("B", 80, 50, 150, 100)
    $Input2 = GUICtrlCreateInput("", 10, 50, 60, 20)
    $label3 = GUICtrlCreateLabel("C", 80, 90, 150, 150)
    $Input3 = GUICtrlCreateInput("", 10, 90, 60, 20)
    $button1 = GUICtrlCreateButton("OK", 10, 150, 60, 20)
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $button1
    $iCount += 1
    If $iCount = 2 Then
    $iCount = 0
    Sleep(Guictrlread($Input1))
    MouseClick("left")
    Sleep(Guictrlread($Input2))
    MouseClick("left")
    Sleep(Guictrlread($Input3))
    MouseClick("left")
    $iCount = 0
    EndIf
    EndSwitch
    WEnd

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

    Func PAUSE()
    $pause = Not $pause
    While $pause
    Sleep(50)
    WEnd
    EndFunc ;==>PAUSE

    [/autoit]

    Hier mal aufgeräumt

    Und an Hauke96,
    Die Pause Funktion ist nicht sinnlos ;)
    Schau dir mal das Beispiel zu HotkeySet an. Zweimal ESC drücken bewirkt, das das Script dann weiter läuft :)

    Um die Sleep Werte zu erhalten, musst du die Inputboxen auslesen. Mit Guictrlread kriegst du den Inhalt, so wie du es hattest kriegst du nur die Control ID der Inputboxen raus

  • pdfsam-win.exe automatisieren

    • TheLuBu
    • 28. August 2012 um 11:40
    [autoit]

    $Path = FileOpenDialog("PDF SAM", "", "EXE (*.exe)")
    $installpath = "C:\Program Files\pdfsam"
    ShellExecute($Path)
    ;Sprache Auswählen
    WinWaitActive("Installer Language")
    ;Send("{ENTER}")
    ControlClick("Installer Language", "","Button1") ; Sprache auswählen
    WinWaitActive("pdfsam Installation")
    ControlClick("pdfsam Installation", "","Button2") ; Willkommen
    ControlClick("pdfsam Installation", "","Button2") ; Lizenz
    ControlClick("pdfsam Installation", "","Button5") ; AVG Toolbar nicht installieren
    ControlClick("pdfsam Installation", "","Button2") ; Weiter
    ControlClick("pdfsam Installation", "","Button2") ; Installation Options
    Send($installpath) ; WOhin soll es installiert werden?
    ControlClick("pdfsam Installation", "","Button2") ; Zielverzeichnis
    ;ControlClick("pdfsam Installation", "","Button2") ; Installieren

    [/autoit]

    Mit diesem Code komme ich bis zur Installation, letzte Zeile nicht mehr auskommentiert installiert es auch direkt

  • Punkt aus Programmfenster lesen

    • TheLuBu
    • 28. August 2012 um 11:27

    Probier doch mal mit dem AutoIt Window Info Tool, diese Controls auszulesen

  • String verarbeiten.

    • TheLuBu
    • 23. August 2012 um 17:02
    [autoit]


    $MyString="Hostname.MyDomain.com"
    $Split = StringSplit($MyString, ".")
    $Hostname = $Split[1]
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Hostname = ' & $Hostname & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $Domainname = $Split[2]
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Domainname = ' & $Domainname & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

    [/autoit]
  • ISN AutoIt Studio

    • TheLuBu
    • 23. August 2012 um 16:17

    Hallo ISI360,
    Ich hab mir ein paar Gedanken zu deinem *.ISF Dateien gemacht, bzw. dem Umwandeln von der AutoIt GUI in dein Format.
    Hier mal zwei Beispiele mit Regex, um die jeweiligen Werte rauszukriegen:

    GUI RegEx
    Code
    GUI Name: (?<=GUICreate\(\"|GUICreate\(\')(.*[^"'])((?=")|(?='))
    GUI HANDLE: (?<=\$)(.*?)(?=\s\=\sGUICreate)
    GUI LEFT : (?<=GUICreate\((\"|\').*?(\"|\')\,\s?)(.*?)(?=,)
    GUI TOP: (?<=GUICreate\((\"|\').*?(\"|\')\,\s?(\$.*|\w*)\,\s?)(.*?)(?=\,)
    GUI WIDTH : (?<=GUICreate\((\"|\').*?(\"|\')\,\s?(\$.*|\w*)\,\s*(\$.*|\w*)\,\s*)(.*?)(?=\,)
    GUI HEIGHT : (?<=GUICreate\((\"|\').*?(\"|\')\,\s?(\$.*|\w*)\,\s*(\$.*|\w*)\,\s*(\$.*|\w*)\,\s*)(.*?)(?=\,)
    GUI STYLE: (?<=GUICreate\((\"|\').*?(\"|\')\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?)(Bit(.*?\))(?=\,)|(\$.*)(?=\,)|(.\w?)(?=\,))
    GUI EXSTYLE: (?<=GUICreate\((\"|\').*?(\"|\')\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(Bit(.*?\))\,|(\$.*)\,|(.\w?)\,)\s?)(Bit(.*?\))(?=\,)|(\$.*)(?=\,)|(.\w?)(?=\,))
    GUI PARENT: (?<=GUICreate\((\"|\').*?(\"|\')\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(Bit(.*?\))\,|(\$.*)\,|(.\w?)\,)\s?(Bit(.*?\))\,|(\$.*)\,|(.\w?)\,)\s?)(.*?)(?=\))
    Button RegEx
    Code
    Button Name: (?<=GUICtrlCreateButton\(\"|GUICtrlCreateButton\(\')(.*[^"'])((?=")|(?='))
    Button HANDLE: (?<=\$)(.*?)(?=\s\=\sGUICtrlCreateButton)
    Button LEFT : (?<=GUICtrlCreateButton\((\"|\').*?(\"|\')\,\s?)(.*?)(?=,)
    Button TOP: (?<=GUICtrlCreateButton\((\"|\').*?(\"|\')\,\s?(\$.*|\w*)\,\s?)(.*?)(?=\,)
    Button WIDTH : (?<=GUICtrlCreateButton\((\"|\').*?(\"|\')\,\s?(\$.*|\w*)\,\s*(\$.*|\w*)\,\s*)(.*?)(?=\,)
    Button HEIGHT : (?<=GUICtrlCreateButton\((\"|\').*?(\"|\')\,\s?(\$.*|\w*)\,\s*(\$.*|\w*)\,\s*(\$.*|\w*)\,\s*)(.*?)(?=\,)
    Button STYLE: (?<=GUICtrlCreateButton\((\"|\').*?(\"|\')\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?)(Bit(.*?\))(?=\,)|(\$.*)(?=\,)|(.\w?)(?=\,))
    Button EXSTYLE: (?<=GUICtrlCreateButton\((\"|\').*?(\"|\')\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(\$.*|\w*)\s?\,\s?(Bit(.*?\))\,|(\$.*)\,|(.\w?)\,)\s?)(Bit(.*?\))(?=\,)|(\$.*)(?=\,)|(.\w?)(?=\,))

    Andere, ähnliche Create Funktionen (Format ( "text", left, top [, width [, height [, style [, exStyle]]]] ) solltest du damit auch hinkriegen können ;)

  • Logo UDF

    • TheLuBu
    • 23. August 2012 um 13:45

    Hallo liebe Community,
    Durch das ISN Studio bin ich an die Erstellung einer Logo UDF gekommen,
    da ich seitdem sehr viele Logos erstellt habe und auch viel mit ihnen arbeite.
    Vielleicht kann die ja jemand von euch auch brauchen.

    Wichtig! Als Farbe für das Label kann nicht #FFFFFE genommen werden, da diese Farbe als Transparent gesetzt wurde.

    UDF
    [autoit]

    #include-once
    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    Global Const $AC_SRC_ALPHA = 1
    Global $__gImageStartup_Logo
    Global $__gPNG_Logo
    Global $__gGUI_Controls_Logo
    Global $__gProgress_Logo
    Global $__gProgress_Label_Logo
    Global $__gFailure_Logo = False

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

    ; #FUNCTION# ;===============================================================================
    ;
    ; Name...........: _Logo_Startup
    ; Description ...: Startup Logo Creation
    ; Syntax.........: _Logo_Startup($s_path, $iP_Left, $iP_Top, $iP_Width, $iP_Height, $iL_Left, $iL_Top, $iL_Width, $iL_Height, $f_GDIP = True, $i_Fade = 10)
    ; Parameters ....: $s_path - Path to PNG File
    ; $iP_Left - Progressbar Left Position
    ; $iP_Top - Progressbar Top Position
    ; $iP_Width - Progressbar Width
    ; $iP_Height - Progressbar Height
    ; $iL_Left - Label Left Position
    ; $iL_Top - Label Top Position
    ; $iL_Width - Label Width
    ; $iL_Height - Label Height
    ; $f_GDIP - Should GDI+ be loaded (Standard = True)
    ; $i_Fade - Speed of Logo to Fade in (Standard = 10)
    ; Return values .: Success - Return 1
    ; Failure - Returns 0 and Sets @Error:
    ; |1 - Invalid $s_path (Not a PNG File)
    ; |2 - Invalid Number (@extended for Wrong Number)
    ; |3 - Invalid $s_path (Image could not be loaded)
    ; Author ........: TheLuBu ([email='LuBu@veytal.com'][/email])
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ;
    ; ;==========================================================================================
    Func _Logo_Startup($s_path, $iP_Left, $iP_Top, $iP_Width, $iP_Height, $iL_Left, $iL_Top, $iL_Width, $iL_Height, $f_GDIP = True, $i_Fade = 10)
    If Not StringRight($s_path, 4) = ".png" Then
    $__gFailure_Logo = True
    Return SetError(1, 0, 0)
    EndIf
    Local $ai_Positions[9]
    $ai_Positions[0] = $iP_Left
    $ai_Positions[1] = $iP_Top
    $ai_Positions[2] = $iP_Width
    $ai_Positions[3] = $iP_Height
    $ai_Positions[4] = $iL_Left
    $ai_Positions[5] = $iL_Top
    $ai_Positions[6] = $iL_Width
    $ai_Positions[7] = $iL_Height
    $ai_Positions[8] = $i_Fade
    For $i = 0 To 8
    If Not StringIsDigit($ai_Positions[$i]) Then
    $__gFailure_Logo = True
    Return SetError(2, $i + 1, 0)
    EndIf
    Next
    $ai_Positions = ""
    Local $i_width, $i_height, $i_alpha
    If $f_GDIP = True Then
    _GDIPlus_Startup()
    EndIf
    $__gImageStartup_Logo = _GDIPlus_ImageLoadFromFile($s_path)
    If @error Then
    $__gFailure_Logo = True
    If $f_GDIP = True Then
    _GDIPlus_Shutdown()
    EndIf
    Return SetError(3, 0, 0)
    EndIf
    $i_width = _GDIPlus_ImageGetWidth($__gImageStartup_Logo)
    $i_height = _GDIPlus_ImageGetHeight($__gImageStartup_Logo)
    $__gPNG_Logo = GUICreate("", $i_width, $i_height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW))
    __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, 0)
    GUISetState()
    WinSetOnTop($__gPNG_Logo, "", 1)
    $__gGUI_Controls_Logo = GUICreate("", $i_width, $i_height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $__gPNG_Logo)
    GUISetBkColor(0xFFFFFE)
    _WinAPI_SetLayeredWindowAttributes($__gGUI_Controls_Logo, 0xFFFFFE)
    $__gProgress_Logo = GUICtrlCreateProgress($iP_Left, $iP_Top, $iP_Width, $iP_Height)
    $__gProgress_Label_Logo = GUICtrlCreateLabel("", $iL_Left, $iL_Top, $iL_Width, $iL_Height, 1, -1)
    $i_alpha = 0
    While 1
    $i_alpha += $i_Fade
    If $i_alpha > 255 Then
    $i_alpha = 255
    ExitLoop
    EndIf
    __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, $i_alpha)
    Sleep(10)
    WEnd
    __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, 255)
    GUISetState(@SW_SHOW, $__gGUI_Controls_Logo)
    Return 1
    EndFunc ;==>_Logo_Startup
    ; #FUNCTION# ;===============================================================================
    ;
    ; Name...........: _Logo_Set_Label_Font
    ; Description ...: Sets Font and Color for Logo Label
    ; Syntax.........: _Logo_Set_Label_Font($iSize = 8.5, $iWeight = 800, $iAttribute = 0, $sFontName = "Arial", $sHexcolor = 0x000000)
    ; Parameters ....: $iSize - Font Size (see GUICtrlSetFont)
    ; $iWeight - Font Weight (see GUICtrlSetFont)
    ; $iAttribute - Font Attributes (see GUICtrlSetFont)
    ; $sFontName - Font Name (see GUICtrlSetFont)
    ; $sHexcolor - Font Color (see GUICtrlSetColor)
    ; Return values .: Success - Return 1
    ; Failure - Returns 0 and Sets @Error:
    ; |0 - _Logo_Startup failed
    ; |1 - Invalid $iWeight (Not a Number)
    ; |2 - Invalid $iAttribute (Not a Number)
    ; |3 - Invalid $sFontName (Not a Number)
    ; |4 - Invalid $iSize (Not a Number)
    ; Author ........: TheLuBu ([email='LuBu@veytal.com'][/email])
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:GUICtrlSetColor, GUICtrlSetFont
    ; Link ..........:
    ;
    ; ;==========================================================================================
    Func _Logo_Set_Label_Font($iSize = 8.5, $iWeight = 800, $iAttribute = 0, $sFontName = "Arial", $sHexcolor = 0x000000)
    If $__gFailure_Logo = True Then Return 0
    If Not StringIsDigit($iWeight) Then Return SetError(1, 0, 0)
    If Not StringIsDigit($iAttribute) Then Return SetError(2, 0, 0)
    If Not StringIsXDigit($sHexcolor) Then Return SetError(3, 0, 0)
    If Not StringIsDigit($iSize) AND not StringIsFloat($iSize) Then Return SetError(4,0,0)
    GUICtrlSetFont($__gProgress_Label_Logo, $iSize, $iWeight, $iAttribute, $sFontName)
    GUICtrlSetColor($__gProgress_Label_Logo, $sHexcolor)
    Return 1
    EndFunc ;==>_Logo_Set_Label_Font
    ; #FUNCTION# ;===============================================================================
    ;
    ; Name...........: _Logo_Set_Data
    ; Description ...: Sets Label Data And/Or Progress Data
    ; Syntax.........: _Logo_Set_Data($i_Progress_Set = False, $s_Label_Set = False)
    ; Parameters ....: $i_Progress_Set - Font Size (see GUICtrlSetFont)
    ; $s_Label_Set - Font Weight (see GUICtrlSetFont)
    ; Return values .: Success - Return 1
    ; Failure - Returns 0 and Sets @Error:
    ; |0 - _Logo_Startup failed
    ; |1 - Invalid $i_Progress_Set (Not a Number)
    ; |2 - Invalid $i_Progress_Set (Out of Range (0-100))
    ; Author ........: TheLuBu ([email='LuBu@veytal.com'][/email])
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ;
    ; ;==========================================================================================
    Func _Logo_Set_Data($i_Progress_Set = False, $s_Label_Set = False)
    If $__gFailure_Logo = True Then Return 0
    If $i_Progress_Set <> False Then
    If Not StringIsDigit($i_Progress_Set) AND NOT StringIsFloat($i_Progress_Set) Then Return SetError(1,0,0)
    If $i_Progress_Set < 0 Or $i_Progress_Set > 100 Then Return SetError(2, 0, 0)
    GUICtrlSetData($__gProgress_Logo, $i_Progress_Set)
    EndIf
    If $s_Label_Set <> False Then
    GUICtrlSetData($__gProgress_Label_Logo, $s_Label_Set)
    EndIf
    Return 1
    EndFunc ;==>_Logo_Set_Data
    ; #FUNCTION# ;===============================================================================
    ;
    ; Name...........: _Logo_Shutdown
    ; Description ...: Shutdown Logo and release Data
    ; Syntax.........: _Logo_Shutdown($f_Shutdown_GDIP = True, $i_Fade_Out = 15)
    ; Parameters ....: $f_Shutdown_GDIP - Shutdown GDI+
    ; $i_Fade_Out - Speed of Logo to Fade out
    ; Return values .: Success - Return 1
    ; Failure - Returns 0 and Sets @Error:
    ; |0 - _Logo_Startup failed
    ; |1 - Invalid $i_Fade_Out (Not a Number)
    ; Author ........: TheLuBu ([email='LuBu@veytal.com'][/email])
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ;
    ; ;==========================================================================================
    Func _Logo_Shutdown($f_Shutdown_GDIP = True, $i_Fade_Out = 15)
    If $__gFailure_Logo = True Then Return 0
    If Not StringIsDigit($i_Fade_Out) Then Return SetError(1,0,0)
    Local $i_alpha = 255
    While 1
    $i_alpha = $i_alpha - $i_Fade_Out
    If $i_alpha <= 0 Then
    $i_alpha = 0
    ExitLoop
    EndIf
    __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, $i_alpha)
    Sleep(10)
    WEnd
    GUIDelete($__gGUI_Controls_Logo)
    GUIDelete($__gImageStartup_Logo)
    If $f_Shutdown_GDIP = True Then
    _GDIPlus_Shutdown()
    EndIf
    Return 1
    EndFunc ;==>_Logo_Shutdown
    ; #INTERNAL FUNCTION# ;======================================================================
    ;
    ; Name...........: __Logo_SetBitmap
    ; Description ...: Sets transparency of an GUI Background
    ; Syntax.........: __Logo_SetBitmap($hGui, $hImage, $iOpacity)
    ; Parameters ....: $hGui - GUI to set transparency
    ; $hImage - Image to set transparency
    ; $iOpacity - Transparency to set (0-255)
    ; Return values .: Success - Return 1
    ; Author ........: Unknown
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ;
    ; ;==========================================================================================
    Func __Logo_SetBitmap($hGui, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGui, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
    Return 1
    EndFunc ;==>__Logo_SetBitmap

    [/autoit]
    Example
    [autoit]

    #include <Logo_UDF.au3>

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

    $s_path = @ScriptDir & "\testlogo.png"
    $t = _Logo_Startup($s_path, 250, 220, 100, 10, 100, 182, 430, 25, True, 3)
    _Logo_Set_Label_Font()
    Sleep(1000)
    _Logo_Set_Data(50, "Autoit")
    SLeep(1000)
    _Logo_Set_Label_Font(8.5,800, 0, "Arial", 0xCE0000)
    SLeep(1000)
    _Logo_Set_Label_Font(8.5,800, 2, "Arial", 0xFF0000)
    Sleep(1000)
    _Logo_Set_Label_Font(8.5,800, 6, "Arial", 0xFFFF00)
    Sleep(1000)
    _Logo_Set_Data(80, "TheLuBu")
    Sleep(1000)
    _Logo_Set_Label_Font(8.5,800, 8, "Arial", 0xFFFFFF)
    _Logo_Set_Data(80)
    Sleep(1000)
    _Logo_Set_Data(False, "Logo UDF")
    Sleep(2000)

    [/autoit]

    Das Testlogo kommt von _Hier
    Idee habe ich von ISI360

    Dateien

    Logo.zip 84,4 kB – 415 Downloads testlogo.png 82,82 kB – 0 Downloads
  • Aufzeichnen -> TCP -> Abspielen (BassUDF)

    • TheLuBu
    • 8. August 2012 um 12:31

    lies dir mal diesen Artikel durch (wegen den 4096Bytes)
    http://ps-2.kev009.com/tl/techlib/man…gd/tcpudppe.htm

  • [IE.au3] div oder frame auslesen

    • TheLuBu
    • 8. August 2012 um 11:45

    Mit diesem Regex kannst du den Text zwischen zwei Tags auslesen (in deinem Fall div)

    Code
    (?<=\<(div)[^>]*?>)(?:.|\n)*?(?=\</\s*\1\s*>)
  • Com Error Handler reagiert nicht

    • TheLuBu
    • 8. August 2012 um 09:19

    Hallo liebe Community,
    Ich habe ein Tool geschrieben, um einige Aufgaben mit einem SQL Server (MSSQL) zu erledigen.
    Eine Abfrage davon ist sehr groß und ich kriege diesen Fehler:

    [autoit]

    ==> The requested action with this object has failed.:
    Return $iSQLCon.execute($iQuery)
    Return $iSQLCon.execute($iQuery)^ ERROR

    [/autoit]

    Das Problem ist, das ich eigentlich einen Com Error Handler "eingebaut" habe, der mir ja den Fehler anzeigen soll.
    Der Error Handler wird am Anfang des Scripts initialisiert

    [autoit]

    Global $o_MyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler

    [/autoit]


    Und die Funktion sieht so aus:

    [autoit]

    Func _MyErrFunc()
    Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
    "err.description is: " & @TAB & $o_MyError.description & @CRLF & _
    "err.windescription:" & @TAB & $o_MyError.windescription & @CRLF & _
    "err.number is: " & @TAB & hex($o_MyError.number,8) & @CRLF & _
    "err.lastdllerror is: " & @TAB & $o_MyError.lastdllerror & @CRLF & _
    "err.scriptline is: " & @TAB & $o_MyError.scriptline & @CRLF & _
    "err.source is: " & @TAB & $o_MyError.source & @CRLF & _
    "err.helpfile is: " & @TAB & $o_MyError.helpfile & @CRLF & _
    "err.helpcontext is: " & @TAB & $o_MyError.helpcontext _
    )
    EndFunc ;==>_MyErrFunc

    [/autoit]

    Aber wie gesagt, der Fehler wird nicht darüber abgefangen.
    Hier noch die _MSSQL_Open Funktion, die das Objekt erstellt, vielleicht liegt es ja auch daran

    [autoit]

    Func _MSSQL_Con($scIP, $scUser, $scPass, $scDB)
    Local $sqlCon
    $sqlCon = ObjCreate("ADODB.Connection")
    $sqlCon.Open("Provider=SQLOLEDB; Data Source=" & $scIP & "; User ID=" & $scUser & "; Password=" & $scPass & "; database=" & $scDB & ";")
    If @error Then Return SetError(1,0,0)
    Return $sqlCon
    EndFunc ;==>_MSSQL_Con

    [/autoit]

    Ich würde mich über eine Antwort wirklich sehr freuen!

    --EDIT--
    Das SQL Statement wird, wenn ich es direkt über den Server ausführe, erfolgreich abgeschlossen. Kann es an der Größe des SQL Statements liegen? Das Statement ist 665 Zeilen (~ 94000 Zeichen) lang

  • _FileWriteFromArray Probleme

    • TheLuBu
    • 6. August 2012 um 17:27
    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include<File.au3>

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

    Global $sFile = @ScriptDir & "\ilse.txt"
    Global $aTexte[3][5]
    FOr $i = 0 To Ubound($aTexte) -1
    For $k = 0 To UBound($aTexte, 2) -1
    $aTexte[$i][$k] = Random(1,100,1)
    Next
    Next
    _arraydisplay($aTexte)
    _FileWriteFromArray2D($sFile, $aTexte,0)
    $read = FileRead($sFile)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $read = ' & $read & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    ;==========================================================================================================================================
    ; Function: _FileWriteFromArray2D($FILEPATH, $ARRAY [, $iROWstart=0 [, $iROWend=0 [, $iCOLstart=0 [, $iCOLend=0 [, $DELIM='|']]]]])
    ;
    ; Description: Write 1D/2D array to file, 2D with delimiter between every entry
    ;
    ; Parameter(s): $FILEPATH - path/filename of the file to be write
    ; $ARRAY - array to write from
    ; optional $iROWstart - start row-index, default 0
    ; optional $iROWend - end row-index, default Ubound(array)-1
    ; optional $iCOLstart - start column-index, default 0
    ; optional $iCOLend - end column-index, default Ubound(array,2)-1
    ; optional $DELIM - delimiter for 2D-array entries, default '|'
    ;
    ; Requirement(s): None
    ;
    ; Return Value(s): On Success - Returns -1
    ; On Failure - Returns 0 and sets @error = 1 (given array is'nt array); @error = 2 (unable to open filepath)
    ;
    ; Note: If $iROWstart > $iROWend or $iCOLstart > $iCOLend the values will be swapped among
    ;
    ; Author(s): BugFix ( [email='bugfix@autoit.de'][/email] )
    ;==========================================================================================================================================
    Func _FileWriteFromArray2D($FILEPATH, $ARRAY, $iROWstart=0, $iROWend=0, $iCOLstart=0, $iCOLend=0, $DELIM='|')
    If Not IsArray($ARRAY) Then
    SetError(1)
    Return 0
    EndIf
    Local $Ubound = UBound($ARRAY)
    If $iROWend = 0 Then $iROWend = $Ubound-1
    Local $fh = FileOpen($FILEPATH, 2)
    If $fh = -1 Then
    SetError(2)
    Return 0
    EndIf
    Select
    Case $iROWstart < 0 Or $iROWstart > $Ubound-1
    $iROWstart = 0
    ContinueCase
    Case $iROWend < 0 Or $iROWend > $Ubound-1
    $iROWend = $Ubound-1
    ContinueCase
    Case $iROWstart > $iROWend
    $tmp = $iROWstart
    $iROWstart = $iROWend
    $iROWend = $tmp
    EndSelect
    Local $Ubound2nd = UBound($ARRAY, 2)
    If @error = 2 Then
    For $i = $iROWstart To $iROWend
    FileWriteLine($fh, $ARRAY[$i])
    Next
    Else
    If $iCOLend = 0 Then $iCOLend = $Ubound2nd-1
    Select
    Case $iCOLstart < 0 Or $iCOLstart > $Ubound2nd-1
    $iCOLstart = 0
    ContinueCase
    Case $iCOLend < 0 Or $iCOLend > $Ubound2nd-1
    $iCOLend = $Ubound2nd-1
    ContinueCase
    Case $iCOLstart > $iCOLend
    $tmp = $iCOLstart
    $iCOLstart = $iCOLend
    $iCOLend = $tmp
    EndSelect
    For $i = $iROWstart To $iROWend
    $tmp = ''
    For $k = $iCOLstart To $iCOLend
    If $k < $iCOLend Then
    $tmp &= $ARRAY[$i][$k] & $DELIM
    Else
    $tmp &= $ARRAY[$i][$k]
    EndIf
    Next
    FileWriteLine($fh, $tmp)
    Next
    EndIf
    FileClose($fh)
    Return -1
    EndFunc ;==>_FileWriteFromArray2D

    [/autoit]

    Funktioniert bei mir einwandfrei, -1 heißt bei dieser Funkltion auch erfolgreich

  • RegEx Problem mit XML Struktur

    • TheLuBu
    • 30. Juli 2012 um 11:31

    Mit diesem Regex hat es geklappt:

    Code
    (?<=<t\stn="e36ef284-42f8-4dbf-abab-d4682c609d25"\stmk=".*tk="0"\stv=")[^"]*

    Danke für eure Hilfe!

  • RegEx Problem mit XML Struktur

    • TheLuBu
    • 30. Juli 2012 um 11:12
    Spoiler anzeigen
    Code
    <cpstruct maxPropID="137"><ts><t tn="9914bafd-2d78-451d-aca3-905ebc3077b6" tmk="3"><tis><<ti tk="1" tv="Nein" ta="True" /><ti tk="2" tv="Vielleicht" ta="True" /><ti tk="3" tv="Sonstiges" ta="True" /></tis></t><t tn="7e3f0209-ce37-4793-a411-b5690e983040" tmk="1"><tis><ti tk="0" tv="Ja" ta="True" /><ti tk="1" tv="Nein" ta="True" /></tis></t><t tn="79b0f3dc-3bf0-4fcf-9fdc-d06016c3ad0e" tmk="3"><tis><ti tk="0" tv="1 Option" ta="True" /><ti tk="1" tv="2 Option" ta="True" /><ti tk="2" tv="3 Option" ta="True" /><ti tk="3" tv="0 Optionen" ta="True" /></tis></t><t tn="e36ef284-42f8-4dbf-abab-d4682c609d25" tmk="10"><tis><ti tk="0" tv="Text1" ta="False" /><ti tk="1" tv="Text2" ta="False" /><ti tk="2" tv="Text3" ta="False" /><ti tk="3" tv="Text4" ta="True" /><ti tk="4" tv="Text5" ta="True" /><ti tk="5" tv="Text6" ta="False" /><ti tk="6" tv="Text7" ta="False" /><ti tk="7" tv="Text8" ta="False" /><ti tk="8" tv="Text9" ta="True" /><ti tk="9" tv="Text10" ta="False" /><ti tk="10" tv="Text11" ta="True" /></tis></t><t tn="31de64f5-dffd-4d4c-8212-2af181cb0fbd" tmk="10"><tis><ti tk="0" tv="BLA" ta="False" /><ti tk="1" tv="BLABLA" ta="False" /><ti tk="2" tv="BLABLA" ta="False" /><ti tk="3" tv="BLA" ta="True" /><ti tk="4" tv="BLA" ta="True" /><ti tk="5" tv="BLA" ta="False" /><ti tk="6" tv="BLA" ta="False" /><ti tk="7" tv="BLA" ta="False" /><ti tk="8" tv="BLA" ta="True" /><ti tk="9" tv="BLA" ta="False" /><ti tk="10" tv="BLA" ta="True" /></tis></t></ts><pds><pd pdid="1" pdn="Nr1" pdtn="st" /><pd pdid="3" pdn="Nr2" pdtn="st" /><pd pdid="5" pdn="Nr3" pdtn="st" /><pd pdid="7" pdn="Nr4" pdtn="st" /><pd pdid="8" pdn="Nr5" pdtn="st" /></pds></cpstruct>

    Anbei der gesamte Beispielstring. Leider kann der String vorher und auch nachher tk-tv Paare enthalten, sowie auch alle anderen Paarungen (tis,t)
    Ich bin jetzt soweit, das ich mit folgendem Regex den Anfang von dem gesuchten String finde:

    Code
    (?<=<t\stn="e36ef284-42f8-4dbf-abab-d4682c609d25"\stmk=".*tk="0"\stv=").*(?=")


    Allerdings wird nicht das " nach dem Text genommen, sondern das letzte im gesamten String.

  • RegEx Problem mit XML Struktur

    • TheLuBu
    • 30. Juli 2012 um 10:09

    Hallo liebe Community,
    Ich beschäftige mich in letzter Zeit viel mit RexEx und bis jetzt hat auch nach einiger Zeit alles so funktioniert wie ich es wollte, nun bin ich aber an meine grenzen gestoßen ^^

    Ich habe folgenden String:

    Spoiler anzeigen
    Code
    <t tn="e36ef284-42f8-4dbf-abab-d4682c609d25" tmk="10"><tis><ti tk="0" tv="Text1" ta="False" /><ti tk="1" tv="Text2" ta="False" /><ti tk="2" tv="Text3" ta="False" /><ti tk="3" tv="Text4" ta="True" /><ti tk="4" tv="Text5" ta="True" /><ti tk="5" tv="Text6" ta="False" /><ti tk="6" tv="Text7" ta="False" /><ti tk="7" tv="Text8" ta="False" /><ti tk="8" tv="Text9" ta="True" /><ti tk="9" tv="Text10" ta="False" /><ti tk="10" tv="Text11" ta="True" /></tis></t>


    Vor dem String können beliebig viele Zeichen stehen, dahinter ebenfalls, diese können aber komplett ignoriert werden.

    Um fürs erste diesen String herauszufinden habe ich folgendes Regex versucht:

    Code
    (?<=<t tn="e36ef284-42f8-4dbf-abab-d4682c609d25" tmk="10">).*(?=</tis></t>)


    aber leider stimmt da wohl etwas noch nicht ganz, da ich kein Ergebnis zurück kriege.

    Ich benötige ein RegEx, mit einer Variablen, je nachdem, welche "id" übergeben wird, die genau dieses Ergebnis zurück liefert, also bei 0 => Text1, 1 => Text2 usw...

    Ich bin für jede Hilfe dankbar

  • SQLite-DB im Speicher in Datei kopieren

    • TheLuBu
    • 27. Juli 2012 um 10:26
    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <SQLite.au3>
    #include <SQLite.dll.au3>
    Global $aResult, $iRows, $iColumns
    $Timer2 = TimerInit()
    _SQLite_Startup()
    $Memdatabase = _SQLite_Open()
    $filedb = _SQLite_Open(@ScriptDir&"\test.db")
    $Createtable = "CREATE TABLE tbl_Demo (ID INTEGER PRIMARY KEY AUTOINCREMENT, Test1 Varchar(150), Test2 Varchar(150), Test3 Varchar(150), Test4 Varchar(150),Test5 Varchar(150), Test6 Varchar(150), Test7 Varchar(150));"
    _SQLite_Exec($Memdatabase, $Createtable)
    _SQLite_Exec($filedb, $Createtable)
    $aSql = 'Begin Transaction ;' & @CRLF
    For $i = 1 To 10000
    $aSql &= "INSERT INTO tbl_Demo (Test1,Test2,Test3,Test4,Test5,Test6,Test7) VALUES ('" & Random(1,10000, 1) & "', '" & Random(1,100000, 1) & "', '" & Random(1,100000, 1) & "', '" & Random(1,100000, 1) & "', '" & Random(1,100000, 1) & "', '" & Random(1,100000, 1) & "', '" & Random(1,100000, 1) & "');" & @CRLF
    Next
    $aSql &= 'Commit Transaction ;' & @CRLF
    _SQLite_Exec($Memdatabase, $aSql)
    _SQLite_GetTable2d($Memdatabase, "SELECT * FROM tbl_Demo", $aResult, $iRows, $iColumns)
    _ArrayDisplay($aResult)
    $Timer = TimerInit()
    $aSql = 'Begin Transaction ;' & @CRLF
    For $i = 1 To UBound($aResult) -1
    $aSql &= "INSERT INTO tbl_Demo (Test1,Test2,Test3,Test4,Test5,Test6,Test7) VALUES ('" & $aResult[$i][0] & "', '" & $aResult[$i][1] & "', '" & $aResult[$i][2] & "', '" & $aResult[$i][3] & "', '" & $aResult[$i][4] & "', '" & $aResult[$i][5] & "', '" & $aResult[$i][6] & "');" & @CRLF
    Next
    $aSql &= 'Commit Transaction ;' & @CRLF
    _SQLite_Exec($filedb, $aSql)
    $Diff = TimerDiff($Timer)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Diff = ' & $Diff & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    _SQLite_GetTable2d($filedb, "SELECT * FROM tbl_Demo", $aResult, $iRows, $iColumns)
    _ArrayDisplay($aResult)

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

    _SQLite_Close($Memdatabase)
    _SQLite_Close($filedb)
    _SQLite_Shutdown()
    $Diff2 = TimerDiff($Timer2)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Diff2 = ' & $Diff2 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

    [/autoit]

    10000 Datensätze mit 8 Spalten schreiben, auslesen und dann in ne Datei schreiben dauert ca 5.5 sec bei mir

  • FileCopy abbrechen wenn Bedingung erfüllt

    • TheLuBu
    • 26. Juli 2012 um 11:51

    Wie groß sind die Dateien die, die du kopieren willst?

  • FileCopy abbrechen wenn Bedingung erfüllt

    • TheLuBu
    • 25. Juli 2012 um 15:55

    Probier das mal, sollte funktionieren und die Größe kannst du über die Variable Step einstellen

    Spoiler anzeigen
    [autoit]

    $Step = 10000
    Global Const $DESKTOP_SWITCHDESKTOP = 0x100
    $from_path = FileOpenDialog("test", "", "Alle (*.*)")
    $hFile = FileOpen($from_path, 16)
    $test = FileRead($hFile)
    FileClose($hFile)
    For $i = 0 To BinaryLen($test) Step $Step
    $p_lngHwnd = DllCall('user32.dll', 'int', 'OpenDesktopA', 'str', 'Default', 'int', 0, 'int', False, 'int', $DESKTOP_SWITCHDESKTOP)
    If $p_lngHwnd = 0 Then
    $hFile = FileOpen(@DesktopDir & "\test.zip", 16 + 2 + 8)
    FileWrite($hFile, BinaryMid($test, $i + 1, $Step))
    FileClose($hFile)
    Else
    While $p_lngHwnd <> 0
    Sleep(100)
    $p_lngHwnd = DllCall('user32.dll', 'int', 'OpenDesktopA', 'str', 'Default', 'int', 0, 'int', False, 'int', $DESKTOP_SWITCHDESKTOP)
    WEnd
    EndIf
    Next

    [/autoit]
  • POST mitgeben

    • TheLuBu
    • 6. März 2012 um 14:04

    mir ist grade aufgefallen, das du über https und nicht über http gehst ^^

    Probier mal die Funktionen:

    [autoit]

    _WinHttpSimpleSSLRequest
    _WinHttpSimpleSendSSLRequest

    [/autoit]
  • POST mitgeben

    • TheLuBu
    • 6. März 2012 um 13:20
    Spoiler anzeigen
    [autoit]

    #include <WinHTTP.au3>

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

    $username="user"
    $password="pass"

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

    $post = "os_username=" & $username&"&os_password="&$password&"&login=Anmelden&os_destination=%2Fhomepage.action"
    $hw_open = _WinHttpOpen("Teest")
    $hw_connect = _WinHttpConnect($hw_open, "wiki.inserve.local")
    $h_openRequest = _WinHttpOpenRequest($hw_connect, "GET", "/dologin.action")
    _WinHttpSendRequest($h_openRequest)
    _WinHttpReceiveResponse($h_openRequest)
    _WinHttpCloseHandle($h_openRequest)

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

    $h_openRequest = _WinHttpOpenRequest($hw_connect,"POST", "/dologin.action","HTTP/1.1")
    _WinHttpSendRequest($h_openRequest, "Content-Type: application/x-www-form-urlencoded"& @CRLF, $post)
    _WinHttpReceiveResponse($h_openRequest)

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

    Local $date=""
    Do
    $date&=_WinHttpReadData($h_openRequest)
    Until @error

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

    msgbox(0,"",$date)

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

    _WinHttpCloseHandle($h_openRequest)
    _WinHttpCloseHandle($hw_connect)
    _WinHttpCloseHandle($hw_open)

    [/autoit]

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™