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

Beiträge von SEuBo

  • _StringReplaceEx()

    • SEuBo
    • 22. Dezember 2009 um 01:35

    Hallo,
    Ich habe die Funktion StringReplace mal ein bisschen erweitert. Möchte mal zum Beispiel in diesem Text hier:

    Spoiler anzeigen
    Zitat

    I am a text, containing the world Hello
    Hello used to be a very important word in the english language.
    Without 'Hello', nobody could greet another person

    I am a text, containing the world Hello
    Hello used to be a very important word in the english language.
    Without 'Hello', nobody could greet another person.

    Erst beim zweiten "Hello" mit dem Suchen und ersetzen starten, und beispielsweise nur 3 mal ersetzen lassen,
    so eigent sich _StringReplaceEx() wunderbar.

    Es werden natürlich keine weiteren includes benötigt. Ich habe absichtlich auf RegEx verzichtet,
    da man hiermit auch Binärdaten suchen und ersetzen können soll (Wers braucht :D)
    Halt ein waschechter Autoit-String-Befehl, der sich durch (fast) nichts aus der Fassung bringen lässt
    *hust* Unnötige Werbung *hust

    Beispiel ist dabei.

    Spoiler anzeigen
    [autoit]


    $hGUI = GUICreate("_StringReplaceEx",400,475)
    $edit = GUICtrlCreateEdit("I am a text, containing the world Hello."&@CRLF& _
    "Hello used to be a very important word in the english language."&@CRLF& _
    "Without 'Hello', nobody could greet another person."&@CRLF&@CRLF& _
    "I am a text, containing the world Hello."&@CRLF& _
    "Hello used to be a very important word in the english language."&@CRLF& _
    "Without 'Hello', nobody could greet another person.",20,20,360,300)

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

    $Search = GUICtrlCreateInput("Hello",150,330,200,25)
    GUICtrlSetTip(-1,"The substring to search.")
    GUICtrlCreateLabel("Search:",70,335,-1,25)
    GUICtrlSetTip(-1,"The substring to search.")

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

    $Replace = GUICtrlCreateInput("Good morning",150,360,200,25)
    GUICtrlSetTip(-1,"The replacement string.")
    GUICtrlCreateLabel("Replace:",70,365,-1,25)
    GUICtrlSetTip(-1,"The replacement string.")

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

    GUICtrlCreateLabel("How Many Times:",20, 400)
    GUICtrlSetTip(-1,"The number of times to replace the searchstring."&@CRLF&"Set this to '0', if you want the function to replace all occurences of the searchstring,"&@CRLF&"starting with the determined occurence in $iOccurence"&@CRLF&"Use a negative value, to search from the right to left.")
    $HowManyTimes = GUICtrlCreateInput("2",125,395,50,25)
    GUICtrlSetTip(-1,"The number of times to replace the searchstring."&@CRLF&"Set this to '0', if you want the function to replace all occurences of the searchstring,"&@CRLF&"starting with the determined occurence in $iOccurence"&@CRLF&"Use a negative value, to search from the right to left.")
    GUICtrlCreateUpdown(-1)

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

    GUICtrlCreateLabel("First Occurence:",200, 400)
    GUICtrlSetTip(-1,"The substrings occurence to start with.")
    $FirstOccurence = GUICtrlCreateInput("3",300,395,50,25)
    GUICtrlSetTip(-1,"The substrings occurence to start with.")
    GUICtrlCreateUpdown(-1)

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

    $button = GUICtrlCreateButton(" _StringReplaceEx ",250,430)
    GUISetState()
    While True
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $button
    $newString = _StringReplaceEx(GUICtrlRead($edit),GUICtrlRead($Search),GUICtrlRead($Replace),GUICtrlRead($FirstOccurence),GUICtrlRead($HowManyTimes))
    If Not @error Then
    GUICtrlSetData($edit,$newString)
    Else
    MsgBox(16,"Error!","_StringReplaceEx returned @error."&@CRLF&"Error Code: "&@error)
    EndIf
    EndSwitch
    WEnd

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

    ;=================================================================================================
    ; Function: _StringReplaceEx($sString,$sSearchString,$sReplaceString[,$iOccurence[,$iHowOften[,$iCaseSense]]])
    ; Description: Extends StringReplace(). Giving you the ability to choose the first occurence to start with,
    ; and how many times the Searchstring should be replaced.
    ;
    ; Parameter(s): $sString - The string to evaluate.
    ; $sSearchString - The substring to search.
    ; $sReplaceString - The replacement string.
    ; $iOccurence - (optional) The substrings occurence to start with. (1) by default.
    ; $iHowOften - (optional) The number of times to replace the searchstring.
    ; (1) by default. Set this parameter to (0) if you want the
    ; function to replace all occurences of the Searchstring, starting with the one
    ; in $iOccurence. Use a negative value, to search from the right to left.
    ; $iCaseSense - (optional) Flag to indicate if the operations should be case sensitive.
    ; 0 = not case sensitive, using the user's locale (default)
    ; 1 = case sensitive
    ; 2 = not case sensitive, using a basic/faster comparison
    ;
    ; Requirement(s): Valid parameters :P
    ;
    ; Return Value(s): On Success - Returns the new string
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Function called with invalid parameters
    ; 2 = Searchstring was not found at the given occurence
    ;
    ; Author(s): SEuBo (http://www.autoit.de)
    ; Note(s):
    ;=================================================================================================
    Func _StringReplaceEx($sString,$sSearchString,$sReplaceString,$iOccurence=1,$iHowOften=1,$iCaseSense=0)
    If $sSearchString = "" Or $sString = "" Or $iOccurence < 1 OR $iCaseSense < 0 Or $iCaseSense > 2 Then Return SetError(1,0,0)
    Local $i = 1
    If $iHowOften = 0 Then $i = -1
    If $iHowOften >= 0 Then
    If Not StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence) Then Return SetError(2,0,0)
    Do
    $sString = StringLeft($sString,StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-1)&StringReplace(StringTrimLeft(StringTrimRight($sString,StringLen($sString)-StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-StringLen($sSearchString)),StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-1),$sSearchString,$sReplaceString)&StringRight($sString,StringLen($sString)-StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-StringLen($sSearchString))
    If $iHowOften <> 0 Then $i += 1
    Until $i > $iHowOften OR Not StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)

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

    Else
    Local $i = -1
    $sString = _StringReplaceEx_Reverse($sString)
    $sSearchString = _StringReplaceEx_Reverse($sSearchString)
    $sReplaceString = _StringReplaceEx_Reverse($sReplaceString)
    If Not StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence) Then Return SetError(2,0,0)
    Do
    $sString = StringLeft($sString,StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-1)&StringReplace(StringTrimLeft(StringTrimRight($sString,StringLen($sString)-StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-StringLen($sSearchString)),StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-1),$sSearchString,$sReplaceString)&StringRight($sString,StringLen($sString)-StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)-StringLen($sSearchString))
    $i -= 1
    Until $i < $iHowOften OR Not StringInStr($sString,$sSearchString,$iCaseSense,$iOccurence)
    $sString = _StringReplaceEx_Reverse($sString)
    EndIf
    Return SetError(0,$i,$sString)
    EndFunc

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

    ;=================================================================================================
    ;#####INTERNAL USE#####
    ;_StringReplaceEx_Reverse : Reverses the contents of the specified string. (without a dll-call)
    ;SEuBo (http://www.autoit.de)
    ;=================================================================================================
    Func _StringReplaceEx_Reverse($sString)
    Local $sReverse = ""
    For $x = 1 to StringLen($sString)
    $sReverse &= StringRight($sString,1)
    $sString = StringTrimRight($sString,1)
    Next
    Return $sReverse
    EndFunc
    ;=================================================================================================

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


    /EDIT (22.12.2009): Bug gefixed, der enstanden ist, wenn man $iHowOften auf 0 setzen wollte.

    Alte Downloads: 3

    Dateien

    _StringReplaceEx.au3 6,81 kB – 455 Downloads
  • Skript schmiert ab

    • SEuBo
    • 21. Dezember 2009 um 23:17

    Ohne jetzt nachgeschaut zu haben, bin ich mir fast sicher, dass Ubound bei dir 0 ausgibt. Also entweder ist es kein Array, oder die Dimension die du abfragen willst ist nicht vorhanden/ungültig.

  • frage zu memory.au3

    • SEuBo
    • 21. Dezember 2009 um 22:46

    guck doch einfach IN die memory.au3 :rolleyes:

    Spoiler anzeigen
    [autoit]

    ;=================================================================================================
    ; AutoIt Version: 3.1.127 (beta)
    ; Language: English
    ; Platform: All Windows
    ; Author: Nomad
    ; Requirements: These functions will only work with beta.
    ;=================================================================================================
    ; Credits: wOuter - These functions are based on his original _Mem() functions. But they are
    ; easier to comprehend and more reliable. These functions are in no way a direct copy
    ; of his functions. His functions only provided a foundation from which these evolved.
    ;=================================================================================================
    ;
    ; Functions:
    ;
    ;=================================================================================================
    ; Function: _MemoryOpen($iv_Pid[, $iv_DesiredAccess[, $iv_InheritHandle]])
    ; Description: Opens a process and enables all possible access rights to the process. The
    ; Process ID of the process is used to specify which process to open. You must
    ; call this function before calling _MemoryClose(), _MemoryRead(), or _MemoryWrite().
    ; Parameter(s): $iv_Pid - The Process ID of the program you want to open.
    ; $iv_DesiredAccess - (optional) Set to 0x1F0FFF by default, which enables all
    ; possible access rights to the process specified by the
    ; Process ID.
    ; $if_InheritHandle - (optional) If this value is TRUE, all processes created by
    ; this process will inherit the access handle. Set to TRUE
    ; (1) by default. Set to 0 if you want it to be FALSE.
    ; Requirement(s): A valid process ID.
    ; Return Value(s): On Success - Returns an array containing the Dll handle and an open handle to
    ; the specified process.
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $iv_Pid.
    ; 2 = Failed to open Kernel32.dll.
    ; 3 = Failed to open the specified process.
    ; Author(s): Nomad
    ; Note(s):
    ;=================================================================================================

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

    ;=================================================================================================
    ; Function: _MemoryRead($iv_Address, $ah_Handle[, $sv_Type])
    ; Description: Reads the value located in the memory address specified.
    ; Parameter(s): $iv_Address - The memory address you want to read from. It must be in hex
    ; format (0x00000000).
    ; $ah_Handle - An array containing the Dll handle and the handle of the open
    ; process as returned by _MemoryOpen().
    ; $sv_Type - (optional) The "Type" of value you intend to read. This is set to
    ; 'dword'(32bit(4byte) signed integer) by default. See the help file
    ; for DllStructCreate for all types.
    ; An example: If you want to read a word that is 15 characters in
    ; length, you would use 'char[16]'.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns the value located at the specified address.
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $ah_Handle.
    ; 2 = $sv_Type was not a string.
    ; 3 = $sv_Type is an unknown data type.
    ; 4 = Failed to allocate the memory needed for the DllStructure.
    ; 5 = Error allocating memory for $sv_Type.
    ; 6 = Failed to read from the specified process.
    ; Author(s): Nomad
    ; Note(s): Values returned are in Decimal format, unless specified as a 'char' type, then
    ; they are returned in ASCII format. Also note that size ('char[size]') for all
    ; 'char' types should be 1 greater than the actual size.
    ;=================================================================================================

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

    ;=================================================================================================
    ; Function: _MemoryWrite($iv_Address, $ah_Handle, $v_Data[, $sv_Type])
    ; Description: Writes data to the specified memory address.
    ; Parameter(s): $iv_Address - The memory address you want to write to. It must be in hex
    ; format (0x00000000).
    ; $ah_Handle - An array containing the Dll handle and the handle of the open
    ; process as returned by _MemoryOpen().
    ; $v_Data - The data to be written.
    ; $sv_Type - (optional) The "Type" of value you intend to write. This is set to
    ; 'dword'(32bit(4byte) signed integer) by default. See the help file
    ; for DllStructCreate for all types.
    ; An example: If you want to write a word that is 15 characters in
    ; length, you would use 'char[16]'.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $ah_Handle.
    ; 2 = $sv_Type was not a string.
    ; 3 = $sv_Type is an unknown data type.
    ; 4 = Failed to allocate the memory needed for the DllStructure.
    ; 5 = Error allocating memory for $sv_Type.
    ; 6 = $v_Data is not in the proper format to be used with the "Type"
    ; selected for $sv_Type, or it is out of range.
    ; 7 = Failed to write to the specified process.
    ; Author(s): Nomad
    ; Note(s): Values sent must be in Decimal format, unless specified as a 'char' type, then
    ; they must be in ASCII format. Also note that size ('char[size]') for all
    ; 'char' types should be 1 greater than the actual size.
    ;=================================================================================================

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

    ;=================================================================================================
    ; Function: _MemoryClose($ah_Handle)
    ; Description: Closes the process handle opened by using _MemoryOpen().
    ; Parameter(s): $ah_Handle - An array containing the Dll handle and the handle of the open
    ; process as returned by _MemoryOpen().
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $ah_Handle.
    ; 2 = Unable to close the process handle.
    ; Author(s): Nomad
    ; Note(s):
    ;=================================================================================================

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

    ;=================================================================================================
    ; Function: _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset[, $sv_Type])
    ; Description: Reads a chain of pointers and returns an array containing the destination
    ; address and the data at the address.
    ; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in
    ; hex format (0x00000000).
    ; $ah_Handle - An array containing the Dll handle and the handle of the open
    ; process as returned by _MemoryOpen().
    ; $av_Offset - An array of offsets for the pointers. Each pointer must have an
    ; offset. If there is no offset for a pointer, enter 0 for that
    ; array dimension.
    ; $sv_Type - (optional) The "Type" of data you intend to read at the destination
    ; address. This is set to 'dword'(32bit(4byte) signed integer) by
    ; default. See the help file for DllStructCreate for all types.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns an array containing the destination address and the value
    ; located at the address.
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = $av_Offset is not an array.
    ; 2 = Invalid $ah_Handle.
    ; 3 = $sv_Type is not a string.
    ; 4 = $sv_Type is an unknown data type.
    ; 5 = Failed to allocate the memory needed for the DllStructure.
    ; 6 = Error allocating memory for $sv_Type.
    ; 7 = Failed to read from the specified process.
    ; Author(s): Nomad
    ; Note(s): Values returned are in Decimal format, unless a 'char' type is selected.
    ; Set $av_Offset like this:
    ; $av_Offset[0] = NULL (not used)
    ; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal)
    ; $av_Offset[2] = Offset for pointer 2
    ; etc...
    ; (The number of array dimensions determines the number of pointers)
    ;=================================================================================================

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

    ;=================================================================================================
    ; Function: _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data[, $sv_Type])
    ; Description: Reads a chain of pointers and writes the data to the destination address.
    ; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in
    ; hex format (0x00000000).
    ; $ah_Handle - An array containing the Dll handle and the handle of the open
    ; process as returned by _MemoryOpen().
    ; $av_Offset - An array of offsets for the pointers. Each pointer must have an
    ; offset. If there is no offset for a pointer, enter 0 for that
    ; array dimension.
    ; $v_Data - The data to be written.
    ; $sv_Type - (optional) The "Type" of data you intend to write at the destination
    ; address. This is set to 'dword'(32bit(4byte) signed integer) by
    ; default. See the help file for DllStructCreate for all types.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns the destination address.
    ; On Failure - Returns 0.
    ; @Error - 0 = No error.
    ; 1 = $av_Offset is not an array.
    ; 2 = Invalid $ah_Handle.
    ; 3 = Failed to read from the specified process.
    ; 4 = $sv_Type is not a string.
    ; 5 = $sv_Type is an unknown data type.
    ; 6 = Failed to allocate the memory needed for the DllStructure.
    ; 7 = Error allocating memory for $sv_Type.
    ; 8 = $v_Data is not in the proper format to be used with the
    ; "Type" selected for $sv_Type, or it is out of range.
    ; 9 = Failed to write to the specified process.
    ; Author(s): Nomad
    ; Note(s): Data written is in Decimal format, unless a 'char' type is selected.
    ; Set $av_Offset like this:
    ; $av_Offset[0] = NULL (not used, doesn't matter what's entered)
    ; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal)
    ; $av_Offset[2] = Offset for pointer 2
    ; etc...
    ; (The number of array dimensions determines the number of pointers)
    ;=================================================================================================

    [/autoit]
  • Abkürzungen in SciTE verwalten

    • SEuBo
    • 21. Dezember 2009 um 22:19

    Einfach spitze!
    Kleiner Verbesserungsvorschlag meinerseits: Statt auf einen "Einzelklick" fände ich es praktischer, würde die Listview nur auf Doppelklicks reagieren. So muss man nicht immer das Fenster wegklicken, wenn man mehrere Abbrev's löschen möchte. Nur ne Idee ;)

    Neben OrganizeIncludes ist das eins meiner neuen Lieblingsspielzeuge :P

  • _Runau3()

    • SEuBo
    • 21. Dezember 2009 um 22:06

    Und so geht die Funktion als Einzeiler:

    [autoit]

    Func _RunAu3($sFile)
    Run(@AutoItExe&" "&$sFile)
    EndFunc

    [/autoit]
  • Texteingabe mit FF.au3

    • SEuBo
    • 21. Dezember 2009 um 21:25

    https://autoit.de/index.php?page=Thread&amp;threadID=14368

  • Icon in Gui ändern

    • SEuBo
    • 21. Dezember 2009 um 19:41
    Zitat von cartan12

    Ja das hab ich auch schon gefunden, aber ich muss ja erstmal wissen, welches icon denn jetzt gerade benutzt wird...

    Erstelle einen Array, der alle Icons beinhaltet. Sobald eines benutzt wird, löschst du dieses aus dem Array. So kann keins 2 mal vorkommen.

  • Icon in Gui ändern

    • SEuBo
    • 21. Dezember 2009 um 19:22

    Zitat aus der Hilfe:

    Zitat

    To update the icon after the dialog box is displayed use GUICtrlSetImage

  • ClipPut

    • SEuBo
    • 21. Dezember 2009 um 19:09

    Markierten Text ins ClipBoard?

    [autoit]

    Send("^{c}")

    [/autoit]

    :rofl:

  • Bestimten Text suchen und verändern

    • SEuBo
    • 21. Dezember 2009 um 19:01

    Bitteschön.

    Spoiler anzeigen
    [autoit]

    $hGUI = GUICreate("")
    $edit = GUICtrlCreateEdit("Ich bin ein Text, in dem Hallo vorkommt."&@CRLF&"Hallo ist nämlich ein gängiges Wort in der deutschen Sprache."&@CRLF&"Ohne Hallo könnte sich niemand begrüßen. Hallo allesamt",20,20,300,300)
    $button = GUICtrlCreateButton("suchen",20,350)
    GUISetState()

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

    While True
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $button
    GUICtrlSetData($edit,_StringReplace(GUICtrlRead($edit),"Hallo","huhuuu",2))
    EndSwitch
    WEnd

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

    Func _StringReplace($sString,$sSubString,$sReplaceString,$iOccurence=1,$iCaseSense=0)
    ;SEuBo
    Return StringLeft($sString,StringInStr($sString,$sSubString,$iCaseSense,$iOccurence)-1)&StringReplace(StringTrimLeft(StringTrimRight($sString,StringLen($sString)-StringInStr($sString,$sSubString,$iCaseSense,$iOccurence)-StringLen($sSubString)),StringInStr($sString,$sSubString,$iCaseSense,$iOccurence)-1),$sSubString,$sReplaceString)&StringRight($sString,StringLen($sString)-StringInStr($sString,$sSubString,$iCaseSense,$iOccurence)-StringLen($sSubString))
    EndFunc

    [/autoit]
  • e-mail senden von inputbox

    • SEuBo
    • 21. Dezember 2009 um 16:18

    Doch tut sie. Es fehlte nur #include <File.au3> und in Zeile 69 war eine Variable falsch geschrieben

    Spoiler anzeigen
    [autoit]

    ;~ Greek, fixed by SEuBo
    #include <File.au3>
    #include <GUIConstantsEx.au3>

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

    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Email versender", 396, 294,-1, -1)
    $Input1 = GUICtrlCreateInput("", 8, 40, 121, 21)
    $Input2 = GUICtrlCreateInput("", 248, 40, 121, 21)
    $Label1 = GUICtrlCreateLabel("Mail sever: Für http://www.web.de ist er smtp.web.de ", 8, 16, 229, 17)
    $Label2 = GUICtrlCreateLabel("Name des Absenders", 248, 16, 105, 17)
    $Label3 = GUICtrlCreateLabel("Absender email addresse", 8, 72, 122, 17)
    $Input3 = GUICtrlCreateInput("", 8, 96, 121, 21)
    $Input4 = GUICtrlCreateInput("", 248, 96, 121, 21)
    $Label4 = GUICtrlCreateLabel("Empfänger email addresse", 248, 72, 128, 17)
    $Input5 = GUICtrlCreateInput("", 8, 152, 121, 21)
    $Label5 = GUICtrlCreateLabel("Betreff", 8, 128, 35, 17)
    $Label6 = GUICtrlCreateLabel(" Text ", 248, 128, 34, 17)
    $Input6 = GUICtrlCreateInput("", 248, 152, 121, 21)
    $Label7 = GUICtrlCreateLabel("Nochmal Absender email", 8, 184, 121, 17)
    $Input7 = GUICtrlCreateInput("", 8, 208, 121, 21)
    $Input8 = GUICtrlCreateInput("", 248, 208, 121, 21)
    $Label8 = GUICtrlCreateLabel("Passwort der Absender email", 248, 184, 140, 17)
    $Button1 = GUICtrlCreateButton("Email versenden", 152, 248, 100, 25, 0)
    $Button2 = GUICtrlCreateButton("Abbrechen", 312, 256, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $rc = _INetSmtpMailCom(GUICtrlRead( $Input1),GUICtrlRead($Input2),GUICtrlRead($Input3), GUICtrlRead($Input4), GUICtrlRead($Input5), GUICtrlRead($Input6), "", "","", GUICtrlRead($Input7), GUICtrlRead($Input8))
    If @error then
    msgbox(0,"Error sending message","Error code:" & @error & " Description:" & $rc)
    EndIf
    Case $Button2
    Exit
    EndSwitch
    WEnd

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

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
    SetError(1)
    return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    if @error then
    SetError(2)
    return $oMyRet[1]
    EndIf
    EndFunc;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description,3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc;==>MyErrFunc

    [/autoit]
  • GetMonitor-Funktion testen

    • SEuBo
    • 21. Dezember 2009 um 16:11

    Scheint fast so. Bei meiner Freundin (Vista x64, TFT per Analog) befindet sich die Auflösung unter
    "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\{CCC3B725-F071-4649-A44D-F804ED56CE6C}\0000"

    Interessant ist, dass "{CCC3B725-F071-4649-A44D-F804ED56CE6C}" Hier auch der letzte Schlüssel unter "..\Control\VIDEO\" ist. Genauso wie die akt. Auflösung bei mir im letzten Schlüssel zu finden war.

    Dateien

    2.jpg 99,61 kB – 0 Downloads
  • e-mail senden von inputbox

    • SEuBo
    • 21. Dezember 2009 um 15:41

    Da ist doch sogar ein Beispiel bei:
    https://autoit.de/index.php?page…97694#post97694

  • Neue Idee des Dateiübertragens !

    • SEuBo
    • 21. Dezember 2009 um 15:39

    Hab das mal ganz dreist aus der _InetSmtpAuth() geklaut:

    Spoiler anzeigen
    [autoit]

    ;===============================================================================
    ;
    ; Function Name: _Base64Encoding()
    ; Description: Kodiert eine Zeichenfolge mit dem Base64-Verfahren
    ; (http://de.wikipedia.org/wiki/Base64)
    ; Parameter(s): $String - Zeichenfolge die kodiert werden soll
    ; Requirement(s): None
    ; Return Value(s): Kodierte Zeichenfolge
    ; Authors: bernd670
    ;
    ;===============================================================================
    Func _Base64Encoding($String)

    $strUmsetzung = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    $strRetValue = ""

    For $i = 1 To StringLen($String) Step 3
    $strTok = StringMid($String, $i, 3)
    Switch StringLen($strTok)
    Case 3
    $iTokVal = (Asc(StringMid($strTok, 1, 1)) * 256 + _
    Asc(StringMid($strTok, 2, 1))) * 256 + _
    Asc(StringMid($strTok, 3, 1))
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt

    Case 2
    $iTokVal = (Asc(StringMid($strTok, 1, 1)) * 256 + _
    Asc(StringMid($strTok, 2, 1))) * 256
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt & "="

    Case 1
    $iTokVal = Asc(StringMid($strTok, 1, 1)) * 65536
    $iTokVal = BitShift($iTokVal, 12)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1)
    $iTokVal = BitShift($iTokVal, 6)
    $strTokCryt = StringMid($strUmsetzung, (BitAND($iTokVal, 63)) + 1, 1) & $strTokCryt
    $strRetValue &= $strTokCryt & "=="

    EndSwitch
    Next

    Return $strRetValue
    EndFunc ;==>_Base64Encoding

    [/autoit]
  • GetMonitor-Funktion testen

    • SEuBo
    • 21. Dezember 2009 um 15:36

    Garnix ^^
    Schau auf das Bild. Ich habe, nach etwas stöbern meine aktuelle Auflösung in
    "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\{DC8F5146-99A1-450C-AA19-3233F6BD554F}\0000" gefunden. Die 2 Unterschlüssel, die du auf dem Bild erkennen kannst sind meine Bildschirme: Der erste ist der ausgeschaltete (weil durchgebrochen :( ) Laptopdisplay, und der zweie ist mein aktiver Röhrenmonitor.

    Der überschlüssel "0000" scheint den grade aktiven Monitor auszugeben?! Nur wie sähe das aus wenn ich 2 Monitore angeschlossen hab? Fragen über Fragen :S

    //EDIT: Juhuuuu Post #800!

    Dateien

    21.12.png 134,54 kB – 0 Downloads
  • Schlüssel auslesen INI-Files

    • SEuBo
    • 21. Dezember 2009 um 15:15

    Ubound gibt die größe eines Arrays aus.

    [autoit]

    $Sektion[UBound($Sektion)-1][0]+1

    [/autoit]


    Hiermit lese ich Den Wert des Elements, welches an der letzen Stelle steht (zb: 2) und rechne ihn um 1 hoch. Alternativ würde auch diese Zeile funktionieren:

    [autoit]

    IniWrite("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR,UBound($Sektion),$eingabe)

    [/autoit]

    Durch das Inireadsection beinhaltet der Array immer so viele Zeilen, wie Schlüssel in der Ini vorhanden sind.
    Sind also 5 Schlüssel vorhanden, sieht der Array so aus:

    Spoiler anzeigen
    [autoit]

    ; $Sektion[0][0] = "Größe des Arrays. Also das was Ubound($Sektion) ausgeben würde"
    ; $Sektion[1][0] = "Schlüssel 1"
    ; $Sektion[1][1] = "Wert 1"
    ; $Sektion[2][0] = "Schlüssel 2"
    ; $Sektion[2][1] = "Wert 2"
    ; $Sektion[3][0] = "Schlüssel 3"
    ; $Sektion[3][1] = "Wert 3"
    ; $Sektion[4][0] = "Schlüssel 4"
    ; $Sektion[4][1] = "Wert 4"
    ; $Sektion[5][0] = "Schlüssel 5"
    ; $Sektion[5][1] = "Wert 5"

    [/autoit]


    Ubound gibt nun 6 aus, weil 0,1,2,3,4,5 vorhanden sind. Ubound()-1 gibt demzufolge 5 aus (Also das letzte "ansprechbare" Element). $Sektion[Ubound($Sektion)-1][1] = $Sektion[5][1]. (das entspricht "Wert 5")

    Hier siehst du wie der Array vorher, und nachher aussieht:

    [autoit]

    #include <Array.au3>
    ;versucht die Sektion einzulesen.
    $eingabe = InputBox ("","Geben Sie einen Text ein","text")
    $Sektion = IniReadSection("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR)
    If @error Then ; Wenn das fehlschlägt, dann erstelle einen Schlüssel "1"
    IniWrite("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR ,"1",$eingabe)
    Else ;Ansonsten, benutze das 2D Array von IniReadSection, welches so aufgebaut ist:
    _ArrayDisplay($Sektion) ; so sieht der array vorher aus:
    IniWrite("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR,UBound($Sektion),$eingabe)
    $Sektion = IniReadSection("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR)
    _ArrayDisplay($Sektion) ; und so danach
    EndIf

    [/autoit]
  • GetMonitor-Funktion testen

    • SEuBo
    • 21. Dezember 2009 um 14:57

    Vista x86, Röhrenmonitor per Analog Anschluss:

    Klappt wunderbar ^^

    Dateien

    21.12.png 44,6 kB – 0 Downloads
  • Schlüssel auslesen INI-Files

    • SEuBo
    • 21. Dezember 2009 um 14:52

    Probier mal so:

    [autoit]

    $eingabe = InputBox ("","Geben Sie einen Text ein","text")
    $Sektion = IniReadSection("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR)
    If @error Then
    IniWrite("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR ,"1",$eingabe)
    Else
    IniWrite("C:\testdatei.ini",@MDAY & "." & @MON & "." & @YEAR,$Sektion[UBound($Sektion)-1][0]+1,$eingabe)
    EndIf

    [/autoit]
  • GUI mit zwei Radio-Bereichen

    • SEuBo
    • 21. Dezember 2009 um 14:20

    Ich würde es so machen. Die Zauberwörter sind Schleifen und Arrays! Da du ja schon für deine Checkboxen einen Array verwendet hast, denke ich dass du dem Thema nicht so fremd bist.

    Spoiler anzeigen
    [autoit]


    #include <GuiConstantsEx.au3>

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

    Global $Befehle[26] = ['MouseMove(200,300)','MsgBox(0,"","Hallo!")','ConsoleWrite("Ich bins, nummer 2!"@CRLF)', _
    'WinMinimizeAll()','ShellExecute("calc.exe")','_ArrayDisplay($Befehle)', 'ConsoleWrite("Ich bins, nummer 6!"@CRLF)', _
    'MouseMove(500,600)','MsgBox(0,"","Miau!")','ShellExecute("notepad.exe")','MouseMove(900,250)','MsgBox(0,"","Hallööchen!")', _
    'ConsoleWrite("Ich bins, nummer 12!"@CRLF)','WinMinimizeAllUndo()','ShellExecute("paint.exe")','_ArrayDisplay($Checkbox)', _
    'ConsoleWrite("Ich bins, nummer 16!"@CRLF)','MouseMove(500,600)','MsgBox(0,"","Wuff!")','ShellExecute("www.autoit.de")', _
    'MsgBox(0,"","Das war die letzte")','ConsoleWrite("Ich bins, nummer 22!"@CRLF)','MsgBox(0,"","Kräh!")','ShellExecute("calc.exe")', _
    'MsgBox(0,"","Servus!")','ShellExecute("www.autoit.de")']

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

    ;Dimension der Radios
    Dim $Radio[26] ; 26 Zeilen

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

    ; GUI
    $Test = GuiCreate("Test", 400, 450)

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

    ; BUTTON
    $Button1 = GuiCtrlCreateButton("Go", 140, 410, 100, 30)

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

    ;Checkboxen
    GuiCtrlCreateCheckbox("Check1", 95, 380, 80, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)

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

    GuiCtrlCreateCheckbox("Check2", 225, 380, 80, 20)
    GuiCtrlSetState(-1, $GUI_CHECKED)

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

    ;Gruppe 1
    GUICtrlCreateGroup("Feld 1", 65, 10, 100, 360)
    Global $y = 35
    For $i = 0 to 12
    $Radio[$i] = GUICtrlCreateRadio("Opt10"&$i+1, 70, $y, 80, 20)
    $y += 25
    Next
    GUICtrlCreateGroup("", -99, -99 , 1, 1)
    ;Gruppe 2
    GUICtrlCreateGroup("Feld 2", 235, 10, 100, 360)
    $y = 35
    For $i = 13 to 25
    $Radio[$i] = GUICtrlCreateRadio("Opt20"&$i-12, 240, $y, 80, 20)
    $y += 25
    Next
    GUICtrlCreateGroup("", -99, -99 , 1, 1)
    GUISetState()
    While 1
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    For $i = 0 to 25
    If BitAND(GUICtrlRead($Radio[$i]), $GUI_CHECKED) Then Execute($Befehle[$i])
    Next
    EndSwitch
    WEnd

    [/autoit]

    PS: ConsoleWrite scheint nicht zu funktionieren, aber das sollte ja nicht weiter tragisch sein.

  • 2 Programme automatich installieren lassen

    • SEuBo
    • 21. Dezember 2009 um 03:42

    Probier mal den hier für Nero:

    [autoit]

    $path = FileOpenDialog("Nero","","Nero Installation (*.exe)")
    If @error Then Exit

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

    RunWait($path&' /i /qb EULAACCEPTED="1"') ;alternativ der Pfad zu deiner installationsdatei
    WinWait("Nero 9 Lite - Installation","")

    [/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™