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

Beiträge von vivus

  • DirectShow UDF für Webcam-capture

    • vivus
    • 13. Oktober 2011 um 21:19

    !!! WWAAUUU !! DANKE ! BugFix
    hab ich mir gleich mal gezogen ;)

    das andere hat auch seinen Zweck bisher erfüllt ;) .. wenn's mal läuft, dann läuft's ..

    haste vielleicht irgend wo noch ne Funktion, um das Live Bild zu drehen ( 90°) ? mach das sehr umständlich und unschön über die Zwischenablage "schäm"

    aber echt beide Daumen hoch, für dein Script !!

    ps: woher bekommst du denn die Binär Code's für die Icon'S ?

  • über autoit alle mappen in excel datei markieren und als pdf drucken

    • vivus
    • 13. Oktober 2011 um 21:11

    läst sich da nix in der #include <Excel.au3> finden ?

    z.b. _ExcelSheetActivate ???

  • Mit FF.au3 Form in Firefox anklicken

    • vivus
    • 13. Oktober 2011 um 21:06

    setz mal bitte die ff.au3 rein. dann guck ich mir des an ..

  • An Autoit beim Starten Werte mit geben

    • vivus
    • 6. Oktober 2011 um 08:00

    also du must beim aufruf deiner Exe die parameter mit geben.

    zum testen und verstehen ist es am einfachsten, wenn du eine Verknüpfungauf deine exe machst ..

    und dann auf einstellungen der Verknüpfung und hinter den link Werte setzt.

    z.b.
    "B:\AUTO IT\cmdline\test.exe" -1 -2

    ( -1) ist der erste und ( -2) der zweite parameter

    und in der exe hast du folgenden Code :

    Spoiler anzeigen
    [autoit]


    $var1 = $CMDLINE[1]
    $var2 = $CMDLINE[2]

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

    MsgBox(0,"gestartet",$var1 &" "&$var2)

    [/autoit]

    das war dann schon das ganze hexenwerk ..

    du wirst dann beim klicken auf die Verknüpfung eine Msgbox bekommen mit der Aussage | -1 -2 |

  • DirectShow UDF für Webcam-capture

    • vivus
    • 5. Oktober 2011 um 10:09

    ich hab dazu nur das in den archiven meines rechners gefunden ..

    Spoiler anzeigen
    [autoit]

    ;credit http://www.autoit.de/index.php?page…B+70#post100341

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

    ;by Unicom for http://www.Autoit.de
    ;tested for AutoIT 3.3.0.0
    ;Demonstrations of Movement Detection via Webcam
    ;First displayed number value represents degree of change between two succeeding images
    ;Second value is maximum change of a single pixel in the image between two succeeding images
    ;Quit by pressing "End" - Button

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

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>

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

    _GDIPlus_Startup()

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

    $Gridstep=50 ;Abstand zwischen den Pixeln zum Abtasten

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

    $sensitivity = 15 ;Empfindlichkeit

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

    $gui_x=@DesktopWidth-(@DesktopWidth/8)
    $gui_y=@DesktopHeight-(@DesktopHeight/8)

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

    $width=$gui_x

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

    $cam_xlength=(1.3*($width/2)-(2*($width/20)));300 ;Breite (1.3*($width/2)-(2*($width/20)))
    $cam_ylength=( $width/2)-(2*($width/20));300 ;Höhe ( $width/2)-(2*($width/20))

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

    HotKeySet("{END}", "Quit");
    HotKeySet("{INSERT}", "SnapShot")

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

    $snapfile1 = @ScriptDir & "\scrshot1.bmp"

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

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

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

    AutoIt Version: 3.2.11.7 (beta)
    thnx to rysiora with his great example!
    Author: Ludocus

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

    Script Function:
    Webcam Udf

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

    #ce ----------------------------------------------------------------------------
    #include-once
    $WM_CAP_START = 0x400
    $WM_CAP_UNICODE_START = $WM_CAP_START +100
    $WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
    $WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
    $WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
    $WM_CAP_ABORT = $WM_CAP_START + 69
    $WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
    $WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
    $WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
    $WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
    $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10
    $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11
    $WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14
    $WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12
    $WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
    $WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
    $WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
    $WM_CAP_EDIT_COPY = $WM_CAP_START + 30
    $WM_CAP_END = $WM_CAP_UNICODE_END
    $WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
    $WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
    $WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
    $WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
    $WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
    $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
    $WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
    $WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
    $WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
    $WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
    $WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
    $WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
    $WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
    $WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
    $WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
    $WM_CAP_GET_STATUS = $WM_CAP_START + 54
    $WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
    $WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
    $WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
    $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
    $WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
    $WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
    $WM_CAP_PAL_OPENA = $WM_CAP_START + 80
    $WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
    $WM_CAP_PAL_PASTE = $WM_CAP_START + 82
    $WM_CAP_SEQUENCE = $WM_CAP_START + 62
    $WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
    $WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
    $WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
    $WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
    $WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
    $WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
    $WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
    $WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
    $WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
    $WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
    $WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
    $WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
    $WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
    $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
    $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
    $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
    $WM_CAP_SET_SCALE = $WM_CAP_START + 53
    $WM_CAP_SET_SCROLL = $WM_CAP_START + 55
    $WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
    $WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
    $WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
    $WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
    $WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
    $WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
    $WM_CAP_STOP = $WM_CAP_START + 68

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

    $avi = DllOpen("avicap32.dll")
    $user = DllOpen("user32.dll")

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

    $gui_name="Webcam UDF Test"

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

    $gui = GUICreate($gui_name,$gui_x,$gui_y)

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

    ;$label1=GUICtrlCreateLabel("Delta",50,400,150,420)
    ;$label2=GUICtrlCreateLabel("Max",150,400)
    ;$label3=GUICtrlCreateLabel("Max",75,420,250)

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

    ;Dim $red[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]
    ;Dim $green[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]
    ;Dim $blue[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]

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

    $WebcamID = _WebcamOpen($gui, 20, 20, $cam_xlength, $cam_ylength)

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

    GUISetState(@SW_SHOW)
    ;$changeold=0

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

    While 1

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($gui)

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

    ;FileCopy(@ScriptDir & "\scrshot1.bmp",@ScriptDir & "\using.bmp")

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

    $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\using.bmp")
    $iWidth = _GDIPlus_ImageGetWidth($hImage) * 96 / _GDIPlus_ImageGetVerticalResolution($hImage)
    $iHeight = _GDIPlus_ImageGetHeight($hImage) * 96 / _GDIPlus_ImageGetHorizontalResolution($hImage)

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

    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, 1200, 500)

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

    _GDIPlus_MatrixRotate($hMatrix, 270, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, -$iWidth / 2, -$iHeight / 2)

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

    Sleep(10)

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

    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()

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

    ;FileDelete(@ScriptDir & "\using.bmp")

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

    ;$pos=WinGetPos ( $gui_name ) ;Farbwerte der Cam werden direkt vom Screen ausgelesen
    ;$xpos=$pos[0] ;dazu wird das direkt angezeigte Bild
    ;$ypos=$pos[1] ;abgefragt
    ;$count=0

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

    ;$change=0
    ;$tempchange=0
    ;$changemax=0

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

    ;For $x_scan = 1 to $cam_xlength Step $Gridstep
    ;For $y_scan = 1 to $cam_ylength Step $Gridstep

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

    ;$count=$count+1 ;Counter für abgetastete Pixel

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

    ;$farbe=PixelGetColor(2+$x_scan+$xpos,21+$y_scan+$ypos)
    ;$redc=BitAND($farbe, 0xFF0000) / 16^4
    ;$greenc=BitAND($farbe, 0x00FF00) / 16^2
    ;$bluec=BitAND($farbe, 0x0000FF)

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

    ;$change_red=$red[$count]-$redc
    ;$change_green=$green[$count]-$greenc
    ;$change_blue=$blue[$count]-$bluec

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

    ;$tempchange=Abs($change_red)+Abs($change_green)+Abs($change_blue)

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

    ;$change+=$tempchange
    ;If $changemax<$tempchange Then $changemax=$tempchange

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

    ;$red[$count]=$redc
    ;$green[$count]=$greenc
    ;$blue[$count]=$bluec

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

    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
    _WebcamClose($WebcamID)
    Exit
    EndIf
    ;Next
    ;Next

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

    ;$change=$change/$count

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

    ;GUICtrlSetData($label1,int($change))
    ;GUICtrlSetData($label2,$changemax)

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

    ;$diff=abs($change-$changeold)

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

    ;Hier können Anweisungen kommen wie "if $diff>50 then snapshot" folgen
    ;
    ;z.B.:

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

    ;Select
    ;Case $diff <$sensitivity
    ; GUICtrlSetData($label3,"none")

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

    ;Case $diff > $sensitivity AND $diff<=$sensitivity*2
    ; GUICtrlSetData($label3,"slight")
    ;Case $diff > 2*$sensitivity AND $diff<=$sensitivity*4
    ; GUICtrlSetData($label3,"medium")
    ;Case $diff > 4*$sensitivity
    ; GUICtrlSetData($label3,"high")
    ;EndSelect

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

    ;$changeold=$change
    ; Sleep(100)
    WEnd

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

    Func SnapShot()
    ;MsgBox(0,"Snapshot","press ok")
    _WebcamSnap($WebcamID, $snapfile1)

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

    EndFunc

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

    Func Quit()
    _WebcamClose($WebcamID)

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

    Exit
    EndFunc

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

    ;===============================================================================
    ;
    ; Description: Open's a webcam preview screen in your gui
    ; Syntax: _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight)
    ; Parameter(s): $sHwnd - The handle of the gui
    ; $sLeft - Left coord. of the preview screen
    ; $sTop - Top coord. of the preview screen
    ; $sWidth - Width of the preview screen
    ; $sHeight - Height of the preview screen
    ; Requirement(s): A webcam
    ; Return Value(s): On Success - Returns id needed for other controls
    ; On Failure - Returns -1
    ; Author(s): Ludocus
    ; Note(s): None
    ;
    ;===============================================================================
    func _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight)
    $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", $sLeft, "int", $sTop, "int", $sWidth, "int", $sHeight, "hwnd", $sHwnd, "int", 1)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
    if @error then return -1
    return $cap[0]
    EndFunc

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

    ;===============================================================================
    ;
    ; Description: Creates a Snapshot from a webcam
    ; Syntax: _WebcamSnap($sId, $sFile)
    ; Parameter(s): $sId - Id (returned from _WebcamOpen)
    ; $sFile - File to save the snapshot to (*.bmp)
    ; Requirement(s): A webcam
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; Author(s): Ludocus
    ; Note(s): None
    ;
    ;===============================================================================
    Func _WebcamSnap($sId, $sFile)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $sFile)
    if @error Then
    return 0
    Else
    return 1
    EndIf
    EndFunc

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

    ;===============================================================================
    ;
    ; Description: Closes the preview screen created with _WebcamOpen
    ; Syntax: _WebcamClose($sId)
    ; Parameter(s): $sId - Id (returned from _WebcamOpen)
    ; Requirement(s): A webcam
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; Author(s): Ludocus
    ; Note(s): None
    ;
    ;===============================================================================
    Func _WebcamClose($sId)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_END, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
    DllClose($user)
    if @error Then
    return 0
    Else
    return 1
    EndIf
    EndFunc

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

    ;===============================================================================
    ;
    ; Description: Starts recording the webcam to a file
    ; Syntax: _WebcamRecordStart($sFile, $sId)
    ; Parameter(s): $sId - Id (returned from _WebcamOpen)
    ; $sFile - File to save the movie to (*.avi)
    ; Requirement(s): A webcam
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; Author(s): Ludocus
    ; Note(s): Stop recording by: _WebcamRecordStop($Id)
    ;
    ;===============================================================================
    #cs
    Func _WebcamRecordStart($sFile, $sId)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $sFile)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0)
    if @error Then
    return 0
    Else
    return 1
    EndIf

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

    EndFunc

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

    ;===============================================================================
    ;
    ; Description: Stops recording.
    ; Syntax: _WebcamRecordStop($sId)
    ; Parameter(s): $sId - Id (returned from _WebcamOpen)
    ; Requirement(s): A webcam
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; Author(s): Ludocus
    ; Note(s): None
    ;
    ;===============================================================================
    Func _WebcamRecordStop($sId)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_STOP, "int", 0, "int", 0)
    if @error Then
    return 0
    Else
    return 1
    EndIf
    EndFunc ;==> _WebcamRecordStop

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

    #ce

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Hat jemand eine Siemens LOGO! Zuhause im Einsatz?

    • vivus
    • 4. Oktober 2011 um 13:03

    dann ist der code ja wieder nicht öffentlich .. ist ja nicht sinn der Übung ..

  • Hat jemand eine Siemens LOGO! Zuhause im Einsatz?

    • vivus
    • 4. Oktober 2011 um 12:21

    uuii !! das hört sich gut an !

    kannst mal mit dem Code raus rücken ?

    hab n paar Logo Versionen hier rum liegen.

    für die RCE ( 0BA7 ) haste nicht rein zufällig was im petto ?

  • LibNoDave-UDF zur Kommunikation mit Simatic SPS

    • vivus
    • 8. September 2011 um 08:06

    ja das hast du ja geschrieben , dass deine alte demo nicht mehr funktioniert....

    aber ich habe deinen "neuen" spoiler genommen .. nicht die alte demo ..

    die variable ist nicht initialisiert ..

    kann es sein, dass du eine *.au3 vergessen hast bei zu legen ? in der alle nicht definierten variablen einen wert zugweisen bekommen ?

    ... mir fehlen folgende :

    $Socket_SPS1, $di_SPS1, $dc_SPS1

  • LibNoDave-UDF zur Kommunikation mit Simatic SPS

    • vivus
    • 6. September 2011 um 08:21

    also mit deinem neuen Spoiler ( demo ) bekomme ich immer einen error von deiner UDF.

    [autoit]

    Func _daveReadBit(ByRef $dc, $iArea, $iDB, $iByte, $iBit)
    Local $Buffer = DLLStructCreate("BYTE buffer[1]")
    $aRet = DllCall($hDLL_LibNoDave, "int", "daveReadBits", "ptr", $dc, "int", $iArea, "int", $iDB, "int", $iStart, "int", $iByte * 8 + 1, "ptr", DllStructGetPtr($Buffer, 'buffer'))
    Return DllStructGetData($Buffer, 1, 1)
    EndFunc

    [/autoit]
    Zitat

    LibNoDave.au3(547,112) : WARNING: $iStart: possibly used before declaration.
    $aRet = DllCall($hDLL_LibNoDave, "int", "daveReadBits", "ptr", $dc, "int", $iArea, "int", $iDB, "int", $iStart,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    \LibNoDave.au3(547,112) : ERROR: $iStart: undeclared global variable.
    $aRet = DllCall($hDLL_LibNoDave, "int", "daveReadBits", "ptr", $dc, "int", $iArea, "int", $iDB, "int", $iStart,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    LibNoDave.au3 - 1 error(s), 1 warning(s)
    !>08:17:04 AU3Check ended.rc:2
    >Running:(3.3.6.1):C:\Programme\AutoIt3\autoit3.exe "C:LibNoDave.au3"
    +>08:18:06 AutoIT3.exe ended.rc:0
    >Exit code: 0 Time: 63.200

    Alles anzeigen
  • PDF erstellen + zusammenfügen

    • vivus
    • 27. Juni 2011 um 14:18

    such mal die PrintMG.dll

    da gibt's ne udf dafür ..

    hier ne kopie ::

    Spoiler anzeigen
    [autoit]


    ; UDF for printing using printmg.dll

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

    #include-once

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

    Const $fpbold = 1, $fpitalic = 2, $fpunderline = 4, $fpstrikeout = 8;
    Const $sUDFVersion = 'PrintMG.au3 V2.64'

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

    ;V2 add missing '$fPrinterOpen = false' to _PrintDllClose
    ; added style to SetFont
    ; added GetTextHeight, GetTextWidth, Line
    ;V2.1 added _PrintImage
    ;V2.2 added _printEllipse, _PrintArc, _PrintPie
    ;V2.3 fix error in _PrintRectangle
    ; comment in _PrintPageOrientation added to reflect new behaviour of dll
    ; which now ignores orientation if printing started and returns -2
    ;V2.4 Added _PrintSelectPrinter. Needs printmg.dll V2.42 or later
    ;V2.45 Added _PrinGetPrinter. Needs printmg.dll V2.45 or later
    ;V2.6 Added _PrintListPrinters. Needs printmg.dll V2.46
    ;V2.61 Added _PrintRoundedRectangle to have 2 extra parameters for rounded corners
    ;V2.62 Added _PrintSetTitle
    ;V2.63 Add $vPath parameter to _PrintDllStart. Thanks to ChrisL
    ;V2.64 Add _PrintBytesDirect thanks to DeDeep00
    ;V2.65 Add PrintImageFromDC thanks to YellowLab
    ;V2.66 Add _PrintGetPaperHeight, _PrintGetPaperWidth. Needs dll V2.52 or later
    #cs
    AutoIt Version: 3.2.3++

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

    Description: Functions for printing using printmg.dll

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

    Functions available:
    _PrintVersion
    _PrintDllStart
    _PrintDllClose
    _PrintSetPrinter
    _PrintGetPageWidth
    _PrintGetPageHeight
    _PrintGetHorRes
    _PrintGetVertRes
    _PrintStartPrint
    _PrintSetFont
    _PrintNewPage
    _PrintEndPrint
    _PrintText
    _PrintGettextWidth
    _PrintGetTextHeight
    _PrintLine
    _PrintGetXOffset
    _PrintGetYOffset
    _PrintSetLineCol
    _PrintSetLIneWid
    _PrintImage
    _PrintEllipse
    _PrintArc
    _PrintPie
    _PrintRectangle
    _PrintGetPageNumber
    _PrintPageOrientation
    _PrintSelectPrinter
    _PrintGetPrinter
    _printListPrinters
    _PrintBytesDirect
    _PrintImageFromDC
    Author: Martin Gibson

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

    #ce

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

    ;PrintVersion
    ;parameters - $type
    ;returns
    ; on success - if $type = 1 returns version of printmg.dll on success And @error =0
    ; - If $type <> 1 Returns version of this UDF and @error = 0
    ; on failure - empty String and @error set to 1
    Func _PrintVersion($hDll, $type)
    If $type <> 1 Then Return $sUDFVersion

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

    $vDllAns = DllCall($hDll, 'str', 'version');
    If @error = 0 Then
    Return $vDllAns[0]
    Else
    SetError(1)
    Return ''
    EndIf

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

    EndFunc ;==>_PrintVersion

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

    ;_PrintGetPrinter
    ;parameters - $hDll a handle to the dll obtained from _PrintDllStart
    ;returns on success a string with the printer name to be used
    ; if no printer then returns an empty string
    ; on failure an empty string and @error is set to 1
    ;Requirements - Needs printmg.dll V2.44 or later
    ;
    ;Remarks Can be used to check the result of _PrintSelectPrinter
    Func _PrintGetPrinter($hDll)
    $vDllAns = DllCall($hDll, 'str', 'GetPrinterName');
    If @error = 0 Then
    Return $vDllAns[0]
    Else
    SetError(1)
    Return ''
    EndIf

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

    EndFunc ;==>_PrintGetPrinter

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

    ;aborts printing
    ;returns 0 on success
    ;returns -1 if not already printing
    ;returns -2 if could not execute the dll call
    Func _PrintAbort($hDll)
    $vDllAns = DllCall($hDll, 'int', 'AbortPrint');
    If @error = 0 Then
    Return $vDllAns[0]
    Else
    Return -2
    EndIf

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

    EndFunc ;==>_PrintGetPrinter

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

    ;===============================================================================
    ; Function Name: _PrintBytesDirect

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

    ; Description: Sends the bytes from array $aData directly to the printer
    ; Parameters: $aData array of bytes to be sent the first byte is $aBata[0]
    ;
    ;==============================================================================
    Func _PrintBytesDirect($hDll, $sPrinter,$aData)
    If Not IsArray($aData) Then Return -1;error
    Local $n, $iNum = UBound($aData)
    Local $structCodes = DllStructCreate("byte[" & $iNum & "]")
    Local $pData = DllStructGetPtr($structCodes)

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

    For $n = 1 To $iNum
    DllStructSetData($structCodes, $n, $aData[$n - 1])
    Next

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

    $vDllAns = DllCall($hDll, 'int', 'PrintBytesDirect', 'str',$sPrinter, 'ptr', $pData, 'int', $iNum)
    Return $vDllAns[0]
    EndFunc ;==>_PrintBytesDirect

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

    ;PrintDllStart
    ;opens the dll. Use PrintDllClose to close the dll
    ;by using PrintDllStart the settings made in other functions will be valid
    ;parameters - $sErr a string to hold the error message if any
    ; - $vPath the full patyh to the printmg.dll. If not given then the dll must be
    ; in the csript folder or one of the folders searched by Windopws
    ;returns
    ; handle to the dll on success - $sErr is empty string And @error =0
    ; the handle must be used in all other calls
    ; -1 on failure , and @error set to -1 and $sErr contains an error message
    Func _PrintDllStart(ByRef $sErr, $vPath = 'printmg.dll')

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

    $hDll = DllOpen($vPath)
    If $hDll = -1 Then
    SetError(1)
    $sErr = 'Failed to open ' & $vPath
    Return -1;failed
    EndIf

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

    Return $hDll;ok

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

    EndFunc ;==>_PrintDllStart

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

    ;PrintDllClose
    ;closes the dll. Use PrintDllClose to open the dll
    ;by using PrintDllStart the settings made in other functions will remain valid for other functions
    ;parameters - $hDll a handle to the dll obtained from _PrintDllStart
    ;returns
    ; 0 on success - @error =0
    ; on failure
    ; -1 if $hDll is invalid
    ; -2 if could not execute _PrintDllClose
    ;NB script will terminate if it fails to close printmg.dll

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

    Func _PrintDllClose($hDll)
    If $hDll = -1 Then Return -1

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

    $vDllAns = DllCall($hDll, 'int', 'ClosePrinter');
    If @error <> 0 Then Return -2
    DllClose($hDll)
    Return 0
    EndFunc ;==>_PrintDllClose

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

    ;_PrintSetPrinter
    ;parameters - $hDll a handle to the dll obtained from _PrintDllStart
    ;Brings up a dialog box for choosing the printer
    ;returns
    ; 1 if printer chosen success
    ; 0 if printer selection cancelled
    ; -1 if failed
    Func _PrintSetPrinter($hDll)
    $vDllAns = DllCall($hDll, 'int', 'SetPrinter')
    If @error = 0 Then
    Return $vDllAns[0]
    Else
    Return -1
    EndIf

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

    EndFunc ;==>_PrintSetPrinter

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

    ;
    ;selects the printer to use
    ;
    ;parameters - $hDll a handle to the dll obtained from _PrintDllStart
    ; - printer name as in WIndows printer list
    ;returns
    ; 1 if printer chosen success -
    ; -1 if failed
    ;Requirements - Needs printmg.dll V2.42 or later
    ;NB selction does not alter the default printer but selects $PrinterName for the
    ; current print job.
    ; _PrintGetPrinter will return the selected printer and can be used to
    ; check the result of _PrintSelectPrinter
    Func _PrintSelectPrinter($hDll, $PrinterName)
    $vDllAns = DllCall($hDll, 'int', 'SelectPrinter', 'str', $PrinterName)
    If @error = 0 Then
    Return $vDllAns[0]
    Else
    Return -1
    EndIf

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

    EndFunc ;==>_PrintSelectPrinter

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

    ;_PrintGetHorRes
    ;parameters - $hDll, the handle for printmg.dll
    ;returns no of pixels across printer page and @error = 0
    ;
    ;on failure returns -1 and @error = 1
    Func _PrintGetHorRes($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetHorRes')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    EndFunc ;==>_PrintGetHorRes

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

    ;_PrintGetVertRes
    ;parameters - $hDll, the handle for printmg.dll
    ;returns no of pixels down printer page and @error = 0
    ;
    ;on failure returns -1 and @error = 1
    Func _PrintGetVertRes($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetVertRes')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetVertRes

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

    ;_PrintSetBrushCol
    ;parameters - $hDll, the handle for printmg.dll
    ; %bcol the colour for the brush ie the color used for filling enclosed shapes
    ;returns 1 on success and @error - 0
    ; -1 on failure And @error = 1
    Func _PrintSetBrushCol($hDll, $bcol)
    $vDllAns = DllCall($hDll, 'int', 'SetBrushCol', 'int', $bcol)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintSetBrushCol

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

    ;_PrintEllipse
    ;parameters - $hDll a handle to the dll obtained from _PrintDllStart. $iTopx,$iTopy,$iBotX,$iBotY explained below
    ;prints an enclosed (ie full) ellipse in the current line colour amd width, filled with the current brush colour
    ; ellipse is drawn on the rectangle $iTopx,$iTopy at the top left, $iBotx,$iBoty at the bottom right
    ;if the rectangle is a square then the ellipse is a circle
    ;returns 1 on success and @error - 0
    ; -1 on failure And @error = 1
    Func _PrintEllipse($hDll, $iTopx, $iTopy, $iBotX, $iBotY)
    $vDllAns = DllCall($hDll, 'int', 'Ellipse', 'int', $iTopx, 'int', $iTopy, 'int', $iBotX, 'int', $iBotY)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    EndFunc ;==>_PrintEllipse

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

    ;_PrintRectangle
    ;prints an enclosed rectangle in the current line colour amd width, filled with the current brush colour
    ;returns 1 on success and @error - 0
    ; -1 on failure And @error = 1
    Func _PrintRectangle($hDll, $iTopx, $iTopy, $iBotX, $iBotY)
    $vDllAns = DllCall($hDll, 'int', 'Rectangle', 'int', $iTopx, 'int', $iTopy, 'int', $iBotX, 'int', $iBotY)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    EndFunc ;==>_PrintRectangle

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

    ;_PrintRoundedRectangle
    ;prints an enclosed rectangle in the current line colour amd width, filled with the current brush colour
    ;if $Icornerx and $iCornery are both greater than zero the cornes will be elliptical curves with height $iCornery and width $iCornerx.
    ;(This means the full ellipse would have height $iCornery * 2, width $iCornerx * 2)
    ; If both $iCornerx and $iCornery are zero then this function is equivalent to _PrintRectangle
    ;returns 1 on success and @error - 0
    ; -1 on failure And @error = 1
    Func _PrintRoundedRectangle($hDll, $iTopx, $iTopy, $iBotX, $iBotY, $iCornerx = 0, $iCornery = 0)
    $vDllAns = DllCall($hDll, 'int', 'RoundedRectangle', 'int', $iTopx, 'int', $iTopy, 'int', $iBotX, 'int', $iBotY, 'int', $iCornerx, 'int', $iCornery)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    EndFunc ;==>_PrintRoundedRectangle

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

    ;_PrintPie
    ;prints an enclosed ie elliptical segment in the current line colour amd width, filled with the current brush colour
    ; ellipse is drawn on the rectangle $iTopx,$iTopy at the top left, $iBotx,$iBoty at the bottom right
    ;if the rectangle is a square then the ellipse is a circle
    ;the start of the ellipse is at the point where the line from the centre of the rectangle through the point $iAx,$iAy
    ; intersects the ellipse. The ellipse is drawn clockwise untill the point is reached where the line from the centre
    ; of the rectangle through the point $iAx,$iAy intersects the ellipse.
    ;If the end point is also the start point then a full ellipse is drawn.
    ;if the rectangle is a square then the ellipse is a circle
    ;returns 1 on success and @error - 0
    ; -1 on failure And @error = 1
    Func _PrintPie($hDll, $iTopx, $iTopy, $iBotX, $iBotY, $iAx, $iAy, $iBx, $iBy)
    $vDllAns = DllCall($hDll, 'int', 'Pie', 'int', $iTopx, 'int', $iTopy, 'int', $iBotX, 'int', $iBotY, 'int', $iAx, 'int', $iAy, 'int', $iBx, 'int', $iBy)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintPie

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

    ;_PrintArc
    ;prints an enclosed ie elliptical arc in the current line colour amd width.
    ; ellipse is drawn on the rectangle $iTopx,$iTopy at the top left, $iBotx,$iBoty at the bottom right
    ;if the rectangle is a square then the ellipse is a circle
    ;the start of the ellipse is at the point where the line from the centre of the rectangle through the point $iAx,$iAy
    ; intersects the ellipse. The ellipse is drawn clockwise untill the point is reached where the line from the centre
    ; of the rectangle through the point $iAx,$iAy intersects the ellipse.
    ;If the end point is also the start point then a full ellipse is drawn.
    ;if the rectangle is a square then the ellipse is a circle
    ;returns 1 on success and @error - 0
    ; -1 on failure And @error = 1
    Func _PrintArc($hDll, $iTopx, $iTopy, $iBotX, $iBotY, $iAx, $iAy, $iBx, $iBy)
    $vDllAns = DllCall($hDll, 'int', 'Arc', 'int', $iTopx, 'int', $iTopy, 'int', $iBotX, 'int', $iBotY, 'int', $iAx, 'int', $iAy, 'int', $iBx, 'int', $iBy)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintArc

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

    ;_PrintGetPageHeight
    ;parameters - $hDll, the handle for printmg.dll
    ;returns page height in tenths of a millimetre and @error = 0
    ;The page ht is the printable ht
    ;on failure returns -1 and @error = 1
    ;Related: _PrintGetPaperHeight
    Func _PrintGetPageHeight($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetPageHeight')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetPageHeight

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

    ;_PrintGetPaperHeight
    ;parameters - $hDll, the handle for printmg.dll
    ;returns physical paper height in tenths of a millimetre and @error = 0
    ;The page ht is the printable ht which will not be greater than the paper ht
    ;on failure returns -1 and @error = 1
    Func _PrintGetPaperHeight($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetPaperHeight')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetPaperHeight

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

    ;_PrintGetPageWidth
    ;parameters - $hDll, the handle for printmg.dll
    ;returns page width in tenths of a millimetre and @error = 0
    ;The page width is the printable width
    ;on failure returns -1 and @error = 1
    Func _PrintGetPageWidth($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetPageWidth')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetPageWidth

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

    ;_PrintGetPaperWidth
    ;parameters - $hDll, the handle for printmg.dll
    ;returns physical paper width in tenths of a millimetre and @error = 0
    ;The page width is the printable width which will not be more than the paper width
    ;on failure returns -1 and @error = 1
    Func _PrintGetPaperWidth($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetPaperWidth')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetPaperWidth

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

    ;_PrintStartPrint
    ;initialises the printer ready to print.
    ;Must be called before any printing functions
    ;parameters - $hDll, the handle for printmg.dll
    ;returns 1 on success and @error = 0
    ;
    ;on failure returns -1 and @error = 1
    Func _PrintStartPrint($hDll)
    $vDllAns = DllCall($hDll, 'int', 'PrinterBegin')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintStartPrint

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

    ;_PrintGetPageNumber
    ;Returns the current page number
    ;Can be used to see if printing has been started with _PrintBeginDoc
    ;parameters - $hDll, the handle for printmg.dll
    ;returns 0 if not printing
    ; the page number if printing in progress ie the page being
    ; created which is not the page actually being printed.
    ;on success @error = 0
    ;on failure returns -1 and @error = 1
    Func _PrintGetPageNumber($hDll)
    $vDllAns = DllCall($hDll, 'int', 'GetPageNumber')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetPageNumber

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

    ;_PrintEndPrint
    ;Ends the printing operations
    ;parameters - $hDll, the handle for printmg.dll
    ;returns 1 on success and @error = 0
    ;
    ;on failure returns -1 and @error = 1
    Func _PrintEndPrint($hDll)
    $vDllAns = DllCall($hDll, 'int', 'PrinterEnd')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    EndFunc ;==>_PrintEndPrint

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

    ;_PrintNewPage
    ;ends the last page; any further printing will be done on the next page
    ;parameters - $hDll, the handle for printmg.dll
    ;returns 1 on success and @error = 0
    ;
    ;on failure returns -1 and @error = 1
    ;if you use this function there will be another page printed even if it is blank!
    Func _PrintNewPage($hDll)
    $vDllAns = DllCall($hDll, 'int', 'NewPage')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    EndFunc ;==>_PrintNewPage

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

    ;_PrintSetFont
    ;Parameters
    ; $hDll handle to the printmg.dll
    ; $FontName the font to use in any later _PrintText functions
    ; $FontSize the size of the font
    ; $FontCol the colour of the font, defaults to 0 (black). -1 is taken as the default colour.
    ; $Fontstyle String which contains any of 'bold', 'underline', 'italic', 'strikeout'
    ; In any Order and case independant
    ; default is '' which means regular
    ; a value for $FontCol must be given if $FontStyle is used.
    Func _PrintSetFont($hDll, $FontName, $FontSize, $FontCol = 0, $Fontstyle = '')
    Local $iStyle = 0

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

    If $FontCol = -1 Then $FontCol = 0
    If $Fontstyle = -1 Then $Fontstyle = ''
    If $Fontstyle <> '' Then
    If StringInStr($Fontstyle, "bold", 0) Then $iStyle = 1
    If StringInStr($Fontstyle, "italic", 0) Then $iStyle += 2
    If StringInStr($Fontstyle, "underline", 0) Then $iStyle += 4
    If StringInStr($Fontstyle, "strikeout", 0) Then $iStyle += 8
    EndIf

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

    $vDllAns = DllCall($hDll, 'int', 'SetFont', 'str', $FontName, 'int', $FontSize, 'int', $FontCol, 'int', $iStyle)
    Return $vDllAns[0]
    EndFunc ;==>_PrintSetFont

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

    ;_PrintImage
    ;Parameters
    ; $hDll handle to the printmg.dll
    ; $sImagePath full path to prints bmp, jpg or ico file to print
    ; $TopX,$TopY, the x,y coords of the top left corner of the rectangle to print in
    ; $wid is the width of the rectangle to print the image in
    ; $ht is the height of the rectangle to print the image in
    ; all dims in tenths of mm
    ;returns 1 on success and @error = 0
    ; on error @error = 1 and value returned is -1 if error calling dll
    ; -2 If file not found
    ; -3 if file is not jpg or bmp
    ; -4 if unsupported icon file
    ;NB File type is determined purely by file extension ie .bmp or .jpg or .ico
    Func _PrintImage($hDll, $sImagePath, $TopX, $TopY, $wid, $ht)
    $vDllAns = DllCall($hDll, 'int', 'Image', 'str', $sImagePath, 'int', $TopX, 'int', $TopY, 'int', $wid, 'Int', $ht)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintImage

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

    ;_PrintImageFromDC
    ;Parameters
    ; $hDC handle to a bitmap
    ; $TopX,$TopY, the x,y coords of the top left corner of the bitmap to copy from
    ; $wid,$ht the width and ht of the rectangle to copy from the bitmap
    ; $PrintX,$PrintY the topleft corner on the page for the picture in units of 0.1mm
    ; $printWId, $PrintHt the width and height of the image on the paper in units of 0.1mm
    ;returns 1 on success and @error = 0
    ; on error @error = 1 and value returned is -1 if error calling dll

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

    Func _PrintImageFromDC($hDll, $hDC, $TopX, $TopY, $wid, $ht,$printTopX, $printTopY, $printWidth, $printHeight)
    ;_PrintImageFomDC($hDll, $hDC, $TopX, $TopY,$Width, $Height,$PrintTopX,$PrintTopY,$PrintWidth,$PrintHeight)
    $vDllAns = DllCall($hDll, 'int', 'ImageFromHandle', 'hwnd', $hDC, 'int', $TopX, 'int', $TopY, 'int', $wid, 'Int', $ht,'Int', $PrintTopX,'Int', $PrintTopY,'Int', $PrintWidth,'Int', $PrintHeight)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintImage

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

    ;_PrintPageOrientation
    ;sets printer to portrait or landscape
    ;parameters
    ; $hDll handle to the printmg.dll
    ; $iPortrait = 1 to set portrait (default)
    ; = 0 to set landscape
    ;returns 1 on success and @error = 0
    ; -2 if printing has been started and orientation cannot be changed
    ; (_PrintStartPrint starts printing even if nothing has been sent to print.)
    ;NB File type is determined purely by file extension ie .bmp or .jpg or .ico
    Func _PrintPageOrientation($hDll, $iPortrait = 1)
    $vDllAns = DllCall($hDll, 'int', 'Portrait', 'int', $iPortrait)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1
    ConsoleWrite("ppoend" & @CRLF)
    EndFunc ;==>_PrintPageOrientation

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

    ;_PrintText
    ;prints the text $sText at position $ix,$iy at an angle $iAngle using the last set font, size,style and colour.
    ;$ix and $iy are in units of 0.1 mm i.e $ix=476 for 47.6mm
    ;for inches multiply by 25.4 i.e. $ix=254 for one inch
    ;returns 1 on success and @error = 0
    ; -1 on failure
    ;parameters
    ; $hDll handle to the printmg.dll
    ; $sText the string to print on the line starting at $ix,$iy
    ; $iAngle in degrees. 0 = default ie normal left to right, 90 = vertically up, 270 = vertically down
    ; 180 degrees bug which is overcome by changing 180 to 179 until solution found
    ;To check that the text will fit a space use _PrintGEtTextHeight and _PrintGetTextWidth
    Func _PrintText($hDll, $sText, $ix = -1, $iy = -1, $iAngle = 0)
    If $iAngle = 180 Then
    $iAngle = 179; 180 doesn't work so maybe this won't get noticed
    EndIf

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

    $vDllAns = DllCall($hDll, 'int', 'printText', 'str', $sText, 'int', $ix, 'int', $iy, 'int', $iAngle)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintText

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

    ;_PrintGetXOffset
    ;gets the width of a margin at the side side of the page in tenths of mm which will cannot be printed on.
    ; can be 0 for some printers.
    ;paramter $dDll handle to the printmg.dll
    Func _PrintGetXOffset($hDll)
    Local $vDllAns = DllCall($hDll, 'int', 'GetXOffset')
    If @error = 0 Then
    Return $vDllAns[0];tenths of mm
    EndIf
    SetError(1)
    Return -1
    EndFunc ;==>_PrintGetXOffset

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

    ;_PrintGetYOffset
    ;gets the heigth of a margin at the top of the page in tenths of mm which will cannot be printed on.
    ; can be 0 for some printers.
    ;paramter $dDll handle to the printmg.dll
    Func _PrintGetYOffset($hDll)
    Local $vDllAns = DllCall($hDll, 'int', 'GetYOffset')
    If @error = 0 Then Return $vDllAns[0];tenths of mm
    SetError(1)
    Return -1
    EndFunc ;==>_PrintGetYOffset

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

    ;_PrintGetTextWidth
    ;parameters - $hDll, the handle for printmg.dll
    ; $sWText the text to find the width for
    ;returns on success the width in tenths of mm taken by the text if printed using the current font settings.
    ; and @error = 0
    ;
    ; on failure returns -1 and @error = -1
    Func _PrintGetTextWidth($hDll, $sWText)

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

    Local $vDllAns = DllCall($hDll, 'int', 'TextWidth', 'str', $sWText)
    If @error = 0 Then Return $vDllAns[0];tenths of mm
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetTextWidth

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

    ;_PrintGetTextHeight
    ;parameters - $hDll, the handle for printmg.dll
    ;returns on success the height in tenths of mm taken by the text if printed using the current font settings.
    ; actually the height is only determined by the font settings not by the text in $sHText
    ; and @error = 0
    ; on failure returns -1 and @error = 1
    ;
    Func _PrintGetTextHeight($hDll, $sHText)

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

    Local $vDllAns = DllCall($hDll, 'int', 'TextHeight', 'str', $sHText)
    If @error = 0 Then Return $vDllAns[0];tenths of mm
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintGetTextHeight

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

    ;_PrintSetLineWid
    ;parameters - $hDll, the handle for printmg.dll
    ; - $iWid the width in tenths of mm for the line
    ;returns on success the width in tenths of mm taken by the text if printed using the current font settings.
    ; and @error = 0
    ; on failure returns -1 and @error = 1
    ;
    Func _PrintSetLineWid($hDll, $iWid)
    Local $vDllAns
    $vDllAns = DllCall($hDll, 'int', 'SetLineWid', 'int', $iWid)
    If @error = 0 Then Return $vDllAns[0];tenths of mm
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintSetLineWid

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

    ;_PrintSetLineCol
    ;parameters - $hDll, the handle for printmg.dll
    ; - $iCol colour for the line
    ;returns 1 success and @error = 0
    ; on failure returns -1 and @error = 1
    Func _PrintSetLineCol($hDll, $iCol)
    Local $vDllAns = DllCall($hDll, 'int', 'SetLineCol', 'int', $iCol)
    ;ConsoleWrite("set line col to " & $iCol & @CRLF)
    If @error = 0 Then Return $vDllAns[0];
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintSetLineCol

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

    ;_PrintLine
    ;parameters - $hDll, the handle for printmg.dll
    ; $iXStart the x coord for the start of the line in tenths of mm
    ; $iYStart the y coord for the start of the line
    ; $iXEnd the x coord for the end of the line
    ; $iYEnd the y coord for the end of the line
    ; 0,0 is top left of page
    ;returns on success the height in tenths of mm taken by the text if printed using the current font settings.
    ; actually the height is only determined by the font settings not by the text in $sHText
    ; and @error = 0
    ; on failure returns -1
    ;
    ;on failure returns -1 and @error = 1
    Func _PrintLine($hDll, $iXStart, $iYStart, $iXEnd, $iYEnd);start x,y, end x,y in tenths of mm
    $vDllAns = DllCall($hDll, 'int', 'Line', 'int', $iXStart, 'int', $iYStart, 'int', $iXEnd, 'int', $iYEnd)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintLine

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

    ;_PrintListPrinters
    ;parameters - $hDll, the handle for printmg.dll
    ;returns on success
    ; a string with a list of installed printers separated by '|' and @error = 0
    ; on failure returns an empty string and @error = 1
    Func _PrintListPrinters($hDll)
    $vDllAns = DllCall($hDll, 'str', 'ListPrinters')
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return ''

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

    EndFunc ;==>_PrintListPrinters

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

    ;_PrintSetDocTitle
    ;Sets the document title. Must be used before _PrintStartPrint or after _PrintEndPrint
    ;returns 1 on success and @error = 0
    ; -1 on failure
    ;parameters
    ; $hDll handle to the printmg.dll
    ; $sTitle the string to be used for the document title
    ;Requires printmg.dll v
    Func _PrintSetDocTitle($hDll, $sTitle)

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

    $vDllAns = DllCall($hDll, 'int', 'SetTitle', 'str', $sTitle)
    If @error = 0 Then Return $vDllAns[0]
    SetError(1)
    Return -1

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

    EndFunc ;==>_PrintSetDocTitle

    [/autoit]
  • C-Dll's generieren und mit Autoit ansprechen

    • vivus
    • 5. April 2011 um 15:17

    aber ich find's jetzt ohne Leerzeichen schlechter .. naja ..
    weg sind se jetzt eh schon ..

  • C-Dll's generieren und mit Autoit ansprechen

    • vivus
    • 5. April 2011 um 09:35

    Hallo !

    Das ist eine "kurze" Anleitung, um C-Dll's zu generieren, welche dann mit AutoIt aufgerufen werden können.
    Dies ist vorallem dann wichtig, wenn C -Code-Beispiele vorhanden sind, sich diese aber selbst nicht in AutoIt umsetzen lassen.

    Was für Software wird benötigt :
    Ich habe für das Beispiel die Programmiersoftware
    CODE:BLOX V10.5 heruntergeladen, welche unter
    http://www.codeblocks.org/

    als openSource geladen werden kann.
    --------------------------------------------------------------------------------------------
    Erstellen der Ersten Dll:

    Offnen Sie Code:Blox.
    Klicken Sie "Create a new project"
    Im Dialog .. Bereich "Projekts" wählen.
    Dort auf "Dynamic Link Library" klicken.
    Dann mit "GO" bestätigen.

    Es öffnet Sich ein Wissard für Dll's.
    Erstes Feld mit "Next" weiter schalten.

    Jetzt will der Wissard einen Namen für das Projekt.
    Hier nehme ich Test_autoit_Dll.
    Den Folder soll er mir auf dem Desktop erstellen.
    dann mit "Next" weiterschalten.
    Jetzt soll der Compiler ausgewählt werden.
    Hier lasse ich die Voreinstellung.
    D.h. GNU GCC Compiler

    Die Pfade für Debug und Release belasse ich auch gleich.
    Der Wissard wird mit "Finish" geschlossen.

    --------------------------------------------------------------------------------------------
    Nun ist das Projekt erstellt.

    Im "Projekts" Reiter im bereich "Management,
    lässt sich jetzt im Sourse Ordner dir Datei
    "main.h" öffnen.

    entfernen Sie komplet jeden Eintrag in der main.h
    tragen sie nun die erste Zeile der "main.h"

    // ab hier
    #include <windows.h>
    // bis hier

    ein.
    --------------------------------------------------------------------------------------------
    öffnen Sie nun die "main.cpp"
    entfernen Sie das erste Beispiel

    // ab hier
    // a sample exported function
    void DLL_EXPORT SomeFunction(const LPCSTR sometext)
    {
    MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION);
    }
    // bis hier

    und tragen Sie folgene Zeilen an dessen Stelle ein :

    // ab hier
    extern "C" __declspec(dllexport) int dllTest(int a,int b){
    int c=0;

    c= a+b;

    return c;

    }
    // bis hier

    Speichern Sie das Projekt
    --------------------------------------------------------------------------------------------
    Erklärung der Zeilen :
    extern "C" ==> sagt dem Compiler, dass er den Funktionsnamen ( hier dllTest) so beibehalten soll.

    __declspec(dllexport) ==> wird der Objektdatei die Exportdirektive hinzugefügt, sodass keine DEF-Datei erforderlich ist.

    das "int" vor dllTest ==> gibt den Rückgabewert der Funktion an !! hier wird es später noch interessant !

    dllTest ==> Ist der Name der Funktion

    (int a,int b) ==> sind die Parameter a und b welche in die Funktion übergeben werden.
    Dies müssen nicht vorhanden Sein, können aber abcuh beliebig viele werden.
    Wichtig ist hier nur, dass in AutoIt später genau die gleiche Anzahl, sowie der gleiche Typ übergeben wird.
    --------------------------------------------------------------------------------------------
    es ist Zeit für einen ersten Test ;)

    In der Titelleiste den Eintrag "Build" auswählen.
    und dann auf "Build" klicken. ( Ctrl-F9 )

    Die Dll wird erstellt.
    schließen Sie das Programm Code Blox.
    --------------------------------------------------------------------------------------------
    gehen Sie in den von Ihnen angelegten Projektordner
    bei mir "Test_autoit_Dll"

    dort wird ein Ordner namens "bin" angezeigt.
    öffnen sie diesen.
    nun erscheint ein Ordner namens "debug".
    Ebenfalls Öffnen.

    hier liegt jetzt die Datei "Test_autoit_Dll.dll"
    für AutoIt wird nur diese benötigt.
    machen Sie einen Rechtsklich in den Ordner und öffnen Sie ein neues *.au3 File.
    ich benenne es ebenfalls "Test_autoit_Dll.au3"

    füllen Sie das projekt mit folgendem Code:

    ;; ab hier
    $dll = "Test_autoit_Dll.dll"

    $result = DllCall($dll,"int:cdecl","dllTest","int",5,"int",6);

    MsgBox(0,"Ergebniss","Das Ergebniss aus der DLL ist " &$result[0]);
    ;; bis hier

    Speichern Sie das Script.
    Testen Sie es.

    Er wird der Text :
    Das Ergebniss aus der DLL ist 11 erscheinen.
    --------------------------------------------------------------------------------------------
    Erklärung der Zeilen;

    $dll = "Test_autoit_Dll.dll" ==> eine Variable welche den Namen der Dll speichert
    ( hier muss das Script im gleichen Ordner mit DLL liegen, ansonsten wird die Dll nicht gefunden. )

    ausser man gibt den Relativen Pfad an.

    $result = DllCall($dll,"int:cdecl","dllTest","int",5,"int",6); ==> das ergebniss des DLLCALL wird in die
    Variable $result hinein geschrieben.
    DllCall ist die Dll funktion, die Variable $dll gibt die Dll an,
    "int:cdecl" !!!!! sehr wichtig ! gibt an in welcher Reihenfolge die Funktion übergeben wird, und welcher
    RückgabeTyp geliefert wird. !!
    "dllTest" ==> ist der name der Gewünschten Funktion
    "int",5 ==> der erste Parameter, bestehend aus Typ und Wert
    "int",6 ==> der zweite Parameter bestehend aus Typ und Wert

    MsgBox(0,"Ergebniss","Das Ergebniss aus der DLL ist " &$result[0]); ==> ist eine Messagebox mit Text
    Hier wichtig, die Variable $result wird als Array zurückgeliefert. Der Rückgabewert steht in [0]
    also muss $result[0] als Variable angegeben werden.
    --------------------------------------------------------------------------------------------
    .... SO !! das war's für's erste ..

    würde mich über feedback freuen ..

    MFG
    Bye
    Vi

  • Ausflug nach Ansi C

    • vivus
    • 16. März 2011 um 08:47

    Hi ! Community !

    Ich bin grad wieder an meinen USB Karten .. ( ansteuern von I/O's über AutoIt )

    Da ich so mit AutoIt nicht weiter komme, habe ich mich mal in die Welt von C reingetraut . . ;)

    ( Tutorials für Microsoft Visual C++ )

    Jetzt habe ich ein Beispiel für die USB I/O Karten in ANSI C ...

    Und stehe total an der Wand !! ... nagu fast . . .

    Gibt's hier jemand, der mir da gerne weiter helfen würde und kann, oder muss ich mir dazu n anderes Forum Suchen.

    THX
    Vi

  • LibNoDave-UDF zur Kommunikation mit Simatic SPS

    • vivus
    • 5. November 2010 um 09:54

    :thumbup: !! :thumbup:

    also Kommunikation ist da.

    Cycle Time wird mir angezeigt und der grüne Statusbar bewegt sich ...

    was das msec drunter soll, bin ich noch nicht dahinter gestiegen. :S

    Settings habe ich jetzt wie folgt angepasst :

    Protocol : S7onlinex.dll
    Com-Port : Com7 ( obwohl dieser nicht in meinem System angelegt ist ?!?! )
    Übertragungsrate Com : leer
    MPI-Speed 187 kBit/s
    Mpi-Local : 3
    Remote : 2
    Cpu-Rack 0
    Slot : 2

    ...
    ...

    jetzt geh ich mal dran irgend welche werte aus der SPS zu lesen .. und wenn das funktioniert, dass gehe ich an das hineinschreiben in die SPS. . .

    Hast du dir irgend ein Test *.k7p File gemacht ?

    nochmals danke für das geniale UDF !! Du hast's halt schon drauf :thumbup:

  • LibNoDave-UDF zur Kommunikation mit Simatic SPS

    • vivus
    • 4. November 2010 um 10:30

    Hi funkey !

    also bei mir kommuniziert da nix.

    Liegt aber wahrscheinlich daran, dass mein USB
    MPI Modul nicht in deiner Demo hinterlegt ist.
    Und / oder ich was falsch einstell.

    Es handelt sich um dem PC/ Adapter (MPI ) von Siemens ( 6ES7 972-0CB20-0XA0 )

    Adresse : 0
    Übertragungsgeschwindigkeit : 187,5kbit/s
    Timeout : 30s
    Anschluss : USB

    Laut deinem Connection Editor habe ich folgendes eingestellt :
    Name : Test
    Protokol : MPI-Protokol
    Description : AutoItSPS
    CPU-Rack : 1
    Slot : leer
    IP-Adresse : leer
    Timeout : 30s
    Intervall : 100
    Com-Port : ? ohne USB ?
    MPI-Speed 187.5 kBit/s
    MPI-Local: 0
    Remote : 1

    .
    .
    .

    so jetzt steh ich an der Wand. . . ;)

  • Hilfe zu einer OpenSource DLL um Daten aus einer SIMATIC-SPS auszulesen

    • vivus
    • 14. Oktober 2010 um 11:49

    ich denke er meint SPS .. nicht SMS damit ..

    also wenn du dir die Arbeit machen wollen würdest ;) .. dagegen hätte ich nix ..

    ne kleine Beschreibung wäre vielleicht noch ganz nice ... mit solchen dingen, die für dich sonnen klar erscheinen. ..

    also, wenn ich es schaffe, mit dem script ne s7 313 anzusteuern .. oder sei es auch nur auszulesen dann kann man wirklich schöne sachen mit machen.

    zumal eine Konventionelle Ansteuerung von PC von Siemens nur über teure Zusatz Software realisierbar ist.

    und wenn man nur eine art Remote Display mit bauen könnte. Wäre dieses Script wirklich wertvoll !!!

    so n mini S7 Display kostet Hunderte von Euros. und kann ( milde gesagt ) NIX ..

    so n kleiner alter Läppi mit USB hat jeder rum fahren .. und eine schöne GUI ist mit AutoIt auch schnell zusammen geschustert. ;)

    bin mal gespannt, was hieraus alles noch wird. !!

  • Hilfe zu einer OpenSource DLL um Daten aus einer SIMATIC-SPS auszulesen

    • vivus
    • 13. Oktober 2010 um 16:48

    hei Funkey..

    hab jetzt einfach mal dein Script laufen lassen.

    Sprichst du die SPS über Lan an ?

    hab nur ein MPi - USB Adapter hier. ( für die 313 CPU )

    .. auto it steigt nämlich "fatal" aus .. ;)

    mit ::
    openSocketw.c: bind Socket error: No error
    !>16:43:53 AutoIT3.exe ended.rc:-1073741819

    ich setz mich mal weiter dran ..

    nicht's desto trotz .. geniales File, des du da gebaut hast . !!!

    beide Daumen hoch !!!!

    bye

  • Hilfe zu einer OpenSource DLL um Daten aus einer SIMATIC-SPS auszulesen

    • vivus
    • 12. Oktober 2010 um 07:42

    also zu davePascalNewInterface finde ich in Google nur ne Hand voll Italienischer Seiten ..

    und das kann ich nicht lesen ...

    haste n brauchbaren link ?

  • Hilfe zu einer OpenSource DLL um Daten aus einer SIMATIC-SPS auszulesen

    • vivus
    • 11. Oktober 2010 um 15:23

    juhuu .. endlich jemand der das auch vor hat ;)

    und sich mit dem gleichen mist rum schlägt ..

    häng mich gleich dran ..

    THX !

  • K8055 Board - Abfrage ob Taster gedrückt?

    • vivus
    • 11. Oktober 2010 um 13:17

    hier noch die neue UDF ( mit Adressierung )

    Spoiler anzeigen
    [autoit]

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

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

    AutoIt Version: 3.3.0.0
    Author: myName

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

    Script Function:
    handles the k8055d.dll 2009.10.19

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

    #ce ----------------------------------------------------------------------------
    ;#include <k8055d_multi.au3>

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

    Func USB_DLLOpen()
    DllOpen(@ScriptDir & "\" & "k8055D_multi.dll") ; öffnen der DLL
    EndFunc ;==>USB_DLLOpen

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

    ;----------------------------------------------------------------------------

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

    Func USB_DLLClose()
    DllClose(@ScriptDir & "\" & "k8055D_multi.dll") ; öffnen der DLL

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

    EndFunc ;==>USB_DLLClose

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

    ;----------------------------------------------------------------------------

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

    Func initial_board($address)

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

    Local $begin, $result, $dif

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

    $begin = TimerInit()
    Do
    $result = USBOpenDevice($address)
    Sleep(250)

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

    $dif = TimerDiff($begin)

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

    If $dif > "4000" Then ExitLoop

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

    Until $result = 1

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

    ClearAllDigital($address)

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

    Sleep(250)

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

    SetDigitalChannel($address, "8")

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

    ;MsgBox(0,"k8055d_multi",$result)

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

    If $result = 1 Then
    Return "1"

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

    Else
    ;MsgBox(0,"k8055d_multi", "fehler bei initialisierung des USB board's" & $address)
    ;MsgBox(0, "k8055d_multi", "Programm wird beendet! mit " & $result)
    ;Exit
    Return "-1"

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

    EndIf

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

    EndFunc ;==>initial_board

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

    ;----------------------------------------------------------------------------

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

    Func USBOpenDevice($address)

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

    Local $result

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

    $result = DllCall("k8055D_multi.dll", "long", "OpenDevice", "long", $address)

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

    If $result[0] = $address Then
    Return "1"

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

    Else
    ;MsgBox(0, "k8055d_multi", "Keine Verbindung zu USB BOARD ADRESSE " & $address & " !!", 2)
    ;exit
    Return "0"
    EndIf

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

    EndFunc ;==>USBOpenDevice

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

    ;---------------------------------------------------------------------------

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

    Func CloseAllDevice()

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

    Local $result
    $result = DllCall("k8055D_multi.dll", "none", "CloseDevice")
    USB_DLLClose()

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

    EndFunc ;==>CloseAllDevice

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

    ;---------------------------------------------------------------------------

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

    Func SearchDevices()

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

    Local $result
    $result = DllCall("k8055D_multi.dll", "long", "SearchDevices")

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

    Return $result[0]

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

    EndFunc ;==>SearchDevices

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

    ;---------------------------------------------------------------------------

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

    Func USBCloseDevice($address)
    Local $result

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

    SetCurrentDevice($address)
    $result = DllCall("k8055D_multi.dll", "none", "CloseDevice")
    ;Return ;;$result[0]
    EndFunc ;==>USBCloseDevice

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

    ;---------------------------------------------------------------------------

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

    Func ClearAllDigital($address)

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

    Local $result
    SetCurrentDevice($address)
    $result = DllCall("k8055D_multi.dll", "int", "ClearAllDigital")
    EndFunc ;==>ClearAllDigital

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

    ;----------------------------------------------------------------------------

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

    Func SetCurrentDevice($address)
    Local $result, $begin, $dif, $ret

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

    $begin = TimerInit()
    Do

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

    $result = DllCall("k8055D_multi.dll", "long", "SetCurrentDevice", "int", $address)

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

    ;ToolTip($address&"="&$result[0],0,0)
    $dif = TimerDiff($begin)

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

    If $dif > "4000" Then ExitLoop

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

    Until $address = $result[0]

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

    ;ToolTip("",0,0)

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

    If $address = $result[0] Then
    ;nix
    Else
    MsgBox(0, "k8055d_multi", "adresse = " & $address & " result = " & $result[0],3)
    $ret = MsgBox(1,"k8055d_multi","Hardware Fehler , Prüfgerät wird neu gestartet in 5 sec",5)
    If $ret = "-1" or $ret = "1" Then
    Shutdown(5)

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

    EndIf

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

    Return "-1"
    EndIf

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

    EndFunc ;==>SetCurrentDevice

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

    ;----------------------------------------------------------------------------

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

    Func SetDigitalChannel($address, $channel)
    SetCurrentDevice($address)
    DllCall("k8055D_multi.dll", "none", "SetDigitalChannel", "int", $channel)
    EndFunc ;==>SetDigitalChannel

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

    ;---------------------------------------------------------------------------

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

    Func ClearDigitalChannel($address, $channel)
    SetCurrentDevice($address)
    DllCall("k8055D_multi.dll", "none", "ClearDigitalChannel", "int", $channel)
    EndFunc ;==>ClearDigitalChannel

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

    ;---------------------------------------------------------------------------

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

    Func ReadAnalogChannel($address, $channel)
    Local $result

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

    SetCurrentDevice($address)
    $result = DllCall("k8055D_multi.dll", "int", "ReadAnalogChannel", "int", $channel)
    Return $result[0]
    EndFunc ;==>ReadAnalogChannel

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

    ;---------------------------------------------------------------------------

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

    Func ReadAllDigital($address)
    Local $result, $alldigit

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

    SetCurrentDevice($address)
    $alldigit = DllCall("k8055D_multi.dll", "int", "ReadAllDigital")
    Return $alldigit[0]
    EndFunc ;==>ReadAllDigital
    ;---------------------------------------------------------------------------

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

    Func ReadDigitalChannel($address, $sellect)

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

    Local $wert
    Local $channel[6]
    $channel[1] = 0
    $channel[2] = 0
    $channel[3] = 0
    $channel[4] = 0
    $channel[5] = 0

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

    $wert = ReadAllDigital($address)

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

    ;MsgBox(0,"k8055d_multi",$alldigit[0] & " " & $wert)
    Select

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

    Case $wert = 0
    $channel[1] = 0
    $channel[2] = 0
    $channel[3] = 0
    $channel[4] = 0
    $channel[5] = 0

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

    Case $wert = 1
    ;I1
    $channel[1] = 1

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

    Case $wert = 2
    ;I2
    $channel[2] = 1

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

    Case $wert = 3
    ;I1 + I2
    $channel[1] = 1
    $channel[2] = 1

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

    Case $wert = 4
    ;I3
    $channel[3] = 1

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

    Case $wert = 5
    ;I3 + I1
    $channel[1] = 1
    $channel[3] = 1

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

    Case $wert = 6
    ;I3 + I2
    $channel[2] = 1
    $channel[3] = 1

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

    Case $wert = 7
    ;I3 + I2 + I1
    $channel[1] = 1
    $channel[2] = 1
    $channel[3] = 1

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

    Case $wert = 8
    ;I4
    $channel[4] = 1

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

    Case $wert = 9
    ;I4 + I1
    $channel[1] = 1
    $channel[4] = 1

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

    Case $wert = 10
    ;I4 + I2
    $channel[2] = 1
    $channel[4] = 1

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

    Case $wert = 11
    ;I4 + I2 + I1
    $channel[1] = 1
    $channel[2] = 1
    $channel[4] = 1

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

    Case $wert = 12
    ;I4 + I3
    $channel[3] = 1
    $channel[4] = 1

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

    Case $wert = 13
    ;I4 + I3 + I1
    $channel[1] = 1
    $channel[3] = 1
    $channel[4] = 1

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

    Case $wert = 14
    ;I4 + I3 + I2
    $channel[2] = 1
    $channel[3] = 1
    $channel[4] = 1

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

    Case $wert = 15
    ;I4 + I3 * I2 + I1
    $channel[1] = 1
    $channel[2] = 1
    $channel[3] = 1
    $channel[4] = 1

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

    Case $wert = 16
    ;I5
    $channel[5] = 1

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

    Case $wert = 17
    ;I1
    $channel[1] = 1
    $channel[5] = 1

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

    Case $wert = 18
    ;I2
    $channel[2] = 1
    $channel[5] = 1

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

    Case $wert = 19
    ;I1 + I2
    $channel[1] = 1
    $channel[2] = 1
    $channel[5] = 1

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

    Case $wert = 20
    ;I3
    $channel[3] = 1
    $channel[5] = 1

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

    Case $wert = 21
    ;I3 + I1
    $channel[1] = 1
    $channel[3] = 1
    $channel[5] = 1

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

    Case $wert = 22
    ;I3 + I2
    $channel[2] = 1
    $channel[3] = 1
    $channel[5] = 1

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

    Case $wert = 23
    ;I3 + I2 + I1
    $channel[1] = 1
    $channel[2] = 1
    $channel[3] = 1
    $channel[5] = 1

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

    Case $wert = 24
    ;I4
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 25
    ;I4 + I1
    $channel[1] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 26
    ;I4 + I2
    $channel[2] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 27
    ;I4 + I2 + I1
    $channel[1] = 1
    $channel[2] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 28
    ;I4 + I3
    $channel[3] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 29
    ;I4 + I3 + I1
    $channel[1] = 1
    $channel[3] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 30
    ;I4 + I3 + I2
    $channel[2] = 1
    $channel[3] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case $wert = 31
    ;I4 + I3 * I2 + I1
    $channel[1] = 1
    $channel[2] = 1
    $channel[3] = 1
    $channel[4] = 1
    $channel[5] = 1

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

    Case Else

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

    $channel[1] = 0
    $channel[2] = 0
    $channel[3] = 0
    $channel[4] = 0
    $channel[5] = 0

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

    EndSelect

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

    If $channel[$sellect] = 1 Then
    ; MsgBox(0,"k8055d_multi","return 1")
    Return 1
    Else
    ; MsgBox(0,"k8055d_multi","return 0")
    Return 0

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

    EndIf

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

    EndFunc ;==>ReadDigitalChannel
    ;----------------------------------------------------------------------------

    [/autoit]

    .. ich würde gerne noch die DLL anhängen .. kann aber nix hochladen .. sorry ..
    gib mir ne email-adresse, dann schick ich se dir zu ..

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™