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

Beiträge von Bitnugger

  • OutlookEX Mail automatisch senden

    • Bitnugger
    • 2. Juni 2020 um 22:24
    Zitat von Windi

    If StringLen($aTermine[$i][3]) = 4 Then
    $sBody &= "0" & $aTermine[$i][3] & " " & $aTermine[$i][4] & "<br>" ; PLZ Ort 4 stellig mit 0
    Else
    $sBody &= $aTermine[$i][3] & " " & $aTermine[$i][4] & "<br>" ; PLZ Ort 5 stellig
    Endif

    Das kannst du auch viel einfacher machen:

    AutoIt
    $sBody &= StringRight("0" & $aTermine[$i][3], 5) & " " & $aTermine[$i][4] & "<br>"   ; PLZ Ort immer 5-stellig, anderfalls mit führender 0: Bsp.: 2151 ===>>> 02151
    Zitat von Windi

    Local $Meldung = GUICtrlCreateLabel("", $Poslinks - 150, $Poshoch +500, 550, 30)
    Local $Meldung = GUICtrlCreateLabel("Mail versendet an " &$Mailadress , $Poslinks - 100, $Poshoch + 500, 600, 30)

    Hier verwendest du für beide Labels dieselbe Variable... das macht keinen Sinn! Zudem sind sie die beiden Zeilen an dieser Stelle schlecht platziert... denn du willst die Labels ja sicher nicht in der Outlook-GUI erzeugen, was so auch nicht ginge, oder?

    Die Labels werden somit bei jedem Funktionsaufruf erzeugt... die erzeugt man vorher. Dann brauchst du in der Funktion _Mail_senden() nur den den Status und den Text entsprechend setzen.

    So z.B.:

    AutoIt
        _OL_ItemSend($oOutlook, $oItem)      ; sendet ohne nachfrage
        If @error Then
            GUICtrlSetState($idMeldung_02, $GUI_SHOW) ; Label anzeigen
            GUICtrlSetData($idMeldung_02, "Mail an " & $Mailadress & " konnte nicht gesendet werden!")
            GUICtrlSetColor($idMeldung_02, $COLOR_Red)
            Sleep(2000)
            GUICtrlSetState($idMeldung_02, $GUI_HIDE) ; Label verstecken
        Else
            GUICtrlSetState($idMeldung_02, $GUI_SHOW) ; Label anzeigen
            GUICtrlSetData($idMeldung_02, "Mail versendet an " & $Mailadress)
            GUICtrlSetColor($idMeldung_02, $COLOR_Green)
            Sleep(2000)
            GUICtrlSetState($idMeldung_02, $GUI_HIDE) ; Label verstecken
        EndIf
    Alles anzeigen

    GUISetFont(18) sollte auch nicht in der Funktion _Mail_senden() stehen.

    Zitat von Windi

    GUICtrlSetColor ($Meldung , $COLOR_Green)

    Tja, für welches der beiden Labels wird sich GUICtrlSetColor wohl entscheiden? ;)

    Von GUICtrlCreateLabel bekommst du eine Control-ID zurück... das würde ich immer als Kürzel im Variablennamen kenntlich machen:

    AutoIt
    Local $idMeldung_01 = GUICtrlCreateLabel("", $Poslinks - 150, $Poshoch +500, 550, 30)
    Local $idMeldung_02 = GUICtrlCreateLabel("Mail versendet an " &$Mailadress , $Poslinks - 100, $Poshoch + 500, 600, 30)
    GUICtrlSetColor($idMeldung_01, $COLOR_Green)
    GUICtrlSetColor($idMeldung_02, $COLOR_Green)

    Wobei hier der erste Labels keine für mich ersichtliche Funktion hat, denn er zeigt ja keinen Text an...

    Mail_senden() ... eigenen Funktionen solltest du immer ein _ voransetzen, damit sie besser von den nativen Funktionen zu unterscheiden sind. Also: _Mail_senden()

    Es ist ja schon mal prima, das du deinen Code in Code-Tags setzt... wenn du die Sytax-Hervorhebung nun noch auf AutoIt setzt, bekommst du 100 von 100 möglichen Punkten! 8o

    AutoIt
    Func _Mail_senden() ;Funtion Mail_senden
        Local $oOutlook = _OL_Open()
        If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
        Local $sMeineMailadresse = $Mailadress
        Local $sBetreff = "Telefonnummern Kunden Tour " & _NowDate()
        Local $aTermine = __ParseCSV($Quelldatei, ';')         ; <== Name der Eingabedatei hier anpassen!
        Local $sBody = "<html><body>"
        For $i = 1 To UBound($aTermine) - 1
            If $aTermine[$i][0] <> "" Then     ; ignoriere leere Zeilen
                $sBody &= "<P><b><u>" & $aTermine[$i][1] & "</u></b><br>"    ; Vorname Name
                $sBody &= $aTermine[$i][2] & "<br>"    ; Straße
                $sBody &= StringRight("0" & $aTermine[$i][3], 5) & " " & $aTermine[$i][4] & "<br>"   ; PLZ Ort 4 stellig mit 0
                If $aTermine[$i][5] <> "" Then $sBody &= "Privat: " & $aTermine[$i][5] & "<br>"    ; Telefonnr 1
                If $aTermine[$i][6] <> "" Then $sBody &= "Firma:  " & $aTermine[$i][6] & "<br>"    ; Telefonnr 2
                If $aTermine[$i][7] <> "" Then $sBody &= "Mobil:  " & $aTermine[$i][7] & "<br>"    ; Handy
            EndIf
        Next
        $sBody &= "</html></body>"
        Local $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=" & $sBetreff, "BodyFormat=" & $olFormatHTML, "HTMLBody=" & $sBody)
        If @error <> 0 Then Exit MsgBox(16, "", "Item Create: @error = " & @error & ", @extended = " & @extended)
        _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $sMeineMailadresse)
        If @error <> 0 Then Exit MsgBox(16, "", "Recipient Add: @error = " & @error & ", @extended = " & @extended)
        ;$oItem.display ; zeigt die Mail Kontrolle
        _OL_ItemSend($oOutlook, $oItem)      ; sendet ohne nachfrage
         If @error Then
            GUICtrlSetState($idMeldung_02, $GUI_SHOW) ; Label anzeigen
            GUICtrlSetData($idMeldung_02, "Mail an " & $Mailadress & " konnte nicht gesendet werden!")
            GUICtrlSetColor($idMeldung_02, $COLOR_Red)
            Sleep(2000)
            GUICtrlSetState($idMeldung_02, $GUI_HIDE) ; Label verstecken
        Else
            GUICtrlSetState($idMeldung_02, $GUI_SHOW) ; Label anzeigen
            GUICtrlSetData($idMeldung_02, "Mail versendet an " & $Mailadress)
            GUICtrlSetColor($idMeldung_02, $COLOR_Green)
            Sleep(2000)
            GUICtrlSetState($idMeldung_02, $GUI_HIDE) ; Label verstecken
        EndIf
        _OL_ItemSendReceive($oOutlook, True) ; Initiiert die sofortige Zustellung aller nicht zugestellten Nachrichten und den sofortigen Empfang von E-Mails für alle Konten im aktuellen Profil.
        _OL_Close($oOutlook)
    EndFunc   ;==>_Mail_senden
    Alles anzeigen
  • OutlookEX Mail automatisch senden

    • Bitnugger
    • 2. Juni 2020 um 09:26
    Zitat von Windi

    Kann man mit der OutookEx eine Mail senden, ohne das man nochmal extra Outlook öffnen muß.

    Wenn du eine Frage stellst, dann sollte der Satz auch mit einem Fragezeichen enden...

    Und ja, sicher geht das, sonst würde die OutookEx doch keinen Sinn machen.

    Outlook wird durch diese Zeile geöffnet:

    Global $oOutlook = _OL_Open()

    Globale Variablen haben übrigens nichts in einer Funktion zu suchen, da sollten nur Lokale Variablen deklariert werden.

  • Auslesen, welche geräte sich im WLan befinden

    • Bitnugger
    • 1. Juni 2020 um 22:39

    Wenn IP und/oder MAC bekannt sind, kannst du den ARP-Cache auslesen... denn da stehen die drin, wenn das Gerät verbunden ist.

    AutoIt
    #include <Array.au3>
    
    ; IP und MAC anpassen!!!
    Global $g_sIP = '192.168.178.30'
    Global $g_sMAC = '8c-f5-a3-0a-7f-f4'
    
    If $g_sIP Then Ping($g_sIP, 1000) ; Stellt sicher, dass die IP und MAC im ARP-Cache landen, wenn das Gerät erreichbar ist.
    
    Example1($g_sIP, $g_sMAC) ; Wenn IP und MAC bekannt sind
    Example2($g_sMAC)         ; Wenn nur die MAC bekannt ist
    Example3($g_sIP)          ; Wenn nur die IP bekannt ist
    
    Func Example1($_sIP, $_sMAC)
        Local $sOutput = _GetArpCache()
        Local $aRx1 = StringRegExp($sOutput, '(?s)(\Q' & $_sIP & '\E|' & $_sMAC & ')', 3)
        _ArrayDisplay($aRx1, '$aRx1')
    EndFunc   ;==>Example1
    
    Func Example2($_sMAC)
        Local $sOutput = _GetArpCache()
        Local $aRx2 = StringRegExp($sOutput, '(?s)(?i)(\d+\.\d+\.\d+\.\d+)\s+(' & $_sMAC & ')', 3)
        _ArrayDisplay($aRx2, '$aRx2')
    EndFunc   ;==>Example2
    
    Func Example3($_sIP)
        Local Static $g_sMAC_Pattern = '([0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}|[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2})'
        Local $sOutput = _GetArpCache()
        Local $aRx3 = StringRegExp($sOutput, '(?s)(?i)(\Q' & $_sIP & '\E)\s+' & $g_sMAC_Pattern, 3)
        _ArrayDisplay($aRx3, '$aRx3')
    EndFunc   ;==>Example3
    
    Func _GetArpCache()
        Local $iPID = Run(@ComSpec & ' /C arp -a', '', @SW_HIDE, $STDOUT_CHILD)
        ProcessWaitClose($iPID)
        Return StdoutRead($iPID)
    EndFunc   ;==>_GetArpCache
    Alles anzeigen
  • Windows Titel auslesen

    • Bitnugger
    • 1. Juni 2020 um 20:19

    Hier noch mal mit GetWindowTextW...

    Code
    import strutils 
    include winim/[inc\winuser]
    
    var hWnd = FindWindowA("SciTEWindow", nil)
    echo "hWnd = " & toHex(hWnd) & "\n"
    
    var
      buflenA = GetWindowTextLengthA(hWnd) + 1
      # bufA: string = spaces(buflenA)
      # lenA = GetWindowTextA(hwnd, cast[LPSTR](addr bufA[0]), buflenA)
      bufA: LPSTR = spaces(buflenA)
      txtlenA = GetWindowTextA(hwnd, bufA, buflenA)
    echo "txtlenA = ", txtlenA
    echo "buflenA = ", buflenA
    echo "bufA    = ", bufA, "\n"
    
    var
      buflenW = GetWindowTextLengthW(hWnd) + 1
      bufW = newWideCString("", buflenW)
      txtlenW = GetWindowTextW(hwnd, cast[LPWSTR](addr bufW[0]), buflenW)
    echo "txtlenW = ", txtlenW
    echo "buflenW = ", buflenW
    echo "bufW    = ", bufW
    Alles anzeigen

    Evtl. auch interessant: Working with Strings

  • Daten aus Pointer in Nim Datentyp einlesen

    • Bitnugger
    • 1. Juni 2020 um 04:28
    Zitat von Oscar

    Um das Ganze noch flexibler zu machen, kann man auch den Pointer und die Anzahl der Bytes übergeben:

    Die Anzahl der Bytes kannst du mit .sizeof ermitteln.

    Code
    # Compile x64: nim c -d:release -o:transfer.dll transfer.nim
    # Compile x86: nim c --cpu:i386 -d:release -o:transfer32.dll transfer.nim
    
    # * x64: Call sendData
    # * x86: Call sendData@4
    proc sendData(pData: ptr UncheckedArray[byte]): int {.stdcall,exportc,dynlib.} =
        var iCount: int = pData.sizeof
        for i in 0..iCount - 1:
          result += int(pData[i])
        pData[iCount - 1] = 0 # den letzten Wert auf 0 setzen (als Test)
    AutoIt
    #AutoIt3Wrapper_UseX64=y
    
    Global $tData = DllStructCreate('byte[8]'), $pData = DllStructGetPtr($tData), $j = 0, $aRet
    For $i = 0 To 7
        $j += $i
        DllStructSetData($tData, 1, $i, $i + 1)
        ConsoleWrite('- $i = ' & $i & '  $j += $i + 1 = ' & $j & @TAB & 'DllStructGetData($tData, 1, ' & $i + 1 & ')' & ' = ' & DllStructGetData($tData, 1, $i + 1) & @CRLF)
    Next
    $aRet = DllCall('transfer' & (@AutoItX64 ? '.dll' : '32.dll'), 'int', 'sendData' & (@AutoItX64 ? '' : '@4'), 'ptr', $pData)
    If @error Then
        ConsoleWrite("$aRet --> " & VarGetType($aRet) & @LF & "!@ " & @TAB & "#Error: " & @error & @TAB & "#Extended: " & @extended & @LF)
    Else
        ConsoleWrite(StringFormat('> $j = %i  $aRet[0] = %i  DllStructGetData($tData, 1, 8) = %2i\n', $j, $aRet[0], DllStructGetData($tData, 1, 8)))
    EndIf
    Alles anzeigen
  • [Nim] und die BASS-Dll

    • Bitnugger
    • 31. Mai 2020 um 06:53

    Hier noch eine etwas erweiterte Version von @Oscar's BassTest.nim, die nun (dank Oscar) auch mit UTF-8-Zeichen im Pfad klar kommt... und die mich viele graue Haare gekostet hat!

    Wird kein Parameter (Verzeichnis oder Datei) angegeben, öffnet sich ein FileDialog, mit dem eine oder mehrere Dateien geladen werden können. Erfolgt im FileDialog keine Auswahl, wird das Programm beendet.

    Alternativ kann aber auch eine Datei angegeben werden, die eine M3U-Playlist oder eine Liste von Verzeichnissen und /oder Dateien enhält. Dazu muss vor dem Dateiname ein -l: (kleines L) stehen.

    Zudem kann mit -v:n.n die Lautstärke gesetzt werden. Erlaubte Werte: 0.0 - 1.0. Default ist -v:0.5

    Bsp.:

    BassTest.exe

    BassTest.exe -v:0.3

    BassTest.exe "f:\Audio\MP3\International\S\Supertramp\1992 - The Very Best Of Supertramp Vol.02" ; Verzeichnis (ohne abschließenden Backslash)

    BassTest.exe "f:\Audio\MP3\International\S\Supertramp\1992 - The Very Best Of Supertramp Vol.02\01. Supertramp - Lady.mp3" ; Datei

    BassTest.exe -l:"f:\Audio\MP3\International\S\Supertramp\1992 - The Very Best Of Supertramp Vol.02\1992 - The Very Best Of Supertramp Vol.02.m3u" ; M3U-Playlist

    BassTest.exe "-l:m:\playlist.lst" ; Listfile, z.B. mit Total Commander (%UL)

    BassTest.exe -v:0.7 -l:"m:\playlist.lst" ; Listfile, z.B. mit Total Commander (%UL)

    Erfolgreich getestet habe ich folgende Formate: ".mp3", ".m4a", ".flac", ".wav", ".wma", ".aif", ".ac3", ".mp2". Mit entsprechenden Add-ons geht aber noch viel mehr.

    Code: BassTest.nim
    #include winim/[inc\shellapi, winstr]
    include winim/[inc\shellapi]
    import winim/winstr
    import nimbass/bass
    import os
    #import wNim
    import wNim/[wFileDialog]
    import strutils
    import strformat
    import typetraits
    #import encodings
    
    # Todo: Volume als Parameter: -v:0.5
    # Todo: Hotkeys for Volume, Prev/Next Song, ...
    # Todo: walkDirRec
    
    #let currentEncoding = getCurrentEncoding()
    
    type
      ConditionPair[T] = object
        ifTrue, ifFalse: T
    
    proc `!`*[T](a, b: T): ConditionPair[T] {.inline.} = ConditionPair[T](ifTrue: a, ifFalse: b)
    
    template `?`*[T](cond: bool; p: ConditionPair[T]): T =
      (if cond: p.ifTrue else: p.ifFalse)
    
    # Die BASS-dll ist in C geschrieben, deswegen die C-Variablen
    var
      iLen: bass.QWORD
      iSeconds, iSecondsNow: cdouble
      fBitrate, fVolume: cfloat
      hChannel: HSTREAM
      flags: bass.DWORD = bass.DWORD(BASS_STREAM_PRESCAN or BASS_STREAM_AUTOFREE or BASS_UNICODE)
      sPlaytime: string
    
    fVolume = 0.5
    
    type
      tExt = array[8, string]
    let aExt: tExt = [".mp3", ".m4a", ".flac", ".wav", ".wma", ".aif", ".ac3", ".mp2"]
      # ".ogg" usw. nur mit add-on: https://www.un4seen.com/
    var audioWildcards: string = "Audio files|" # für FileDialog
    for i in low(aExt)..high(aExt):
      audioWildcards &= "*" & aExt[i] & (i == high(aExt) ? "" ! ";")
    echo "audioWildcards = " & audioWildcards
    
    proc checkExt(s: string): bool =
      var e = splitFile(s).ext
      #echo "checkExt s = " & $type(s) & " " & s
      #echo "checkExt e = " & $type(e) & " " & e
      for i in low(aExt)..high(aExt):
        if aExt[i] == e:
          return true
      return false
    
    proc fmtPlaytime(): void =
      case ($int(iSeconds)).len:
      of 5:
        sPlaytime = fmt"{$int(iSecondsNow):>5}" & " / " & fmt"{$int (iSeconds):>5}"
      of 4:
        sPlaytime = fmt"{$int(iSecondsNow):>4}" & " / " & fmt"{$int (iSeconds):>4}"
      of 3:
        sPlaytime = fmt"{$int(iSecondsNow):>3}" & " / " & fmt"{$int (iSeconds):>3}"
      else:
        sPlaytime = fmt"{$int(iSecondsNow):>2}" & " / " & fmt"{$int (iSeconds):>2}"
    
    proc playfile(sMp3File: string): bool =
      var pMp3File: LPCWSTR = sMp3File
      
      echo "\nPlaying           : " & sMp3File
    
      # Audiogerät initialisieren
      discard BASS_Init(cint(-1), cast[bass.DWORD](44100), cast[bass.DWORD](0), cast[bass.DWORD](0), nil)
    
      # Gesamtlautstärke ändern (0.0 - 1.0)
      discard BASS_SetVolume(fVolume)
    
      # BASS_StreamCreateFile erwartet einen Pointer auf den Dateinamen
      # MP3-File als Stream in den Speicher laden (wird am Ende automatisch freigegeben)
      hChannel = BASS_StreamCreateFile(false, pMp3File, 0, 0, flags)
      echo "hChannel          : 0x" & toHex($hChannel)
      if hChannel == 0:
        echo "BASS_ErrorGetCode() = " & $BASS_ErrorGetCode()
        return false
    
      # Lautstärke (0.0 - 1.0) für den Stream setzen
      discard BASS_ChannelSetAttribute(hChannel, BASS_ATTRIB_VOL, fVolume)
    
      # Durchschnittliche Bitrate auslesen (Pointer auf fBitrate)
      if BASS_ChannelGetAttribute(hChannel, BASS_ATTRIB_BITRATE, fBitrate.addr()):
        echo "Bitrate           : " & $int(fBitrate) & " kBit/s"
    
      # Lautstärke des Streams auslesen (Pointer auf fVolume)
      if BASS_ChannelGetAttribute(hChannel, BASS_ATTRIB_VOL, fVolume.addr()):
        echo "Volume            : " & fmt"{fVolume:<2.1f}"
    
      # Laufzeit des Streams auslesen (in Bytes)
      iLen = BASS_ChannelGetLength(hChannel, BASS_POS_BYTE)
      echo "Länge in Bytes    : " & $iLen
    
      # Laufzeit in Sekunden umrechnen
      iSeconds = BASS_ChannelBytes2Seconds(hChannel, iLen)
      echo "Länge in Sekunden : " & $int(iSeconds)
    
      if BASS_ChannelPlay(hChannel, false):
        while true:
          case BASS_ChannelIsActive(hChannel) # liefert ein DWORD zurück
          of BASS_ACTIVE_PLAYING:             # Player ist noch aktiv
            iLen = BASS_ChannelGetPosition(hChannel, BASS_POS_BYTE)
            iSecondsNow = BASS_ChannelBytes2Seconds(hChannel, iLen)
            #echo "Position: " & $int(iSecondsNow) & " / " & $int(iSeconds)
            #stdout.write "\rPlaytime: " & $int(iSecondsNow) & " / " & $int(iSeconds)
            fmtPlaytime()
            # "\r" puts the write cursor back at the beginning of the line
            stdout.write "\rPlaytime          : " & sPlaytime
            sleep(1000)                       # eine Sekunde warten 
          of BASS_ACTIVE_STOPPED: break       # Player Stop
          of BASS_ACTIVE_PAUSED: break        # Player Pause
          of BASS_ACTIVE_PAUSED_DEVICE: break # Device Pause
          of BASS_ACTIVE_STALLED: break       # Datenstrom unterbrochen
          else: break                         # While-Schleife verlassen
      discard BASS_ChannelStop(hChannel)
      discard BASS_Free()
      echo "\n"
      return true
    
    var sPath:string
    
    if paramCount() > 0:
      for p in 1..paramCount():
        var list = paramStr(p)
        if list[0..2] == "-v:": # Lautstärke 0.0 - 1.0
          fVolume = parseFloat(list[3..^1])
          fVolume = parseFloat(fmt"{fVolume:<2.1f}")
          continue
        if list[0..2] == "-l:": # ? Listfile (from Total Commander) or M3U-Playlist
          if PathFileExistsW(list[3..^1]) != windef.TRUE:
            echo "Listfile not found!\n===>>> " & list[3..^1]
            quit(-1)
          else:
            var files = readFile(list[3..^1])
            if toHex(files[0..2]) == "EFBBBF": files = files[3..^1] # UTF-8 BOM entfernen
            if files[0..6] == "#EXTM3U": sPath = splitFile(list[3..^1]).dir & r"\"
            echo "sPath = " & sPath
            echo "files = " & $type(files) & "\n" & files # TaintedString
            for line in splitLines(files):
              if line == "": continue
              echo "line = " & $type(line) & " '" & line & "'"
              if PathIsDirectoryW(sPath & line) == FILE_ATTRIBUTE_DIRECTORY or
                splitFile(sPath & line).ext == "":
                echo "play from list dir"
                echo "walkFiles('" & sPath & line & r"\*.*')"
                for walk in walkFiles(sPath & line & r"\*.*"): # *.mp3
                  echo "walk = " & $type(walk) & " " & walk
                  if checkExt(walk):
                    if not playfile(walk): # <<<================================== OK
                      echo "play from list dir failed!\n===>>> " & walk
                      quit(1)
              else:
                echo "play from list file " &
                  (sPath == "" ? "(Total Commander)" ! "(M3U-Playlist)")
                echo "line = " & $type(line) & " '" & line & "'"
                if checkExt(sPath & line):
                  if not playfile(sPath & line): # <<<============================ OK
                    echo "play from list file failed!\n===>>> " & sPath & line
                    quit(2)
        else:
          sPath = paramStr(p)
          if sPath[^1] == chr(34): # [^1] = [sPath.len-1]
            # ! Bad path, trim trailing quote
            sPath = sPath[0..^2] # [0..^2] = [0..sPath.len-2]
          if PathFileExistsW(sPath) != windef.TRUE:
            echo "File from paramStr(" & $p & ") not found!\n===>>> " & sPath
            quit(-1)
          if PathIsDirectoryW(sPath) == FILE_ATTRIBUTE_DIRECTORY or
              splitFile(sPath).ext == "":
    #[
          # It works that way too, but is more cumbersome.
          try:
            var oFileInfo = getFileInfo(sPath)
            if $oFileInfo.kind == "pcDir":
              echo "getFileInfo(sPath): sPath is a directory!"
          except:
            echo "getFileInfo(sPath) failed!"
            
            # Iterate over all the directories that match the pattern.
            for kind, path in walkDir(sPath):
          
            # Iterate over all the files and directories that match the pattern.
            for path in walkPattern($sPath & "\\*.mp3"):
    
            #Recursively walks over the directory dir and yields for each file or directory in dir.
            #If relative is true (default: false) the resulting path is shortened to be relative to dir, otherwise the full path is returned.
            walkDirRec(dir: string; yieldFilter = {pcFile}; followFilter = {pcDir};
                       relative = false; checkDir = false): string {...}
    ]#
    
            echo "play from paramStr(" & $p & ") (dir)"
            # Iterate over all the files that match the pattern.
            for walk in walkFiles($sPath & "\\*.*"): # ? sPath is a directory
              if checkExt(walk):
                if not playfile(walk): # <<<==================================== OK
                  echo "play from param dir failed!\n===>>> " & walk
                  quit(3)
          else: # ? sPath is not a file
            #pMp3File = paramStr(p)
            echo "play from paramStr(" & $p & ") (file)"
            if checkExt(paramStr(p)):
              if not playfile(paramStr(p)): # <<<=============================== OK
                echo "play from param file failed!\n===>>> " & paramStr(p)
                quit(4)
    else:
      echo "play from FileDialog"
      while true:
        var files = FileDialog(nil, "Select Audio Files",
          defaultDir = r"f:\Audio\MP3\International\",
          wildcard = audioWildcards, # "Audio files|*.mp3;*.m4a;..."
          style = wFdOpen or wFdFileMustExist or wFdMultiple).display()
        if files.len > 0:
          for k in 0..<files.len:
            if not playfile(files[k]): # <<<==================================== OK
              echo "play from FileDialog failed!\n===>>> " & files[k]
              quit(5)
        else:
          break
    Alles anzeigen

    Dateien

    BassTest.zip 372,9 kB – 315 Downloads
  • [Nim] und die BASS-Dll

    • Bitnugger
    • 30. Mai 2020 um 21:48
    Zitat von Oscar

    So funktioniert es jetzt bei mir:

    Ja, bei mir auch... LPCWSTR ...das macht natürlich Sinn.

    Danke!

  • [offen] Kompilieren für x86 ?

    • Bitnugger
    • 30. Mai 2020 um 16:56

    Bei mir funktioniert es nun auch... nur sehr seltsam, dass es mit --app:lib nicht funktioniert.

    Hier hin habe ich die Archive mingw32.7z und mingw64.7z entpackt:

    c:\Users\<USER>\scoop\apps\nim\current\dist\

    mingw32 

    mingw64 

    nimble

    Hier die nim.cfg geändert:

    Code: c:\Users\<USER>\scoop\apps\nim\current\config\nim.cfg
    # Configuration for the GNU C/C++ compiler:
    @if windows:
      #gcc.path = r"$nim\dist\mingw\bin"
      @if i386:
        gcc.path = r"$nim\dist\mingw32\bin"
      @else:
        gcc.path = r"$nim\dist\mingw64\bin"
      @end
      @if gcc or tcc:
        tlsEmulation:on
      @end
    @end
    Alles anzeigen
  • DllStruct to bitmap

    • Bitnugger
    • 30. Mai 2020 um 03:06
    Zitat von Musashi

    Allerdings darf man keine Direktive wie #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 setzen, dann gibt es in der Tat diverse Deklarationsmeldungen.

    Habe ich nicht... bis auf den Time Stamp, der als Kommentar eingefügt wird, ist das Script bis auf ein paar eliminierte Leerzeilen unverändert und schmeißt bei mir 4 Errors und 4 Warnings.

    Ich sehe aber gerade, dass Andy es zwischenzeitlich wohl geändert hat... hier die Version mit ein paar eliminierten Leerzeilen, die ich via Copy-Button in SciTE eingefügt hatte:

    AutoIt
    ;-- TIME_STAMP   2020-05-30 03:03:08   v 0.1
    
    ;#include <AssembleIt2_64.au3>
    #include <GDIPlus.au3>
    
    #AutoIt3Wrapper_UseX64=n
    ;32Bit only!
    
    #cs _grayscale
        use32                                 ;32Bit!
    
        mov esi,dword[esp+4]                  ;Startadress Bitmapdata (Pixel)
        mov ecx,dword[esp+8]                  ;number of Pixel
        mov edi,21845                         ;konstant, *21845/2^16 is approximately 1/3 (replaces the slow DIV 3)
    
        _loop1:                               ;until ecx=0
        mov edx,[esi]                         ;load pixel  AARRGGBB  (RR+GG+BB)/3 = colour grayscale
        mov al,dl                             ;lowbyte (BB) Pixel to lowbyte al
        movzx bx,dh                           ;highbyte (GG) Pixel to lowbyte of bx (bh is 0)
        shr edx,8                             ;shift RR into dh
        add ax,bx                             ;BB + GG
        movzx bx,dh                           ;highbyte (RR) Pixel to lowbyte of bx (bh ist 0)
        add ax,bx                             ;and add: dx=RR+GG+BB
        mul edi                               ;ax=ax*21845      *21845/2^16 is about 1/3
        shr eax,16                            ;ax=ax/2^16   in al is now the greyscale colour for RR, GG und BB
        movzx dx,al                           ;grayscale to dl,  dh = 0
        shl edx,16                            ;grayscale to RR,  AA = 0!
        mov dh,al                             ;grayscale to GG
        mov dl,al                             ;grayscale to BB     edx is now 00alalal = grayscale AARRGGBB
        mov [esi],edx                         ;write pixel
    
        add esi,4                             ;address next pixel: 4 Byte = 1 dword = 1 Pixel
        sub ecx,1                             ;counter (next pixel)
        ja _loop1                             ;until ecx=0
        ;upper 3 lines are faster than loop _loop1            ;until ecx=0
        ret                                   ;return
    #ce                                        ;==>_grayscale
    
    $file = FileOpenDialog("Select 32 Bpp image!", @ScriptDir, "Image (*.jpg;*.bmp;*.png)", 1 + 2)
    if @error then exit
    
    $binarycode = "0x8B7424048B4C2408BF555500008B1688D0660FB6DEC1EA086601D8660FB6DE6601D8F7E7C1E810660FB6D0C1E21088C688C2891683C60483E90177D1C3" ;code in Speicher schreiben
    Global $tCodeBuffer = DllStructCreate("byte[" & StringLen($binarycode) / 2 - 1 & "]") ;reserve Memory for opcodes
    DllStructSetData($tCodeBuffer, 1, $binarycode) ;write opcodes into memory
    
    _GDIPlus_Startup()
    
    Global $ptr, $hbmp, $iwidth, $iheight ;werden ByRef von _CreateNewBmp32FromFile ausgefüllt
    $DC = _CreateNewBmp32FromFile($file, $ptr, $hbmp, $iwidth, $iheight)
    
    ;pointer und bitmapgröße, mehr braucht man zum bearbeiten einer bitmap nicht!
    ;$ret=_AssembleIt2("handle","_grayscale","ptr", $ptr, "int", $iWidth * $iHeight)
    
    $ret = DllCallAddress("uint:cdecl", DllStructGetPtr($tCodeBuffer), "ptr", $ptr, "int", $iwidth* $iheight);bytecode aufrufen, rückgabe in a[0]
    
    ;grafik speichern
     $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hbmp)
    _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\greyscale.jpg")
    _GDIPlus_Shutdown()
    
    ShellExecute(@ScriptDir & "\greyscale.jpg")
    Exit
    
    Func _CreateNewBmp32FromFile($bmpfile, ByRef $ptr, ByRef $hbmp, ByRef $iwidth, ByRef $iheight) ;ptr to bitmapdata, it is possible to manipulate one pixel if needed
        Local $hbitmap, $hdc, $hcdc
    
        $hbitmap = _GDIPlus_ImageLoadFromFile($bmpfile)
        If @error Or $hbitmap = 0 Then
            MsgBox(0, "Func _CreateNewBmp32FromFile()", "Error opening File: " & @CRLF & $bmpfile)
            Return -1
        EndIf
        $hbmpfile = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hbitmap)
        $iwidth = _GDIPlus_ImageGetWidth($hbitmap)
        $iheight = _GDIPlus_ImageGetHeight($hbitmap)
        $hcdc = _WinAPI_CreateCompatibleDC(0)
        _WinAPI_SelectObject($hcdc, $hbmpfile)           ;image im hcdc
    
        ;neue bitmap
        $tBMI = DllStructCreate($tagBITMAPINFO)          ;Struktur der Bitmapinfo erstellen und Daten eintragen
        DllStructSetData($tBMI, 1, DllStructGetSize($tBMI) - 4);Structgröße abzüglich der Daten für die Palette
        DllStructSetData($tBMI, 2, $iwidth)
        DllStructSetData($tBMI, 3, -$iheight)            ;minus =standard = bottomup
        DllStructSetData($tBMI, 4, 1)
        DllStructSetData($tBMI, 5, 32)                   ;32 Bit = 4 Bytes => AABBGGRR
        $adib = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBMI), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0)
        $hbmp = $adib[0]                                 ;hbitmap handle auf die Bitmap, auch per GDI+ zu verwenden
        $ptr = $adib[4]                                  ;pointer auf den Anfang der Bitmapdaten, vom Assembler verwendet
    
        $hdc = _WinAPI_CreateCompatibleDC(0)
        _WinAPI_SelectObject($hdc, $hbmp)                ;leere bitmap im hdc
        _WinAPI_BitBlt($hdc, 0, 0, $iwidth, $iheight, $hcdc, 0, 0, $srccopy);image in leere bitmap
        _WinAPI_DeleteDC($hcdc)
        _WinAPI_DeleteObject($hbmpfile)
        Return $hdc                                      ;DC der Bitmap zurückgeben
    EndFunc                                              ;==>_CreateNewBmp32FromFile
    
    
    _DeleteBitmap32($DC_bmp, $ptr1, $hbmp1)
    Exit
    
    Func _CreateNewBmp32($iWidth, $iHeight, ByRef $ptr, ByRef $hbmp) ;erstellt leere 32-bit-Bitmap; Rückgabe $HDC und $ptr und handle auf die Bitmapdaten
        $hcdc = _WinAPI_CreateCompatibleDC(0)                    ;Desktop-Kompatiblen DeviceContext erstellen lassen
        $tBMI = DllStructCreate($tagBITMAPINFO)                  ;Struktur der Bitmapinfo erstellen und Daten eintragen
        DllStructSetData($tBMI, 1, DllStructGetSize($tBMI) - 4)  ;Structgröße abzüglich der Daten für die Palette
        DllStructSetData($tBMI, 2, $iWidth)
        DllStructSetData($tBMI, 3, -$iHeight)                    ;minus =standard = bottomup
        DllStructSetData($tBMI, 4, 1)
        DllStructSetData($tBMI, 5, 32)                           ;32 Bit = 4 Bytes => AABBGGRR
        $adib = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBMI), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0)
        $hbmp = $adib[0]                                         ;hbitmap handle auf die Bitmap, auch per GDI+ zu verwenden
        $ptr = $adib[4]                                          ;pointer auf den Anfang der Bitmapdaten, vom Assembler verwendet
        _WinAPI_SelectObject($hcdc, $hbmp)                       ;objekt hbitmap in DC
        Return $hcdc                                             ;DC der Bitmap zurückgeben
    EndFunc                                                      ;==>_CreateNewBmp32
    
    Func _DeleteBitmap32($DC, $ptr, $hbmp)
        _WinAPI_DeleteDC($DC)
        _WinAPI_DeleteObject($hbmp)
        $ptr = 0
    EndFunc                                                      ;==>_DeleteBitmap32
    Alles anzeigen

    Und ja, die aktuelle Version funktioniert, wenn die Zeile "Global Const $SRCCOPY = 0x00CC0020" eingefügt wird.

  • DllStruct to bitmap

    • Bitnugger
    • 29. Mai 2020 um 23:36
    Zitat von Andy

    Ohne weitere Infos ist doch alles nur :Glaskugel:

    Eben... sagte ich doch bereits in meinem ersten Post! ;)

    Allerdings funktioniert dein letztes Script bei mir nicht, weil einige Variablen nicht deklariert wurden:

    Code
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(91,72) : warning: $srccopy: possibly used before declaration.
        _WinAPI_BitBlt($hdc, 0, 0, $iwidth, $iheight, $hcdc, 0, 0, $srccopy)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(98,24) : warning: $DC_bmp: possibly used before declaration.
    _DeleteBitmap32($DC_bmp,
    ~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(98,31) : warning: $ptr1: possibly used before declaration.
    _DeleteBitmap32($DC_bmp, $ptr1,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(98,39) : warning: $hbmp1: possibly used before declaration.
    _DeleteBitmap32($DC_bmp, $ptr1, $hbmp1)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(91,72) : error: $srccopy: undeclared global variable.
        _WinAPI_BitBlt($hdc, 0, 0, $iwidth, $iheight, $hcdc, 0, 0, $srccopy)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(98,24) : error: $DC_bmp: undeclared global variable.
    _DeleteBitmap32($DC_bmp,
    ~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(98,31) : error: $ptr1: undeclared global variable.
    _DeleteBitmap32($DC_bmp, $ptr1,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    "m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3"(98,39) : error: $hbmp1: undeclared global variable.
    _DeleteBitmap32($DC_bmp, $ptr1, $hbmp1)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    m:\AutoIt\@Texos\DllStruct_to_Bitmap @Andy (ASM).au3 - 4 error(s), 4 warning(s)
    !>23:39:51 AU3Check ended. Press F4 to jump to next error.rc:2
    +>23:39:51 AutoIt3Wrapper Finished.
    >Exit code: 2    Time: 1.092
    Alles anzeigen
  • DllStruct to bitmap

    • Bitnugger
    • 29. Mai 2020 um 20:27
    Zitat von UEZ

    Hier eine GDI+ Variante:

    Das Ergebnis sieht dann bei mir so aus:

    Dies ist aber sicher nicht das gewünschte Ergebnis...

    Was bewirken bei (($i)) die doppelten Klammern?

  • Dll erstellen

    • Bitnugger
    • 29. Mai 2020 um 00:58

    Schau mal, was ich in meinem Temp-Verzeichnis gefunden habe...

    c:\Users\Ghost\AppData\Local\Temp\mat*

    mat-debug-100.log

    mat-debug-140.log

    mat-debug-236.log

    mat-debug-492.log

    mat-debug-496.log

    mat-debug-732.log

    mat-debug-748.log

    mat-debug-828.log

    mat-debug-844.log

    mat-debug-988.log

    mat-debug-1060.log

    mat-debug-1064.log

    mat-debug-1092.log

    mat-debug-1116.log

    mat-debug-1176.log

    mat-debug-1180.log

    mat-debug-1184.log

    mat-debug-1208.log

    mat-debug-1304.log

    mat-debug-1484.log

    mat-debug-1536.log

    mat-debug-1548.log

    mat-debug-1644.log

    mat-debug-1656.log

    mat-debug-1660.log

    mat-debug-1672.log

    mat-debug-1748.log

    mat-debug-1772.log

    mat-debug-1832.log

    mat-debug-1844.log

    mat-debug-1848.log

    mat-debug-1896.log

    mat-debug-1900.log

    mat-debug-1908.log

    mat-debug-1940.log

    mat-debug-1944.log

    mat-debug-1952.log

    mat-debug-1984.log

    mat-debug-2040.log

    mat-debug-2060.log

    mat-debug-2092.log

    mat-debug-2100.log

    mat-debug-2116.log

    mat-debug-2124.log

    mat-debug-2164.log

    mat-debug-2204.log

    mat-debug-2220.log

    mat-debug-2224.log

    mat-debug-2248.log

    mat-debug-2264.log

    mat-debug-2304.log

    mat-debug-2316.log

    mat-debug-2328.log

    mat-debug-2332.log

    mat-debug-2368.log

    mat-debug-2396.log

    mat-debug-2404.log

    mat-debug-2504.log

    mat-debug-2520.log

    mat-debug-2524.log

    mat-debug-2528.log

    mat-debug-2612.log

    mat-debug-2620.log

    mat-debug-2628.log

    mat-debug-2680.log

    mat-debug-2692.log

    mat-debug-2696.log

    mat-debug-2708.log

    mat-debug-2760.log

    mat-debug-2772.log

    mat-debug-2804.log

    mat-debug-2812.log

    mat-debug-2832.log

    mat-debug-2860.log

    mat-debug-2868.log

    mat-debug-2920.log

    mat-debug-2936.log

    mat-debug-2996.log

    mat-debug-3008.log

    mat-debug-3024.log

    mat-debug-3036.log

    mat-debug-3040.log

    mat-debug-3084.log

    mat-debug-3092.log

    mat-debug-3140.log

    mat-debug-3208.log

    mat-debug-3232.log

    mat-debug-3240.log

    mat-debug-3300.log

    mat-debug-3316.log

    mat-debug-3420.log

    mat-debug-3488.log

    mat-debug-3524.log

    mat-debug-3540.log

    mat-debug-3724.log

    mat-debug-3760.log

    mat-debug-3776.log

    mat-debug-3812.log

    mat-debug-3840.log

    mat-debug-4008.log

    mat-debug-4024.log

    mat-debug-4032.log

    mat-debug-4108.log

    mat-debug-4124.log

    mat-debug-4164.log

    mat-debug-4220.log

    mat-debug-4344.log

    mat-debug-4360.log

    mat-debug-4416.log

    mat-debug-4460.log

    mat-debug-4468.log

    mat-debug-4524.log

    mat-debug-4528.log

    mat-debug-4544.log

    mat-debug-4564.log

    mat-debug-4656.log

    mat-debug-4660.log

    mat-debug-4696.log

    mat-debug-4700.log

    mat-debug-4720.log

    mat-debug-4756.log

    mat-debug-4816.log

    mat-debug-4884.log

    mat-debug-4896.log

    mat-debug-4984.log

    mat-debug-5020.log

    mat-debug-5048.log

    mat-debug-5144.log

    mat-debug-5200.log

    mat-debug-5228.log

    mat-debug-5336.log

    mat-debug-5352.log

    mat-debug-5420.log

    mat-debug-5468.log

    mat-debug-5524.log

    mat-debug-5576.log

    mat-debug-5688.log

    mat-debug-5692.log

    mat-debug-5788.log

    mat-debug-5804.log

    mat-debug-5824.log

    mat-debug-5880.log

    mat-debug-5888.log

    mat-debug-5896.log

    mat-debug-5920.log

    mat-debug-5976.log

    mat-debug-6048.log

    mat-debug-6052.log

    mat-debug-6204.log

    mat-debug-6212.log

    mat-debug-6220.log

    mat-debug-6252.log

    mat-debug-6256.log

    mat-debug-6260.log

    mat-debug-6284.log

    mat-debug-6296.log

    mat-debug-6324.log

    mat-debug-6344.log

    mat-debug-6416.log

    mat-debug-6604.log

    mat-debug-6608.log

    mat-debug-6636.log

    mat-debug-6644.log

    mat-debug-6648.log

    mat-debug-6660.log

    mat-debug-6664.log

    mat-debug-6672.log

    mat-debug-6676.log

    mat-debug-6696.log

    mat-debug-6736.log

    mat-debug-6764.log

    mat-debug-6780.log

    mat-debug-6820.log

    mat-debug-6828.log

    mat-debug-6872.log

    mat-debug-6876.log

    mat-debug-6892.log

    mat-debug-6936.log

    mat-debug-6980.log

    mat-debug-6984.log

    mat-debug-7072.log

    mat-debug-7088.log

    mat-debug-7128.log

    mat-debug-7688.log

    mat-debug-7700.log

    mat-debug-7764.log

    mat-debug-7828.log

    mat-debug-7872.log

    mat-debug-7908.log

    mat-debug-7932.log

    mat-debug-7936.log

    mat-debug-7944.log

    mat-debug-7956.log

    mat-debug-7988.log

    mat-debug-8004.log

    mat-debug-8068.log

    mat-debug-8084.log

    mat-debug-8160.log

    mat-debug-8168.log

    mat-debug-8172.log

    mat-debug-8188.log

    mat-debug-8200.log

    mat-debug-8204.log

    mat-debug-8228.log

    mat-debug-8244.log

    mat-debug-8276.log

    mat-debug-8316.log

    mat-debug-8320.log

    mat-debug-8344.log

    mat-debug-8376.log

    mat-debug-8424.log

    mat-debug-8428.log

    mat-debug-8436.log

    mat-debug-8452.log

    mat-debug-8460.log

    mat-debug-8592.log

    mat-debug-8604.log

    mat-debug-8636.log

    mat-debug-8648.log

    mat-debug-8664.log

    mat-debug-8680.log

    mat-debug-8712.log

    mat-debug-8720.log

    mat-debug-8748.log

    mat-debug-8808.log

    mat-debug-8816.log

    mat-debug-8848.log

    mat-debug-8884.log

    mat-debug-8924.log

    mat-debug-9048.log

    mat-debug-9104.log

    mat-debug-9120.log

    mat-debug-9152.log

    mat-debug-9192.log

    mat-debug-9208.log

    mat-debug-9244.log

    mat-debug-9276.log

    mat-debug-9368.log

    mat-debug-9384.log

    mat-debug-9528.log

    mat-debug-9532.log

    mat-debug-9600.log

    mat-debug-9700.log

    mat-debug-9788.log

    mat-debug-9808.log

    mat-debug-9848.log

    mat-debug-9856.log

    mat-debug-9940.log

    mat-debug-9996.log

    mat-debug-10032.log

    mat-debug-10076.log

    mat-debug-10104.log

    mat-debug-10108.log

    mat-debug-10120.log

    mat-debug-10124.log

    mat-debug-10176.log

    mat-debug-10192.log

    mat-debug-10196.log

    mat-debug-10204.log

    mat-debug-10252.log

    mat-debug-10336.log

    mat-debug-10348.log

    mat-debug-10364.log

    mat-debug-10440.log

    mat-debug-10452.log

    mat-debug-10520.log

    mat-debug-10532.log

    mat-debug-10584.log

    mat-debug-10600.log

    mat-debug-10640.log

    mat-debug-10664.log

    mat-debug-10748.log

    mat-debug-10756.log

    mat-debug-10768.log

    mat-debug-10784.log

    mat-debug-10844.log

    mat-debug-10880.log

    mat-debug-10948.log

    mat-debug-10972.log

    mat-debug-10988.log

    mat-debug-11064.log

    mat-debug-11088.log

    mat-debug-11096.log

    mat-debug-11116.log

    mat-debug-11152.log

    mat-debug-11164.log

    mat-debug-11192.log

    mat-debug-11244.log

    mat-debug-11252.log

    mat-debug-11276.log

    mat-debug-11292.log

    mat-debug-11324.log

    mat-debug-11360.log

    mat-debug-11372.log

    mat-debug-11380.log

    mat-debug-11432.log

    mat-debug-11492.log

    mat-debug-11508.log

    mat-debug-11524.log

    mat-debug-11596.log

    mat-debug-11612.log

    mat-debug-11636.log

    mat-debug-11676.log

    mat-debug-11700.log

    mat-debug-11720.log

    mat-debug-11744.log

    mat-debug-11748.log

    mat-debug-11752.log

    mat-debug-11836.log

    mat-debug-11868.log

    mat-debug-11912.log

    mat-debug-11980.log

    mat-debug-11984.log

    mat-debug-12020.log

    mat-debug-12024.log

    mat-debug-12100.log

    mat-debug-12200.log

    mat-debug-12212.log

    mat-debug-12280.log

    mat-debug-12304.log

    mat-debug-12344.log

    mat-debug-12352.log

    mat-debug-12360.log

    mat-debug-12452.log

    mat-debug-12472.log

    mat-debug-12496.log

    mat-debug-12504.log

    mat-debug-12508.log

    mat-debug-12532.log

    mat-debug-12620.log

    mat-debug-12760.log

    mat-debug-12824.log

    mat-debug-12912.log

    mat-debug-12932.log

    mat-debug-12936.log

    mat-debug-12956.log

    mat-debug-13064.log

    mat-debug-13088.log

    mat-debug-13108.log

    mat-debug-13224.log

    mat-debug-13228.log

    mat-debug-13272.log

    mat-debug-13344.log

    mat-debug-13408.log

    mat-debug-13432.log

    mat-debug-13536.log

    mat-debug-13632.log

    mat-debug-13712.log

    mat-debug-13772.log

    mat-debug-13808.log

    mat-debug-13816.log

    mat-debug-13824.log

    mat-debug-13860.log

    mat-debug-13976.log

    mat-debug-13980.log

    mat-debug-14048.log

    mat-debug-14092.log

    mat-debug-14152.log

    mat-debug-14240.log

    mat-debug-14292.log

    mat-debug-14312.log

    mat-debug-14444.log

    mat-debug-14476.log

    mat-debug-14548.log

    mat-debug-14568.log

    mat-debug-14632.log

    mat-debug-14680.log

    mat-debug-14720.log

    mat-debug-14844.log

    mat-debug-14852.log

    mat-debug-14944.log

    mat-debug-14984.log

    mat-debug-14988.log

    mat-debug-15060.log

    mat-debug-15080.log

    mat-debug-15116.log

    mat-debug-15196.log

    mat-debug-15292.log

    mat-debug-15372.log

    mat-debug-15384.log

    mat-debug-15392.log

    mat-debug-15452.log

    mat-debug-15560.log

    mat-debug-15568.log

    mat-debug-15580.log

    mat-debug-15612.log

    mat-debug-15628.log

    mat-debug-15636.log

    mat-debug-15728.log

    mat-debug-15748.log

    mat-debug-15876.log

    mat-debug-15920.log

    mat-debug-16016.log

    mat-debug-16036.log

    mat-debug-16088.log

    mat-debug-16184.log

    mat-debug-16204.log

    mat-debug-16256.log

    mat-debug-16272.log

    mat-debug-16280.log

    mat-debug-16340.log

    mat-debug-16352.log

    mat-debug-16376.log

    mat-debug-16380.log

    mat-debug-16396.log

    mat-debug-16448.log

    mat-debug-16456.log

    mat-debug-16492.log

    mat-debug-16496.log

    mat-debug-16580.log

    mat-debug-16588.log

    mat-debug-16600.log

    mat-debug-16620.log

    mat-debug-16652.log

    mat-debug-16664.log

    mat-debug-16668.log

    mat-debug-16688.log

    mat-debug-16740.log

    mat-debug-16760.log

    mat-debug-16776.log

    mat-debug-16788.log

    mat-debug-16812.log

    mat-debug-16852.log

    mat-debug-16860.log

    mat-debug-16880.log

    mat-debug-16908.log

    mat-debug-16912.log

    mat-debug-16916.log

    mat-debug-16940.log

    mat-debug-16956.log

    mat-debug-17048.log

    mat-debug-17136.log

    mat-debug-17148.log

    mat-debug-17176.log

    mat-debug-17200.log

    mat-debug-17252.log

    mat-debug-17272.log

    mat-debug-17284.log

    mat-debug-17308.log

    mat-debug-17316.log

    mat-debug-17320.log

    mat-debug-17340.log

    mat-debug-17412.log

    mat-debug-17592.log

    mat-debug-17600.log

    mat-debug-17628.log

    mat-debug-17644.log

    mat-debug-17652.log

    mat-debug-17716.log

    mat-debug-17724.log

    mat-debug-17744.log

    mat-debug-17768.log

    mat-debug-17776.log

    mat-debug-17820.log

    mat-debug-17832.log

    mat-debug-17844.log

    mat-debug-17972.log

    mat-debug-18040.log

    mat-debug-18120.log

    mat-debug-18136.log

    mat-debug-18156.log

    mat-debug-18168.log

    mat-debug-18244.log

    mat-debug-18328.log

    mat-debug-18348.log

    mat-debug-18444.log

    mat-debug-18528.log

    mat-debug-18596.log

    mat-debug-18608.log

    mat-debug-18988.log

    mat-debug-19060.log

    mat-debug-19080.log

    mat-debug-19196.log

    mat-debug-19224.log

    mat-debug-19376.log

    mat-debug-19396.log

    Sind alle 0 Bytes groß. Wieso sind die da drin? Habe doch nichts von loggen gesagt...

  • Wrapper für FLANN-Bibliothek - ideal für Nearest-Neighbour-Problem

    • Bitnugger
    • 28. Mai 2020 um 21:54
    Zitat von AspirinJunkie

    So läuft es bei mir zumindest als X64-Skript. Nur bei X86 kackt es weiterhin ab.

    Bei mir läuft es jetzt auch mit x64... na ja, X86... kann man mit leben!

  • Wrapper für FLANN-Bibliothek - ideal für Nearest-Neighbour-Problem

    • Bitnugger
    • 28. Mai 2020 um 21:15
    Zitat von AspirinJunkie

    Hab mir die Zip runtergeladen - da war es korrekt drin.

    Ich habe sie mir soeben auch noch mal runtergeladen... und da ist es der Fehler immer noch drin!

    Local Static $p_A = DllCall($h_KRNL32, "ptr", "GetProcAddress", "handle", $p_FLANNDLL, "str", " ")[0]

    Habe es nun wieder so geändert:

    Local Static $p_A = DllCall($h_KRNL32, "ptr", "GetProcAddress", "handle", $p_FLANNDLL, "str", "flann_find_nearest_neighbors")[0]

    Aber... ich bekomme trotzdem die gleiche Fehlermeldung wie karlgustavv .

    @@_Debug_line 40 var: $p_A --> 0x501F0510

    !>18:57:12 AutoIt3.exe ended.rc:-1073741819

    Zitat von AspirinJunkie

    Wo genau sollen die Typen nicht richtig sein?

    Code
    DllCallAddress("INT", $p_A, _                                                                  ;~ EXPORTED int flann_find_nearest_neighbors(
           "PTR", $t_DataSet[0], "INT", $t_DataSet[1], "INT", $t_DataSet[2], _                     ;~ float* dataset, int rows, int cols,
           "PTR", $t_TestSet[0], "INT", $t_TestSet[1], "PTR", DllStructGetPtr($p_indices), _       ;~ float* testset, int tcount, int* result,
           "PTR", DllStructGetPtr($p_dists), "INT", $nn, _                                         ;~ float* dists, int nn,
           "Ptr", DllStructGetPtr($p_DEFAULT_FLANN_PARAMETERS))                                    ;~ FLANNParameters* flann_params)

    Hm, schein soweit aber korrekt zu sein... (wenn ptr == float*)... aber auch so schmiert AutoIt trotzdem ab:

    https://docs.rs/flann-sys/0.1.…_neighbors.html

    Code
    DllCallAddress("INT", $p_A, _                                                                  ;~ EXPORTED int flann_find_nearest_neighbors(
           "float*", $t_DataSet[0], "INT", $t_DataSet[1], "INT", $t_DataSet[2], _                  ;~ float* dataset, int rows, int cols,
           "float*", $t_TestSet[0], "INT", $t_TestSet[1], "INT*", DllStructGetPtr($p_indices), _   ;~ float* testset, int tcount, int* result,
           "float*", DllStructGetPtr($p_dists), "INT", $nn, _                                      ;~ float* dists, int nn,
           "INT_PTR", DllStructGetPtr($p_DEFAULT_FLANN_PARAMETERS))                                ;~ FLANNParameters* flann_params)

    Evtl. stimmen die DEFAULT_FLANN_PARAMETERS nicht:

    https://docs.rs/flann-sys/0.0.…Parameters.html

    Code
    Global Const $tag_FLANNParameters = "struct;INT algorithm;INT checks;FLOAT cb_index;FLOAT eps;INT trees;INT leaf_max_size;INT branching;INT iterations;INT centers_init;FLOAT target_precision;FLOAT build_weight;FLOAT memory_weight;FLOAT sample_fraction;UINT table_number_;UINT key_size_;UINT multi_probe_level_;INT log_level;LONG random_seed;endstruct"
  • [Nim] und die BASS-Dll

    • Bitnugger
    • 28. Mai 2020 um 18:36
    Zitat von BugFix

    Ich würde eher dazu tendieren, Nicht-ANSI Zeichen in Dateinamen generell durch ANSI zu ersetzen.

    Ja, mit meinen Dateien mache ich das auch... bei Audio-Dateien mit Mp3tag.

    Ungeachtet dessen hätte ich trotzdem gerne die Möglichkeit, solche Dateien mit BASS abspielen zu können, zumal dies auch jeder mir bekannte Player kann.

    Wenn ich z.B. ein Script mit BASS für andere Leute schreibe, die mir Geld dafür geben, steht nicht BASS blöd da, sondern ich, wenn ich denen sage: Du musst deine Dateien umbenennen, weil mein Script nicht mit UTF-8-Zeichen im Dateipfad funktioniert.

  • [Nim] und die BASS-Dll

    • Bitnugger
    • 28. Mai 2020 um 10:15

    Moin,

    gestern hatte ich festgestellt, das BASS_StreamCreateFile mir einen Fehler beschert, wenn der Dateipfad UTF-8-Zeichen enthält: BASS_ERROR_FILEOPEN (2) = Datei nicht gefunden.

    Nach etlichen Stunden und ungezählten Versuchen, den String zu konvertieren, hatte ich dann entdeckt, dass ich bei BASS_StreamCreateFile ein BASS_UNICODE flag setzen kann... und dann fing der Ärger erst richtig an!

    http://www.un4seen.com/doc/#bass/BASS_StreamCreateFile.html

    BASS_UNICODE file is in UTF-16 form. Otherwise it is ANSI on Windows or Windows CE, and UTF-8 on other platforms.

    Was soll denn der Quatsch? Wieso UTF-8 nur für andere Plattformen und wieso trotz des Flags nur ANSI für Windows?

    Ich bekomme es einfach nicht hin, dass BASS_StreamCreateFile Dateien abspielt, die UTF-8-Zeichen im Dateipfad haben. Als Möglichkeit sehe ich hier, die Datei temporär umzubenennen... oder einen Hardlink zu erzeugen, der keine UTF-8-Zeichen enthält. Damit dies nicht für alle Dateipfade gemacht werden muss, müsste ich prüfen, ob UTF-8-Zeichen enthalten sind... das wäre das nächste Problem.

    Bei diesem Namen ist es mir aufgefallen: Louisa Johnson - Who’s Loving You.m4a

    Wer kann helfen?

  • [offen] Kompilieren für x86 ?

    • Bitnugger
    • 28. Mai 2020 um 05:58

    Wenn ich von hier die Versionen für x86 (nim-1.2.0_x32.zip, mingw32.7z) verwende, dann kann ich die dll mit deinen Parametern zwar erstellen, ohne dass gemeckert wird, aber es funktioniert dann trotzdem nicht in AutoIt, wenn #AutoIt3Wrapper_UseX64=n.

    Code
    C:\Users\ghost\NIM\@BugFix>nim c --app:lib --cpu:i386 -o:math32.dll math.nim
    Hint: used config file 'C:\Users\ghost\scoop\apps\nim\current\config\nim.cfg' [Conf]
    Hint: system [Processing]
    Hint: widestrs [Processing]
    Hint: io [Processing]
    Hint: math [Processing]
    CC: math.nim
    Hint:  [Link]
    Hint: 14222 LOC; 1.184 sec; 10.629MiB peakmem; Debug build; proj: C:\Users\ghost\NIM\@BugFix\math.nim; out: C:\Users\ghost\NIM\@BugFix\math32.dll [SuccessX]
    
    C:\Users\ghost\NIM\@BugFix>
    Alles anzeigen
  • DllStruct to bitmap

    • Bitnugger
    • 28. Mai 2020 um 03:05
    Zitat von Texos

    Danach werden die Pixel je nach Algorithmus durch andere ersetzt und dafür bräuchte ich eine Möglichkeit wie man jetzt auf einfachem Wege das Struct nochmals als gleicher Typ der Variable $tBitmapData neu zuweist.

    Was für ein Satz... habe ihn min. 10x gelesen und bin mir immer noch nicht sicher, ob ich ihn verstehe.

    Du willst die geänderten Pixel aus $tPixel nach $tBitmapData kopieren? Wieso änderst du sie nicht gleich in $tBitmapData?

    Ansonsten denke ich mal so:

    DllStructSetData($tBitmapData, "Scan0", DllStructGetData($tPixel)

    Zitat von Texos

    ImageSaveToStream bekomm ich nicht zum Laufen, zeigt alles schwarz an

    Ja super, mit dem Satz können wir jetzt auch unheimlich viel anfangen... aber ok, ich besorge mir schnellstmöglich eine Glaskugel und du schau dir inzwischen das Bsp. zu _GDIPlus_ImageSaveToStream in der Hilfe an. 8o

  • [Nim] paramStr() / getFileInfo() zickt rum...

    • Bitnugger
    • 27. Mai 2020 um 17:57
    Zitat von Oscar

    Es reicht: sPath[^1] == chr(34)

    Danke, das ist natürlich noch viel einfacher...

  • Speicheranzeige

    • Bitnugger
    • 27. Mai 2020 um 06:05
    Zitat von HansJ54

    Gibt es dazu eine Möglichkeit?

    Ja sicher, bestimmt auch zwei. 8o

    _WinAPI_GetProcessMemoryInfo

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™