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

Beiträge von Kanashius

  • GUI Programmierung...

    • Kanashius
    • 24. Mai 2014 um 12:29

    Ich baue die Oberfläche meistens schon gleich zu begin ein, damit ich dieses Problemchen von dir nicht habe :D außerdem arbeite ich immer mit Guictrlsetoneventmode() und den guiregistermsg() (notifity und wm_command,etc.) damit kommt man auch nicht so schnell in die Gefahr, dass irgendwelche Abläufe alles blockieren :rolleyes:

  • GUI Programmierung...

    • Kanashius
    • 24. Mai 2014 um 11:07

    An sich kenne ich das Problem was du beschreibst nicht ganz so gut :D
    Ich benutze für das Grundgerüst meistens den Koda Designer. Mein Problem ist nur, dass ich manchmal sachen hinzufüge und dann alle anderen Control-Positionen bzw. größen anpassen muss.
    Manchmal wird das dann ein wenig viel und dauert tatsächlich recht lange.
    Ich fands ganz cool, wenn man nen Bereich erstellen würde, in dem praktisch wie bei visual studio ne xml erstellt wird, welche das Fenster repräsentiert, wodurch man das Fenster dann immerwieder bearbeiten kann. Das fänd ich noch recht nützlich. Immer mit den Koordinaten zu arbeiten... starten, ne, 5 pixel weiter nach oben... nochmal starten, hmm. da fehlen noch 2 pixel,........ nervt ein wenig ;)

  • EPUB/E-Book Verwaltung und Reader

    • Kanashius
    • 23. Mai 2014 um 23:05

    Das hinzufügen eines Readers werte ich jetzt mal als größere Änderung und veröffentliche somit Version 2 der Epub-Verwaltung mit eigenem Epub-Reader :)

  • TTS (Text-To-Speech) UDF

    • Kanashius
    • 23. Mai 2014 um 16:55

    So. Jetzt kann man angeben, ob die Namen als Array zurückgegeben werden sollen.Ich hatte es erst als String mit "|", da ich den String dann direkt in eine Combobox packen konnte, wo ich dann bei Guictrlsetonevent() den Output/die Stimme geändert habe.

    Das mit Speach und Speech ist echt peinlich. Grad bei meiner ersten UDF :S ;( . Habs mal schnell geändert ;)

  • TTS (Text-To-Speech) UDF

    • Kanashius
    • 23. Mai 2014 um 16:44

    bobekos:
    Es Funktioniert alles. Du solltest nur nicht stoppen, sobald du gestartet hast. In <1ms kann man nicht wirklich viel lesen :D
    So könnte man es lösen:

    Spoiler anzeigen
    [autoit]

    #include <TTS UDF.au3>

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

    $object = _SpeachObject_Create()

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

    _SpeachObject_SetOutput($object,"Lautsprecher (High Definition Audio-Gerät)")
    _SpeachObject_Say($object,"Hallooooooooooooooooooooooooooo")

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

    While Not _SpeachObject_isReady($object)
    sleep(100)
    WEnd

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

    _SpeachObject_Stop($object)

    [/autoit]

    Beim TTS gibt es mehrere Modes. Ich benutze den Modus, dass das Script weiterläuft. Deshalb muss abgefragt werden, wann er fertig ist. (ansonsten "hängt" dein script, bis er fertig gelesen hat.)

    PainTain:
    Hast recht. War gestern abend nicht so auf der Höhe :D
    ich werds ändern und dabei auch gleich das mit dem Array hinzufügen ;)

    @Raupi:
    Es muss keine Stimme oder kein Audioausgang gewählt werden. Es wird der als Standard eingestellte verwendet. Nur wenn man die Stimme oder den Audioausgang ändern möchte muss man die Funktionen benutzen :)

  • TTS (Text-To-Speech) UDF

    • Kanashius
    • 23. Mai 2014 um 00:04

    Im lauf eines meiner Projekte brauchte ich TTS, weshalb diese kleine UDF entstanden ist.
    Ich hoffe, jemand kann sie gebrauchen :)
    Viel Spaß damit.Da das meine erste UDF ist freue ich mich schon auf Verbesserungsvorschläge ^^


    Version 1.01

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.10.2
    Author: Kanashius
    Rights: Open Source UDF
    Script Function:
    UDF zum wiedergeben von Text mittels Text-To-Speech
    #ce ----------------------------------------------------------------------------
    #include <WinAPI.au3>

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

    ; #CURRENT# =====================================================================================================================
    ; _SpeechObject_Create
    ; _SpeechObject_Say
    ; _SpeechObject_setRate
    ; _SpeechObject_SetVolume
    ; _SpeechObject_SetVoice
    ; _SpeechObject_SetOutput
    ; _SpeechObject_Pause
    ; _SpeechObject_Resume
    ; _SpeechObject_Stop
    ; _SpeechObject_isReady
    ; _SpeechObject_getOutputsName
    ; _SpeechObject_getVoicesName
    ; ===============================================================================================================================

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_Create()
    ; Description: Create TTS-Object
    ; Parameter(s): none.
    ; Requirement(s): none.
    ; Return Value(s): Returns an Object
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_Create()
    $oSpeech=ObjCreate('SAPI.SpVoice')
    if @error then
    return -1
    endif
    $oSpeech.Rate = 1
    $oSpeech.Volume = 100
    return $oSpeech
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_Say()
    ; Description: Read a text.
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $sText - String to read
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_Say($oSpeech,$sText)
    _SpeechObject_Stop($oSpeech)
    $oSpeech.Speak($sText,1)
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_setRate()
    ; Description: Set Rate of an Speech-Object (reading-speed)
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $iRate - Int Between -10 and 10
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_SetRate($oSpeech,$iRate)
    $oSpeech.Rate=$iRate
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_SetVolume()
    ; Description: Set the Volume of the Speech-Object
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $iVolume - int between 0 and 100
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_SetVolume($oSpeech,$iVolume)
    $oSpeech.Volume=$iVolume
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_SetVoice()
    ; Description: Set the voice of the Speech-Object.
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $sName - Name (String) of an Voice as returned by _SpeechObject_getVoicesName()
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_SetVoice($oSpeech,$sName)
    Dim $SOTokens = $oSpeech.GetVoices('', '')
    For $Token In $SOTokens
    if $Token.GetDescription=$sName then
    $oSpeech.Voice=$Token
    endif
    Next
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_SetOutput()
    ; Description: Set the Output of the Speech-Object.
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $sName - Name (String) of an Outputdevice as returned by _SpeechObject_getOutputsName()
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_SetOutput($oSpeech,$sName)
    Dim $SOTokens = $oSpeech.GetAudioOutputs('','')
    For $Token In $SOTokens
    if $Token.GetDescription=$sName then
    $oSpeech.AudioOutput=$Token
    endif
    Next
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_Pause()
    ; Description: Pauses the Speech-Object while reading.
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_Pause($oSpeech)
    $oSpeech.Pause()
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_Resume()
    ; Description: Resumes the Speech-Object when it is paused.
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_Resume($oSpeech)
    $oSpeech.Resume()
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_Stop()
    ; Description: Stops an Speech-Obekt while reading
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; Requirement(s): none.
    ; Return Value(s): none.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_Stop($oSpeech)
    $Output=$oSpeech.AudioOutput
    $Voice=$oSpeech.Voice
    $Rate=$oSpeech.Rate
    $Volume=$oSpeech.Volume
    $oSpeech = ObjCreate("SAPI.SpVoice")
    $oSpeech.AudioOutput=$oSpeech
    $oSpeech.Voice=$oSpeech
    $oSpeech.Rate = $Rate
    $oSpeech.Volume = $Volume
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_isReady()
    ; Description: Check if the Speech-Object is ready.
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; Requirement(s): none.
    ; Return Value(s): true - if Speech-Object is ready
    ; false - if Speech-Object is reading
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_isReady($oSpeech)
    if _WinAPI_WaitForSingleObject($oSpeech.SpeakCompleteEvent,0)<>258 then
    return true
    endif
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_getOutputsName()
    ; Description: Return the Names of all avaible AudioOutput-Devices
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $bAsArray - true if names have to be returned as an Array
    ; Requirement(s): none.
    ; Return Value(s): String where the Devicenames are seperated with a "|"
    ; or Array with Names.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_getOutputsName($oSpeech,$bAsArray=false)
    Dim $SOTokens = $oSpeech.GetAudioOutputs('','')
    $sString=""
    For $Token In $SOTokens
    $sString&="|"&$Token.GetDescription
    Next
    $sString=StringTrimLeft($sString,1)
    if $bAsArray then
    return StringSplit($sString,"|",2)
    else
    return $sString
    endif
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _SpeechObject_getVoicesName()
    ; Description: Return the Names of all avaible Voices
    ; Parameter(s): $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
    ; $bAsArray - true if names have to be returned as an Array
    ; Requirement(s): none.
    ; Return Value(s): String where the Voicenames are seperated with a "|"
    ; or Array with Names.
    ; Author(s): Kanashius
    ;
    ;===============================================================================
    Func _SpeechObject_getVoicesName($oSpeech,$bAsArray=false)
    Dim $SOTokens = $oSpeech.GetVoices('', '')
    $sString=""
    For $Token In $SOTokens
    $sString&="|"&$Token.GetDescription
    Next
    $sString=StringTrimLeft($sString,1)
    if $bAsArray then
    return StringSplit($sString,"|",2)
    else
    return $sString
    endif
    EndFunc

    [/autoit]

    Dateien

    TTS UDF.au3 8,97 kB – 515 Downloads
  • XML Post. Wie?

    • Kanashius
    • 22. Mai 2014 um 17:24

    Wo dein Problem selbst ist weiß ich nicht, ich würde aber mal am Pfad ansetzen. Auf jeden fall solltest du, wenn du mit
    fileopen() arbeitest auch fileclose() nutzen (ansonsten einfach in fileread() den pfad als parameter übergeben)
    Deine @Error-abfrage bezieht sich denke ich auf die Verbindung mit TCP. Es wird aber der Error der letzten Funktion abgefragt. In diesem Fall der von fileread(). Du musst @Error direkt nach der Funktion benutzen, oder aber in eine Variable zwischenspeichern.

  • Navigieren über ID (IE-Objekt)

    • Kanashius
    • 22. Mai 2014 um 14:51

    Ich hab das ganze jetzt anders gelöst (über Buttons zum navigieren). Daher setz ich das Präfix jetzt einfach mal auf gelöst :)

  • Datum mit anderem Datum vergleichen

    • Kanashius
    • 22. Mai 2014 um 10:50

    Ich hab mal ne kleine Funktion geschrieben. Probier sie einfach mal aus. Die FUnktion gibt jeweils das neuere Datum wieder. Sind beide Daten gleich gibt sie den String "Die Daten sind gleich" aus.

    Ich hoffe, ich konnte dir helfen!

    Code:

    Spoiler anzeigen
    [autoit]

    msgbox(48,"",_newestData("01.01.2014 / 10:00:00","01.01.2014 / 10:00:00"))

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

    Func _newestData($data1,$data2)
    $data1=stringreplace($data1," ","")
    $data1Ar=stringsplit($data1,"/")
    $data2=stringreplace($data2," ","")
    $data2Ar=stringsplit($data2,"/")
    $date1Ar=stringsplit( $data1Ar[1] ,".")
    $time1Ar=stringsplit( $data1Ar[2] ,":")
    $date2Ar=stringsplit( $data2Ar[1] ,".")
    $time2Ar=stringsplit( $data2Ar[2] ,":")
    if $date1Ar[3]<$date2Ar[3] then
    return $data2
    elseif $date1Ar[3]>$date2Ar[3] then
    return $data1
    else
    if $date1Ar[2]<$date2Ar[2] then
    return $data2
    elseif $date1Ar[2]>$date2Ar[2] then
    return $data1
    else
    if $date1Ar[1]<$date2Ar[1] then
    return $data2
    elseif $date1Ar[1]>$date2Ar[1] then
    return $data1
    else
    if $time1Ar[1]<$time2Ar[1] then
    return $data2
    elseif $time1Ar[1]>$time2Ar[1] then
    return $data1
    else
    if $time1Ar[2]<$time2Ar[2] then
    return $data2
    elseif $time1Ar[2]>$time2Ar[2] then
    return $data1
    else
    if $time1Ar[3]<$time2Ar[3] then
    return $data2
    elseif $time1Ar[3]>$time2Ar[3] then
    return $data1
    else
    return "Die Daten sind gleich"
    endif
    endif
    endif
    endif
    endif
    endif
    EndFunc

    [/autoit]
  • Navigieren über ID (IE-Objekt)

    • Kanashius
    • 21. Mai 2014 um 22:57

    Hab den Plan jetzt aufgegeben und mach es mit den einzelnen Dateien, die ich einfach aufrufe. Jetzt versuche ich es so zu machen, dass automatisch, wenn das untere Ende der Seite erreicht wird die nächste Datei geöffnet wird. Das funktoniert auch. Das Problem ist nur, dass ich nicht, wenn ich am oberen Rand bin die Seite davor nutzen kann. Ich hab das versucht, indem ich die Scrollposition benutze. Ist die Scrollbar am Ende kommt die nächste Seite, ist sie am Anfang, die vorherige. Dazu Scrolle ich beim Aufruf der Seite 1px nach unten. Leider wechselt er dennoch zur Vorherigen seite. Die aufgerufene Seite wird nur ganz kurz angezeigt.
    Code:

    Spoiler anzeigen
    [autoit]

    while 1
    GUICtrlSetData($ButtonNext,$o_doc.body.scrollTop)
    if $o_doc.body.scrollTop=($o_doc.body.scrollHeight-$o_doc.body.clientHeight) then
    setFile($pos+1)
    $pos+=1
    elseif $o_doc.body.scrollTop=0 then
    setFile($pos-1)
    $pos-=1
    endif
    sleep(100)
    WEnd
    Func setFile($nr=-1)
    if $nr>-1 and $nr<UBound($spinesar)-1 then
    $file=_ArraySearch($manifestsar,$spinesar[$nr],0,0,0,0,1,0)
    local $drive,$dir,$name,$ext
    _PathSplit ($GlobalReadPath&""&$manifestsar[$file][1], $drive,$dir,$name,$ext)
    ;msgbox(48,"",$drive&$dir&$name&$ext)
    if $ext<>".html" then
    if $ext=".xhtml" then
    $path=$drive&$dir&$name&".html"
    $path=StringReplace($path,$GlobalReadPath&"","")
    $manifestsar[$file][1]=$path
    FileMove($drive&$dir&$name&$ext,$drive&$dir&$name&".html")
    _IENavigate($IE,"file:///" &$GlobalReadPath&""&$manifestsar[$file][1])
    else
    $fileData=FileRead($GlobalReadPath&""&$manifestsar[$file][1])
    $ar=stringsplit($manifestsar[$idx][1],"")
    $pfad=$ar[UBound($ar)-1]
    $fileData=StringRegExpReplace($fileData,"<body(.*?)>","<body>",1)
    $fileData=StringRegExpReplace($fileData,"<head(.*?)>","<head>",1)
    $betw=_StringBetween($fileData,"<body>","</body>")
    _IEBodyWriteHTML($IE,$betw[0])
    endif
    else
    _IENavigate($IE,"file:///" &$GlobalReadPath&""&$manifestsar[$file][1])
    endif
    $IE.document.parentWindow.scroll(0, 1)
    endif
    EndFunc

    [/autoit]


    Jetzt stellt sich mir die Frage, woran das liegt, bzw. ob man das auch besser lösen kann.Ich hoffe, es hat jemand eine Idee :)

  • Navigieren über ID (IE-Objekt)

    • Kanashius
    • 21. Mai 2014 um 12:36

    Ich lade mehrere HTML-Dateien und nehme die BODY-Bereiche davon. Diese packe ich in eine Variable und schreibe den Inhalt in das IE-Objekt. (head und body,... Grundgerüst wird erzeugt).
    Jede Datei wird von einem DIV umgeben und die Divs bekommen eine durchnummerierte id.
    Beispielhafter Aufbau:

    Spoiler anzeigen


    <html>
    <head>
    ...........
    </head>
    <body>
    <div id="0">Datei 1</div>
    <div id="1">Datei 2</div>
    <div id="2">Datei 3</div>
    <div id="3">Datei 4</div>
    ...........
    </body>
    </html>


    Dabei ist der Inhalt der Divs recht groß.
    Daher will ich links von dem IE-Objekt eine ListBox erzeugen, wo die einzelnen Dateien angeklickt werden können.
    Dann will ich damit zu dem jeweiligen Div "scrollen".
    (Im Explorer geht das ja über die ID (<a href="#id">...</a>)

  • Navigieren über ID (IE-Objekt)

    • Kanashius
    • 20. Mai 2014 um 22:34

    Ich möchte fragen, wie ich zu einer bestimmten div-id in einem IE-Objekt navigieren kann.
    Ich navigiere erst mit

    [autoit]

    _IENavigate($IE, 'about:blank')

    [/autoit]


    und schreibe dann den Inhalt mehrerer HTML-Dateien mit

    [autoit]

    _IEDocWriteHTML($IE,$data)

    [/autoit]


    in das Objekt. soweit klappt das auch alles. Nun muss ich aber in einzelne Divs navigieren.
    Sie sind alle durchnummeriert und die Nummer steht in der ID.
    Über die Nummer versuche ich nun zum Div mit der ID zu navigieren.

    [autoit]

    _IENavigate($IE,"#10",0)

    [/autoit]


    Dies funktioniert jedoch nicht.
    Wenn ich vorher zu einer der Dateien navigiere öffnet sich erst die Seite, wird mit dem HTML Überschrieben, danach funktioniert das navigieren jedoch auch nicht.

    [autoit]

    _IENavigate($IE,"file:///" &$GlobalReadPath&""&$ges[5][2],0)

    [/autoit]


    Navigiere ich in den Ordner öffnet sich der Ordner, das bringt mich aber auch nicht weiter.

    Ich hoffe, einer von euch hat eine Idee, wie ich das umsetzen kann.

  • .net dll in Autoit verwenden

    • Kanashius
    • 18. Mai 2014 um 18:51

    So. Hab jetzt versucht, die erste Möglichkeit umzusetzen, scheitere jedoch daran, dass ich mehrere .cs dateien habe, sodass ich nicht weiß, welche ich verwenden muss.
    Ein weiteres problem wäre, dass ich mich noch nicht mit DLLCall() auseinandergesetzt habe. Aber da kann ich mich dann hoffentlich durchschlagen :)

    Könnte mir jemand helfen, die Bibliotheksdatei zu erstellen? Eventuell auch, wie sie verwendet wird?
    (Im Anhang befinden sich alle Dateien, die dafür benötigt werden)

    Dateien

    AutoIT-C# dll.7z 391,15 kB – 422 Downloads
  • .net dll in Autoit verwenden

    • Kanashius
    • 18. Mai 2014 um 17:50

    Upppss... Hab da was durcheinandergeschmissen :rolleyes:
    James: Danke, werd mich gleich mal damit auseinandersetzen :)

  • .net dll in Autoit verwenden

    • Kanashius
    • 18. Mai 2014 um 14:53

    Ich möchte gerne fragen, ob mir jemand erklären kann, wie ich eine Java Dll verwende, falls es überhaupt geht, da Java ja objektorientiert ist.
    Die Dll ist von der Seite:
    http://epubreader.codeplex.com/
    (opensource)

    Ich möchte dabei gerne die Dll verwenden, um einen eigenen E-Pub Reader zu erstellen.
    Ich hab mich schon mit dem Aufbau von E-Pubs auseinandergesetzt. Einzelne E-Pubs bekomme ich auch schon geöffnet, allerdings nur ohne Menü, ...
    Der Aufbau der Epubs ist allerdings recht variable, weshalb meine Funktion nur bedingt funktioniert. Deshalb wollte ich auf die Dll zurückgreifen.

    Wie ich es bisher gemacht habe (vielleicht hat jemand eine Idee, wie es besser ginge (RegExp)):

    Spoiler anzeigen
    [autoit]

    #include <array.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>
    #include <String.au3>
    #include <IE.au3>
    #include "_XMLDomWrapper.au3"
    Opt("GUIOnEventMode", 1)

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

    global $ReadGui,$ReadObj,$IE,$GlobalReadPath,$ReadObj2,$IE2
    Reader()
    _setData(FileOpenDialog("Wähle Epub",@DesktopDir,"epub (*.epub)",1,"",$ReadGui))
    GUISetOnEvent($GUI_EVENT_CLOSE, "MainGui_Close")

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

    while 1
    sleep(100)
    WEnd

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

    Func Reader()
    $ReadGui = GUICreate("Reader", 800, 600-25, 0, 0,$WS_CAPTION +$WS_SYSMENU+ $WS_SIZEBOX +$WS_MINIMIZEBOX+$WS_MAXIMIZEBOX)
    $IE = _IECreateEmbedded ()
    $IE2 = _IECreateEmbedded ()
    $ReadObj = GUICtrlCreateObj($IE,90, 10, 700, 560)
    GUICtrlSetResizing(-1,1)
    _IENavigate($IE, 'about:blank')
    $ReadObj2 = GUICtrlCreateObj($IE2,90, 10, 700, 560)
    GUICtrlSetResizing(-1,1)
    GUICtrlSetState($ReadObj2,@SW_HIDE)
    _IENavigate($IE2, 'about:blank')
    GUISetState(@SW_SHOW)
    EndFunc

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

    Func _setData($pfad)
    local $spinesar[1],$manifestsar[1][3]
    _gibXmlData($manifestsar,$spinesar,$pfad,@ScriptDir&"\tempRead")
    ;_ArrayDisplay($spinesar)
    ;_ArrayDisplay($manifestsar)
    $toc=_ArraySearch($manifestsar,"toc.ncx",0,0,0,0,1,1)
    if $toc<>-1 then
    ;other captures
    $TocFile=FileRead($GlobalReadPath&""&$manifestsar[$toc][1])
    ClipPut($TocFile)
    $navsTmp=_StringBetween($TocFile,"<navPoint","</navPoint>")
    $pagesTmp=_StringBetween($TocFile,"<pageTarget","</pageTarget>")
    local $navs[UBound($navsTmp)][4]
    local $pages[UBound($pagesTmp)][4]
    for $i=0 to UBound($navsTmp)-1 step 1
    $navs[$i][0]=_StringBetween($navsTmp[$i],'playOrder="','"')[0]
    $navs[$i][1]=_StringBetween($navsTmp[$i],'<text>','</text>')[0]
    $tmp=_StringBetween($navsTmp[$i],'src="','"')[0]
    if StringInStr($tmp,"#") then
    $ar=StringSplit($tmp,"#")
    $navs[$i][2]=$ar[1]
    $navs[$i][3]="#"&$ar[2]
    else
    $navs[$i][2]=$tmp
    $navs[$i][3]=""
    endif
    next
    for $i=0 to UBound($pagesTmp)-1 step 1
    $pages[$i][0]=_StringBetween($pagesTmp[$i],'playOrder="','"')[0]
    $pages[$i][1]=_StringBetween($pagesTmp[$i],'<content src="','"/>')[0]
    $tmp=$pages[$i][1]
    if StringInStr($tmp,"#") then
    $ar=StringSplit($tmp,"#")
    $pages[$i][2]=$ar[1]
    $pages[$i][3]=$ar[2]
    else
    $pages[$i][2]=$tmp
    $pages[$i][3]=""
    endif
    next
    else
    ;my captures
    endif
    _ArrayDisplay($navsTmp)
    _ArrayDisplay($navs)
    _ArrayDisplay($pagesTmp)
    _ArrayDisplay($pages)
    ;local $idxList[UBound($spinesar)]
    $data=""
    $head=""
    for $i=0 to UBound($spinesar)-1 step 1
    ;$idxList[$i]=_ArraySearch($manifestsar,$spinesar[$i],0,0,0,0,1,0)
    $idx=_ArraySearch($manifestsar,$spinesar[$i],0,0,0,0,1,0)
    $fileData=FileRead($GlobalReadPath&""&$manifestsar[$idx][1])
    $ar=stringsplit($manifestsar[$idx][1],"")
    $pfad=$ar[UBound($ar)-1]
    $betw=_StringBetween($fileData,"<body>","</body>")
    for $j=0 to ubound($betw)-1 step 1
    $data&=$betw[$j]
    next
    if $head="" then
    $ar=_StringBetween($fileData,"<head>","</head>")
    if $ar<>0 then
    $head=$ar[0]
    endif
    endif
    if $i<>UBound($spinesar)-1 then
    ;$data&='<div style="display:none">'&$pfad&'</div>'
    $data&='<div style="display:none">'&$pfad&'</div>'
    endif
    next
    $data="<html><head>"&$head&"</head><body>"&$data&"</body></html>"
    ClipPut($data)
    ;$data=StringLeft($data,1000)

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

    ;_IENavigate($IE,"file:///" & $GlobalReadPath);_IENavigate($IE, @ScriptDir&"\Aakeson, Kim Fupz - Taeter wie wir\OEBPS\b9783423415538_000017.xhtml")
    ;msgbox(48,"",$GlobalReadPath&""&$manifestsar[9][1])
    ;msgbox(48,"",FileRead($GlobalReadPath&""&$manifestsar[9][1]))
    ;for $i=0 to UBound($manifestsar)-1 step 1
    ; $data&=FileRead($GlobalReadPath&""&$manifestsar[$i][1])
    ;next
    ;StringReplace($GlobalReadPath&""&$manifestsar[$toc][1],"","/")
    _IENavigate($IE,"file:///" &$GlobalReadPath&""&$manifestsar[$toc][1])
    ;_IEDocWriteHTML($IE,$data)
    EndFunc

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

    Func _gibXmlData(ByRef $manifestAr,ByRef $SpineAr,$path,$MainPath)
    _7ZipProgress(@ScriptDir&"\7zG.exe",$path, $MainPath, false)
    $path=$MainPath&"\META-INF\container.xml"
    $file=FileOpen($path)
    $content=FileRead($file)
    FileClose($file)
    $sc1=StringSplit($content,'<rootfile full-path="',1)
    if $sc1[0]<2 then
    return -1
    else
    $sc1=StringSplit($sc1[2],'"',1)
    $sc1[1]=StringReplace($sc1[1],"/","")
    ;global Path
    $splittedPath=StringSplit($MainPath&""&$sc1[1],"")
    for $i=1 to UBound($splittedPath)-3 step 1
    $GlobalReadPath&=$splittedPath[$i]&""
    next
    $GlobalReadPath&=$splittedPath[UBound($splittedPath)-2]
    ;global path end
    $fileData=FileRead($MainPath&""&$sc1[1])
    $fileManifestData=_StringBetween($fileData,"<manifest","</manifest")
    $fileManifestData=_StringBetween($fileManifestData[0],"<item",">")
    local $fileManifestDataArray[UBound($fileManifestData)][3]
    for $i=0 to UBound($fileManifestData)-1 step 1
    $fileManifestDataArray[$i][0]=_StringBetween($fileManifestData[$i],'id="','"')[0]
    $fileManifestDataArray[$i][1]=_StringBetween($fileManifestData[$i],'href="','"')[0]
    $fileManifestDataArray[$i][2]=_StringBetween($fileManifestData[$i],'media-type="','"')[0]
    next
    $fileSpineData=_StringBetween($fileData,"<spine","</spine")
    $fileSpineData=_StringBetween($fileSpineData[0],"<itemref",">")
    for $i=0 to UBound($fileSpineData)-1 step 1
    $fileSpineData[$i]=_StringBetween($fileSpineData[$i],'idref="','"')[0]
    next
    ReDim $manifestAr[UBound($fileManifestDataArray)][3]
    ReDim $SpineAr[UBound($fileSpineData)]
    for $i=0 to UBound($fileManifestDataArray)-1 step 1
    $manifestAr[$i][0]=$fileManifestDataArray[$i][0]
    $manifestAr[$i][1]=$fileManifestDataArray[$i][1]
    $manifestAr[$i][2]=$fileManifestDataArray[$i][2]
    next
    for $i=0 to UBound($fileSpineData)-1 step 1
    $SpineAr[$i]=$fileSpineData[$i]
    next
    endif
    EndFunc

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

    Func MainGui_Close()
    DirRemove (@ScriptDir&"\tempRead",1)
    exit
    EndFunc

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

    Func _7ZipProgress($s7ZipEXE, $sSource, $sDestination = @TempDir, $fPack = True, $sPackType = '7z', $iPackLv = 5, $sAdditionalCommands = '', $sFuncToCall = '', $iMinPercentage = 0, $iMaxPercentage = 100, $iUpdateRate = 50)
    Local $sCommand, $iSize, $hTimeBefore, $iPID, $aProcessStats, $iPercentage
    If Not FileExists($s7ZipEXE) Or Not FileExists($sSource) Or $sDestination = '' Then
    Return SetError(1, Default, 0)
    EndIf
    If $iPackLv < 1 Or $iPackLv > 9 Or Not StringRegExp($sPackType, '7z|zip|wim|tar') Then
    Return SetError(2, Default, 0)
    EndIf
    If $sAdditionalCommands <> '' Then
    $sAdditionalCommands = ' ' & $sAdditionalCommands
    EndIf
    If $fPack Then
    $sCommand = ' a "' & $sDestination & '" "' & $sSource & '" -t' & $sPackType & ' -mx=' & $iPackLv & $sAdditionalCommands
    Else
    $sCommand = ' x -o"' & $sDestination & '" "' & $sSource & '"' & $sAdditionalCommands
    EndIf
    If StringInStr(FileGetAttrib($sSource), 'D') Then
    $iSize = DirGetSize($sSource)
    Else
    $iSize = FileGetSize($sSource)
    EndIf
    $hTimeBefore = TimerInit()
    $iPID = Run($s7ZipEXE & ' ' & $sCommand, @TempDir, @SW_HIDE)
    While ProcessExists($iPID)
    $aProcessStats = ProcessGetStats($iPID, 1)
    If $aProcessStats = 0 Then
    SetError(3, Default, 0)
    EndIf
    Sleep($iUpdateRate)
    WEnd
    Return SetExtended(TimerDiff($hTimeBefore), $s7ZipEXE & ' ' & $sCommand)
    EndFunc

    [/autoit]

    Dateien

    eBdb.EpubReader.7z 11,47 kB – 355 Downloads
  • Textersetzer Script fertigstellen mit Gegenleistung

    • Kanashius
    • 15. Mai 2014 um 11:48

    BugFix
    Ich hatte das ganze aus nem anderen Programm von mir und da wurde die Zählervariable noch anderweitig benutzt. Deshalb global :).Was ich bei deiner Änderung nicht verstehe ist, wie der Überwachen soll, dass das Programm schon seit X (->30) Sekunden läuft. Du zählst ja, bevor das entpacken gestartet wird. An sich dient die Funktion dazu, das Entzippen nach 30 Sekunden abzubrechen. Hat den Hintergrund, dass der, wenn er beim Entpacken scheitert, ewig weiterläuft, da die 7zg.exe als Prozess bestehen bleibt. Dadurch würde das Programm dann ja auch nicht weiterlaufen. Deshalb wird der Prozess nach 30 Sekunden beendet, wenn er bis dahin noch nicht fertig ist. (ich hatte nur kleine Zip-Dateien, weshalb das meist nur 2-3 Sekunden dauerte. Eventuell kann man das ja mit der Größe der Zip-Datei verrechnen.)

    Die _7zipProgress() war nicht von mir. Hab nur vergessen, wo sie herkam :D.
    (War gestern nicht so extrem motiviert, nen neues entpacken zu schreiben :whistling: )

    Aber danke für die Hinweise :thumbup:

  • Textersetzer Script fertigstellen mit Gegenleistung

    • Kanashius
    • 15. Mai 2014 um 01:25

    Falls sich noch jemand damit beschäftigen möchte:
    Zum entpacken und packen einer Datei kann man folgendes verwenden:

    Spoiler anzeigen
    [autoit]

    global $UnZipTime=0

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

    Func Unzip($path,$tempPath=@TempDir)
    $UnZipTime=0
    AdlibRegister(observateZip(),1000)
    _7ZipProgress("7zG.exe", $path, $tempPath, false)
    AdlibUnRegister(observateZip())
    if @error then
    return @error
    EndIf
    if $UnZipTime=30 then
    return -1
    endif
    return 1
    EndFunc

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

    Func zip($path,$OutPath)
    $ar=StringSplit($OutPath,".")
    _7ZipProgress($s7ZipEXE, $path, $OutPath, True, $ar[UBound($ar)-1])
    return 1
    EndFunc

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

    Func observateZip()
    $UnZipTime+=1
    if $UnZipTime=30 then
    ProcessClose("7zG.exe")
    endif
    EndFunc

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

    Func _7ZipProgress($s7ZipEXE, $sSource, $sDestination = @TempDir, $fPack = True, $sPackType = '7z', $iPackLv = 5, $sAdditionalCommands = '', $sFuncToCall = '', $iMinPercentage = 0, $iMaxPercentage = 100, $iUpdateRate = 50)
    Local $sCommand, $iSize, $hTimeBefore, $iPID, $aProcessStats, $iPercentage
    If Not FileExists($s7ZipEXE) Or Not FileExists($sSource) Or $sDestination = '' Then
    Return SetError(1, Default, 0)
    EndIf
    If $iPackLv < 1 Or $iPackLv > 9 Or Not StringRegExp($sPackType, '7z|zip|wim|tar') Then
    Return SetError(2, Default, 0)
    EndIf
    If $sAdditionalCommands <> '' Then
    $sAdditionalCommands = ' ' & $sAdditionalCommands
    EndIf
    If $fPack Then
    $sCommand = ' a "' & $sDestination & '" "' & $sSource & '" -t' & $sPackType & ' -mx=' & $iPackLv & $sAdditionalCommands
    Else
    $sCommand = ' x -o"' & $sDestination & '" "' & $sSource & '"' & $sAdditionalCommands
    EndIf
    If StringInStr(FileGetAttrib($sSource), 'D') Then
    $iSize = DirGetSize($sSource)
    Else
    $iSize = FileGetSize($sSource)
    EndIf
    $hTimeBefore = TimerInit()
    $iPID = Run($s7ZipEXE & ' ' & $sCommand, @TempDir, @SW_HIDE)
    While ProcessExists($iPID)
    $aProcessStats = ProcessGetStats($iPID, 1)
    If $aProcessStats = 0 Then
    SetError(3, Default, 0)
    EndIf
    Sleep($iUpdateRate)
    WEnd
    Return SetExtended(TimerDiff($hTimeBefore), $s7ZipEXE & ' ' & $sCommand)
    EndFunc

    [/autoit]


    Die Fehlerbehebung müsste noch explizit eingearbeitet werden :)
    Die 7zG.exe muss im gleichen Verzeichnis wie das Programm sein.

    Dateien

    7zG.7z 134,76 kB – 529 Downloads
  • Benötige Hilfe Einweißung in Treeview

    • Kanashius
    • 15. Mai 2014 um 00:42

    Was das dauerhafte überschreiben der ini angeht wäre es ja vermutlich am besten, wenn du alles einträgst und dann mit

    [autoit]

    IniWrite()

    [/autoit]

    die Werte änderst.
    Wenn du eine unterschiedliche Anzahl an Einträgen hast würde ich einen Count-Eintrag mit der Anzahl der Einträge anlegen und dann hochzählen.
    Bsp: (eintrag steht für die Funktion der Einträge)

    Spoiler anzeigen


    eintrag=3
    eintrag1=irgendwas
    eintrag2=irgendwas
    eintrag3=irgendwas


    Dann kannst du bequem mit einer For-Schleife die Einträge auslesen.

    Nun zum ändern, wenn einzelne Einträge geändert werden. Dazu solltest du dich näher mit WM_Command und WM_Notify auseinandersetzen.
    In dem Spoiler hier findest du nen Beispiel einer WM_Command und WM_Notify Funktion. Die Variablen sind Handle zu den jeweiligen controls (im Namen steht, welche).
    Desweiteren findet sich noch eine Funktion, mit der Drag and Drop verarbeitet werden kann.

    Spoiler anzeigen
    [autoit]

    GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY')
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    GUISetOnEvent($GUI_EVENT_DROPPED,"_Event_DragAndDrop",$FTPGui)

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

    Func _Event_DragAndDrop()
    if @GUI_DragId=$FTPGui_ListView1 then
    if @GUI_DropId=$FTPGui_ListView2 then
    ;_FTP_FilePut
    $p1=getPathFromTreeView($FTPGui_ListTree1,_GUICtrlTreeView_GetSelection($FTPGui_ListTree1))
    $p2=_GUICtrlListView_GetItemText($FTPGui_ListView1,int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView1)))
    $localPath=$p1&""&$p2
    $p1=getFTPPathFromTreeView($FTPGui_ListTree2,_GUICtrlTreeView_GetSelection($FTPGui_ListTree2))
    ;$p2=_GUICtrlListView_GetItemText($FTPGui_ListView2,int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView2)))
    $remotePath=$p1&"/"&$p2
    if $remotePath="root" then
    $remotePath=StringReplace($remotePath,"root","/",1)
    endif
    $remotePath=StringReplace($remotePath,"root","",1)
    GUICtrlSetData($FTPGui_Label1,"Uploading "&$localPath&" to "&$remotePath)
    GUICtrlSetState($FTPGui_Button1,@SW_SHOW)
    _FTP_ProgressUpload($FTPhConn,$localPath,$remotePath,"show_Upload")
    GUICtrlSetState($FTPGui_Button1,@SW_HIDE)
    GUICtrlSetData($FTPGui_Label1,"Upload completed")
    endif
    elseif @GUI_DragId=$FTPGui_ListView2 then
    if @GUI_DropId=$FTPGui_ListView1 then
    msgbox(48,"","Zu LW1")
    endif
    endif
    EndFunc

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

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    If Not IsHWnd($FTPGui_Combo) Then $hWndCombo = GUICtrlGetHandle($FTPGui_Combo)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
    Case $FTPGui_Combo, GUICtrlGetHandle($FTPGui_Combo)
    Switch $iCode
    Case $CBN_SELCHANGE ; Sent when the user double-clicks a string in a list box
    _selChangeCombo()
    Case $WM_DROPFILES
    msgbox(48,"","Drop Combo")
    EndSwitch
    Case $FTPGui_ListView1
    Switch $iCode
    Case $WM_DROPFILES
    msgbox(48,"","Drop Combo LW1")
    EndSwitch
    Case $FTPGui_ListView2
    Switch $iCode
    Case $WM_DROPFILES
    msgbox(48,"","Drop Combo LW2")
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

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

    Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hChild, $hITEM, $tNMTREEVIEW = DllStructCreate($tagNMTREEVIEW, $ilParam)
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListTree1) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
    Switch DllStructGetData($tNMTREEVIEW, 'Action')
    Case $TVE_EXPAND
    $hITEM = DllStructGetData($tNMTREEVIEW, 'NewhItem')
    DirInTree("",$FTPGui_ListTree1,$hITEM,true,true)
    ;msgbox(48,"",$hITEM)
    EndSwitch
    Case $TVN_SELCHANGEDW
    $sel=_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1))
    if $sel<>0 then
    Content(getPathFromTreeView(GUICtrlGetHandle($FTPGui_ListTree1),$sel)&"",$FTPGui_ListView1)
    endif
    EndSwitch
    EndIf
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListView1) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $NM_DBLCLK
    $selIndex=int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView1))
    if $selIndex>0 and $selIndex<$FoldersCount+1 then
    $selText=_GUICtrlListView_GetItemText($FTPGui_ListView1,$selIndex,0)
    openTreePath($selText,$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)))
    DirInTree("C:",$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)),true,true)
    elseif $selIndex=0 then
    $path=getPathFromTreeView($FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)))
    $ar=StringSplit($path,"")
    $string=""
    for $i=1 to UBound($ar)-2 step 1
    $string&=$ar[$i]&""
    next
    openTreePath($string,$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)),true)
    DirInTree("C:",$FTPGui_ListTree1,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree1)),true,true)
    endif
    EndSwitch
    EndIf
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListTree2) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
    Switch DllStructGetData($tNMTREEVIEW, 'Action')
    Case $TVE_EXPAND
    $hITEM = DllStructGetData($tNMTREEVIEW, 'NewhItem')
    FTPDirInTree2("",$FTPGui_ListTree2,$hITEM,true,true)
    ;msgbox(48,"",$hITEM)
    EndSwitch
    Case $TVN_SELCHANGEDW
    $sel=_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2))
    if $sel<>0 then
    FTPContent(getFTPPathFromTreeView(GUICtrlGetHandle($FTPGui_ListTree2),$sel),$FTPGui_ListView2)
    endif
    EndSwitch
    EndIf
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = GUICtrlGetHandle($FTPGui_ListView2) Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $NM_DBLCLK
    $selIndex=int(_GUICtrlListView_GetSelectedIndices($FTPGui_ListView2))
    if $selIndex>0 and $selIndex<$FtpFoldersCount+1 then
    $selText=_GUICtrlListView_GetItemText($FTPGui_ListView2,$selIndex,0)
    openFTPTreePath($selText,$FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)))
    FTPDirInTree2("/",$FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)),true,true)
    elseif $selIndex=0 then
    $path=getFTPPathFromTreeView($FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)))
    $ar=StringSplit($path,"/")
    $string=""
    for $i=1 to UBound($ar)-2 step 1
    $string&=$ar[$i]&"/"
    next
    openFTPTreePath($string,$FTPGui_ListTree2,0,true)
    FTPDirInTree2("",$FTPGui_ListTree2,_GUICtrlTreeView_GetSelection(GUICtrlGetHandle($FTPGui_ListTree2)),true,true)
    endif
    EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_NOTIFY

    [/autoit]

    Ich denke, du wirst erstmal damit zu tun haben, das ganze durchzuarbeiten :). (ich hab nicht unbedingt den besten Programmierstil :D)
    (Das Script, aus dem ich den Quelltext habe ist für einen FTP-Clienten, an dem ich gerade arbeite. Deshalb ist bei den Variablen überall ein FTP drin :))

  • Tooltip verschieben

    • Kanashius
    • 15. Mai 2014 um 00:26

    Vielleicht schaust du dir dieses Script einmal an:

    Spoiler anzeigen
    [autoit]

    ; ===============================================================================
    ;~ This script gets the control under the mouse pointer (active or inactive)
    ;~ The information then can be used with in conjunction with control functions.
    ;~ Requires AutoIt v3.3.6.0 or later to run and to view apps maximized.
    ;~ Big thanks to SmOke_N and Valik their help in creating it.
    ; ===============================================================================
    #include <WinAPI.au3>
    #include <Array.au3>
    #include <WindowsConstants.au3>

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

    AutoItSetOption("MustDeclareVars", 1)
    AutoItSetOption("MouseCoordMode", 1)
    AdlibRegister("_Mouse_Control_GetInfoAdlib", 10)
    HotKeySet("^!c", "MyExit") ; Press Ctrl+Alt+c to stop the script
    ;~ #AutoIt3Wrapper_run_debug_mode=Y

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

    Global $pos1 = MouseGetPos()
    Global $pos2 = MouseGetPos() ; must be initialized
    Global $appHandle = 0

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

    While 1
    Sleep(0xFFFFFFF)
    WEnd

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

    ; ===============================================================================
    ;~ Retrieves the information of a Control located under the mouse and displayes it in a tool tip next to the mouse.
    ;~ Function uesd
    ;~ _Mouse_Control_GetInfo()
    ;~ GetDlgCtrlID
    ; ===============================================================================
    Func _Mouse_Control_GetInfoAdlib()
    $pos1 = MouseGetPos()
    If $pos1[0] <> $pos2[0] Or $pos1[1] <> $pos2[1] Then ; has the mouse moved?
    Local $a_info = _Mouse_Control_GetInfo()
    Local $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $a_info[0]) ; get the ID of the control
    If @error Then Return
    ToolTip("Handle = " & $a_info[0] & @CRLF & _
    "Class = " & $a_info[1] & @CRLF & _
    "ID = " & $aDLL[0] & @CRLF & _
    "Mouse X Pos = " & $a_info[2] & @CRLF & _
    "Mouse Y Pos = " & $a_info[3] & @CRLF & _
    "ClassNN = " & $a_info[4] & @CRLF & _ ; optional
    "Parent Hwd = " & _WinAPI_GetAncestor($appHandle, $GA_ROOT))
    $pos2 = MouseGetPos()
    EndIf
    EndFunc ;==>_Mouse_Control_GetInfoAdlib

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

    ; ===============================================================================
    ;~ Retrieves the information of a Control located under the mouse.
    ;~ Uses Windows functions WindowFromPoint and GetClassName to retrieve the information.
    ;~ Functions used
    ;~ _GetHoveredHwnd()
    ;~ _ControlGetClassnameNN()
    ;~ Returns
    ;~ [0] = Control Handle of the control
    ;~ [1] = The Class Name of the control
    ;~ [2] = Mouse X Pos (converted to Screen Coord)
    ;~ [3] = Mouse Y Pos (converted to Screen Coord)
    ;~ [4] = ClassNN
    ; ===============================================================================
    Func _Mouse_Control_GetInfo()
    Local $client_mpos = $pos1 ; gets client coords because of "MouseCoordMode" = 2
    Local $a_mpos
    ;~ Call to removed due to offset issue $a_mpos = _ClientToScreen($appHandle, $client_mpos[0], $client_mpos[1]) ; $a_mpos now screen coords
    $a_mpos = $client_mpos
    $appHandle = GetHoveredHwnd($client_mpos[0], $client_mpos[1]) ; Uses the mouse to do the equivalent of WinGetHandle()

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

    If @error Then Return SetError(1, 0, 0)
    Local $a_wfp = DllCall("user32.dll", "hwnd", "WindowFromPoint", "long", $a_mpos[0], "long", $a_mpos[1]) ; gets the control handle
    If @error Then Return SetError(2, 0, 0)

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

    Local $t_class = DllStructCreate("char[260]")
    DllCall("User32.dll", "int", "GetClassName", "hwnd", $a_wfp[0], "ptr", DllStructGetPtr($t_class), "int", 260)
    Local $a_ret[5] = [$a_wfp[0], DllStructGetData($t_class, 1), $a_mpos[0], $a_mpos[1], "none"]
    Local $sClassNN = _ControlGetClassnameNN($a_ret[0]) ; optional, will run faster without it
    $a_ret[4] = $sClassNN

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

    Return $a_ret
    EndFunc ;==>_Mouse_Control_GetInfo

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

    ; ===============================================================================
    ; Retrieves the Handle of GUI/Application the mouse is over.
    ; Similar to WinGetHandle except it used the current mouse position
    ; Taken from <a href='http://www.autoitscript.com/forum/index.php?showtopic=444962' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showtopic=444962</a>
    ; Changed to take params to allow only one set of coords to be used.
    ; Params
    ;~ $i_xpos - x position of the mouse - usually from MouseGetPos(0)
    ;~ $i_ypos - x position of the mouse - usually from MouseGetPos(1)
    ; ===============================================================================
    Func GetHoveredHwnd($i_xpos, $i_ypos)
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", $i_xpos, "long", $i_ypos)
    If IsArray($iRet) Then
    $appHandle = $iRet[0]
    Return HWnd($iRet[0])
    Else
    Return SetError(1, 0, 0)
    EndIf
    EndFunc ;==>GetHoveredHwnd

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

    ; ===============================================================================
    ;~ Gets the ClassNN of a control (Classname and Instance Count). This is checked with ControlGetHandle
    ;~ The instance is really a way to uniquely identify classes with the same name
    ;~ Big thanks to Valik for writing the function, taken from - <a href='http://www.autoitscript.com/forum/index.php?showtopic=97662' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showtopic=97662</a>
    ;~ Param
    ;~ $hControl - the control handle from which you want the ClassNN
    ;~ Returns
    ;~ the ClassNN of the given control

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

    ; ===============================================================================
    Func _ControlGetClassnameNN($hControl)
    If Not IsHWnd($hControl) Then Return SetError(1, 0, "")
    Local Const $hParent = _WinAPI_GetAncestor($appHandle, $GA_ROOT) ; get the Window handle, this is set in GetHoveredHwnd()
    If Not $hParent Then Return SetError(2, 0, "")

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

    Local Const $sList = WinGetClassList($hParent) ; list of every class in the Window
    Local $aList = StringSplit(StringTrimRight($sList, 1), @LF, 2)
    _ArraySort($aList) ; improves speed
    Local $nInstance, $sLastClass, $sComposite

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

    For $i = 0 To UBound($aList) - 1
    If $sLastClass <> $aList[$i] Then ; set up the first occurrence of a unique classname
    $sLastClass = $aList[$i]
    $nInstance = 1
    EndIf
    $sComposite = $sLastClass & $nInstance ;build the ClassNN for testing with ControlGetHandle. ClassNN = Class & ClassCount
    ;if ControlGetHandle(ClassNN) matches the given control return else look at the next instance of the classname
    If ControlGetHandle($hParent, "", $sComposite) = $hControl Then
    Return $sComposite
    EndIf
    $nInstance += 1 ; count the number of times the class name appears in the list
    Next
    Return SetError(3, 0, "")

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

    EndFunc ;==>_ControlGetClassnameNN

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

    ; ===============================================================================
    ;~ Functions not used anymore.
    ; ===============================================================================

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

    ; ===============================================================================
    ;~ Translates client coordinates into screen coordinates, [0] = x and [1] = y from the return array.
    ;~ Requires - AutoItSetOption("MouseCoordMode", 2)
    ;~ Params
    ;~ $h_wnd - Identifies the window whose client area is used for the conversion.
    ;~ $i_x - x pos of the client coord
    ;~ $i_y - Y pos of the client coord
    ;~ Returns
    ;~ Screen coordinates
    ; ===============================================================================
    Func _ClientToScreen($h_wnd, $i_x, $i_y)
    ;~ ConsoleWrite("Client here, " & $i_x & "," & $i_y & @ CRLF)
    Local $t_point = DllStructCreate("int;int")
    DllStructSetData($t_point, 1, $i_x)
    DllStructSetData($t_point, 2, $i_y)
    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $h_wnd, "ptr", DllStructGetPtr($t_point))
    Local $a_ret[2] = [DllStructGetData($t_point, 1), DllStructGetData($t_point, 2)]
    ;~ ConsoleWrite("Screen here, " & $a_ret[0] & "," & $a_ret[1] & @CRLF)
    Return $a_ret
    EndFunc ;==>_ClientToScreen

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

    ;~ Finds a matching window with the given handle
    Func matchWinHandle($hParent)
    Local $aWinList = WinList()
    Local $flag = 0;
    For $i = 0 To UBound($aWinList) - 1
    If $aWinList[$i][1] = $hParent Then
    ConsoleWriteError("hParent match is " & $aWinList[$i][0] & @LF)
    $flag = 1
    ;~ _ArrayDisplay($aWinList)
    ExitLoop
    EndIf
    Next
    If $flag = 0 Then
    ConsoleWriteError("No windows handle match found in WinList" & @LF)
    EndIf
    EndFunc ;==>matchWinHandle

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

    Func MyExit() ; stops the script
    ConsoleWrite("Script Stoppted By User" & @CR)
    Exit
    EndFunc ;==>MyExit

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

    ;==> Recersive version. No need now that I am using $GA_ROOT with get _WinAPI_GetAncestor
    Func matchWinHandleRec($hParent)
    Local $aWinList = WinList()
    Local $flag = 0;
    For $i = 0 To UBound($aWinList) - 1
    If $aWinList[$i][1] = $hParent Then
    ConsoleWriteError("hParent match is " & $aWinList[$i][0] & @LF)
    $flag = 1;
    ExitLoop
    Return
    EndIf
    Next
    If $flag = 0 Then
    ConsoleWriteError("No windows handle match found in WinList. Calling it again" & @LF)
    matchWinHandle(_WinAPI_GetAncestor($hParent))
    Local $sClassList = WinGetClassList($hParent)
    Local $aClassList = StringSplit(StringTrimRight($sClassList, 1), @LF, 2)

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

    For $i = 0 To UBound($aClassList) - 1
    ConsoleWrite($aClassList[$i] & @LF)
    Next
    EndIf

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

    EndFunc ;==>matchWinHandleRec

    [/autoit]

    Es erzeugt einen Tooltip, der der Maus folgt. Damit wäre es nicht mehr im Weg.
    Ansonsten kannst du ja damit überprüfen, ob der Tooltip unter der Maus ist, und wenn er dort ist kannst du beim linksklick mit ziehen den Tooltip verschieben.
    Ich hoffe es hilft dir weiter :)

    Viel Glück noch!

  • MSSQL 2008 Abfrage = keine Ergebnisse, bzw. kein Update

    • Kanashius
    • 12. Mai 2014 um 10:38

    Ich bin mir nicht sicher, aber versuchs mal ohne das ; am Ende. Bei Sqlite wird das auch nicht benötigt. Eventuell ist das der Fehler. Ansonsten würde ich Blowcake zustimmen.

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™