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

Beiträge von McPoldy

  • verschieden I-net seiten mithilfe von _StringBetween auslesen

    • McPoldy
    • 19. Februar 2008 um 15:51

    Och sieh an, kaum hat man Quelltext, kann sogar ich mir was vorstellen :D ( brauche halt immer Beispiele)

    ich bekomme das hier raus:
    händler 1 10 11 12 13 14 15
    händler 2 21 21 22 23 24 25

    wenn ich mir die beispielseite einlese mit:

    Spoiler anzeigen
    [autoit]

    ;Internet Explorer öffnen und Module laden
    #include <IE.au3>
    #include <String.au3>
    #include <Inet.au3>
    #include <Array.au3>

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

    ;Module laden ende------------------------

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

    $sUrl = "http://www.autohaus-roethig.de/clan/test.html"
    $oIE = _IECreate($sUrl)
    _IELoadWait($oIE)

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

    $filew = FileOpen(@ScriptDir & "\high.txt", 2) ; Nur einmal öffnen

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

    $sText1 = _IEBodyReadHTML($oIE)
    $sanfang1 = 'href="">' ;Textfeld davor
    $ende1 = '</TR>' ;Textfeld dahinter
    $gesucht1 = _StringBetween($sText1, $sanfang1, $ende1)
    ;~ $gesucht1 = _StringBetween($sText1, $sanfang1, $ende1)
    If IsArray( $gesucht1 ) Then
    for $i = 0 to UBound($gesucht1) -1
    $str = StringSplit($gesucht1[$i],"<TD>")
    FileWriteLine( $filew, $str[21] & " " & $str[31] & " " & $str[39] & " " & $str[47] & " " & $str[55] & " " & $str[63] & " " & $str[71] )
    next
    EndIf

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

    Geht zwar noch schöner, aber du willst sicher noch selber nen bissel rumspielen mit dem Quelltext.

  • Array richtig verwenden?!^^

    • McPoldy
    • 19. Februar 2008 um 14:31

    :S;(:S stimmt

  • verschieden I-net seiten mithilfe von _StringBetween auslesen

    • McPoldy
    • 19. Februar 2008 um 14:29

    Also auf der Seite http://www.ichliebegemuese.de bekomme ich einen Ladefehler (kann ich verstehen, wer liebt schon Gemüse), dann stell uns doch mal den Inhalt aus der $sText1 Variable zur Verfügung.

  • Array richtig verwenden?!^^

    • McPoldy
    • 19. Februar 2008 um 13:38

    Naja hab trozdem mal nen bissel was in den Quelltext geschrieben, aber Xenobiologist hat schon recht, die Hilfe ist ne gute Hilfe (was blöderes ist mir grade nicht eingefallen ;) )

  • Array richtig verwenden?!^^

    • McPoldy
    • 19. Februar 2008 um 09:48

    ja aber, er soll die suche wohl "selber" schreiben :)

    Spoiler anzeigen
    [autoit]


    ; In diese Variabel wird der Wert der 1. Zeile aus der Textdatei eingelesen
    $search = FileReadLine("Zahlen.txt",1)

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

    ; Diese Variable bekommt alle möglichen Werte und ist ein Array, sieht dann so aus:
    ;~ $array[0] = 10 => Anzahl der Einträge im Array
    ;~ $array[1] = 1 => Wert
    ;~ $array[2] = 2 => Wert
    ;~ $array[3] = 3 => Wert
    ;~ $array[4] = 4 => Wert
    ;~ $array[5] = 5 => Wert
    ;~ $array[6] = 6 => Wert
    ;~ $array[7] = 7 => Wert
    ;~ $array[8] = 8 => Wert
    ;~ $array[9] = 9 => Wert
    ;~ $array[10] = 10 => Wert
    $array = StringSplit("1,2,3,4,5,6,7,8,9,0", ",")

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

    ; Die For...Next Schleife, $int ist eine Zählvariable,
    ;die bei jedem durchlauf um 1 erhöht wird
    For $int = 1 To $array[0] ;<= Druchlaufe die Schleife von 1 bis 10
    If $search = $array[$int] Then ;<= Wenn der Wert aus $search gleich dem aus dem Arrayfeld ist, dann....
    MsgBox(64,"Info","Wert wurde gefunden.") ;<= gib mir eine MsgBox, mit einer Erfolgsmeldung
    Exit 0 ;<= Verlasse das Skript
    EndIf ;<= Ende der If Abfrage
    Next ;<= Ende der For...Next Schleife
    MsgBox(48,"Info","Wert wurde NICHT gefunden.") ;<= Wenn nicht gefunden dann Meldung ausgeben
    Exit 0 ;<= Skript beenden

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

    glaube er meint es etwa so.

  • Array richtig verwenden?!^^

    • McPoldy
    • 19. Februar 2008 um 09:41
    Zitat

    Ps: das ganze soll keine searching funktion werden


    @JanSchmidt Vielleicht deshalb ;)

  • Array richtig verwenden?!^^

    • McPoldy
    • 19. Februar 2008 um 08:42

    Wäre schön den Sinn zu erfahren, so kann ich mir nicht vorstellen wozu es gut sein soll bzw. wie man weiter helfen kann :(

  • Endlosschleife sinngemäß?

    • McPoldy
    • 19. Februar 2008 um 08:02

    Ok, das ist richtig, dann mach es mit WMI, da kannst du einen neuen Process auf einem Remote-PC erzeugen, wichtig, du solltest Adminberechtigungen auf dem PC haben, es wird keine GUI angezeigt. Sollte aber deinen Anforderungen genügen :)

    VB Script
    Code
    ' StartProcess.vbs
    ' Sample VBScript to start a process. Inputbox for name
    ' Author Guy Thomas http://computerperformance.co.uk/
    ' Version 2.2 - December 2005
    ' -------------------------------------------------------'
    Option Explicit
    Dim objWMIService, objProcess
    Dim strShell, objProgram, strComputer, strExe, strInput
    strExe = "Calc.exe"
    ' Input Box to get name of machine to run the process
    Do
    strComputer = (InputBox(" ComputerName to Run Script",_
    "Computer Name"))
    If strComputer <> "" Then
    strInput = True
    End if
    Loop until strInput = True
    
    
    ' Connect to WMI
    set objWMIService = getobject("winmgmts://"_
    & strComputer & "/root/cimv2")
    ' Obtain the Win32_Process class of object.
    Set objProcess = objWMIService.Get("Win32_Process")
    Set objProgram = objProcess.Methods_( _
    "Create").InParameters.SpawnInstance_
    objProgram.CommandLine = strExe
    
    
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod( _
    "Win32_Process", "Create", objProgram)
    
    
    WScript.echo "Created: " & strExe & " on " & strComputer
    WSCript.Quit
    ' End of Example of a Process VBScript
    Alles anzeigen

    Quelle

    AutoIT
    [autoit]

    Global $Computer, $strCMD, $Obj_WMIService,$objProcess, $objProgram, $strShell
    $Computer = InputBox("Ziel-PC","Auf welchem Rechner:",@ComputerName)
    $strCMD = InputBox("WMI Create Process","Was soll gestartet werden?","notepad.exe")
    $Obj_WMIService = ObjGet('winmgmts:\\' & $Computer & '\root\cimv2')

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

    If (IsObj($Obj_WMIService)) And (Not @error) Then

    $objProcess = $Obj_WMIService.Get("Win32_Process")
    $objProgram = $objProcess.Methods_("Create").InParameters.SpawnInstance_
    $objProgram.CommandLine = $strCMD
    $strShell = $Obj_WMIService.ExecMethod("Win32_Process", "Create", $objProgram)
    EndIf

    [/autoit]
  • scrollbare GUI

    • McPoldy
    • 18. Februar 2008 um 13:28

    Bitte schön :)

    GUIScrollBars.au3
    [autoit]


    #include-once
    #include <WinAPI.au3>

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

    Global Const $Debug = 1

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

    Global Const $SIF_POS = 0x4
    Global Const $SIF_PAGE = 0x2
    Global Const $SIF_RANGE = 0x1
    Global Const $SIF_TRACKPOS = 0x10
    Global Const $SIF_ALL = BitOR($SIF_RANGE, $SIF_PAGE, $SIF_POS, $SIF_TRACKPOS)

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

    Global Const $SB_HORZ = 0
    Global Const $SB_VERT = 1
    Global Const $SB_CTL = 2
    Global Const $SB_BOTH = 3

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

    Global Const $SB_LINELEFT = 0
    Global Const $SB_LINERIGHT = 1
    Global Const $SB_PAGELEFT = 2
    Global Const $SB_PAGERIGHT = 3
    Global Const $SB_LINEUP = 0
    Global Const $SB_LINEDOWN = 1
    Global Const $SB_PAGEUP = 2
    Global Const $SB_PAGEDOWN = 3
    Global Const $SB_TOP = 6
    Global Const $SB_BOTTOM = 7

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

    ;0 = hwnd;1 = xClientMax;2 cxChar;3 = cyChar;4 cxClient;5 = cyClient,6 = iHMax;7 = iVMax
    Global $aSB_WindowInfo[1][8]

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

    Global Const $tagSCROLLINFO = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"

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

    Global Const $tagTEXTMETRIC = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & _
    "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & _
    "char tmFirstChar;char tmLastChar;char tmDefaultChar;char tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & _
    "byte tmPitchAndFamily;byte tmCharSet"

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

    Func _GUIScrollBars_Init($hWnd, $iHMax = -1, $ivMax = -1)
    If Not IsHWnd($hWnd) Then WinGetHandle($hWnd)
    If $aSB_WindowInfo[0][0] <> 0 Then ReDim $aSB_WindowInfo[UBound($aSB_WindowInfo) + 1][8]

    Local $xChar, $yChar, $index, $wpos, $hdc, $tTEXTMETRIC
    Local $xUpper
    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    $index = UBound($aSB_WindowInfo) - 1
    ;~ $wpos = WinGetPos($hwnd)

    _DebugPrint("index: " & $index)
    $aSB_WindowInfo[$index][0] = $hWnd
    $aSB_WindowInfo[$index][1] = $iHMax
    $aSB_WindowInfo[$index][6] = $iHMax
    $aSB_WindowInfo[$index][7] = $ivMax
    If $ivMax = -1 Then $aSB_WindowInfo[$index][7] = 27

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

    $hdc = _WinAPI_GetDC ($hWnd)

    $tTEXTMETRIC = DllStructCreate($tagTEXTMETRIC)

    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))

    DllCall("gdi32.dll", "int", "GetTextMetrics", "int", $hdc, "ptr", DllStructGetPtr($tTEXTMETRIC))
    $xChar = DllStructGetData($tTEXTMETRIC, "tmAveCharWidth")
    If $Debug Then _DebugPrint("$xChar: " & $xChar)
    If BitAND(DllStructGetData($tTEXTMETRIC, "tmPitchAndFamily"), 1) Then
    $xUpper = 3 * $xChar / 2
    Else
    $xUpper = 2 * $xChar / 2
    EndIf

    If $Debug Then _DebugPrint("$xUpper: " & $xUpper)
    $yChar = DllStructGetData($tTEXTMETRIC, "tmHeight") + DllStructGetData($tTEXTMETRIC, "tmExternalLeading")
    If $Debug Then _DebugPrint("$yChar: " & $yChar)
    _WinAPI_ReleaseDC ($hWnd, $hdc)
    If $iHMax = -1 Then $aSB_WindowInfo[$index][1] = 48 * $xChar + 12 * $xUpper
    If $Debug Then _DebugPrint("$xClientMax: " & $aSB_WindowInfo[$index][1])
    $aSB_WindowInfo[$index][2] = $xChar
    $aSB_WindowInfo[$index][3] = $yChar

    _GUIScrollBars_Show($hWnd, $SB_HORZ, False)
    _GUIScrollBars_Show($hWnd, $SB_VERT, False)
    _GUIScrollBars_Show($hWnd, $SB_HORZ)
    _GUIScrollBars_Show($hWnd, $SB_VERT)

    EndFunc ;==>_GUIScrollBars_Init

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

    Func MY_WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xClient, $yClient
    Local $ivMax, $aRet
    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xClientMax = $aSB_WindowInfo[$index][1]
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    $ivMax = $aSB_WindowInfo[$index][7]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    $aRet = DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    $aRet = DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)

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

    Return $GUI_RUNDEFMSG
    EndFunc ;==>MY_WM_SIZE

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

    Func MY_WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $hwndScrollBar = HWnd($lParam)
    If $Debug Then _DebugPrint($nScrollCode & ";" & BitShift($wParam, 16) & ";" & $hwndScrollBar)

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

    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xChar = $aSB_WindowInfo[$index][2]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    ; Get all the horizontal scroll bar information
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO))
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode

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

    Case $SB_LINELEFT ; user clicked left arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

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

    Case $SB_LINERIGHT ; user clicked right arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

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

    Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

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

    Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

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

    Case $SB_THUMBTRACK ; user dragged the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

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

    ;~ // Set the position and then retrieve it. Due to adjustments
    ;~ // by Windows it may not be the same as the value set.

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO))
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", $xChar * ($xPos - $Pos), "int", 0, "ptr", 0, "ptr", 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>MY_WM_HSCROLL

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

    Func MY_WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $hwndScrollBar = HWnd($lParam)
    If $Debug Then _DebugPrint($nScrollCode & ";" & BitShift($wParam, 16) & ";" & $hwndScrollBar)
    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $yChar = $aSB_WindowInfo[$index][3]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    ; Get all the vertial scroll bar information
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO))
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

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

    Switch $nScrollCode
    Case $SB_TOP ; user clicked the HOME keyboard key
    DllStructSetData($tSCROLLINFO, "nPos", $Min)

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

    Case $SB_BOTTOM ; user clicked the END keyboard key
    DllStructSetData($tSCROLLINFO, "nPos", $Max)

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

    Case $SB_LINEUP ; user clicked the top arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

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

    Case $SB_LINEDOWN ; user clicked the bottom arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

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

    Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

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

    Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

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

    Case $SB_THUMBTRACK ; user dragged the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch
    ;~ // Set the position and then retrieve it. Due to adjustments
    ;~ // by Windows it may not be the same as the value set.

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO))
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

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

    If ($Pos <> $yPos) Then
    DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", 0, "int", $yChar * ($yPos - $Pos), "ptr", 0, "ptr", 0)
    $yPos = $Pos
    EndIf

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

    Return $GUI_RUNDEFMSG

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

    EndFunc ;==>MY_WM_VSCROLL

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

    Func _GUIScrollBars_Enable($hWnd, $wBar, $enable = True)
    Local Const $SIF_DISABLENOSCROLL = 0x8

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

    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xClient, $yClient

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xClientMax = $aSB_WindowInfo[$index][1]
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    $xClient = $aSB_WindowInfo[$index][4]
    $yClient = $aSB_WindowInfo[$index][5]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_DISABLENOSCROLL, $SIF_ALL))
    DllStructSetData($tSCROLLINFO, "nMax", 0)
    If $wBar = $SB_HORZ Then
    If $enable Then
    DllStructSetData($tSCROLLINFO, "nMax", $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    EndIf
    Else
    If $enable Then
    DllStructSetData($tSCROLLINFO, "nMax", 27) ; max
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    EndIf
    EndIf
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    EndFunc ;==>_GUIScrollBars_Enable

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

    Func _GUIScrollBars_Show($hWnd, $wBar, $Show = True)
    Local $v_ret = DllCall("user32.dll", "int", "ShowScrollBar", "hwnd", $hWnd, "int", $wBar, "int", $Show)
    If @error Or Not IsArray($v_ret) Then Return SetError(-1, -1, -1)
    Return $v_ret[0]
    EndFunc ;==>_GUIScrollBars_Show

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

    Func _GUIScrollBars_SetPos($hWnd, $wBar, $Pos)
    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xyPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    ; Save the position for comparison later on
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO))
    $xyPos = DllStructGetData($tSCROLLINFO, "nPos")

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    DllStructSetData($tSCROLLINFO, "nPos", $Pos)
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO))
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If $wBar = $SB_HORZ Then
    If ($Pos <> $xyPos) Then DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", $xChar * ($xyPos - $Pos), "int", 0, "ptr", 0, "ptr", 0)
    Else
    If ($Pos <> $xyPos) Then DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", 0, "int", $yChar * ($xyPos - $Pos), "ptr", 0, "ptr", 0)
    EndIf
    EndFunc ;==>_GUIScrollBars_SetPos

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

    Func _GUIScrollBars_SetRange($hWnd, $nBar, $nMinPos, $nMaxPos)
    Local $v_ret = DllCall("user32.dll", "int", "SetScrollRange", "hwnd", $hWnd, "int", $nBar, "int", $nMinPos, "int", $nMaxPos, "int", True)
    If @error Or Not IsArray($v_ret) Then Return SetError(-1, -1, -1)
    Return $v_ret[0]
    EndFunc ;==>_GUIScrollBars_SetRange

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

    Func _GUIScrollBars_GetRange($hWnd, $nBar)
    Local $lpMin = DllStructCreate("int")
    Local $lpMax = DllStructCreate("int")
    Local $v_ret = DllCall("user32.dll", "int", "GetScrollRange", "hwnd", $hWnd, "int", $nBar, "ptr", DllStructGetPtr($lpMin), "ptr", DllStructGetPtr($lpMax))
    If @error Or Not IsArray($v_ret) Then Return SetError(-1, -1, -1)
    Local $Min_Max[2]
    $Min_Max[0] = DllStructGetData($lpMin, 1)
    $Min_Max[1] = DllStructGetData($lpMax, 1)
    Return $Min_Max
    EndFunc ;==>_GUIScrollBars_GetRange

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

    Func _DebugPrint($s_text)
    $s_text = StringReplace($s_text, @LF, @LF & "-->")
    ConsoleWrite("!===========================================================" & @LF & _
    "+===========================================================" & @LF & _
    "-->" & $s_text & @LF & _
    "+===========================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Problem mit adfunctions.au3

    • McPoldy
    • 18. Februar 2008 um 13:22

    Ich habe es mal auf einem ADS getestet, der selbe Fehler (Win 2003 SBS)

  • Endlosschleife sinngemäß?

    • McPoldy
    • 18. Februar 2008 um 13:20

    Ich spinne mal so einfach drauf los, was mir als erstes in den Kopf kommt. Wie wäre ein kleines Skript was einen UDP Server darstellt, und dem Du über das Netzwerk einen bestimmten Befehl sendst, so nach dem Motto Befehl1 = Desktop sperren Befehl2 = Desktop freigeben.
    Wie schon gesagt nur so ein Gedankenblitz.

  • Programm hängt bei starten einer Funktion...

    • McPoldy
    • 18. Februar 2008 um 08:14

    Moin, vielleicht zur Erklärung was ich in meinem Quelltext gemacht habe bzw. was OnEvent heißt.

    In Deinem Skript hast du eine GUI die aufgerufen wird und anschliessend eine While Schleife die immer wieder abfragt ob der Benutzer einen Knopf/Button gedrückt hat. Drückt nun jemand Start, springst Du in die Funktion pot(), das heißt das die GUI Ereignisse nicht mehr abgefragt werden, wenn also z. B. jemand auf Stop klickt. Wenn du nun Opt("GUIOnEventMode",1) (In der Hilfe unterAutoIt -> GUI Reference -> GUI OnEventModus) setzt, wird eine Function aufgerufen wenn du auf einen Knopf drückst. Das zweite was ich anders gemacht habe, ich habe Adlib genutzt, so wird deine put() Funktion je nach Zeitangabe aufgerufen, es können aber auch noch andere Buttons genutzt werden ( du hast oben gefragt wie man es hin bekommt das man die Stop Taste drückt und auch was passiert).

  • Programm hängt bei starten einer Funktion...

    • McPoldy
    • 17. Februar 2008 um 21:46

    Ich habe mal ein bissel gebastelt und würde es vielleicht nicht ganz so lösen wie du (vom Aufbau her) wenn du auf Events reagierst dürfte es besser klappen.

    Spoiler anzeigen
    [autoit]

    ; SRO Autopotter 0.8
    ; Author: born2die
    ; Copyright 2008 152x87, 152x93 rgb=DA4348 rgb=F7DA4E

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

    #include <GUIConstants.au3>

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

    Opt("GUIOnEventMode",1)
    Opt("TrayIconHide", 1)

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

    Global $health = "1"
    Global $food = "2"
    Global $sro_name

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

    $Sro = GUICreate("Sro Autopotter by born2die 0.8", 285, 340, 193, 125)
    $Group1 = GUICtrlCreateGroup("Autopot", 24, 8, 65, 89)
    $Checkbox1 = GUICtrlCreateCheckbox("Life", 32, 32, 57, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $Checkbox2 = GUICtrlCreateCheckbox("Food", 32, 56, 49, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("Start", 104, 16, 73, 25, 0)
    $Button2 = GUICtrlCreateButton("Stop", 104, 48, 75, 25, 0)
    $Button3 = GUICtrlCreateButton("About", 192, 16, 75, 25, 0)
    $Button4 = GUICtrlCreateButton("Exit", 192, 48, 75, 25, 0)
    $Label1 = GUICtrlCreateLabel("Copyright by born2die 2008", 24, 312, 133, 17)
    $Group2 = GUICtrlCreateGroup("Place of Life", 24, 112, 185, 89)
    $Radio1 = GUICtrlCreateRadio("1", 72, 144, 25, 17)
    $Radio2 = GUICtrlCreateRadio("2", 104, 144, 25, 17)
    $Radio3 = GUICtrlCreateRadio("3", 136, 144, 33, 17)
    $Radio4 = GUICtrlCreateRadio("4", 168, 144, 25, 17)
    $Radio5 = GUICtrlCreateRadio("5", 32, 168, 25, 17)
    $Radio6 = GUICtrlCreateRadio("6", 72, 168, 25, 17)
    $Radio7 = GUICtrlCreateRadio("7", 104, 168, 25, 17)
    $Radio8 = GUICtrlCreateRadio("8", 136, 168, 25, 17)
    $Radio9 = GUICtrlCreateRadio("9", 168, 168, 25, 17)
    $Radio10 = GUICtrlCreateRadio("0", 32, 144, 25, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("Place of Food", 22, 215, 185, 89)
    $Radio11 = GUICtrlCreateRadio("1", 70, 247, 25, 17)
    $Radio12 = GUICtrlCreateRadio("2", 102, 247, 25, 17)
    $Radio13 = GUICtrlCreateRadio("3", 134, 247, 33, 17)
    $Radio14 = GUICtrlCreateRadio("4", 166, 247, 25, 17)
    $Radio15 = GUICtrlCreateRadio("5", 30, 271, 25, 17)
    $Radio16 = GUICtrlCreateRadio("6", 70, 271, 25, 17)
    $Radio17 = GUICtrlCreateRadio("7", 102, 271, 25, 17)
    $Radio18 = GUICtrlCreateRadio("8", 134, 271, 25, 17)
    $Radio19 = GUICtrlCreateRadio("9", 166, 271, 25, 17)
    $Radio20 = GUICtrlCreateRadio("0", 30, 247, 25, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Input1 = GUICtrlCreateInput("Silkroad-Online", 152, 88, 121, 21)
    $Label2 = GUICtrlCreateLabel("Sro-Name:", 96, 88, 54, 17)
    $Label3 = GUICtrlCreateLabel("Sleeptime:", 216, 120, 53, 17)
    $Input2 = GUICtrlCreateInput("3", 216, 144, 57, 21)

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

    GUICtrlSetOnEvent($Button1, "_start")
    GUICtrlSetOnEvent($Button2, "_stop")
    GUICtrlSetOnEvent($Button3, "_info")
    GUICtrlSetOnEvent($Button4, "_exit")
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")

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

    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(1000)
    WEnd

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

    Func _start()
    $sro_name = GUICtrlGetState($Input1)
    GetHealth()
    GetFood()
    if $health == $food Then
    MsgBox(16, "Error!", "Health and Food have the same Number, that doesn't work!")
    Exit
    EndIf
    AdlibEnable("pot",GUICtrlRead($Input2) * 1000)
    EndFunc

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

    Func _stop()
    AdlibDisable()
    EndFunc

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

    Func _info()
    MsgBox(0, "Sro Autopotter", "Sro Autopotter made by born2die" & @CR & "Version 0.8" & @CR & "Copyright 2008")
    EndFunc

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

    Func _exit()
    Exit
    EndFunc

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

    Func pot()
    If WinWaitActive($sro_name) Then
    If (GUICtrlGetState($Checkbox1) == $GUI_CHECKED) Then
    If PixelGetColor(152, 87) <> 0xDA4348 Then Send($health) ;prüfen ob das Leben unter ca 50% ist
    EndIf
    If (GUICtrlGetState($Checkbox2) == $GUI_CHECKED) Then
    If PixelGetColor(152, 93) <> 0xF7DA4E Then Send($food) ;prüfen ob Hunger unter ca 50% ist
    EndIf
    EndIf
    EndFunc

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

    Func GetHealth()
    If GUICtrlGetState($Radio1) == $GUI_CHECKED Then $health = 1
    If GUICtrlGetState($Radio2) == $GUI_CHECKED Then $health = 2
    If GUICtrlGetState($Radio3) == $GUI_CHECKED Then $health = 3
    If GUICtrlGetState($Radio4) == $GUI_CHECKED Then $health = 4
    If GUICtrlGetState($Radio5) == $GUI_CHECKED Then $health = 5
    If GUICtrlGetState($Radio6) == $GUI_CHECKED Then $health = 6
    If GUICtrlGetState($Radio7) == $GUI_CHECKED Then $health = 7
    If GUICtrlGetState($Radio8) == $GUI_CHECKED Then $health = 8
    If GUICtrlGetState($Radio9) == $GUI_CHECKED Then $health = 9
    If GUICtrlGetState($Radio10) == $GUI_CHECKED Then $health = 0
    EndFunc

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

    Func GetFood()
    If GUICtrlGetState($Radio11) == $GUI_CHECKED Then $health = 1
    If GUICtrlGetState($Radio12) == $GUI_CHECKED Then $health = 2
    If GUICtrlGetState($Radio13) == $GUI_CHECKED Then $health = 3
    If GUICtrlGetState($Radio14) == $GUI_CHECKED Then $health = 4
    If GUICtrlGetState($Radio15) == $GUI_CHECKED Then $health = 5
    If GUICtrlGetState($Radio16) == $GUI_CHECKED Then $health = 6
    If GUICtrlGetState($Radio17) == $GUI_CHECKED Then $health = 7
    If GUICtrlGetState($Radio18) == $GUI_CHECKED Then $health = 8
    If GUICtrlGetState($Radio19) == $GUI_CHECKED Then $health = 9
    If GUICtrlGetState($Radio20) == $GUI_CHECKED Then $health = 0
    EndFunc

    [/autoit]
  • Problem mit ComboBox & switch case

    • McPoldy
    • 17. Februar 2008 um 12:41
    Zitat

    aber ist -1 nicht das selbe als wenn ich sofort sage $char?...

    ja schon, nur für tippfaule ist es so einfacher ;)

  • Problem mit ComboBox & switch case

    • McPoldy
    • 17. Februar 2008 um 12:34

    Hi, meinste sowas?

    Spoiler anzeigen
    [autoit]


    #include <GUIConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 447, 193, 125)
    $Char = GUICtrlCreateCombo("Charakter", 232, 8, 169, 25)
    GUICtrlSetData(-1,"Assasine")
    GUICtrlSetData(-1,"Derwisch")
    GUICtrlSetData(-1,"Elementarmagier")
    GUICtrlSetData(-1,"Krieger")
    GUICtrlSetData(-1,"Mesmer")
    GUICtrlSetData(-1,"Mönch")
    GUICtrlSetData(-1,"Nekromant")
    GUICtrlSetData(-1,"Paragon")
    GUICtrlSetData(-1,"Ritualist")
    GUICtrlSetData(-1,"Waldläufer")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Char
    $select = GUICtrlRead($Char)
    Switch $select
    Case "Assasine"
    MsgBox(64,"Info",$select)
    Case "Derwisch"
    MsgBox(64,"Info",$select)
    Case "Elementarmagier"
    MsgBox(64,"Info",$select)
    Case "Krieger"
    MsgBox(64,"Info",$select)
    Case "Mesmer"
    MsgBox(64,"Info",$select)
    Case "Mönch"
    MsgBox(64,"Info",$select)
    Case "Nekromant"
    MsgBox(64,"Info",$select)
    Case "Paragon"
    MsgBox(64,"Info",$select)
    Case "Ritualist"
    MsgBox(64,"Info",$select)
    Case "Waldläufer"
    MsgBox(64,"Info",$select)
    EndSwitch
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Classic Games

    • McPoldy
    • 17. Februar 2008 um 09:10

    Auf dem C64 fand ich Gina Sisters und Oil Imperium gut :)

  • *.lnk Datei ausführen

    • McPoldy
    • 16. Februar 2008 um 18:32
    FileGetShortcut
    Zitat

    FileGetShortcut

    Retrieves details about a shortcut.

    FileGetShortcut ( "lnk" )


    Parameters
    lnk Full path and file name of the shortcut.


    Return Value
    Success: Returns an array that contains the shortcut information. See Remarks.
    Failure: Sets @error to 1 if the shortcut could not be accessed.


    Remarks
    The array returned from this function is a single dimension array containing the following elements:
    $array[0] = Shortcut target path
    $array[1] = Working directory
    $array[2] = Arguments
    $array[3] = Description
    $array[4] = Icon filename
    $array[5] = Icon index
    $array[6] = The shortcut state (@SW_SHOWNORMAL, @SW_SHOWMINNOACTIVE, @SW_SHOWMAXIMIZED)

    Alles anzeigen

    Wie du siehst steht in $detail[0] der Pfad der zu der Verknüpfung gehört, daher sollte das Skript wohl so laufen :)

  • Desktop Icons speichern/restoren mit zwei ausführbaren scripten ohne GUI

    • McPoldy
    • 15. Februar 2008 um 21:42

    So habe jetzt mal was zusammen gebastelt und lege es in Skripte ab ( Link zum Skript )

  • Desktop Icons wiederherstellen

    • McPoldy
    • 15. Februar 2008 um 21:41

    Nabend, im Hilfebereich hatten wir heute die Frage wie man es hin bekommt das man die Icon Positionen speichern kann und die Icons an die Usprungspositionen zurück bringen kann. Nützlich ist das zum Beispiel wenn man ein Spiel hat, was die Bildschirmauflösung ändert (z. B. von 1280x1024 auf 800x600) und wenn man mit dem Spiel fertig ist alle mühevoll sortierten Icons auf dem Desktop durcheinander sind.

    Zum Skript selber, ich habe es jetzt mal so gebastelt:
    1. das die Positionen in einer INI Datei abgelegt werden
    2. das wenn eine Verknüpfung gelöscht wird, diese aber zuvor in der INI gespeichert wurde übergangen wird
    3. das man das Skript über zwei Parameter bedient (-save und -restore)

    Spoiler anzeigen
    [autoit]


    ;#################################################################################################
    ;
    ; Titel: Restore-IconPos-Desktop
    ; Datum: 15. Feb. 2008
    ; Version: 1.0
    ;
    ; Anmerkungen:
    ;
    ; - Die Position der Icons und der Titel wird in einer INI Datei gespeichert
    ; - Das Script wird über Parameter aufgerufen:
    ; -save = Speichert die Positionen
    ; -restore = Plaziert die Icons wieder da wo sie waren
    ;
    ;#################################################################################################

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

    ;#################################################################################################
    ; Einfügen der Include Dateien
    ;#################################################################################################
    #include <Constants.au3>
    #Include <GuiListView.au3>
    #include <File.au3>
    #include <Array.au3>

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

    ;#################################################################################################
    ; Optionen setzen
    ;#################################################################################################
    #NoTrayIcon ;Kein TrayIcon anzeigen
    Opt("MustDeclareVars", 1) ;Variablen müssen deklariert werden

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

    ;#################################################################################################
    ; Variablen deklarieren
    ;#################################################################################################
    Local $handle ;Handle für den Desktop
    Local $anzIcons ;Anzahl der Icons auf dem Desktop
    Local $arrIcons[1] ;Array für Restore
    Local $arrayPos ;Position im Array
    Local $txt ;Für das zwischenspeichern von Texten
    Local $int ;Als Zähler Variable
    Local $icon ;Name des Icon
    Local $posX ;X Position
    Local $posY ;y Position
    Local $Mode = "Help" ;In welchem Modus das Script gestartet wurde
    Local $iniFile = @ScriptDir & "\icons.ini" ;Pfad zu der Ini-Datei

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

    ;#################################################################################################
    ; Programm Einstigspunkt (POE)
    ;#################################################################################################
    If $CmdLine[0] > 0 Then
    $Mode = $CmdLine[1]
    _CheckIniExsit()
    Switch $CmdLine[1]
    Case "-save"
    ToolTip("Positionen der Icons werden gespeichert!",0,0,"Info")
    Sleep(1000)
    _SavePos()
    Case "-restore"
    ToolTip("Icons werden wieder hergestellt!",0,0,"Info")
    Sleep(1000)
    _RestorePos()
    Case Else
    _ShowHelp()
    EndSwitch
    Else
    _ShowHelp()
    EndIf

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

    Exit 0 ;Programm wird verlassen

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

    ;#################################################################################################
    ; _CheckIniExsit
    ; Diese Funktion prüft ob die INI Datei vohanden ist, falls Nein, wird eine leere Datei
    ; erstellt. Ist eine vorhanden, wird gelöscht und eine neue erstellt, aber nur bei -save
    ;#################################################################################################
    Func _CheckIniExsit()
    IF Not FileExists($iniFile) Then
    _FileCreate($iniFile)
    If @error Then
    MsgBox(48,"Fehler","INI-Datei konnte nicht erstellt werden.")
    Exit 1
    EndIf
    ElseIf $Mode = "-save" Then
    If FileDelete($iniFile) = 0 Then
    MsgBox(48,"Fehler","INI-Datei konnte nicht gelöscht werden.")
    Exit 1
    EndIf
    EndIf
    EndFunc

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

    ;#################################################################################################
    ; _ShowHelp
    ; Wenn das Script ohne Parameter gestartet wird, wird diese Hilfe angezeigt, oder wenn ein
    ; falscher Parameter übergeben wurde.
    ;#################################################################################################
    Func _ShowHelp()
    $txt = "Parameter:" & @CRLF
    $txt &= "-save = Speichert die Positionen" & @CRLF
    $txt &= "-restore = Plaziert die Icons wieder da wo sie waren"
    MsgBox(64,"Hilfe - Restore-IconPos-Desktop", $txt)
    Exit 0
    EndFunc

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

    ;#################################################################################################
    ; _SavePos
    ; Speichern der Icon Positionen in der INI Datei
    ;#################################################################################################
    Func _SavePos()
    $handle = ControlGetHandle("Program Manager", "", "SysListView321")
    $anzIcons = _GUICtrlListView_GetItemCount ($handle) - 1
    IniWrite($iniFile,"Global","Anzahl",$anzIcons)
    For $int = 0 To $anzIcons
    IniWrite($iniFile,"IconPos" & $int,"Icon",_GUICtrlListView_GetItemText($handle,$int))
    IniWrite($iniFile,"IconPos" & $int,"X-Pos",_GUICtrlListView_GetItemPositionX ($handle,$int))
    IniWrite($iniFile,"IconPos" & $int,"Y-Pos",_GUICtrlListView_GetItemPositionY ($handle,$int))
    Next
    EndFunc

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

    ;#################################################################################################
    ; _RestorePos
    ; Speichern der Icon Positionen in der INI Datei
    ;#################################################################################################
    Func _RestorePos()
    $anzIcons = IniRead($iniFile,"Global","Anzahl",-1)
    If $anzIcons = -1 Then
    MsgBox(48,"Fehler","INI-Datei ist leer.")
    Exit 1
    Else
    $handle = ControlGetHandle("Program Manager", "", "SysListView321")
    ReDim $arrIcons[_GUICtrlListView_GetItemCount ($handle)]
    For $int = 0 To UBound($arrIcons) - 1
    $arrIcons[$int] = _GUICtrlListView_GetItemText($handle,$int)
    Next
    For $int = 0 To $anzIcons
    $icon = IniRead($iniFile,"IconPos" & $int,"Icon",-1)
    $posX = IniRead($iniFile,"IconPos" & $int,"X-Pos",-1)
    $posY = IniRead($iniFile,"IconPos" & $int,"Y-Pos",-1)
    If $icon = -1 Or $posX = -1 Or $posY = -1 Then ContinueLoop
    $arrayPos = _ArraySearch($arrIcons,$icon,0,0,1,False)
    If $arrayPos = -1 Then ContinueLoop
    _GUICtrlListView_SetItemPosition($handle,$arrayPos,$posX,$posY)
    Next
    EndIf
    EndFunc

    [/autoit]
  • Outlook Regel mit AutoIT erstellen

    • McPoldy
    • 15. Februar 2008 um 14:41

    Och der Link von GtaSpider ist schon gut und es ist eigenlich nur ein bissel Umbau nötig (von VBA -> AutoIT) aber!!!! in Office 2003 kann man damit nichts anfangen, is für Office 2007 :)

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™