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

Beiträge von TheDeath24

  • Datei wird immer als HEX ausgeben ??!?!?

    • TheDeath24
    • 9. Dezember 2015 um 21:56

    Hi zusammen,

    ich habe folgendes Problem. Ich möchte eine Datei uploaden, diese Datei lese ich Binär ein und schreibe diese in eine Variable.
    Wenn ich diese Variable dann in eine Textdatei schreiben lasse ist es der Binärcode.
    Lasse ich mir mit der Variable eine Msgbox ausgeben dann ist es aufeinmal HEXcode.
    Aber der Server an den ich das Bild senden möchte versteht nur Binär.
    Wenn ich dann den $oHTTP.Send ($sPD) mache wird auch immer der HEXcode versendet.
    Wie kann das passieren? Muss ich auf irgendwas achten?


    Spoiler anzeigen
    AutoIt
    Func Sendpicture()
    $sFilePath = "C:/Users/Admin/Pictures/352_640x960_iphonehdwallpapers_net.jpg"
    Local $sFile = FileOpen($sFilePath, 16)
    If $sFile = -1 Then
    	MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
    EndIf
    Local $sFileRead = FileRead($sFile)
    MsgBox(0,"shda", $sFileRead)
    FileClose($sFile)
    ;debug info
        If FileExists("output.txt") Then FileDelete("output.txt")
        $file = FileOpen("output.txt", 1)
        FileWrite($file, $sFileRead)
        FileClose($file)
    
    
     $sBoundary = "------WebKitFormBoundary"&Chr(Random(Asc("A"), Asc("Z"), 3))&Chr(Random(Asc("a"), Asc("z"), 3))&Chr(Random(Asc("A"), Asc("Z"), 3))&Chr(Random(Asc("a"), Asc("z"), 3))&Random(1, 9, 1)&Random(1, 9, 1)&Random(1, 9, 1)
    Local $sPD
    $sPD = $sBoundary & @CRLF & _
     'Content-Disposition: form-data; name="photo"; filename="Test.jpg"' & @CRLF & _
     'Content-Type: image/jpeg' & @CRLF & @CRLF & _
     $sFileRead
    $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    $oHTTP.Open("POST", "http://requestb.in/19g7yg56456", False)
    $oHTTP.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36")
    $oHTTP.SetRequestHeader("Content-Type", 'multipart/form-data; boundary="' & $sBoundary & '"')
    $oHTTP.SetRequestHeader("Accept-Encoding", 'gzip, deflate')
    $oHTTP.setRequestHeader("Content-Length", StringLen($sPD))
    $oHTTP.Send ($sPD)
    $oHeaderResponses = $oHTTP.GetAllResponseHeaders()
    $oReceived = $oHTTP.ResponseText
    $oStatusCode = $oHTTP.Status
    ConsoleWrite($oStatusCode & @CRLF)
    ConsoleWrite($oReceived)
    ConsoleWrite($oHeaderResponses)
    EndFunc
    Alles anzeigen
  • Http Request mit Upload für Telegram_Bot_API / Senden von Fotos und Documenten

    • TheDeath24
    • 6. Dezember 2015 um 17:07

    Hi zusammen,

    ich würde gerne eine Datei Uploaden und mit dem Telegram Bot versenden. Doch leider bekomme ich dies nicht hin. Habe jetzt schon viele Sachen durchprobiert aber bin nicht zum erfolg gekommen.
    Eine Nachricht kann ich über einen HTTP Request versenden, das Funktioniert. Aber sobald es um eine Datei mit Upload geht scheitert es.

    Der Request für die Text-Nachricht sieht so aus.

    Spoiler anzeigen


    $BotToken =XXXXXXXXXXXXX:XXXXXXXXXXXXX
    $sendto = 1837568
    $sendtext= "Hallo"

    https://api.telegram.org/bot' & $BotToken & '/sendmessage?chat_id=' & $sendto & '&text=' & $sendtext


    Jetzt meine Versuche eine Datei Hochzuladen:

    Spoiler anzeigen
    AutoIt
    Func _Test1()
    
    
    
    
    
    
    Global Const $fTestMode = false ; testmode will delete images after 15 minutes
    Global Const $sAPIURL = "/bot1718sdfer7:AAGVRavnvnvnv/sendphoto?chat_id=183783345"
    Global Const $sURL = "api.telegram.org"
    
    
    Global $hOpen = _WinHttpOpen("")
    Global $hConnect = _WinHttpConnect($hOpen, $sURL)
    Global $hRequest = _WinHttpOpenRequest($hConnect, "POST", $sAPIURL)
    
    
    Global $sData = ""
    If $fTestMode Then
        $sData &= '----------darker' & @CRLF
        $sData &= 'Content-Disposition: multipart/form-data; name="testMode"' & @CRLF & @CRLF
        $sData &= '1' & @CRLF
    EndIf
    $sData &= '----------darker' & @CRLF
    $sData &= 'Content-Disposition: form-data; name="xmlOutput"' & @CRLF & @CRLF
    $sData &= '1' & @CRLF
    $sData &= '----------darker' & @CRLF
    $sData &= 'Content-Disposition: multipart/form-data; name="imageMD5"' & @CRLF & @CRLF
    $sData &= StringLower(Hex(_Crypt_HashFile("C:\Users\Pictures\342_640x960_net.jpg", $CALG_MD5))) & @CRLF
    $sData &= '----------darker' & @CRLF
    $sData &= 'Content-Disposition: multipart/form-data; name="photo"; filename="testimage.jpg"' & @CRLF
    $sData &= 'Content-Type: image/jpg' & @CRLF & @CRLF
    $sData &= FileRead("C:\Users\Pictures\342_640x960_net.jpg") & @CRLF
    $sData &= '----------darker--'
    
    
    
    
    _WinHttpSendRequest($hRequest, "Content-Type: multipart/form-data; boundary=--------darker", Binary($sData))
    _WinHttpReceiveResponse($hRequest)
    
    
    $sResult = _WinHttpReadData($hRequest)
    MsgBox(0, "", $sResult)
    ConsoleWrite($sResult & @CRLF)
    
    
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
    
    
    EndFunc
    Alles anzeigen


    Spoiler anzeigen
    AutoIt
    Func Test2()
    $sFilePath = "C:\Users\Pictures\342_640x960_iphonehdwallpapers_net.jpg"
    Local $sFile = FileOpen($sFilePath, 16)
    If $sFile = -1 Then
    	MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
    EndIf
    $sFileRead = BinaryToString(FileRead($sFile))
    FileClose($sFile)
    $sBoundary = "mymultipartboundary"
    Local $sPD
    $sPD = '--' & $sBoundary & @CRLF & _
    		'Content-Type: form-data; charset=UTF-8' & @CRLF & @CRLF & _
    		'--' & $sBoundary & @CRLF & _
    		'Content-Disposition: form-data; name="photo"; filename="342_640x960_iphonehdwallpapers_net.jpg"' & @CRLF & @CRLF & _
    		'--' & $sBoundary & @CRLF & _
    		'Content-Type: image/jpeg' & @CRLF & _
    		'Content-Transfer-Encoding: binary' & @CRLF & @CRLF & _
    		$sFileRead & @CRLF & '--' & $sBoundary & '--' & @CRLF
    ;~ MsgBox(0, "", $sPD)
    $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    $oHTTP.Open("POST", "https://api.telegram.org/bot1718348737597:AAGVRaSolrajhDi06j7u5hjotdgdge/sendphoto?chat_id=183785459", False)
    $oHTTP.setRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;)")
    $oHTTP.SetRequestHeader("Content-Type", 'multipart/form-data; boundary="' & $sBoundary & '"')
    $oHTTP.setRequestHeader("Content-Length", StringLen($sPD))
    $oHTTP.Send(BinaryToString($sPD))
    $oHeaderResponses = $oHTTP.GetAllResponseHeaders()
    $oReceived = $oHTTP.ResponseText
    $oStatusCode = $oHTTP.Status
    ConsoleWrite($oStatusCode & @CRLF)
    ConsoleWrite($oReceived)
    ConsoleWrite($oHeaderResponses)
    EndFunc
    Alles anzeigen


    Der Link zur Telegram Bot API


    Kann mir dabei jemand weiterhelfen? Es geht letztendlich nur darum das Telegram den Http Request an nimmt und das File Hoch lädt.

    In PHP geht das wohl ganz einfach so -----> PHP SendPhoto

  • RSS Auslesen - _XMLgetValue funktioniert bei <content:encoded> nicht

    • TheDeath24
    • 15. November 2015 um 13:13

    Hi zusammen,


    ich möchte gerne ein RSS auslesen. Den RSS lese ich wie folgt aus:


    Funktion

    Spoiler anzeigen
    AutoIt
    Func _GetFeedData($rss_source)
    
    
    Local $strXML = _INetGetSource($rss_source)
    _XMLLoadXML($strXML, "")
    
    
    Local $title_node = "//rss/channel/item/title";
    Local $title_array = _XMLGetValue($title_node)
    
    
    Local $descr_node = "//rss/channel/item/description";
    Local $descr_array = _XMLGetValue($descr_node)
    
    
    Local $category_node = "//rss/channel/item/category";
    Local $category_array = _XMLGetValue($category_node)
    
    
    Local $encoded_node = "//rss/channel/item/encoded";
    Local $encoded_array = _XMLSelectNodes($encoded_node)
    
    
    Local $feed_data = ""
    
    
    
    
    For $i = 1 To $title_array[0]
    $feed_data = $feed_data & "Titel: " & $title_array[$i] & " // "  &  "Kategorie : " & $category_array [1] & " // "
    If $i = $title_array[0] Then $feed_data = $feed_data & " --END-- "
    Next
    
    
    Return $feed_data
    EndFunc
    Alles anzeigen


    XML Code

    Spoiler anzeigen


    XML
    <rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
    
    
    <channel>
    <title>HD-World.org</title>
    <atom:link href="http://hd-world.org/feed/" rel="self" type="application/rss+xml"/>
    <link>http://hd-world.org</link>
    <description>Only High Definition Movies</description>
    <lastBuildDate>Sat, 14 Nov 2015 11:10:41 +0000</lastBuildDate>
    <language>de-DE</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <generator>http://wordpress.org/?v=4.2.2</generator>
    <item>
    <title>Die.Syrische.Braut.2004.GERMAN.720p.HDTV.x264-BTVG</title>
    <link>...</link>
    <comments>...</comments>
    <pubDate>Sat, 14 Nov 2015 10:57:12 +0000</pubDate>
    <dc:creator>...</dc:creator>
    <category>
    <![CDATA[ -720p ]]>
    </category>
    <category>...</category>
    <category>
    <![CDATA[ Komödie ]]>
    </category>
    <guid isPermaLink="false">...</guid>
    <description>
    <![CDATA[
    Mona (Clara Khoury), eine junge Drusin aus einem kleinen Dorf auf den Golanhöhen, sieht ihrer arrangierten Hochzeit mit einem Syrer gefasst entgegen. Ihren zukünftigen Gatten kennt sie momentan nur aus dem Fernsehen, wo dieser als Schauspieler zu sehen ist. Die Hochzeit bedeutet zugleich auch Abschied von der eigenen Familie, einmal die Grenze nach Syrien überschritten, […]
    ]]>
    </description>
    <content:encoded>
    <![CDATA[
    <p>Mona (Clara Khoury), eine junge Drusin aus einem kleinen Dorf auf den Golanhöhen, sieht ihrer arrangierten Hochzeit mit einem Syrer gefasst entgegen. Ihren zukünftigen Gatten kennt sie momentan nur aus dem Fernsehen, wo dieser als Schauspieler zu sehen ist. Die Hochzeit bedeutet zugleich auch A
    ]]>
    <![CDATA[
    bschied von der eigenen Familie, einmal die Grenze nach Syrien überschritten, gibt es für sie keinen Weg zurück. Einstweilen jedoch ist Geduld gefragt. Erst beim langen Abschied, dann beim Festessen und schließlich beim Überqueren der Grenze mit deren Paragraphenreitern.</p> <p>.. Language..: German<br /> .. Video…..: x264 / crf20 @ 1280×720@1914 Kbps<br /> .. Audio…..: ac3 192 kbits<br /> .. Source….: HDTV</p> <p><img src="http://fs5.directupload.net/images/151114/iz82ljkd.jpg" alt="" width="297" height="436" /><br /> <strong>Dauer: </strong>90 Min. | <strong>Format: </strong>MKV | <strong>Größe: </strong>1479 MB | <a target="_blank" href="http://www.imdb.com/title/tt0423310/" > IMDb: 7,5/10 </a><br /> <strong>Download:</strong> <a target="_blank" href="https://www.smoozed.rocks/redirect/6cd9307e90?_link=U2FsdGVkX1_hNQe45_X5fxgA_b91Amd2O2i4xQprZSnuzb3uD1xE-XWAM8xjw4gEazgjd0uqN-o176DFVKkFhQ&i=t92Yu02bvJ2b" >★ OBOOM.com ★</a> <div id="mirror_aabe6a65fadb95ced6f6134cde60af71ef07ac84_x"><strong>Mirrors:</strong> <a href="javascript:;" onclick="jQuery('#mirror_aabe6a65fadb95ced6f6134cde60af71ef07ac84_x').remove(); jQuery('#mirror_aabe6a65fadb95ced6f6134cde60af71ef07ac84').show();">anzeigen (2)</a></div> <div id="mirror_aabe6a65fadb95ced6f6134cde60af71ef07ac84" style="display:none;"> <strong>Mirror #1: </strong> <a target="_blank" href="https://www.smoozed.rocks/redirect/6cd9307e90?_link=U2FsdGVkX19a5_KJCxM0IJbzThCzbDBANA8WI-4ZNDkUmufPUyIuwcbnDJPeiPslwASfR77C2_QDx-sgcbsMCw&i=0VmbuQWZkF2bsBXd" >Uploaded</a><br /> <strong>Mirror #2: </strong> <a target="_blank" href="https://www.smoozed.rocks/redirect/6cd9307e90?_link=U2FsdGVkX1-WTTO4w4ra6dredyxJbKk2UX2gOb3OQgz9wfHM42I6JdASVxcAGgwfVhA4S5V6kzrwP0yzROlNiQ&i=gepJmLl5Was52btUmchh2c" >Share-online</a><br /> </div><strong>Passwort: </strong>hd-world.org <strong>Uploader: </strong>Pegasusika</p>
    ]]>
    </content:encoded>
    <wfw:commentRss>...</wfw:commentRss>
    <slash:comments>0</slash:comments>
    </item>
    Alles anzeigen


    Local $encoded_node = "//rss/channel/item/encoded";
    Local $encoded_array = _XMLSelectNodes($encoded_node)

    $encoded_array=-1

    Also Fehler/Error allerdings weis ich nicht wieso.

    Ich wurde gerne nach den Links Filter so wie nach IMDB. Diese Inforamtionen bekomme ich allerdings nur wenn ich content:encoded auslesen kann.

    Kann mir da jemand weiterhelfen?

  • AdvanceLcd - UDF für alle Logitech Produkte (G15, G19 etc.)

    • TheDeath24
    • 27. Juli 2015 um 23:06

    ich habe beide Dll´s ausprobiert. Leider kein Unterschied.

  • AdvanceLcd - UDF für alle Logitech Produkte (G15, G19 etc.)

    • TheDeath24
    • 6. Juli 2015 um 22:23

    Hi,

    ich bekomme die UDF einfach nicht zum laufen. Beim mir tauchen immer nur die Applets in der Logitech Anwendung auf als auswählbar aber verwenden kann ich diese nicht.

    Kann mir da jemand weiterhelfen?

  • SQL Datenbank auslesen mit portable ODBC Treiber

    • TheDeath24
    • 23. Juni 2015 um 19:39

    Hi zusammen,

    ich möchte gerne eine SQL Datenbank auslesen und diese dann anzeigen. Nun habe ich leider nicht die möglichkeit auf dem Rechner Treiber zu installieren.
    Aber zum auslesen der SQL Datenbank braucht man den Treiber. Jetzt gibt es den Treiber auch ohne Installation. Diesen würde ich gerne im Script Ordner entpacken und nutzen.

    Das Script sieht momentan so aus.

    Script

    Spoiler anzeigen


    #include<MySQL.au3>
    #include<array.au3>
    #include <string.au3>

    $adCN = ObjCreate("ADODB.Connection")
    $sql_server="10.10.10.10"
    $sql_db="Stördaten"
    $sql_user="passwort"
    $sql_pass="passwort"
    $adCN.Open("DRIVER={SQL Server};SERVER=" & $sql_server & ";DATABASE=" & $sql_db & ";uid=" & $sql_user & ";pwd=" & $sql_pass & ";")
    ;SQL Abfrage
    $query = $adCN.Execute("Select * from Datenbank")
    ConsoleWrite($query)

    Diese UDF benutze ich:

    MySQL.au3

    Spoiler anzeigen


    #include-once

    #cs
    Function Name: _MySQLConnect
    Description: Initiate a connection to a MySQL database.
    Parameter(s): $username - The username to connect to the database with.
    $password - The password to connect to the database with. $Database - Database to connect to.
    $server - The server your database is on.
    $driver (optional) the ODBC driver to use (default is "{MySQL ODBC 3.51 Driver}"
    Requirement(s): Autoit 3 with COM support
    Return Value(s): On success returns the connection object for subsequent functions. On failure returns 0 and sets @error
    @Error = 1
    Error opening connection
    @Error = 2
    MySQL ODBC Driver not installed.
    Author(s): cdkid
    #ce

    Func _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver = "{MySQL ODBC 3.51 Driver}", $iPort=3306)
    Local $v = StringMid($sDriver, 2, StringLen($sDriver) - 2)
    Local $key = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $val = RegRead($key, $v)
    If @error or $val = "" Then
    SetError(2)
    Return 0
    EndIf
    $ObjConn = ObjCreate("ADODB.Connection")
    $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)
    If @error Then
    SetError(1)
    Return 0
    Else
    Return $ObjConn
    EndIf
    EndFunc ;==>_MySQLConnect

    #cs
    Function name: _Query
    Description: Send a query to the database
    Parameter(s): $oConnectionObj - As returned by _MySQLConnect. $query - The query to execute
    Return Value(s):On success returns the query result. On failure returns 0 and sets @error to 1
    Requirement(s):Autoit3 with COM support
    Author(s): cdid
    #ce


    Func _Query($oConnectionObj, $sQuery)
    If IsObj($oConnectionObj) Then
    Return $oConnectionobj.execute($sQuery)
    EndIf
    If @error Then
    SetError(1)
    Return 0
    EndIf

    EndFunc ;==>_Query

    #cs
    Function name: _MySQLEnd
    Description: Closes the database connection (see notes!)
    Parameter(s): $oConnectionObj - The connection object as returned by _MySQLConnect()
    Requirement(s):Autoit 3 with COM support
    Return Value(s):On success returns 1. On failure returns 0 and sets @error to 1
    Author(s): cdkid
    #ce

    Func _MySQLEnd($oConnectionObj)
    If IsObj($oConnectionObj) Then
    $oConnectionObj.close
    Return 1
    Else
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_MySQLEnd

    #cs
    Function name: _AddRecord
    Description: Adds a record to the specified table
    Note(s): to add to multiple columns use an array with one blank element at the end as the $sColumn, and $value parameter
    Parameter(s): $oConnectionObj - As returned by _MySQL Connect. $sTable - The table to put the record in
    $row - The row to put the record in. $value - The value to put into the row
    $vValue - OPTIONAL default will be default for the column (will not work with array, see notes)
    Requirement(s): Autoit 3 with COM support
    Return value(s): On success returns 1. If the connectionobj is not an object returns 0 and sets @error to 2. If there is any other error returns 0 and sets @error to 1.
    Author(s): cdkid
    #ce

    Func _AddRecord($oConnectionObj, $sTable, $vRow, $vValue = "")
    If IsObj($oConnectionObj) Then
    $query = "INSERT INTO " & $sTable & " ("

    If IsArray($vRow) Then
    For $i = 0 To UBound($vRow, 1) - 1
    If $i > 0 And $i <> UBound($vRow, 1) - 1 Then
    $query = $query & "," & $vRow[$i] & ""
    ElseIf $i = UBound($vRow, 1) - 1 And $vRow[$i] <> "" Then
    $query = $query & "," & $vRow[$i] & ") VALUES("
    ElseIf $i = 0 Then
    $query = $query & "" & $vRow[$i] & ""
    ElseIf $vRow[$i] = "" Then
    $query = $query & ") VALUES("
    EndIf
    Next
    EndIf
    If Not IsArray($vRow) And Not IsArray($vValue) And Not IsInt($vValue) Then
    $oConnectionobj.execute ("INSERT INTO " & $sTable & " (" & $vRow & ") VALUES('" & $vValue & "')")
    return 1
    ElseIf IsInt($vValue) And Not IsArray($vRow) And Not IsArray($vValue) Then
    $oconnectionobj.execute ("INSERT INTO " & $sTable & " (" & $vRow & ") VALUES(" & $vValue & ")")
    return 1
    EndIf

    If IsArray($vValue) Then
    For $i = 0 To UBound($vValue, 1) - 1
    If $i > 0 And $i <> UBound($vValue, 1) - 1 And Not IsInt($vValue[$i]) Then
    $query = $query & ",'" & $vValue[$i] & "'"
    ElseIf $i = UBound($vValue, 1) - 1 And $vValue[$i] <> "" And Not IsInt($vValue[$i]) Then
    $query = $query & ",'" & $vValue[$i] & "');"
    ElseIf $i = 0 And Not IsInt($vValue[$i]) Then
    $query = $query & "'" & $vValue[$i] & "'"
    ElseIf $vValue[$i] = "" Then
    $query = $query & ");"
    ElseIf IsInt($vValue[$i]) And $vValue[$i] <> "" Then
    $query = $query & "," & $vValue[$i]
    EndIf
    Next
    EndIf
    If StringRight($query, 2) <> ");" Then
    $query = $query & ");"

    EndIf
    $oconnectionobj.execute ($query)
    EndIf
    If Not IsObj($oConnectionObj) Then
    SetError(2)
    Return 0
    EndIf
    If @error And IsObj($oConnectionObj) Then
    Return 0
    SetError(1)
    Else
    Return 1
    EndIf

    EndFunc ;==>_AddRecord


    #cs
    Function name: _DeleteRecord
    Description: Deletes a record from the specified table
    Parameter(s): $oConnectionObj - As returned by _MySQLConnect. $sTable - The table to delete from.
    $sColumn - The column to check value (see the example in the next post) $vRecordVal -
    The value to check in $sColumn (see example).
    $iLimit (optional) - the max number of record to delete if multiple match the criteria (default 1)
    Return Value(s): On success returns 1. If there $oConnectionObj is not an object returns 0 and sets @error to 1. If there are any other errors returns 0 and sets @error to 2
    Requirement(s): Autoit 3 with COM support
    #ce

    Func _DeleteRecord ($oConnectionObj, $sTable, $sColumn, $vRecordVal, $iLimit = 1)
    If IsObj($oConnectionObj) And Not IsInt($vRecordVal) Then
    $oconnectionobj.execute ("DELETE FROM " & $sTable & " WHERE " & $sColumn & " = '" & $vRecordVal & "' LIMIT " & $iLimit & ";")
    ElseIf IsInt($vRecordVal) Then
    $oconnectionobj.execute ("DELETE FROM " & $sTable & " WHERE " & $sColumn & " = " & $vRecordVal & " LIMIT " & $iLimit & ";")
    If Not @error Then
    Return 1
    ElseIf Not IsObj($oConnectionObj) Then
    SetError(1)
    Return 0
    ElseIf @error And IsObj($oConnectionObj) Then
    SetError(2)
    Return 0
    EndIf
    EndIf
    EndFunc ;==>_DeleteRecord

    #cs
    Function name: _CreateTable()
    Description: Creates a table
    Parameters: $oConnectionObj - as returned by _MySQLConnect, $sTbl - The name of the table to create, $sPrimeKey - The name of the
    primary key column. $keytype - The datatype of the primary key (default is integer), $sNotNull - "yes" = must be filled out whenever
    a record is added "no" does not need to be filled out ("yes" default). $keyautoinc - "yes" = Auto incrememnts "no" = does not.
    $sType - The table type (default is InnoDB)
    Requirements: Autoit V3 with COM support
    Return value(s): on success returns 1 on failure sets @error to 1 and returns 0
    Author: cdkid
    #ce

    Func _CreateTable($oConnectionObj, $sTbl, $sPrimeKey, $keytype = "INTEGER", $sNotNull = "yes", $keyautoinc = "yes", $sType = "InnoDB")
    If IsObj($oConnectionObj) And Not @error Then
    $str = "CREATE TABLE " & $sTbl & " " & "(" & $sPrimeKey & " " & $keytype & " UNSIGNED"
    If $sNotNull = "yes" Then
    $str = $str & " NOT NULL"
    EndIf

    If $keyautoinc = "yes" Then
    $str = $str & " AUTO_INCREMENT,"
    EndIf

    $str = $str & " PRIMARY KEY (" & $sPrimeKey & " )" & " ) " & "TYPE = " & $sType & ";"
    $oConnectionObj.execute ($str)
    Return 1


    ElseIf @error Then
    Return 0
    SetError(1)
    EndIf

    EndFunc ;==>_CreateTable

    #cs
    Function Name: _CreateColumn
    Description: Creates a column in the given table
    Requirements: AutoitV3 with COM support
    Parameters: $oConnectionObj - as returned by _MySQLConnect. $sTable - the name of the table to add the column to.
    $sAllowNull - if 'yes' then does not add 'NOT NULL' to the SQL statement (default 'yes') $sDataType - The data type of the column
    default('VARCHAR(45)').$sAutoInc - if 'yes' adds 'AUTO_INCREMENT' to the MySQL Statement (for use with Integer types)
    default('no').$sUnsigned - if 'yes' adds 'UNSIGNED' to the MySQL statement. default('no') $vDefault - the default value of the column
    default('')
    Author: cdkid
    #ce

    Func _CreateColumn($oConnectionObj, $sTable, $sColumn, $sAllowNull = "no", $sDataType = "VARCHAR(45)", $sAutoInc = "no", $sUnsigned = "no", $vDefault = '')
    If IsObj($oConnectionObj) And Not @error Then
    $str = "ALTER TABLE `" & $sTable & "` ADD COLUMN `" & $sColumn & "` " & $sDataType & " "
    If $sAllowNull = "yes" Then
    $str = $str & "NOT NULL "
    EndIf
    If $sAutoInc = 'yes' Then
    $str = $str & "AUTO_INCREMENT "
    EndIf
    If $sUnsigned = 'yes' Then
    $str = $str & "UNSIGNED "
    EndIf
    $str = $str & "DEFAULT '" & $vDefault & "';"
    $oConnectionObj.execute ($str)
    Return 1
    Else
    SetError(1)
    Return 0
    EndIf

    EndFunc ;==>_CreateColumn

    #cs
    Function Name: _DropCol()
    Description: Delete a column from the given table
    Requirements: AutoitV3 with COM support
    Parameters: $oConnectionObj - As returned by _MySQLConnect(). $sTable - The name of the table to delete the column from
    $sColumn - THe name of the column to delete
    Author: cdkid
    #ce

    Func _DropCol($oConnectionObj, $sTable, $sColumn)
    If IsObj($oConnectionObj) & Not @error Then
    $oConnectionObj.execute ("ALTER TABLE " & $sTable & " DROP COLUMN " & $sColumn & ";")
    Return 1
    ElseIf @error Then
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_DropCol

    #cs
    Function Name: _DropTbl()
    Description: Deletes a table from the database
    Requirements: AutoitV3 with COM support
    Parameters: $oConnectionObj - As returned by _MySQLConnect. $sTable - The name of the table to delete
    Author: cdkid
    #ce

    Func _DropTbl($oConnectionObj, $sTable)
    If IsObj($oConnectionObj) And Not @error Then
    $oConnectionObj.execute ("DROP TABLE " & $sTable & ";")
    Return 1
    Else
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_DropTbl


    #cs
    Function name: _CountRecords()
    Description: Get the number of records in the specified column
    Parameters: $oConnectionObj - As returned by _MySQLConnect. $sTable - The name of the table that the column is in
    $value - If not = "" then it is put in the select statement in the WHERE clause (default "")
    Return value(s): On success returns the number of records. On failure sets @error to 1 and returns 0
    Author: cdkid
    #ce
    Func _CountRecords($oConnectionObj, $sTable, $sColumn, $vValue = '')
    If IsObj($oConnectionObj) And Not @error Then

    If $sColumn <> "" And $vValue <> "" And Not IsInt($vValue) Then
    $constr = "SELECT " & $sColumn & " FROM " & $sTable & " WHERE " & $sColumn & " = '" & $vValue & "'"
    ElseIf $sColumn <> "" And $vValue = '' And Not IsInt($vValue) Then
    $constr = "SELECT " & $sColumn & " FROM " & $sTable
    ElseIf IsInt($vValue) And $sColumn <> '' And $vValue <> '' Then
    $constr = "SELECT " & $sColumn & " FROM " & $sTable & " WHERE " & $sColumn & " = " & $vValue
    EndIf
    $sql2 = ObjCreate("ADODB.Recordset")
    $sql2.cursorlocation = 3
    $sql2.open ($constr, $oConnectionObj)
    With $sql2
    $ret = .recordcount
    EndWith
    $sql2.close
    Return $ret
    Else
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_CountRecords

    #cs
    Function name: _CountTables
    Description: Counts the number of tables in the database
    Parameter(s): $oConnectionObj - As returned by _MySQLConnect
    Return value(s): if error - returns 0 and sets @error to 1. on success returns the number of tables in the database
    Author: cdkid
    #ce

    Func _CountTables($oConnectionObj)
    If IsObj($oConnectionObj) Then
    $quer = $oConnectionObj.execute ("SHOW TABLES;")
    $i = 0
    With $quer
    While Not .EOF
    $i = $i + 1
    .MoveNext
    WEnd
    EndWith
    Return $i
    EndIf
    If @error Then
    SetError(1)
    Return 0
    EndIf

    EndFunc ;==>_CountTables

    #cs
    Function name: _GetColNames
    Description: Get's the names of all columns in a specified table
    Parameters: $oConnectionObj - As returned by _MySQLConnect. $sTable - The name of the table to get the column names from
    Return values: On success returns an array where $array[0] is the number of elements in the array and all the rest are column names.
    On failure returns 0 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetColNames($oConnectionObj, $sTable)
    If IsObj($oConnectionObj) And Not @error Then
    Dim $ret[1], $rs

    $rs = $oConnectionObj.execute ("SHOW COLUMNS FROM " & $sTable & ";")

    With $rs
    While Not .EOF

    ReDim $ret[UBound($ret, 1) + 1]
    $ret[UBound($ret, 1) - 1] = $rs.Fields (0).Value
    .MoveNext
    WEnd
    EndWith
    $ret[0] = UBound($ret, 1) - 1
    Return $ret
    EndIf
    If @error Then
    Return 0
    SetError(1)
    EndIf
    EndFunc ;==>_GetColNames


    #cs
    Function name: _GetTblNames
    Description: Gets the names of all tables in the database
    Parameters: $oConnectionObj - As returned by _MySQLConnect
    Return value(s): On success returns an array where $array[0] is the number of tables and $array[n] is the nth table's name
    on failure - returns 0 and sets @error to 1
    Author: cdkid
    #ce

    Func _GetTblNames($oConnectionObj)
    If IsObj($oConnectionObj) Then
    Dim $ret[1]
    $quer = $oConnectionObj.execute ("SHOW TABLES;")
    With $quer
    While Not .eof
    ReDim $ret[UBound($ret, 1) + 1]
    $ret[UBound($ret, 1) - 1] = .fields (0).value
    .movenext
    WEnd
    EndWith
    $ret[0] = UBound($ret, 1) - 1
    Return $ret
    EndIf
    EndFunc ;==>_GetTblNames

    #cs
    Function name: _GetColVals
    Description: Gets all of the values of a specified column in a specified table
    Parameters: $oConnectionObj - As returned by _MySQLConnect(), $sTable - the table that the column is in
    $sColumn - the column to get values from.
    Return value(s): On success returns an array where $array[0] is the number of values and $array[n] is the Nth value
    On failure sets @error to 1 and returns 0
    Author: cdkid
    #ce

    Func _GetColVals($oConnectionObj, $sTable, $sColumn)
    If IsObj($oConnectionObj) Then
    Dim $ret[1]
    $quer = $oConnectionObj.execute ("SELECT " & $sColumn & " FROM " & $sTable & ";")
    With $quer
    While Not .EOF
    ReDim $ret[UBound($ret, 1) + 1]
    $ret[UBound($ret, 1) - 1] = .Fields (0).value
    .MoveNext
    WEnd
    EndWith
    $ret[0] = UBound($ret, 1) - 1
    Return $ret
    EndIf
    EndFunc ;==>_GetColVals

    #cs
    Function name: _GetColCount
    Description: Gets the number of columns in the specified table
    Parameters: $oConnectionObj - As returned by _MySQLConnect(). $sTable - the table to count the columns in
    Return Value(s): On success returns the number of columns in the table. On failure returns -1 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetColCount($oConnectionObj, $sTable)
    If IsObj($oConnectionObj) Then
    $quer = $oConnectionObj.execute ("SHOW COLUMNS IN " & $sTable)
    With $quer
    $i = 0
    While Not .eof
    $i = $i + 1
    .movenext
    WEnd
    EndWith
    Return $i
    EndIf
    If @error Then
    Return -1
    SetError(1)
    EndIf

    EndFunc ;==>_GetColCount

    #cs
    Function name: _GetColType
    Description: Gets the DATA TYPE of the specified column
    Parameters: $oConnectionObj - As returned by _MySQLConnect(). $sTable - the table that the column is in. $sColumn - the column
    to retrieve the data type from.
    Return value(s): On success returns the data type of the column. On failure returns 0 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetColType($oConnectionObj, $sTable, $sColumn)
    If IsObj($oConnectionObj) Then
    $quer = $oConnectionObj.execute ("SHOW COLUMNS IN " & $sTable)
    With $quer
    $i = 0
    While Not .eof
    If .fields (0).value = $sColumn Then
    $ret = .fields (1).value
    EndIf
    .MoveNext
    WEnd
    EndWith
    Return $ret
    EndIf
    If @error Then
    Return 0
    SetError(1)
    EndIf
    EndFunc ;==>_GetColType

    #cs
    Function: _GetDBNames
    Description: Get a count and list of all databases on current server.
    Parameters: $oConObj - As returned by _MySQLConnect
    Return Value(s): Success - An array where $array[0] is the number of databases and $array[n] is the nth database name.
    Failure - -1 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetDBNames($conobj)
    If IsObj($conobj) Then
    Local $arr[1], $m
    $m = $conobj.Execute ("SHOW DATABASES;")
    With $m
    While Not .eof
    ReDim $arr[UBound($arr, 1) + 1]
    $arr[UBound($arr, 1) - 1] = .Fields (0).Value
    .MoveNext
    WEnd
    EndWith
    $arr[0] = UBound($arr, 1) - 1
    Return $arr
    Else
    SetError(1)
    Return -1
    EndIf
    EndFunc ;==>_GetDBNames

    #cs
    Function: _ChangeCon
    Description: Change your connection string
    Parameters:
    $oConnectionObj
    As returned by _MySQLConnect
    $username
    OPTIONAL: the new username to use
    If omitted, the same username will be used.
    $password
    OPTIONAL: the new password to use
    If omitted, the same password will be used.
    $database
    OPTIONAL: the new database to connect to
    If omitted, the same database will be used.
    $driver
    OPTIONAL: the new driver to use
    If omitted, the MySQL ODBC 3.51 DRIVER will be used.
    $server
    OPTIONAL: the new server to connect to
    If omitted, the same server will be used.
    $iPort
    OPTIONAL: the new port to be used to connect
    if omitted, the default port (3306) will be used
    Return Value:
    On success, a new connection object for use with subsequent functions.
    On failure, -1 and sets @error to 1
    Author: cdkid
    #ce

    Func _ChangeCon($oConnectionObj, $username = "", $password = "", $database = "", $driver = "", $server = "", $iPort = 0)
    Local $constr, $db, $usn, $pwd, $svr
    If IsObj($oConnectionObj) Then
    $constr = $oConnectionObj.connectionstring
    $constr = StringReplace($constr, 'Provider=MSDASQL.1;Extended Properties="', '')
    $constr = StringSplit($constr, ";")
    For $i = 1 To $constr[0]
    If StringLeft($constr[$i], 3) = "UID" Then
    If $username <> "" Then
    $usn = $username
    Else
    $usn = StringMid($constr[$i], 5)
    EndIf
    $usn = StringTrimRight($usn, 1)
    EndIf
    If StringLeft($constr[$i], 3) = "PWD" Then
    If $password <> "" Then
    $pwd = $password
    Else
    $pwd = StringMid($constr[$i], 5)
    EndIf
    EndIf
    If StringLeft($constr[$i], 8) = "DATABASE" Then
    If $database <> "" Then
    $db = $database
    Else
    $db = StringMid($constr[$i], 10)
    EndIf
    EndIf
    If StringLeft($constr[$i], 6) = "SERVER" Then
    If $server <> "" Then
    $svr = $server
    Else
    $svr = StringMid($constr[$i], 8)
    EndIf
    EndIf
    If StringLeft($constr[$i], 6) = "DRIVER" Then
    If $driver <> "" Then
    $dvr = $driver
    Else
    $dvr = "{MySQL ODBC 3.51 DRIVER}"
    EndIf
    EndIf
    If StringLeft($constr[$i], 4) = "PORT" Then
    if $iport <> 0 Then
    $port = $iport
    Else
    $port = 3306
    EndIf
    EndIf
    Next
    $oConnectionObj.close
    $oConnectionObj.Open ("DATABASE=" & $db & ";DRIVER=" & $dvr & ";UID=" & $usn & ";PWD=" & $pwd & ";SERVER=" & $svr & ";PORT=" & $port & ";")
    Return $oConnectionObj
    Else
    SetError(1)
    Return -1
    EndIf
    EndFunc ;==>_ChangeCon


    Vielleicht kann mir damit jemand helfen? ?(

  • UDF erstellen für Telegram Client -> Gegenleistung in Euro (Verhandelbar gegen Aufwand)

    • TheDeath24
    • 30. Mai 2015 um 19:03

    Hallo

    ich bin auf der Suche nach jemanden der mir eine UDF schreibt damit ich Telegram Chats auslesen kann und darauf antworten kann.


    https://core.telegram.org/api

    - Auslesen eines Ausgewählten Chats -> Variable (text)
    - Variable (text) -> an eine Bestimmte Person senden
    - Bilder (Dateien) -> an eine Bestimmte Person senden

    Ich hoffe das ist verständlich. Ansonsten gerne fragen.

    Wie schon geschrieben bin ich bereit dafür Geld auszugeben. Die Frage ist wie viel Aufwand macht das . Einfach Preis per PN schicken.

  • Tree-View aus einer Textdatei auslesen

    • TheDeath24
    • 30. Mai 2015 um 06:28

    Hi,

    erstmal vielen Dank für die Mühe. Doch leider kommen dort Sachen durcheinander. Das heißt es sind dort Teile zu finden die nicht in diese Struktur gehören sondern unter einem anderen Punkt.


    Ich habe hier nochmal ein Teilausschnitt mit angehängt.

    Leider darf ich die gesamte Datei nicht hochladen.

    Dateien

    Teilausschnitt.txt 29,42 kB – 398 Downloads
  • Tree-View aus einer Textdatei auslesen

    • TheDeath24
    • 29. Mai 2015 um 16:07

    Ups da hast du recht. Habe mich vertan. Ja ich meine auch eine TreeView. Sorry

  • Tree-View aus einer Textdatei auslesen

    • TheDeath24
    • 29. Mai 2015 um 15:21

    Hallo,

    ich bräuchte Hilfe bei auslesen einer Textdatei. Die Textdatei ist zum ersten sehr groß (1.8MB) und zum anderen weis ich leider nicht genau wie ich das anstellen soll genau diese Struktur aus der Datei auszulesen.


    Einteil Auszug aus der Datei.

    Grün = Varbiable die beim anklicken in dem Tree-View zum passenden Text ausgelesen wird.
    Rot = Text in dem Tree-View

    Struktur:


    Techn. Platz DE02 Gültig ab 27.05.15
    Bezeichnung Test
    DE02 Test
    |
    |-- DE02-CCP Processing
    | |
    | |-- DE02-CCP-010 Processing allgemein
    | | |
    | | |-- DE02-CCP-010-010 ALLGEMEIN
    | | | |
    | | | |--- DE02-CCP-010-010-010 WAENDE, DECKEN, FUSSBOEDEN / CCP
    | | | |--- DE02-CCP-010-010-020 KALT- UND WARMWASSER-LEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-030 SCHMUTZWASSER-LEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-040 REGENWASSER-LEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-050 DAMPF-LEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-060 KONDENSAT-LEITUNGEN / FC
    | | | |-- DE02-CCP-010-010-070 PRESSLUFT-LEITUNGEN / FC
    | | | | |
    | | | | |-- 5269116 CPS Druckluft-Sterilfilter SMF 05/25,UF1 1 ST
    | | | | |
    | | | | |--- 79712744 ULTRAFILTERELEMENT SMF05/25 L 2 ST
    | | | |
    | | | |--- DE02-CCP-010-010-080 PRODUKTLEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-090 CO2 LEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-100 N2 LEITUNGEN / FC
    | | | |--- DE02-CCP-010-010-110 LEITERN / FC
    | | | |-- DE02-CCP-010-010-120 HOLAC-VIELZWECKSCHNEIDER
    | | | | |
    | | | | |--- 5269147 CPS HOLAC-VIELZWECKSCHNEIDER 1 ST
    | | | |
    | | | |--- DE02-CCP-010-010-130 Nauter Mischer T460
    | | | |--- DE02-CCP-010-010-140 Pufferbehalter T 461
    | | | |-- DE02-CCP-010-010-145 Sauger BQ690 WAP Alto Typ22

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™